[Scummvm-cvs-logs] SF.net SVN: scummvm:[40827] scummvm/trunk/sound/mods

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Sat May 23 22:38:09 CEST 2009


Revision: 40827
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40827&view=rev
Author:   drmccoy
Date:     2009-05-23 20:38:08 +0000 (Sat, 23 May 2009)

Log Message:
-----------
Allow for different MOD signatures

Modified Paths:
--------------
    scummvm/trunk/sound/mods/module.cpp
    scummvm/trunk/sound/mods/module.h

Modified: scummvm/trunk/sound/mods/module.cpp
===================================================================
--- scummvm/trunk/sound/mods/module.cpp	2009-05-23 20:36:51 UTC (rev 40826)
+++ scummvm/trunk/sound/mods/module.cpp	2009-05-23 20:38:08 UTC (rev 40827)
@@ -26,6 +26,7 @@
 #include "sound/mods/module.h"
 
 #include "common/util.h"
+#include "common/endian.h"
 
 namespace Modules {
 
@@ -111,6 +112,10 @@
 	 216 , 203 , 192 , 181 , 171 , 161 , 152 , 144 , 136 , 128 , 121 , 114,
 	 108 , 101 , 96  , 90  , 85  , 80  , 76  , 72  , 68  , 64  , 60  , 57 }};
 
+const uint32 Module::signatures[] = {
+	MKID_BE('M.K.'), MKID_BE('M!K!'), MKID_BE('FLT4')
+};
+
 bool Module::load(Common::SeekableReadStream &st, int offs) {
 	if (offs) {
 		// Load the module with the common sample data
@@ -138,9 +143,19 @@
 	undef = st.readByte();
 
 	st.read(songpos, 128);
-	st.read(sig, 4);
-	if (memcmp(sig, "M.K.", 4)) {
-		warning("Expected 'M.K.' in protracker module");
+
+	sig = st.readUint32BE();
+
+	bool foundSig = false;
+	for (int i = 0; i < ARRAYSIZE(signatures); i++) {
+		if (sig == signatures[i]) {
+			foundSig = true;
+			break;
+		}
+	}
+
+	if (!foundSig) {
+		warning("No known signature found in protracker module");
 		return false;
 	}
 

Modified: scummvm/trunk/sound/mods/module.h
===================================================================
--- scummvm/trunk/sound/mods/module.h	2009-05-23 20:36:51 UTC (rev 40826)
+++ scummvm/trunk/sound/mods/module.h	2009-05-23 20:38:08 UTC (rev 40827)
@@ -70,7 +70,7 @@
 	byte songlen;
 	byte undef;
 	byte songpos[128];
-	byte sig[4];
+	uint32 sig;
 	pattern_t *pattern;
 
 	Module();
@@ -82,6 +82,7 @@
 
 private:
 	static const int16 periods[16][60];
+	static const uint32 signatures[];
 };
 
 } // End of namespace Modules


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list