From: <sv...@op...> - 2024-10-26 11:18:10
|
Author: sagamusix Date: Sat Oct 26 13:17:58 2024 New Revision: 21921 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21921 Log: Merged revision(s) 21898 from trunk/OpenMPT: [Fix] IT/S3M: Properly identify IT2.14 patch versions (tx cs127). ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/soundlib/Load_it.cpp branches/OpenMPT-1.31/soundlib/Load_s3m.cpp branches/OpenMPT-1.31/soundlib/Sndfile.h Modified: branches/OpenMPT-1.31/soundlib/Load_it.cpp ============================================================================== --- branches/OpenMPT-1.31/soundlib/Load_it.cpp Sat Oct 26 13:15:55 2024 (r21920) +++ branches/OpenMPT-1.31/soundlib/Load_it.cpp Sat Oct 26 13:17:58 2024 (r21921) @@ -341,6 +341,26 @@ } +// Get version of Impulse Tracker that was used to create an IT/S3M file. +mpt::ustring CSoundFile::GetImpulseTrackerVersion(uint16 cwtv, uint16 cmwt) +{ + mpt::ustring version; + cwtv &= 0xFFF; + if(cmwt > 0x0214) + { + version = UL_("Impulse Tracker 2.15"); + } else if(cwtv >= 0x0215 && cwtv <= 0x0217) + { + const mpt::uchar *versions[] = {UL_("1-2"), UL_("3"), UL_("4-5")}; + version = MPT_UFORMAT("Impulse Tracker 2.14p{}")(versions[cwtv - 0x0215]); + } else + { + version = MPT_UFORMAT("Impulse Tracker {}.{}")((cwtv & 0x0F00) >> 8, mpt::ufmt::hex0<2>((cwtv & 0xFF))); + } + return version; +} + + // Get version of Schism Tracker that was used to create an IT/S3M file. mpt::ustring CSoundFile::GetSchismTrackerVersion(uint16 cwtv, uint32 reserved) { @@ -1239,19 +1259,7 @@ madeWithTracker = U_("Unknown"); } else if(fileHeader.cmwt < 0x0300 && madeWithTracker.empty()) { - if(fileHeader.cmwt > 0x0214) - { - madeWithTracker = U_("Impulse Tracker 2.15"); - } else if(fileHeader.cwtv > 0x0214) - { - // Patched update of IT 2.14 (0x0215 - 0x0217 == p1 - p3) - // p4 (as found on modland) adds the ITVSOUND driver, but doesn't seem to change - // anything as far as file saving is concerned. - madeWithTracker = MPT_UFORMAT("Impulse Tracker 2.14p{}")(fileHeader.cwtv - 0x0214); - } else - { - madeWithTracker = MPT_UFORMAT("Impulse Tracker {}.{}")((fileHeader.cwtv & 0x0F00) >> 8, mpt::ufmt::hex0<2>((fileHeader.cwtv & 0xFF))); - } + madeWithTracker = GetImpulseTrackerVersion(fileHeader.cwtv, fileHeader.cmwt); if(m_FileHistory.empty() && fileHeader.reserved != 0) { // Starting from version 2.07, IT stores the total edit time of a module in the "reserved" field Modified: branches/OpenMPT-1.31/soundlib/Load_s3m.cpp ============================================================================== --- branches/OpenMPT-1.31/soundlib/Load_s3m.cpp Sat Oct 26 13:15:55 2024 (r21920) +++ branches/OpenMPT-1.31/soundlib/Load_s3m.cpp Sat Oct 26 13:17:58 2024 (r21921) @@ -304,17 +304,11 @@ nonCompatTracker = true; break; case S3MFileHeader::trkImpulseTracker: - if(fileHeader.cwtv <= S3MFileHeader::trkIT2_14) - { - madeWithTracker = UL_("Impulse Tracker"); - formatTrackerStr = true; - } else if(fileHeader.cwtv == S3MFileHeader::trkIT1_old) - { + if(fileHeader.cwtv == S3MFileHeader::trkIT1_old) madeWithTracker = UL_("Impulse Tracker 1.03"); // Could also be 1.02, maybe? I don't have that one - } else - { - madeWithTracker = MPT_UFORMAT("Impulse Tracker 2.14p{}")(fileHeader.cwtv - S3MFileHeader::trkIT2_14); - } + else + madeWithTracker = GetImpulseTrackerVersion(fileHeader.cwtv, 0); + if(fileHeader.cwtv >= S3MFileHeader::trkIT2_07 && fileHeader.reserved3 != 0) { // Starting from version 2.07, IT stores the total edit time of a module in the "reserved" field Modified: branches/OpenMPT-1.31/soundlib/Sndfile.h ============================================================================== --- branches/OpenMPT-1.31/soundlib/Sndfile.h Sat Oct 26 13:15:55 2024 (r21920) +++ branches/OpenMPT-1.31/soundlib/Sndfile.h Sat Oct 26 13:17:58 2024 (r21921) @@ -978,6 +978,7 @@ bool LoadExtendedSongProperties(FileReader &file, bool ignoreChannelCount, bool* pInterpretMptMade = nullptr); void LoadMPTMProperties(FileReader &file, uint16 cwtv); + static mpt::ustring GetImpulseTrackerVersion(uint16 cwtv, uint16 cmwt); static mpt::ustring GetSchismTrackerVersion(uint16 cwtv, uint32 reserved); // Reads extended instrument properties(XM/IT/MPTM). |