aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2010-05-01 14:51:57 +0000
committerMartin Kiewitz2010-05-01 14:51:57 +0000
commit0cd0d8bafe300f3cf9c02fbea0a9d3287936c6f7 (patch)
treed87286bfff7d497a7e45ae7ed5be8313484bdd38
parente3ac8713e3718bff97858d25b5a98048357867f1 (diff)
downloadscummvm-rg350-0cd0d8bafe300f3cf9c02fbea0a9d3287936c6f7.tar.gz
scummvm-rg350-0cd0d8bafe300f3cf9c02fbea0a9d3287936c6f7.tar.bz2
scummvm-rg350-0cd0d8bafe300f3cf9c02fbea0a9d3287936c6f7.zip
SCI: fix sync resources not loading correctly when compressed (mp3/ogg/flac) audio resource file was used
svn-id: r48881
-rw-r--r--engines/sci/resource.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 02d8e62137..3651fe9e91 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -295,7 +295,7 @@ void ResourceManager::checkIfAudioVolumeIsCompressed(ResourceSource *source) {
bool ResourceManager::loadPatch(Resource *res, Common::File &file) {
// We assume that the resource type matches res->type
- file.seek(res->_fileOffset + 2, SEEK_SET);
+ // We also assume that the current file position is right at the actual data (behind resourceid/headersize byte)
res->data = new byte[res->size];
@@ -329,7 +329,8 @@ bool ResourceManager::loadFromPatchFile(Resource *res) {
res->unalloc();
return false;
}
-
+ // Skip resourceid and header size byte
+ file.seek(2, SEEK_SET);
return loadPatch(res, file);
}
@@ -375,6 +376,8 @@ bool ResourceManager::loadFromAudioVolumeSCI11(Resource *res, Common::File &file
// Load sample size
file.seek(7, SEEK_CUR);
res->size = file.readUint32LE();
+ // Adjust offset to point at the header data again
+ file.seek(-11, SEEK_CUR);
}
return loadPatch(res, file);
@@ -460,8 +463,15 @@ void ResourceManager::loadResource(Resource *res) {
mappingTable++;
compressedOffset = *mappingTable;
// Go to next compressed offset and use that to calculate size of compressed sample
- mappingTable += 2;
- res->size = *mappingTable - compressedOffset;
+ switch (res->_id.type) {
+ case kResourceTypeSync:
+ case kResourceTypeSync36:
+ // we should already have a (valid) size
+ break;
+ default:
+ mappingTable += 2;
+ res->size = *mappingTable - compressedOffset;
+ }
break;
}
mappingTable += 2;