From: <rel...@us...> - 2010-03-28 16:24:30
|
Revision: 558 http://modplug.svn.sourceforge.net/modplug/?rev=558&view=rev Author: relabsoluness Date: 2010-03-28 16:24:23 +0000 (Sun, 28 Mar 2010) Log Message: ----------- [Mod] MPTM: Increased internal file version number and now user will be shown warning about "last saved with a more recent version of OpenMPT" only if the internal file version has increased. Also OpenMPT will now reject to load MPTM file if its file version is above certain limit. [Mod] Version: Changed to 1.18.01.00. [Fix] Song cleanup: Fixed a memory leak in pattern name handling. [Mod] Resource: Removed resource ID duplicate. Modified Paths: -------------- trunk/OpenMPT/mptrack/CleanupSong.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/resource.h trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/Load_it.cpp Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp =================================================================== --- trunk/OpenMPT/mptrack/CleanupSong.cpp 2010-03-28 00:09:41 UTC (rev 557) +++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2010-03-28 16:24:23 UTC (rev 558) @@ -452,8 +452,8 @@ // Reorder patterns & Delete unused patterns BEGIN_CRITICAL(); { - UINT npatnames = pSndFile->m_nPatternNames; - LPSTR lpszpatnames = pSndFile->m_lpszPatternNames; + const UINT npatnames = pSndFile->m_nPatternNames; + const LPSTR lpszpatnames = pSndFile->m_lpszPatternNames; pSndFile->m_nPatternNames = 0; pSndFile->m_lpszPatternNames = NULL; for (PATTERNINDEX i = 0; i < maxPatIndex; i++) @@ -487,6 +487,8 @@ { pSndFile->Patterns[nPat].SetData(pPatterns[nPat], nPatRows[nPat]); } + + delete[] lpszpatnames; } END_CRITICAL(); EndWaitCursor(); Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-28 00:09:41 UTC (rev 557) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-03-28 16:24:23 UTC (rev 558) @@ -191,6 +191,16 @@ } EndWaitCursor(); + + // Show log messages from loaders. + if (GetLog() != nullptr) + { + CString sTemp; + sTemp.Format("File: %s\nLast saved with: %s, current version is %s\n\n%s", lpszPathName, (LPCTSTR)MptVersion::ToStr(m_SndFile.m_dwLastSavedWithVersion), MptVersion::str, GetLog()); + AfxMessageBox(sTemp, MB_ICONINFORMATION); + ClearLog(); + } + if ((m_SndFile.m_nType == MOD_TYPE_NONE) || (!m_SndFile.m_nChannels)) return FALSE; // Midi Import if (m_SndFile.m_nType == MOD_TYPE_MID) @@ -366,7 +376,11 @@ // -> DESC="channels management dlg" ReinitRecordState(); // -! NEW_FEATURE#0015 - if (m_SndFile.m_dwLastSavedWithVersion > MptVersion::num) { + + // Show warning if file was made with more recent version of OpenMPT except for MPTM-files, + // which uses CModDocs log-mechanism to show messages. + if (m_SndFile.m_dwLastSavedWithVersion > MptVersion::num && m_SndFile.GetType() != MOD_TYPE_MPT) + { char s[256]; wsprintf(s, "Warning: this song was last saved with a more recent version of OpenMPT.\r\nSong saved with: v%s. Current version: v%s.\r\n", (LPCTSTR)MptVersion::ToStr(m_SndFile.m_dwLastSavedWithVersion), Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2010-03-28 00:09:41 UTC (rev 557) +++ trunk/OpenMPT/mptrack/resource.h 2010-03-28 16:24:23 UTC (rev 558) @@ -103,8 +103,7 @@ #define IDB_SPLASHTEST 432 #define IDB_SPLASHNOFOLDFIN 435 #define IDR_VSTMENU 436 -#define IDB_VISNODE1 436 -#define IDB_VISPCNODE 436 +#define IDB_VISPCNODE 437 #define IDD_DEFAULTPLUGINEDITOR 438 #define IDD_CHANNELMANAGER 440 #define IDD_SOUNDBANK_INFO1 441 Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2010-03-28 00:09:41 UTC (rev 557) +++ trunk/OpenMPT/mptrack/version.h 2010-03-28 16:24:23 UTC (rev 558) @@ -14,8 +14,8 @@ //Version definitions. The only thing that needs to be changed when changing version number. #define VER_MAJORMAJOR 1 #define VER_MAJOR 18 -#define VER_MINOR 00 -#define VER_MINORMINOR 01 +#define VER_MINOR 01 +#define VER_MINORMINOR 00 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2010-03-28 00:09:41 UTC (rev 557) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2010-03-28 16:24:23 UTC (rev 558) @@ -28,7 +28,26 @@ #define str_pattern (GetStrI18N((_TEXT("pattern")))) #define str_PatternSetTruncationNote (GetStrI18N((_TEXT("The module contains %u patterns but only %u patterns can be loaded in this OpenMPT version.")))) #define str_SequenceTruncationNote (GetStrI18N((_TEXT("Module has sequence of length %u; it will be truncated to maximum supported length, %u.")))) +#define str_LoadingIncompatibleVersion TEXT("The file informed that it is incompatible with this version of OpenMPT. Loading was terminated.") +#define str_LoadingMoreRecentVersion TEXT("The loaded file was made with a more recent OpenMPT version and this version may not be able to load all the features or play the file correctly.") +const uint16 verMptFileVer = 0x88F; +const uint16 verMptFileVerLoadLimit = 0x1000; // If cwtv-field is greater or equal to this value, + // the MPTM file will not be loaded. + +/* +MPTM version history for cwtv-field in IT header: +0x88E(1.17.02.50) -> 0x88F(1.18.01.00): +0x88D(1.17.02.49) -> 0x88E(1.17.02.50): Changed ID to that of IT and undone the orderlist change done in + 0x88A->0x88B. Now extended orderlist is saved as extension. +0x88C(1.17.02.48) -> 0x88D(1.17.02.49): Some tuning related changes - that part fails to read on older versions. +0x88B -> 0x88C: Changed type in which tuning number is printed to file: size_t -> uint16. +0x88A -> 0x88B: Changed order-to-pattern-index table type from BYTE-array to vector<UINT>. +*/ + + + + static bool AreNonDefaultTuningsUsed(CSoundFile& sf) //-------------------------------------------------- { @@ -939,6 +958,20 @@ if(pifh->cwtv == 0x214 && pifh->cmwt == 0x202) m_dwLastSavedWithVersion = MAKE_VERSION_NUMERIC(1, 09, 00, 00); } + else // case: type == MOD_TYPE_MPT + { + if (pifh->cwtv >= verMptFileVerLoadLimit) + { + if (GetpModDoc()) + GetpModDoc()->AddToLog(str_LoadingIncompatibleVersion); + return false; + } + else if (pifh->cwtv > verMptFileVer) + { + if (GetpModDoc()) + GetpModDoc()->AddToLog(str_LoadingMoreRecentVersion); + } + } } if(GetType() == MOD_TYPE_IT) mptStartPos = dwMemLength; @@ -1500,7 +1533,7 @@ if(version >= 0x88D) { srlztn::Ssb ssb(iStrm); - ssb.BeginRead("mptm", 1); + ssb.BeginRead("mptm", MptVersion::num); ssb.ReadItem(GetTuneSpecificTunings(), "0", 1, &ReadTuningCollection); ssb.ReadItem(*this, "1", 1, &ReadTuningMap); ssb.ReadItem(Order, "2", 1, &ReadModSequenceOld); @@ -1847,17 +1880,8 @@ //VERSION if(GetType() == MOD_TYPE_MPT) { - header.cwtv = 0x88E; // Used in OMPT-hack versioning. + header.cwtv = verMptFileVer; // Used in OMPT-hack versioning. header.cmwt = 0x888; - /* - Version history: - 0x88D(v.02.49) -> 0x88E: Changed ID to that of IT and undone the orderlist change done in - 0x88A->0x88B. Now extended orderlist is saved as extension. - 0x88C(v.02.48) -> 0x88D: Some tuning related changes - that part fails to read on older versions. - 0x88B -> 0x88C: Changed type in which tuning number is printed - to file: size_t -> uint16. - 0x88A -> 0x88B: Changed order-to-pattern-index table type from BYTE-array to vector<UINT>. - */ } else //IT { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |