aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorColin Snover2016-12-14 11:27:49 -0600
committerColin Snover2017-03-30 19:46:27 -0500
commit477e31cea69f2ac4f2cf80549d6a773319868a61 (patch)
tree9efd5c927225239fb75f9ffadcb87e39b4659f74 /engines
parent30435ec0abee168af13b5c41671ee5ca41db8a88 (diff)
downloadscummvm-rg350-477e31cea69f2ac4f2cf80549d6a773319868a61.tar.gz
scummvm-rg350-477e31cea69f2ac4f2cf80549d6a773319868a61.tar.bz2
scummvm-rg350-477e31cea69f2ac4f2cf80549d6a773319868a61.zip
SCI32: Ignore invalid audio map entries in GK2
The invalid entries, which are on CD 6, appear to correspond to audio that's on CD 4 (though not with the correct offset for CD 4's RESOURCE.AUD). Skipping the invalid map entries on CD 6 should cause these audio files to be loaded from the CD 4 audio bundle if they are requested during chapter six since ScummVM combines resources from all CDs and matches on their IDs.
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/resource.h2
-rw-r--r--engines/sci/resource_audio.cpp14
2 files changed, 14 insertions, 2 deletions
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index a9a7a86c96..3e7a7a5e96 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -185,7 +185,7 @@ public:
}
// Convert from a resource ID to a base36 patch name
- Common::String toPatchNameBase36() {
+ Common::String toPatchNameBase36() const {
Common::String output;
output += (getType() == kResourceTypeAudio36) ? '@' : '#'; // Identifier
diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp
index 7423890903..c70a2a2322 100644
--- a/engines/sci/resource_audio.cpp
+++ b/engines/sci/resource_audio.cpp
@@ -430,8 +430,20 @@ int ResourceManager::readAudioMapSCI11(IntMapResourceSource *map) {
}
}
+ const ResourceId id = ResourceId(kResourceTypeAudio36, map->_mapNumber, n & 0xffffff3f);
+
+ // At least version 1.00 of GK2 has multiple invalid audio36 map
+ // entries on CD 6
+ if (g_sci->getGameId() == GID_GK2 &&
+ map->_volumeNumber == 6 &&
+ offset + syncSize >= srcSize) {
+
+ debugC(kDebugLevelResMan, "Invalid offset %u for %s in map %d for disc %d", offset + syncSize, id.toPatchNameBase36().c_str(), map->_mapNumber, map->_volumeNumber);
+ continue;
+ }
+
assert(offset + syncSize < srcSize);
- addResource(ResourceId(kResourceTypeAudio36, map->_mapNumber, n & 0xffffff3f), src, offset + syncSize);
+ addResource(id, src, offset + syncSize);
}
}