aboutsummaryrefslogtreecommitdiff
path: root/sound/mods
diff options
context:
space:
mode:
authorSven Hesse2009-05-23 20:38:08 +0000
committerSven Hesse2009-05-23 20:38:08 +0000
commitbe6fd784b43ba2f6c6055e939f33d198cdd8d55b (patch)
tree889c936563ddfc57bfe07b850556a3c83a6125d1 /sound/mods
parent5878acfc0e5dc6e6f1096d793bcafc0fa94b5d2c (diff)
downloadscummvm-rg350-be6fd784b43ba2f6c6055e939f33d198cdd8d55b.tar.gz
scummvm-rg350-be6fd784b43ba2f6c6055e939f33d198cdd8d55b.tar.bz2
scummvm-rg350-be6fd784b43ba2f6c6055e939f33d198cdd8d55b.zip
Allow for different MOD signatures
svn-id: r40827
Diffstat (limited to 'sound/mods')
-rw-r--r--sound/mods/module.cpp21
-rw-r--r--sound/mods/module.h3
2 files changed, 20 insertions, 4 deletions
diff --git a/sound/mods/module.cpp b/sound/mods/module.cpp
index c2a6190308..992c2a28e3 100644
--- a/sound/mods/module.cpp
+++ b/sound/mods/module.cpp
@@ -26,6 +26,7 @@
#include "sound/mods/module.h"
#include "common/util.h"
+#include "common/endian.h"
namespace Modules {
@@ -111,6 +112,10 @@ const int16 Module::periods[16][60] = {
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 @@ bool Module::load(Common::SeekableReadStream &st, int offs) {
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;
}
diff --git a/sound/mods/module.h b/sound/mods/module.h
index 0d2282f770..550b63617e 100644
--- a/sound/mods/module.h
+++ b/sound/mods/module.h
@@ -70,7 +70,7 @@ public:
byte songlen;
byte undef;
byte songpos[128];
- byte sig[4];
+ uint32 sig;
pattern_t *pattern;
Module();
@@ -82,6 +82,7 @@ public:
private:
static const int16 periods[16][60];
+ static const uint32 signatures[];
};
} // End of namespace Modules