diff options
author | Colin Snover | 2017-05-10 15:29:10 -0500 |
---|---|---|
committer | Colin Snover | 2017-05-10 15:29:53 -0500 |
commit | ea6eebca09f9303cd08aa6d767123ba383c548e8 (patch) | |
tree | 27ceffdad276e2a0ed0c30e4ab7d4d7d0b174599 /engines | |
parent | 80e7eaa442b435d64ade13d175cfa05b762fa397 (diff) | |
download | scummvm-rg350-ea6eebca09f9303cd08aa6d767123ba383c548e8.tar.gz scummvm-rg350-ea6eebca09f9303cd08aa6d767123ba383c548e8.tar.bz2 scummvm-rg350-ea6eebca09f9303cd08aa6d767123ba383c548e8.zip |
SCI: Fix reading of Rave data from compressed KQ6 audio volumes
Refs Trac#9764.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/resource.cpp | 6 | ||||
-rw-r--r-- | engines/sci/resource.h | 2 | ||||
-rw-r--r-- | engines/sci/resource_audio.cpp | 11 |
3 files changed, 15 insertions, 4 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 2f34f8f433..6ee77fd4c7 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -2010,10 +2010,12 @@ bool ResourceManager::validateResource(const ResourceId &resourceId, const Commo return true; } -void ResourceManager::addResource(ResourceId resId, ResourceSource *src, uint32 offset, uint32 size, const Common::String &sourceMapLocation) { +Resource *ResourceManager::addResource(ResourceId resId, ResourceSource *src, uint32 offset, uint32 size, const Common::String &sourceMapLocation) { // Adding new resource only if it does not exist if (_resMap.contains(resId) == false) { - updateResource(resId, src, offset, size, sourceMapLocation); + return updateResource(resId, src, offset, size, sourceMapLocation); + } else { + return _resMap.getVal(resId); } } diff --git a/engines/sci/resource.h b/engines/sci/resource.h index d8651304be..2bbbd42a4a 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -520,7 +520,7 @@ protected: void loadResource(Resource *res); void freeOldResources(); bool validateResource(const ResourceId &resourceId, const Common::String &sourceMapLocation, const Common::String &sourceName, const uint32 offset, const uint32 size, const uint32 sourceSize) const; - void addResource(ResourceId resId, ResourceSource *src, uint32 offset, uint32 size = 0, const Common::String &sourceMapLocation = Common::String("(no map location)")); + Resource *addResource(ResourceId resId, ResourceSource *src, uint32 offset, uint32 size = 0, const Common::String &sourceMapLocation = Common::String("(no map location)")); Resource *updateResource(ResourceId resId, ResourceSource *src, uint32 size, const Common::String &sourceMapLocation = Common::String("(no map location)")); Resource *updateResource(ResourceId resId, ResourceSource *src, uint32 offset, uint32 size, const Common::String &sourceMapLocation = Common::String("(no map location)")); void removeAudioResource(ResourceId resId); diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp index 2cd157a631..0b00725d8b 100644 --- a/engines/sci/resource_audio.cpp +++ b/engines/sci/resource_audio.cpp @@ -444,7 +444,16 @@ int ResourceManager::readAudioMapSCI11(IntMapResourceSource *map) { ptr += 2; if (kq6HiresSyncSize > 0) { - addResource(ResourceId(kResourceTypeRave, map->_mapNumber, n & 0xffffff3f), src, offset + syncSize, kq6HiresSyncSize, map->getLocationName()); + // Rave resources do not have separate entries in the audio + // map (their data was just appended to sync resources), so + // we have to use the sync resource offset first and then + // adjust the offset & size later, otherwise offset + // validation will fail for compressed volumes (since the + // relocation table in a compressed volume only contains + // offsets that existed in the original audio map) + Resource *res = addResource(ResourceId(kResourceTypeRave, map->_mapNumber, n & 0xffffff3f), src, offset, syncSize + kq6HiresSyncSize, map->getLocationName()); + res->_fileOffset += syncSize; + res->_size -= syncSize; syncSize += kq6HiresSyncSize; } } |