aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2010-01-16 00:22:22 +0000
committerFilippos Karapetis2010-01-16 00:22:22 +0000
commit22e8b3ed027669496e7ebd57e23eb391e61b33cf (patch)
treed5bd51be4ee9d92cbe383f0e5d4efe221224b7c0
parentc4a9d373ca30eed9df9aaf555f9798d131f0dd19 (diff)
downloadscummvm-rg350-22e8b3ed027669496e7ebd57e23eb391e61b33cf.tar.gz
scummvm-rg350-22e8b3ed027669496e7ebd57e23eb391e61b33cf.tar.bz2
scummvm-rg350-22e8b3ed027669496e7ebd57e23eb391e61b33cf.zip
The GM patches from Sierra's GM utility can now also be processed with their original names. Thus, the user can just extract the patches from Sierra's GM utility in the extras folder, and it's not necessary to rename each individual file to "4.pat" and place it inside the associated game (works with the games that Sierra's GM patch updates, i.e. LSL1, LSL5, Hoyle3, SQ1, SQ4, Eco1, Longbow and Fairy tales)
svn-id: r47318
-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