aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/engine/game.cpp2
-rw-r--r--engines/sci/resource.cpp30
-rw-r--r--engines/sci/resource.h8
3 files changed, 40 insertions, 0 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index d3006a719e..d84df17117 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -288,6 +288,8 @@ int game_init(EngineState *s) {
s->_gameObj = s->_segMan->lookupScriptExport(0, 0);
uint32 gameFlags = 0; // unused
s->_gameId = convertSierraGameId(s->_segMan->getObjectName(s->_gameObj), &gameFlags, s->resMan);
+ // Add the after market GM patches for the specified game, if they exist
+ s->resMan->addNewGMPatch(s->_gameId);
debug(2, " \"%s\" at %04x:%04x", s->_gameId.c_str(), PRINT_REG(s->_gameObj));
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 9861b6892c..c3730a757d 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -474,6 +474,36 @@ int ResourceManager::addInternalSources() {
return 1;
}
+void ResourceManager::addNewGMPatch(Common::String gameId) {
+ Common::String gmPatchFile;
+
+ if (gameId == "ecoquest")
+ gmPatchFile = "ECO1GM.PAT";
+ else if (gameId == "hoyle3")
+ gmPatchFile = "HOY3GM.PAT";
+ else if (gameId == "hoyle3")
+ gmPatchFile = "HOY3GM.PAT";
+ else if (gameId == "lsl1sci")
+ gmPatchFile = "LL1_GM.PAT";
+ else if (gameId == "lsl5")
+ gmPatchFile = "LL5_GM.PAT";
+ else if (gameId == "longbow")
+ gmPatchFile = "ROBNGM.PAT";
+ else if (gameId == "sq1sci")
+ gmPatchFile = "SQ1_GM.PAT";
+ else if (gameId == "sq4")
+ gmPatchFile = "SQ4_GM.PAT";
+ else if (gameId == "fairytales")
+ gmPatchFile = "TALEGM.PAT";
+
+ if (!gmPatchFile.empty() && Common::File::exists(gmPatchFile)) {
+ ResourceSource *psrcPatch = new ResourceSource;
+ psrcPatch->source_type = kSourcePatch;
+ psrcPatch->location_name = gmPatchFile;
+ processPatch(psrcPatch, kResourceTypePatch, 4);
+ }
+}
+
void ResourceManager::scanNewSources() {
for (Common::List<ResourceSource *>::iterator it = _sources.begin(); it != _sources.end(); ++it) {
ResourceSource *source = *it;
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index e3ef848c87..3422c44837 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -274,6 +274,14 @@ public:
ViewType getViewType() const { return _viewType; }
const char *getMapVersionDesc() const { return versionDescription(_mapVersion); }
const char *getVolVersionDesc() const { return versionDescription(_volVersion); }
+
+ /**
+ * Adds the appropriate GM patch from the Sierra MIDI utility as 4.pat, without
+ * requiring the user to rename the file to 4.pat. Thus, the original Sierra
+ * archive can be extracted in the extras directory, and the GM patches can be
+ * applied per game, if applicable
+ */
+ void addNewGMPatch(Common::String gameId);
protected:
// Maximum number of bytes to allow being allocated for resources