aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorPaweł Kołodziejski2008-01-15 20:09:56 +0000
committerPaweł Kołodziejski2008-01-15 20:09:56 +0000
commitc3d4abe4b7b6bcfbb53edd76bffd64f8a79b129e (patch)
treef0e2dd13ba264183d3a3a63462adb549902a6463 /engines/scumm
parent173988960be7bb4a73a6911b2f4474b85387145c (diff)
downloadscummvm-rg350-c3d4abe4b7b6bcfbb53edd76bffd64f8a79b129e.tar.gz
scummvm-rg350-c3d4abe4b7b6bcfbb53edd76bffd64f8a79b129e.tar.bz2
scummvm-rg350-c3d4abe4b7b6bcfbb53edd76bffd64f8a79b129e.zip
fix last commit to release, and add version 2 fallback for compressed files
svn-id: r30499
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/imuse_digi/dimuse_sndmgr.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
index 5f8a030c9b..8b278bc8db 100644
--- a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
+++ b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
@@ -101,7 +101,10 @@ void ImuseDigiSndMgr::prepareSoundFromRMAP(Common::File *file, SoundDesc *sound,
assert(tag == MKID_BE('RMAP'));
int32 version = file->readUint32BE();
if (version != 3) {
- error("ImuseDigiSndMgr::prepareSoundFromRMAP: Wrong version number, expected 3, but it's: %d.", version);
+ if (version == 2)
+ warning("ImuseDigiSndMgr::prepareSoundFromRMAP: Wrong version number, expected 3, but it's 2. Recompress data with latest tool.");
+ else
+ error("ImuseDigiSndMgr::prepareSoundFromRMAP: Wrong version number, expected 3, but it's: %d.", version);
}
sound->bits = file->readUint32BE();
sound->freq = file->readUint32BE();
@@ -109,7 +112,11 @@ void ImuseDigiSndMgr::prepareSoundFromRMAP(Common::File *file, SoundDesc *sound,
sound->numRegions = file->readUint32BE();
sound->numJumps = file->readUint32BE();
sound->numSyncs = file->readUint32BE();
- sound->numMarkers = file->readUint32BE();
+ if (version >= 3)
+ sound->numMarkers = file->readUint32BE();
+ else
+ sound->numMarkers = 0;
+
sound->region = new Region[sound->numRegions];
assert(sound->region);
sound->jump = new Jump[sound->numJumps];
@@ -134,11 +141,13 @@ void ImuseDigiSndMgr::prepareSoundFromRMAP(Common::File *file, SoundDesc *sound,
sound->sync[l].ptr = (byte *)malloc(sound->sync[l].size);
file->read(sound->sync[l].ptr, sound->sync[l].size);
}
- for (l = 0; l < sound->numMarkers; l++) {
- sound->marker[l].pos = file->readUint32BE();
- sound->marker[l].length = file->readUint32BE();
- sound->marker[l].ptr = new char[sound->marker[l].length];
- file->read(sound->marker[l].ptr, sound->marker[l].length);
+ if (version >= 3) {
+ for (l = 0; l < sound->numMarkers; l++) {
+ sound->marker[l].pos = file->readUint32BE();
+ sound->marker[l].length = file->readUint32BE();
+ sound->marker[l].ptr = new char[sound->marker[l].length];
+ file->read(sound->marker[l].ptr, sound->marker[l].length);
+ }
}
}
@@ -475,10 +484,11 @@ void ImuseDigiSndMgr::closeSound(SoundDesc *soundDesc) {
for (int r = 0; r < soundDesc->numSyncs; r++)
free(soundDesc->sync[r].ptr);
+ for (int r = 0; r < soundDesc->numSyncs; r++)
+ delete[] soundDesc->marker[r].ptr;
delete[] soundDesc->region;
delete[] soundDesc->jump;
delete[] soundDesc->sync;
- delete[] soundDesc->marker->ptr;
delete[] soundDesc->marker;
memset(soundDesc, 0, sizeof(SoundDesc));
}