diff options
author | Paweł Kołodziejski | 2004-03-13 17:41:36 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2004-03-13 17:41:36 +0000 |
commit | f2f6c75ba575cf40fdd0bb0842a359f24355c78b (patch) | |
tree | 17d8eb26b3f7fd5667bf270fae177d44cc8809a5 | |
parent | fae98dec52fab0353ff433d15bb3a7e35e61c851 (diff) | |
download | scummvm-rg350-f2f6c75ba575cf40fdd0bb0842a359f24355c78b.tar.gz scummvm-rg350-f2f6c75ba575cf40fdd0bb0842a359f24355c78b.tar.bz2 scummvm-rg350-f2f6c75ba575cf40fdd0bb0842a359f24355c78b.zip |
fix for voice bundle bug in german version comi
svn-id: r13260
-rw-r--r-- | scumm/imuse_digi/dimuse_bndmgr.cpp | 8 | ||||
-rw-r--r-- | scumm/imuse_digi/dimuse_bndmgr.h | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/scumm/imuse_digi/dimuse_bndmgr.cpp b/scumm/imuse_digi/dimuse_bndmgr.cpp index 4e6f2a5632..49dc33169f 100644 --- a/scumm/imuse_digi/dimuse_bndmgr.cpp +++ b/scumm/imuse_digi/dimuse_bndmgr.cpp @@ -117,6 +117,7 @@ BundleMgr::BundleMgr(BundleDirCache *cache) { _bundleTable = NULL; _compTable = NULL; _numFiles = 0; + _numCompItems = 0; _curSample = -1; _fileBundleId = -1; } @@ -150,6 +151,7 @@ void BundleMgr::closeFile() { _file.close(); _bundleTable = NULL; _numFiles = 0; + _numCompItems = 0; _compTableLoaded = false; _lastBlock = -1; _lastCacheOutputSize = 0; @@ -179,7 +181,7 @@ int32 BundleMgr::decompressSampleByIndex(int32 index, int32 offset, int32 size, if (!_compTableLoaded) { _file.seek(_bundleTable[index].offset, SEEK_SET); tag = _file.readUint32BE(); - num = _file.readUint32BE(); + _numCompItems = num = _file.readUint32BE(); _file.readUint32BE(); _file.readUint32BE(); @@ -201,6 +203,10 @@ int32 BundleMgr::decompressSampleByIndex(int32 index, int32 offset, int32 size, first_block = (offset + header_size) / 0x2000; last_block = (offset + size + header_size - 1) / 0x2000; + // workaround for bug when (offset + size + header_size - 1) is more one byte after sound resource + if ((last_block >= _numCompItems) && (_numCompItems > 0)) + last_block = _numCompItems - 1; + comp_output = (byte *)malloc(0x2000); int32 blocks_final_size = 0x2000 * (1 + last_block - first_block); *comp_final = (byte *)malloc(blocks_final_size); diff --git a/scumm/imuse_digi/dimuse_bndmgr.h b/scumm/imuse_digi/dimuse_bndmgr.h index b30c8f9c38..a8819a500e 100644 --- a/scumm/imuse_digi/dimuse_bndmgr.h +++ b/scumm/imuse_digi/dimuse_bndmgr.h @@ -64,6 +64,7 @@ private: BundleDirCache::AudioTable *_bundleTable; CompTable *_compTable; int32 _numFiles; + int32 _numCompItems; int32 _curSample; File _file; bool _compTableLoaded; |