diff options
author | Paweł Kołodziejski | 2004-01-14 21:46:58 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2004-01-14 21:46:58 +0000 |
commit | 89318f10fee4fd13812619a6c0f8c651bab3bbeb (patch) | |
tree | 37b01a09d210fd769a4122e79660ca4841cb7457 /scumm/imuse_digi | |
parent | 9b13e872b3c381e37fe05c4778260315f8bf2340 (diff) | |
download | scummvm-rg350-89318f10fee4fd13812619a6c0f8c651bab3bbeb.tar.gz scummvm-rg350-89318f10fee4fd13812619a6c0f8c651bab3bbeb.tar.bz2 scummvm-rg350-89318f10fee4fd13812619a6c0f8c651bab3bbeb.zip |
fixed bundle decompression for some case
svn-id: r12394
Diffstat (limited to 'scumm/imuse_digi')
-rw-r--r-- | scumm/imuse_digi/dimuse_bndmgr.cpp | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/scumm/imuse_digi/dimuse_bndmgr.cpp b/scumm/imuse_digi/dimuse_bndmgr.cpp index ef4cef9098..4e6f2a5632 100644 --- a/scumm/imuse_digi/dimuse_bndmgr.cpp +++ b/scumm/imuse_digi/dimuse_bndmgr.cpp @@ -198,24 +198,15 @@ int32 BundleMgr::decompressSampleByIndex(int32 index, int32 offset, int32 size, _compTableLoaded = true; } - if (header_outside) { - first_block = offset / 0x2000; - last_block = (offset + size - 1) / 0x2000; - } else { - first_block = (offset + header_size) / 0x2000; - last_block = (offset + size + header_size - 1) / 0x2000; - } + first_block = (offset + header_size) / 0x2000; + last_block = (offset + size + header_size - 1) / 0x2000; comp_output = (byte *)malloc(0x2000); int32 blocks_final_size = 0x2000 * (1 + last_block - first_block); *comp_final = (byte *)malloc(blocks_final_size); final_size = 0; - if (header_outside) { - skip = offset - (first_block * 0x2000); - } else { - skip = offset - (first_block * 0x2000) + header_size; - } + skip = offset - (first_block * 0x2000) + header_size; for (i = first_block; i <= last_block; i++) { byte *curBuf; @@ -239,8 +230,6 @@ int32 BundleMgr::decompressSampleByIndex(int32 index, int32 offset, int32 size, } if (header_outside) { - if ((header_size != 0) && (i == 0)) - skip += header_size; output_size -= skip; } else { if ((header_size != 0) && (skip >= header_size)) @@ -250,8 +239,7 @@ int32 BundleMgr::decompressSampleByIndex(int32 index, int32 offset, int32 size, if (output_size > size) output_size = size; - if (final_size + output_size > blocks_final_size) - error(""); + assert(final_size + output_size <= blocks_final_size); memcpy(*comp_final + final_size, curBuf + skip, output_size); |