aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Kołodziejski2004-04-25 19:51:46 +0000
committerPaweł Kołodziejski2004-04-25 19:51:46 +0000
commit7251d5324ec47d422b4f69522fabd3f3f8b91088 (patch)
tree92ea26cfee15cc0b019ac2d4982cf86a414919b7
parentc5c1a83d3528332134e3215327901be86e24aa24 (diff)
downloadscummvm-rg350-7251d5324ec47d422b4f69522fabd3f3f8b91088.tar.gz
scummvm-rg350-7251d5324ec47d422b4f69522fabd3f3f8b91088.tar.bz2
scummvm-rg350-7251d5324ec47d422b4f69522fabd3f3f8b91088.zip
- added workaround for strange regions length in some FT voc samples
- increased regions up to 70 svn-id: r13631
-rw-r--r--scumm/imuse_digi/dimuse_sndmgr.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/scumm/imuse_digi/dimuse_sndmgr.cpp b/scumm/imuse_digi/dimuse_sndmgr.cpp
index 1f6e343586..69a02a1127 100644
--- a/scumm/imuse_digi/dimuse_sndmgr.cpp
+++ b/scumm/imuse_digi/dimuse_sndmgr.cpp
@@ -82,23 +82,31 @@ void ImuseDigiSndMgr::countElements(byte *ptr, int &numRegions, int &numJumps, i
void ImuseDigiSndMgr::prepareSound(byte *ptr, int slot) {
if (READ_UINT32(ptr) == MKID('Crea')) {
bool quit = false;
+ int len;
int32 offset = READ_LE_UINT16(ptr + 20);
int16 version = READ_LE_UINT16(ptr + 22);
int16 code = READ_LE_UINT16(ptr + 24);
- assert(version == 0x010A || version == 0x0114);
- assert(code == ~version + 0x1234);
- _sounds[slot].region = (_region *)malloc(sizeof(_region) * 4);
+ _sounds[slot].region = (_region *)malloc(sizeof(_region) * 70);
_sounds[slot].jump = (_jump *)malloc(sizeof(_jump));
_sounds[slot].resPtr = ptr;
_sounds[slot].bits = 8;
_sounds[slot].channels = 1;
while (!quit) {
- int len = READ_LE_UINT32(ptr + offset);
- offset += 4;
+ len = READ_LE_UINT32(ptr + offset);
code = len & 0xFF;
+ if ((code != 0) && (code != 1) && (code != 6) && (code != 7)) {
+ // try again with 2 bytes forward (workaround for some FT sounds (ex.362, 363)
+ offset += 2;
+ len = READ_LE_UINT32(ptr + offset);
+ code = len & 0xFF;
+ if ((code != 0) && (code != 1) && (code != 6) && (code != 7)) {
+ error("Invalid code in VOC file : %d", code);
+ }
+ }
+ offset += 4;
len >>= 8;
switch(code) {
case 0:
@@ -132,7 +140,6 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, int slot) {
quit = true;
break;
}
- // FIXME some FT samples (ex. 362) has bad length, 2 bytes too short
offset += len;
}
} else if (READ_UINT32(ptr) == MKID('iMUS')) {