aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Snover2017-07-23 15:56:27 -0500
committerColin Snover2017-07-23 16:01:19 -0500
commitd38704e16d33b4ccd735a1b824edcdef60ce2a9c (patch)
tree5a9ad65d167f74c78aabfae40b71139e82b01876
parent4d52b018a23114813fd5c0d159abb97a02a96d34 (diff)
downloadscummvm-rg350-d38704e16d33b4ccd735a1b824edcdef60ce2a9c.tar.gz
scummvm-rg350-d38704e16d33b4ccd735a1b824edcdef60ce2a9c.tar.bz2
scummvm-rg350-d38704e16d33b4ccd735a1b824edcdef60ce2a9c.zip
SCI: Blacklist certain audio map patch files
Refs Trac#9976.
-rw-r--r--engines/sci/resource.cpp32
-rw-r--r--engines/sci/resource.h7
2 files changed, 33 insertions, 6 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 29f3017acb..019aaffab1 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -1423,6 +1423,30 @@ ResVersion ResourceManager::detectVolVersion() {
return kResVersionUnknown;
}
+bool ResourceManager::isBlacklistedPatch(const ResourceId &resId) const {
+ switch (g_sci->getGameId()) {
+ case GID_SHIVERS:
+ // The SFX resource map patch in the Shivers interactive demo has
+ // broken offsets for some sounds; ignore it so that the correct map
+ // from RESSCI.000 will be used instead.
+ return g_sci->isDemo() &&
+ resId.getType() == kResourceTypeMap &&
+ resId.getNumber() == 65535;
+ case GID_PHANTASMAGORIA:
+ // The GOG release of Phantasmagoria 1 merges all resources into a
+ // single-disc bundle, but they also include the 65535.MAP & 37.MAP
+ // patch files from original game's CD 1, which (of course) do not
+ // contain the entries for audio from later CDs. So, just ignore these
+ // map patches since the correct maps will be found in the RESSCI.000
+ // file. This also helps eliminate user error when copying files from
+ // the original CDs.
+ return resId.getType() == kResourceTypeMap &&
+ (resId.getNumber() == 65535 || resId.getNumber() == 37);
+ default:
+ return false;
+ }
+}
+
// version-agnostic patch application
void ResourceManager::processPatch(ResourceSource *source, ResourceType resourceType, uint16 resourceNr, uint32 tuple) {
Common::SeekableReadStream *fileStream = 0;
@@ -1430,12 +1454,8 @@ void ResourceManager::processPatch(ResourceSource *source, ResourceType resource
ResourceId resId = ResourceId(resourceType, resourceNr, tuple);
ResourceType checkForType = resourceType;
- // HACK: The SFX resource map patch in the Shivers interactive demo has
- // broken offsets for some sounds; ignore it so that the correct map from
- // RESSCI.000 will be used instead
- if (g_sci->getGameId() == GID_SHIVERS && g_sci->isDemo() &&
- resourceType == kResourceTypeMap && resourceNr == 65535) {
-
+ if (isBlacklistedPatch(resId)) {
+ debug("Skipping blacklisted patch file %s", source->getLocationName().c_str());
delete source;
return;
}
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index 878e2acd8b..8e91a601dc 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -575,6 +575,13 @@ protected:
*/
void readResourcePatches();
void readResourcePatchesBase36();
+
+ /**
+ * Determines whether or not a patch file matching the given resource ID
+ * should be ignored when processing patches.
+ */
+ bool isBlacklistedPatch(const ResourceId &resId) const;
+
void processPatch(ResourceSource *source, ResourceType resourceType, uint16 resourceNr, uint32 tuple = 0);
/**