diff options
author | Paweł Kołodziejski | 2004-04-25 19:51:46 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2004-04-25 19:51:46 +0000 |
commit | 7251d5324ec47d422b4f69522fabd3f3f8b91088 (patch) | |
tree | 92ea26cfee15cc0b019ac2d4982cf86a414919b7 | |
parent | c5c1a83d3528332134e3215327901be86e24aa24 (diff) | |
download | scummvm-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.cpp | 19 |
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')) { |