aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
}
}