|
From: <sag...@us...> - 2013-11-18 00:53:47
|
Revision: 3260
http://sourceforge.net/p/modplug/code/3260
Author: saga-games
Date: 2013-11-18 00:53:40 +0000 (Mon, 18 Nov 2013)
Log Message:
-----------
[Fix] Extended IT/MPTM instruments (referencing samples >= 256) from versions older than OpenMPT 1.20 were not readable.
Modified Paths:
--------------
trunk/OpenMPT/soundlib/ITTools.cpp
trunk/OpenMPT/soundlib/ITTools.h
Modified: trunk/OpenMPT/soundlib/ITTools.cpp
===================================================================
--- trunk/OpenMPT/soundlib/ITTools.cpp 2013-11-18 00:32:28 UTC (rev 3259)
+++ trunk/OpenMPT/soundlib/ITTools.cpp 2013-11-18 00:53:40 UTC (rev 3260)
@@ -421,7 +421,7 @@
if(usedExtension)
{
// If we actually had to extend the sample map, update the magic bytes and instrument size.
- memcpy(iti.dummy, "MPTX", 4);
+ memcpy(iti.dummy, "XTPM", 4);
instSize = sizeof(ITInstrumentEx);
}
@@ -436,7 +436,8 @@
uint32 insSize = iti.ConvertToMPT(mptIns, fromType);
// Is this actually an extended instrument?
- if(insSize == 0 || memcmp(iti.dummy, "MPTX", 4))
+ // Note: OpenMPT 1.20 - 1.22 accidentally wrote "MPTX" here (since revision 1203), while previous versions wrote the reversed version, "XTPM".
+ if(insSize == 0 || (memcmp(iti.dummy, "MPTX", 4) && memcmp(iti.dummy, "XTPM", 4)))
{
return insSize;
}
Modified: trunk/OpenMPT/soundlib/ITTools.h
===================================================================
--- trunk/OpenMPT/soundlib/ITTools.h 2013-11-18 00:32:28 UTC (rev 3259)
+++ trunk/OpenMPT/soundlib/ITTools.h 2013-11-18 00:53:40 UTC (rev 3260)
@@ -217,11 +217,6 @@
// MPT IT Instrument Extension
struct PACKED ITInstrumentEx
{
- enum Magic
- {
- mptx = 0x5854504D, // "MPTX" Extended Instrument Header Magic Bytes
- };
-
ITInstrument iti; // Normal IT Instrument
uint8 keyboardhi[120]; // High Byte of Sample map
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|