aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2006-03-19 17:25:13 +0000
committerMax Horn2006-03-19 17:25:13 +0000
commit03734aa876e39561f5b8569cc75ad769c8dce1c1 (patch)
tree82533bb8d20eb42e2a2e6f9c2ca0b791e47611a6 /engines
parent99635b6a900f41dcec7d7fd17f11e297ece6210b (diff)
downloadscummvm-rg350-03734aa876e39561f5b8569cc75ad769c8dce1c1.tar.gz
scummvm-rg350-03734aa876e39561f5b8569cc75ad769c8dce1c1.tar.bz2
scummvm-rg350-03734aa876e39561f5b8569cc75ad769c8dce1c1.zip
Moved filename substitution code from scumm.cpp to plugin.cpp
svn-id: r21386
Diffstat (limited to 'engines')
-rw-r--r--engines/scumm/plugin.cpp336
-rw-r--r--engines/scumm/plugin.h35
-rw-r--r--engines/scumm/scumm.cpp310
-rw-r--r--engines/scumm/scumm.h35
4 files changed, 362 insertions, 354 deletions
diff --git a/engines/scumm/plugin.cpp b/engines/scumm/plugin.cpp
index 5ba83cd5a3..341a97ee0d 100644
--- a/engines/scumm/plugin.cpp
+++ b/engines/scumm/plugin.cpp
@@ -393,8 +393,8 @@ static const ScummGameSettings scumm_settings[] = {
static const ScummGameSettings extra_versions[] = {
// The C64 version of MM is detected via the platform field and hence has no seperate entry in this list
{"maniac", "", GID_MANIAC, 2, 0, MDT_PCSPK, GF_SMALL_HEADER | GF_NO_SCALING | GF_16COLOR | GF_USE_KEY | GF_OLD_BUNDLE, UNK},
- {"maniac", "NES", GID_MANIAC, 1, 0, MDT_NONE, GF_SMALL_HEADER | GF_USE_KEY | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALING, Common::kPlatformNES},
- {"maniac", "V1", GID_MANIAC, 1, 0, MDT_PCSPK, GF_SMALL_HEADER | GF_USE_KEY | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALING, Common::kPlatformPC},
+ {"maniac", "NES", GID_MANIAC, 1, 0, MDT_NONE, GF_SMALL_HEADER | GF_NO_SCALING | GF_16COLOR | GF_USE_KEY | GF_OLD_BUNDLE, Common::kPlatformNES},
+ {"maniac", "V1", GID_MANIAC, 1, 0, MDT_PCSPK, GF_SMALL_HEADER | GF_NO_SCALING | GF_16COLOR | GF_USE_KEY | GF_OLD_BUNDLE, Common::kPlatformPC},
// The C64 version of Zak is detected via the platform field and hence has no seperate entry in this list
{"zak", "", GID_ZAK, 2, 0, MDT_PCSPK, GF_SMALL_HEADER | GF_NO_SCALING | GF_16COLOR | GF_USE_KEY | GF_OLD_BUNDLE, UNK},
@@ -657,17 +657,17 @@ static const ScummGameSettings multiple_versions_md5_settings[] = {
GF_SMALL_HEADER | GF_NO_SCALING | GF_OLD256 | GF_AUDIOTRACKS, Common::kPlatformFMTowns},
{"3905799e081b80a61d4460b7b733c206", "NES E", GID_MANIAC, 1, 0, MDT_NONE,
- GF_SMALL_HEADER | GF_USE_KEY | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALING, Common::kPlatformNES},
+ GF_SMALL_HEADER | GF_NO_SCALING | GF_16COLOR | GF_USE_KEY | GF_OLD_BUNDLE, Common::kPlatformNES},
{"81bbfa181184cb494e7a81dcfa94fbd9", "NES F", GID_MANIAC, 1, 0, MDT_NONE,
- GF_SMALL_HEADER | GF_USE_KEY | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALING, Common::kPlatformNES},
+ GF_SMALL_HEADER | GF_NO_SCALING | GF_16COLOR | GF_USE_KEY | GF_OLD_BUNDLE, Common::kPlatformNES},
{"257f8c14d8c584f7ddd601bcb00920c7", "NES G", GID_MANIAC, 1, 0, MDT_NONE,
- GF_SMALL_HEADER | GF_USE_KEY | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALING, Common::kPlatformNES},
+ GF_SMALL_HEADER | GF_NO_SCALING | GF_16COLOR | GF_USE_KEY | GF_OLD_BUNDLE, Common::kPlatformNES},
{"22d07d6c386c9c25aca5dac2a0c0d94b", "NES SW", GID_MANIAC, 1, 0, MDT_NONE,
- GF_SMALL_HEADER | GF_USE_KEY | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALING, Common::kPlatformNES},
+ GF_SMALL_HEADER | GF_NO_SCALING | GF_16COLOR | GF_USE_KEY | GF_OLD_BUNDLE, Common::kPlatformNES},
{"d8d07efcb88f396bee0b402b10c3b1c9", "NES U", GID_MANIAC, 1, 0, MDT_NONE,
- GF_SMALL_HEADER | GF_USE_KEY | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALING, Common::kPlatformNES},
+ GF_SMALL_HEADER | GF_NO_SCALING | GF_16COLOR | GF_USE_KEY | GF_OLD_BUNDLE, Common::kPlatformNES},
{"7f45ddd6dbfbf8f80c0c0efea4c295bc", "v1", GID_MANIAC, 1, 0, MDT_PCSPK,
- GF_SMALL_HEADER | GF_USE_KEY | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALING, Common::kPlatformPC},
+ GF_SMALL_HEADER | GF_NO_SCALING | GF_16COLOR | GF_USE_KEY | GF_OLD_BUNDLE, Common::kPlatformPC},
{"898eaa21f79cf8d4f08db856244689ff", "Updated", GID_HEGAME, 6, 99, MDT_NONE,
GF_USE_KEY | GF_NEW_COSTUMES, Common::kPlatformWindows},
@@ -827,9 +827,9 @@ static const ScummGameSettings multiple_versions_md5_settings[] = {
GF_USE_KEY | GF_NEW_COSTUMES, Common::kPlatformWindows},
{"b23f7cd7c304d7dff08e92a96120d5b4", "v1", GID_ZAK, 1, 0, MDT_PCSPK,
- GF_SMALL_HEADER | GF_USE_KEY | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALING, Common::kPlatformPC},
+ GF_SMALL_HEADER | GF_NO_SCALING | GF_16COLOR | GF_USE_KEY | GF_OLD_BUNDLE, Common::kPlatformPC},
{"7020931d5a2be0a49d68e7a1882363e4", "v1", GID_ZAK, 1, 0, MDT_PCSPK,
- GF_SMALL_HEADER | GF_USE_KEY | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALING, Common::kPlatformPC},
+ GF_SMALL_HEADER | GF_NO_SCALING | GF_16COLOR | GF_USE_KEY | GF_OLD_BUNDLE, Common::kPlatformPC},
{"2d4536a56e01da4b02eb021e7770afa2", "FM-TOWNS", GID_ZAK, 3, 0, MDT_TOWNS,
GF_SMALL_HEADER | GF_NO_SCALING | GF_OLD256 | GF_AUDIOTRACKS, Common::kPlatformFMTowns},
@@ -846,6 +846,231 @@ static const ScummGameSettings multiple_versions_md5_settings[] = {
{NULL, NULL, 0, 0, MDT_NONE, 0, 0, Common::kPlatformUnknown}
};
+static const SubstResFileNames substResFileNameTable[] = {
+ // The first few entries for 00.LFL/01.LFL files are here for two reasons:
+ // 1) For the detector to detect these games
+ // 2) Because the ScummEngine constructor distinguishes between extracted
+ // and non-extracted variants of these C64/NES games by the presence
+ // or absence of a SubstResFileNames record.
+ // Use 1 will go away with the new detector code. Use 2 needs some more
+ // attention, but most likely should be solved by passing the name of the
+ // "detect file" to the contructor.
+ { "00.LFL", "Maniac Mansion (E).prg", kGenAsIs },
+ { "00.LFL", "Maniac Mansion (F).prg", kGenAsIs },
+ { "00.LFL", "Maniac Mansion (SW).prg", kGenAsIs },
+ { "00.LFL", "Maniac Mansion (U).prg", kGenAsIs },
+ { "00.LFL", "Maniac Mansion (G).prg", kGenAsIs },
+ { "00.LFL", "maniac1.d64", kGenAsIs }, // Do not
+ { "01.LFL", "maniac2.d64", kGenAsIs }, // swap
+ { "00.LFL", "zak1.d64", kGenAsIs }, // these
+ { "01.LFL", "zak2.d64", kGenAsIs }, // lines
+
+ { "atlantis", "Fate of Atlantis Data", kGenAsIs },
+ { "atlantis", "fate", kGenPC },
+ { "atlantis", "playfate", kGenPC },
+ { "atlantis", "indy4", kGenPC },
+ { "atlantis", "indydemo", kGenPC },
+ { "tentacle", "Day of the Tentacle Data", kGenAsIs },
+ { "tentacle", "dottdemo", kGenPC },
+ { "tentacle", "Day of the Tentacle Demo Data", kGenAsIs },
+ { "monkey", "monkey1", kGenPC },
+ { "monkey", "monkeyk", kGenPC }, // FM-TOWNS Jap
+ { "monkey", "game", kGenPC }, // SegaCD
+ { "monkey2", "mi2demo", kGenPC },
+ { "samnmax", "Sam & Max Data", kGenAsIs },
+ { "samnmax", "Sam & Max Demo Data", kGenAsIs },
+ { "samnmax", "ramnmax", kGenPC }, // Used in some releases of Russian Sam'n'Max
+ { "samnmax", "samdemo", kGenPC },
+ { "samnmax", "snmdemo", kGenPC },
+ { "samnmax", "snmidemo", kGenPC },
+ { "samnmax", "sdemo", kGenPC },
+#ifndef DISABLE_SCUMM_7_8
+ { "dig", "The Dig Data", kGenAsIs },
+ { "dig", "The Dig Demo Data", kGenAsIs },
+ { "ft", "Full Throttle Data", kGenAsIs },
+ { "ft", "Full Throttle Demo Data", kGenAsIs },
+ { "ft", "Vollgas Data", kGenAsIs },
+ { "ft", "Vollgas Demo Data", kGenAsIs },
+ { "ft", "ftdemo", kGenPC },
+#endif
+ { "fbear", "fbdemo", kGenPC },
+ { "fbear", "Fatty Bear Demo", kGenMacNoParens },
+ { "fbear", "Fatty Bear", kGenMacNoParens },
+ { "puttmoon", "moondemo", kGenPC },
+ { "puttmoon", "Putt-Putt Moon Demo", kGenMacNoParens },
+ { "puttmoon", "Putt-Putt Moon", kGenMacNoParens },
+ { "puttputt", "puttdemo", kGenPC },
+ { "puttputt", "Putt-Putt's Demo", kGenMacNoParens },
+ { "puttputt", "Putt-Putt Parade", kGenMacNoParens },
+#ifndef DISABLE_HE
+ { "airport", "airdemo", kGenPC },
+ { "airport", "Airport Demo", kGenMac },
+ { "airport", "The AirPort", kGenMac },
+ { "balloon", "Balloon-O-Rama", kGenMac },
+ { "baseball", "BaseBall", kGenMac },
+ { "baseball2001", "bb2demo", kGenPC },
+ { "baseball2001", "Baseball 2001 Demo", kGenMac },
+ { "baseball2001", "Baseball 2001", kGenMac },
+ { "baseball2001", "baseball 2001", kGenPC },
+ { "Baseball2003", "Baseball 2003", kGenMac },
+ { "basketball", "Basketball", kGenMac },
+ { "BluesABCTimeDemo", "BluesABCTimeDemo", kGenMac },
+ { "catalog", "catalog2", kGenPC },
+ { "chase", "Cheese Chase", kGenMac },
+ { "dog", "Dog on a Stick", kGenMac },
+ { "farm", "farmdemo", kGenPC },
+ { "farm", "Farm Demo", kGenMac },
+ { "football", "FootBall", kGenMac },
+ { "football", "FootBall Demo", kGenMac },
+ { "football", "FootBall2002", kGenPC },
+ { "football", "footdemo", kGenPC },
+ { "freddi", "freddemo", kGenPC },
+ { "freddi", "Freddi Demo", kGenMac },
+ { "freddi", "Freddi Fish", kGenMac },
+ { "freddi", "FreddiD", kGenPC },
+ { "freddi2", "ff2-demo", kGenPC },
+ { "freddi2", "FFHSDemo", kGenMac },
+ { "freddi2", "FFHSDemo", kGenPC },
+ { "freddi2", "Freddi Fish 2 Demo", kGenMac },
+ { "freddi2", "Freddi Fish 2", kGenMac },
+ { "freddi2", "FreddiCHSH", kGenPC },
+ { "freddi2", "Fritzi Fisch 2", kGenMac },
+ { "freddi3", "F3-mdemo", kGenMac },
+ { "freddi3", "F3-Mdemo", kGenMac },
+ { "freddi3", "f3-mdemo", kGenPC },
+ { "freddi3", "FF3-DEMO", kGenPC },
+ { "freddi3", "Freddi Fish 3", kGenMac },
+ { "freddi3", "FreddiFGT", kGenPC },
+ { "freddi3", "FreddiFGT", kGenMac },
+ { "freddi3", "FreddiSCS", kGenPC },
+ { "freddi3", "Fritzi3demo", kGenMac },
+ { "freddi3", "Fritzi3demo", kGenPC },
+ { "freddi3", "MM3-DEMO", kGenPC },
+ { "freddi3", "MM3-Demo", kGenMac }, // FR Mac demo
+ { "freddi4", "f4-demo", kGenPC },
+ { "freddi4", "ff4demo", kGenPC },
+ { "freddi4", "Ff4demo", kGenMac },
+ { "freddi4", "Freddi 4", kGenMac },
+ { "freddi4", "Freddi 4 Demo", kGenMac },
+ { "freddi4", "FreddiGS", kGenPC },
+ { "freddi4", "FreddiGS", kGenMac },
+ { "freddi4", "FreddiHRBG", kGenPC },
+ { "freddicove", "FreddiCCC", kGenPC },
+ { "freddicove", "FreddiCove", kGenMac },
+ { "freddicove", "FreddiDZZ", kGenPC },
+ { "freddicove", "ff5demo", kGenPC },
+ { "freddicove", "FFCoveDemo", kGenPC },
+ { "freddicove", "FreddiCoveDemo", kGenMac },
+ { "freddicove", "FF5Demo", kGenMac }, // NL Mac demo
+ { "FreddisFunShop", "Freddi's FunShop", kGenMac },
+ { "jungle", "The Jungle", kGenMac },
+ { "lost", "Lost and Found", kGenMac },
+ { "lost", "smaller", kGenPC },
+ { "maze", "Maze Madness", kGenMac},
+ { "mustard", "Mustard", kGenMac },
+ { "pajama", "Pyjama Pit", kGenMac },
+ { "pajama", "Pajama Sam", kGenMac },
+ { "pajama", "PajamaNHD", kGenPC },
+ { "pajama", "PJS-DEMO", kGenPC },
+ { "pajama", "PYJAMA", kGenPC },
+ { "pajama", "SAMDEMO", kGenPC },
+ { "pajama", "SAMDEMO", kGenMac }, // FR Mac demo
+ { "pajama2", "Pajama Sam 2", kGenMac },
+ { "pajama2", "PajamaTAL", kGenPC },
+ { "pajama2", "PyjamaDBMN", kGenPC },
+ { "pajama2", "PyjamaDBMN", kGenMac },
+ { "pajama2", "Pyjama Pit 2 Demo", kGenMac },
+ { "pajama2", "PJP2DEMO", kGenPC },
+ { "pajama2", "PJ2Demo", kGenMac },
+ { "pajama2", "pj2demo", kGenPC },
+ { "pajama2", "Pjs2demo", kGenPC },
+ { "pajama2", "PJ2 Demo", kGenMac }, // NL Mac demo
+ { "pajama3", "GPJ3Demo", kGenPC },
+ { "pajama3", "Pajama Sam 3", kGenMac },
+ { "pajama3", "Pajama Sam 3-Demo", kGenMac },
+ { "pajama3", "pj3-demo", kGenPC },
+ { "pajama3", "pj3demo", kGenPC },
+ { "pajama3", "PJ3Demo", kGenMac },
+ { "pajama3", "Pajama Sam Demo", kGenMac },
+ { "pajama3", "PjSamDemo", kGenMac },
+ { "pajama3", "PjSamDemo", kGenPC },
+ { "pajama3", "PyjamaSKS", kGenPC },
+ { "pajama3", "PyjamaSKS", kGenMac },
+ { "pajama3", "UKPajamaEAT", kGenPC }, // Russian
+ { "pjgames", "PJGames", kGenMac },
+ { "puttcircus", "circdemo", kGenPC },
+ { "puttcircus", "Putt Circus Demo", kGenMac },
+ { "puttcircus", "Putt Circus", kGenMac },
+ { "puttrace", "500demo", kGenPC },
+ { "puttrace", "racedemo", kGenPC },
+ { "puttrace", "RaceDemo", kGenMac },
+ { "puttrace", "Rennen", kGenPC },
+ { "puttrace", "Putt500 demo", kGenMac }, // NL Mac demo
+ { "puttrace", "Putt Race", kGenMac },
+ { "puttrace", "ToffRennen", kGenPC },
+ { "puttrace", "ToffRennen", kGenMac },
+ { "puttrace", "UKPuttRace", kGenPC }, // Russian
+ { "PuttsFunShop", "Putt's FunShop", kGenMac },
+ { "putttime", "PuttPuttTTT", kGenPC },
+ { "putttime", "PuttPuttTTT", kGenMac },
+ { "putttime", "PuttTijd", kGenPC },
+ { "putttime", "Putt Time", kGenMac },
+ { "putttime", "PuttTTT", kGenMac },
+ { "putttime", "PuttTTT", kGenPC },
+ { "putttime", "TIJDDEMO", kGenPC },
+ { "putttime", "timedemo", kGenPC },
+ { "putttime", "TimeDemo", kGenMac },
+ { "putttime", "TEMPDEMO", kGenPC },
+ { "putttime", "Tempdemo", kGenMac }, // FR Mac demo
+ { "putttime", "toffzeit", kGenPC }, // German Toeff-Toeff: Reist durch die Zeit
+ { "putttime", "toffzeit", kGenMac }, // German Toeff-Toeff: Reist durch die Zeit
+ { "putttime", "ZeitDemo", kGenMac },
+ { "putttime", "ZEITDEMO", kGenPC },
+ { "puttzoo", "Puttzoo Demo", kGenMac },
+ { "puttzoo", "PuttZoo", kGenMac },
+ { "puttzoo", "Töff-Töff™ Zoo Demo", kGenMac },
+ { "puttzoo", "zoodemo", kGenPC },
+ { "puttzoo", "Zoo Demo", kGenMac },
+ { "SamsFunShop", "Sam's FunShop", kGenMac },
+ { "soccer", "Soccer", kGenMac },
+ { "Soccer2004", "Soccer 2004", kGenMac },
+ { "socks", "SockWorks", kGenMac },
+ { "spyfox", "Fuchsdem", kGenMac },
+ { "spyfox", "FUCHSDEM", kGenPC},
+ { "spyfox", "FoxDemo", kGenMac },
+ { "spyfox", "foxdemo", kGenPC},
+ { "spyfox", "JAMESDEM", kGenPC },
+ { "spyfox", "Spydemo", kGenMac},
+ { "spyfox", "Spydemo", kGenPC},
+ { "spyfox", "SPYFox", kGenMac },
+ { "spyfox", "SPYFoxDC", kGenPC },
+ { "spyfox", "SPYFoxDC", kGenMac },
+ { "spyfox", "SpyFoxDMK", kGenPC },
+ { "spyfox", "SpyFoxDMK", kGenMac },
+ { "spyfox", "Spy Fox Demo", kGenMac }, // NL Mac demo
+ { "spyfox", "JR-Demo", kGenMac }, // FR Mac demo
+ { "spyfox2", "sf2-demo", kGenPC },
+ { "spyfox2", "sf2demo", kGenPC },
+ { "spyfox2", "Sf2demo", kGenMac },
+ { "spyfox2", "Spy Fox 2 - Demo", kGenMac },
+ { "spyfox2", "Spy Fox 2", kGenMac },
+ { "spyfox2", "SpyFoxOR", kGenPC },
+ { "spyfox2", "SpyFoxOR", kGenMac },
+ { "spyfox2", "spyfoxsr", kGenPC },
+ { "spyozon", "sf3-demo", kGenPC },
+ { "spyozon", "Spy Ozone Demo", kGenMac },
+ { "spyozon", "SPYFoxOZU", kGenPC },
+ { "spyozon", "SpyOzon", kGenMac },
+ { "thinker1", "1grademo", kGenPC },
+ { "thinker1", "Thinker1", kGenMac },
+ { "thinkerk", "kinddemo", kGenPC },
+ { "thinkerk", "KindDemo", kGenMac },
+ { "thinkerk", "ThinkerK", kGenMac },
+ { "water", "Water Worries", kGenMac },
+#endif
+ { NULL, NULL, kGenAsIs }
+};
+
#pragma mark -
#pragma mark --- Miscellaneous ---
#pragma mark -
@@ -870,6 +1095,97 @@ static int compareMD5Table(const void *a, const void *b) {
#pragma mark -
+#pragma mark --- Filename substitution ---
+#pragma mark -
+
+
+static void applySubstResFileName(const SubstResFileNames &subst, char *buf, int bufsize, const char *ext, char num) {
+ switch (subst.genMethod) {
+ case kGenMac:
+ case kGenMacNoParens:
+ if (num == '3') { // special case for cursors
+ // For mac they're stored in game binary
+ strncpy(buf, subst.expandedName, bufsize);
+ } else {
+ if (subst.genMethod == kGenMac)
+ snprintf(buf, bufsize, "%s (%c)", subst.expandedName, num);
+ else
+ snprintf(buf, bufsize, "%s %c", subst.expandedName, num);
+ }
+ break;
+
+ case kGenPC:
+ if (ext)
+ snprintf(buf, bufsize, "%s%s", subst.expandedName, ext);
+ else
+ strncpy(buf, subst.expandedName, bufsize);
+ break;
+
+ case kGenAsIs:
+ strncpy(buf, subst.expandedName, bufsize);
+ break;
+
+ default:
+ *buf = 0;
+ break;
+ }
+}
+
+bool applySubstResFileName(const SubstResFileNames &subst, const char *filename, char *buf, int bufsize) {
+ if (subst.almostGameID == 0)
+ return false;
+
+ size_t len = strlen(filename);
+ assert(len > 0);
+
+ char num = filename[len - 1];
+
+ // In some cases we have .(a) and .(b) extensions
+ if (num == ')')
+ num = filename[len - 2];
+
+ const char *ext = strrchr(filename, '.');
+ if (ext)
+ len = ext - filename;
+
+ if (!scumm_strnicmp(filename, subst.almostGameID, len)) {
+ applySubstResFileName(subst, buf, bufsize, ext, num);
+ return true;
+ }
+
+ return false;
+}
+
+int findSubstResFileName(SubstResFileNames &subst, const char *filename, int index) {
+ if (index < 0)
+ return -1;
+
+ size_t len = strlen(filename);
+ assert(len > 0);
+
+ char num = filename[len - 1];
+
+ // In some cases we have .(a) and .(b) extensions
+ if (num == ')')
+ num = filename[len - 2];
+
+ const char *ext = strrchr(filename, '.');
+ if (ext)
+ len = ext - filename;
+
+ int i;
+ for (i = index; substResFileNameTable[i].almostGameID; i++) {
+ if (!scumm_strnicmp(filename, substResFileNameTable[i].almostGameID, len)) {
+ subst = substResFileNameTable[i];
+ return i+1;
+ }
+ }
+ subst = substResFileNameTable[i];
+ return -1;
+}
+
+
+#pragma mark -
#pragma mark --- Plugin code ---
#pragma mark -
diff --git a/engines/scumm/plugin.h b/engines/scumm/plugin.h
index 74c6948b4a..a8ba8a426b 100644
--- a/engines/scumm/plugin.h
+++ b/engines/scumm/plugin.h
@@ -24,4 +24,39 @@
#ifndef SCUMM_PLUGIN_H
#define SCUMM_PLUGIN_H
+#include "common/util.h"
+
+/**
+ * Descriptor of a specific SCUMM game. Used internally to store
+ * information about the tons of game variants that exist.
+ */
+struct ScummGameSettings {
+ const char *gameid;
+ const char *extra;
+ byte id, version, heversion;
+ int midi; // MidiDriverFlags values
+ uint32 features;
+ Common::Platform platform;
+
+};
+
+
+enum GenMethods {
+ kGenMac,
+ kGenMacNoParens,
+ kGenPC,
+ kGenAsIs
+};
+
+struct SubstResFileNames {
+ const char *almostGameID;
+ const char *expandedName;
+ GenMethods genMethod;
+};
+
+
+extern bool applySubstResFileName(const SubstResFileNames &subst, const char *filename, char *buf, int bufsize);
+extern int findSubstResFileName(SubstResFileNames &subst, const char *filename, int index);
+
+
#endif
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index f55af75b2e..51829cf75f 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -81,316 +81,6 @@ namespace Scumm {
ScummEngine *g_scumm = 0;
-static const SubstResFileNames substResFileNameTable[] = {
- // The first few entries for 00.LFL/01.LFL files are here for two reasons:
- // 1) For the detector to detect these games
- // 2) Because the ScummEngine constructor distinguishes between extracted
- // and non-extracted variants of these C64/NES games by the presence
- // or absence of a SubstResFileNames record.
- // Use 1 will go away with the new detector code. Use 2 needs some more
- // attention, but most likely should be solved by passing the name of the
- // "detect file" to the contructor.
- { "00.LFL", "Maniac Mansion (E).prg", kGenAsIs },
- { "00.LFL", "Maniac Mansion (F).prg", kGenAsIs },
- { "00.LFL", "Maniac Mansion (SW).prg", kGenAsIs },
- { "00.LFL", "Maniac Mansion (U).prg", kGenAsIs },
- { "00.LFL", "Maniac Mansion (G).prg", kGenAsIs },
- { "00.LFL", "maniac1.d64", kGenAsIs }, // Do not
- { "01.LFL", "maniac2.d64", kGenAsIs }, // swap
- { "00.LFL", "zak1.d64", kGenAsIs }, // these
- { "01.LFL", "zak2.d64", kGenAsIs }, // lines
-
- { "atlantis", "Fate of Atlantis Data", kGenAsIs },
- { "atlantis", "fate", kGenPC },
- { "atlantis", "playfate", kGenPC },
- { "atlantis", "indy4", kGenPC },
- { "atlantis", "indydemo", kGenPC },
- { "tentacle", "Day of the Tentacle Data", kGenAsIs },
- { "tentacle", "dottdemo", kGenPC },
- { "tentacle", "Day of the Tentacle Demo Data", kGenAsIs },
- { "monkey", "monkey1", kGenPC },
- { "monkey", "monkeyk", kGenPC }, // FM-TOWNS Jap
- { "monkey", "game", kGenPC }, // SegaCD
- { "monkey2", "mi2demo", kGenPC },
- { "samnmax", "Sam & Max Data", kGenAsIs },
- { "samnmax", "Sam & Max Demo Data", kGenAsIs },
- { "samnmax", "ramnmax", kGenPC }, // Used in some releases of Russian Sam'n'Max
- { "samnmax", "samdemo", kGenPC },
- { "samnmax", "snmdemo", kGenPC },
- { "samnmax", "snmidemo", kGenPC },
- { "samnmax", "sdemo", kGenPC },
-#ifndef DISABLE_SCUMM_7_8
- { "dig", "The Dig Data", kGenAsIs },
- { "dig", "The Dig Demo Data", kGenAsIs },
- { "ft", "Full Throttle Data", kGenAsIs },
- { "ft", "Full Throttle Demo Data", kGenAsIs },
- { "ft", "Vollgas Data", kGenAsIs },
- { "ft", "Vollgas Demo Data", kGenAsIs },
- { "ft", "ftdemo", kGenPC },
-#endif
- { "fbear", "fbdemo", kGenPC },
- { "fbear", "Fatty Bear Demo", kGenMacNoParens },
- { "fbear", "Fatty Bear", kGenMacNoParens },
- { "puttmoon", "moondemo", kGenPC },
- { "puttmoon", "Putt-Putt Moon Demo", kGenMacNoParens },
- { "puttmoon", "Putt-Putt Moon", kGenMacNoParens },
- { "puttputt", "puttdemo", kGenPC },
- { "puttputt", "Putt-Putt's Demo", kGenMacNoParens },
- { "puttputt", "Putt-Putt Parade", kGenMacNoParens },
-#ifndef DISABLE_HE
- { "airport", "airdemo", kGenPC },
- { "airport", "Airport Demo", kGenMac },
- { "airport", "The AirPort", kGenMac },
- { "balloon", "Balloon-O-Rama", kGenMac },
- { "baseball", "BaseBall", kGenMac },
- { "baseball2001", "bb2demo", kGenPC },
- { "baseball2001", "Baseball 2001 Demo", kGenMac },
- { "baseball2001", "Baseball 2001", kGenMac },
- { "baseball2001", "baseball 2001", kGenPC },
- { "Baseball2003", "Baseball 2003", kGenMac },
- { "basketball", "Basketball", kGenMac },
- { "BluesABCTimeDemo", "BluesABCTimeDemo", kGenMac },
- { "catalog", "catalog2", kGenPC },
- { "chase", "Cheese Chase", kGenMac },
- { "dog", "Dog on a Stick", kGenMac },
- { "farm", "farmdemo", kGenPC },
- { "farm", "Farm Demo", kGenMac },
- { "football", "FootBall", kGenMac },
- { "football", "FootBall Demo", kGenMac },
- { "football", "FootBall2002", kGenPC },
- { "football", "footdemo", kGenPC },
- { "freddi", "freddemo", kGenPC },
- { "freddi", "Freddi Demo", kGenMac },
- { "freddi", "Freddi Fish", kGenMac },
- { "freddi", "FreddiD", kGenPC },
- { "freddi2", "ff2-demo", kGenPC },
- { "freddi2", "FFHSDemo", kGenMac },
- { "freddi2", "FFHSDemo", kGenPC },
- { "freddi2", "Freddi Fish 2 Demo", kGenMac },
- { "freddi2", "Freddi Fish 2", kGenMac },
- { "freddi2", "FreddiCHSH", kGenPC },
- { "freddi2", "Fritzi Fisch 2", kGenMac },
- { "freddi3", "F3-mdemo", kGenMac },
- { "freddi3", "F3-Mdemo", kGenMac },
- { "freddi3", "f3-mdemo", kGenPC },
- { "freddi3", "FF3-DEMO", kGenPC },
- { "freddi3", "Freddi Fish 3", kGenMac },
- { "freddi3", "FreddiFGT", kGenPC },
- { "freddi3", "FreddiFGT", kGenMac },
- { "freddi3", "FreddiSCS", kGenPC },
- { "freddi3", "Fritzi3demo", kGenMac },
- { "freddi3", "Fritzi3demo", kGenPC },
- { "freddi3", "MM3-DEMO", kGenPC },
- { "freddi3", "MM3-Demo", kGenMac }, // FR Mac demo
- { "freddi4", "f4-demo", kGenPC },
- { "freddi4", "ff4demo", kGenPC },
- { "freddi4", "Ff4demo", kGenMac },
- { "freddi4", "Freddi 4", kGenMac },
- { "freddi4", "Freddi 4 Demo", kGenMac },
- { "freddi4", "FreddiGS", kGenPC },
- { "freddi4", "FreddiGS", kGenMac },
- { "freddi4", "FreddiHRBG", kGenPC },
- { "freddicove", "FreddiCCC", kGenPC },
- { "freddicove", "FreddiCove", kGenMac },
- { "freddicove", "FreddiDZZ", kGenPC },
- { "freddicove", "ff5demo", kGenPC },
- { "freddicove", "FFCoveDemo", kGenPC },
- { "freddicove", "FreddiCoveDemo", kGenMac },
- { "freddicove", "FF5Demo", kGenMac }, // NL Mac demo
- { "FreddisFunShop", "Freddi's FunShop", kGenMac },
- { "jungle", "The Jungle", kGenMac },
- { "lost", "Lost and Found", kGenMac },
- { "lost", "smaller", kGenPC },
- { "maze", "Maze Madness", kGenMac},
- { "mustard", "Mustard", kGenMac },
- { "pajama", "Pyjama Pit", kGenMac },
- { "pajama", "Pajama Sam", kGenMac },
- { "pajama", "PajamaNHD", kGenPC },
- { "pajama", "PJS-DEMO", kGenPC },
- { "pajama", "PYJAMA", kGenPC },
- { "pajama", "SAMDEMO", kGenPC },
- { "pajama", "SAMDEMO", kGenMac }, // FR Mac demo
- { "pajama2", "Pajama Sam 2", kGenMac },
- { "pajama2", "PajamaTAL", kGenPC },
- { "pajama2", "PyjamaDBMN", kGenPC },
- { "pajama2", "PyjamaDBMN", kGenMac },
- { "pajama2", "Pyjama Pit 2 Demo", kGenMac },
- { "pajama2", "PJP2DEMO", kGenPC },
- { "pajama2", "PJ2Demo", kGenMac },
- { "pajama2", "pj2demo", kGenPC },
- { "pajama2", "Pjs2demo", kGenPC },
- { "pajama2", "PJ2 Demo", kGenMac }, // NL Mac demo
- { "pajama3", "GPJ3Demo", kGenPC },
- { "pajama3", "Pajama Sam 3", kGenMac },
- { "pajama3", "Pajama Sam 3-Demo", kGenMac },
- { "pajama3", "pj3-demo", kGenPC },
- { "pajama3", "pj3demo", kGenPC },
- { "pajama3", "PJ3Demo", kGenMac },
- { "pajama3", "Pajama Sam Demo", kGenMac },
- { "pajama3", "PjSamDemo", kGenMac },
- { "pajama3", "PjSamDemo", kGenPC },
- { "pajama3", "PyjamaSKS", kGenPC },
- { "pajama3", "PyjamaSKS", kGenMac },
- { "pajama3", "UKPajamaEAT", kGenPC }, // Russian
- { "pjgames", "PJGames", kGenMac },
- { "puttcircus", "circdemo", kGenPC },
- { "puttcircus", "Putt Circus Demo", kGenMac },
- { "puttcircus", "Putt Circus", kGenMac },
- { "puttrace", "500demo", kGenPC },
- { "puttrace", "racedemo", kGenPC },
- { "puttrace", "RaceDemo", kGenMac },
- { "puttrace", "Rennen", kGenPC },
- { "puttrace", "Putt500 demo", kGenMac }, // NL Mac demo
- { "puttrace", "Putt Race", kGenMac },
- { "puttrace", "ToffRennen", kGenPC },
- { "puttrace", "ToffRennen", kGenMac },
- { "puttrace", "UKPuttRace", kGenPC }, // Russian
- { "PuttsFunShop", "Putt's FunShop", kGenMac },
- { "putttime", "PuttPuttTTT", kGenPC },
- { "putttime", "PuttPuttTTT", kGenMac },
- { "putttime", "PuttTijd", kGenPC },
- { "putttime", "Putt Time", kGenMac },
- { "putttime", "PuttTTT", kGenMac },
- { "putttime", "PuttTTT", kGenPC },
- { "putttime", "TIJDDEMO", kGenPC },
- { "putttime", "timedemo", kGenPC },
- { "putttime", "TimeDemo", kGenMac },
- { "putttime", "TEMPDEMO", kGenPC },
- { "putttime", "Tempdemo", kGenMac }, // FR Mac demo
- { "putttime", "toffzeit", kGenPC }, // German Toeff-Toeff: Reist durch die Zeit
- { "putttime", "toffzeit", kGenMac }, // German Toeff-Toeff: Reist durch die Zeit
- { "putttime", "ZeitDemo", kGenMac },
- { "putttime", "ZEITDEMO", kGenPC },
- { "puttzoo", "Puttzoo Demo", kGenMac },
- { "puttzoo", "PuttZoo", kGenMac },
- { "puttzoo", "Töff-Töff™ Zoo Demo", kGenMac },
- { "puttzoo", "zoodemo", kGenPC },
- { "puttzoo", "Zoo Demo", kGenMac },
- { "SamsFunShop", "Sam's FunShop", kGenMac },
- { "soccer", "Soccer", kGenMac },
- { "Soccer2004", "Soccer 2004", kGenMac },
- { "socks", "SockWorks", kGenMac },
- { "spyfox", "Fuchsdem", kGenMac },
- { "spyfox", "FUCHSDEM", kGenPC},
- { "spyfox", "FoxDemo", kGenMac },
- { "spyfox", "foxdemo", kGenPC},
- { "spyfox", "JAMESDEM", kGenPC },
- { "spyfox", "Spydemo", kGenMac},
- { "spyfox", "Spydemo", kGenPC},
- { "spyfox", "SPYFox", kGenMac },
- { "spyfox", "SPYFoxDC", kGenPC },
- { "spyfox", "SPYFoxDC", kGenMac },
- { "spyfox", "SpyFoxDMK", kGenPC },
- { "spyfox", "SpyFoxDMK", kGenMac },
- { "spyfox", "Spy Fox Demo", kGenMac }, // NL Mac demo
- { "spyfox", "JR-Demo", kGenMac }, // FR Mac demo
- { "spyfox2", "sf2-demo", kGenPC },
- { "spyfox2", "sf2demo", kGenPC },
- { "spyfox2", "Sf2demo", kGenMac },
- { "spyfox2", "Spy Fox 2 - Demo", kGenMac },
- { "spyfox2", "Spy Fox 2", kGenMac },
- { "spyfox2", "SpyFoxOR", kGenPC },
- { "spyfox2", "SpyFoxOR", kGenMac },
- { "spyfox2", "spyfoxsr", kGenPC },
- { "spyozon", "sf3-demo", kGenPC },
- { "spyozon", "Spy Ozone Demo", kGenMac },
- { "spyozon", "SPYFoxOZU", kGenPC },
- { "spyozon", "SpyOzon", kGenMac },
- { "thinker1", "1grademo", kGenPC },
- { "thinker1", "Thinker1", kGenMac },
- { "thinkerk", "kinddemo", kGenPC },
- { "thinkerk", "KindDemo", kGenMac },
- { "thinkerk", "ThinkerK", kGenMac },
- { "water", "Water Worries", kGenMac },
-#endif
- { NULL, NULL, kGenAsIs }
-};
-
-static void applySubstResFileName(const SubstResFileNames &subst, char *buf, int bufsize, const char *ext, char num) {
- switch (subst.genMethod) {
- case kGenMac:
- case kGenMacNoParens:
- if (num == '3') { // special case for cursors
- // For mac they're stored in game binary
- strncpy(buf, subst.expandedName, bufsize);
- } else {
- if (subst.genMethod == kGenMac)
- snprintf(buf, bufsize, "%s (%c)", subst.expandedName, num);
- else
- snprintf(buf, bufsize, "%s %c", subst.expandedName, num);
- }
- break;
-
- case kGenPC:
- if (ext)
- snprintf(buf, bufsize, "%s%s", subst.expandedName, ext);
- else
- strncpy(buf, subst.expandedName, bufsize);
- break;
-
- case kGenAsIs:
- strncpy(buf, subst.expandedName, bufsize);
- break;
-
- default:
- *buf = 0;
- break;
- }
-}
-
-bool applySubstResFileName(const SubstResFileNames &subst, const char *filename, char *buf, int bufsize) {
- if (subst.almostGameID == 0)
- return false;
-
- size_t len = strlen(filename);
- assert(len > 0);
-
- char num = filename[len - 1];
-
- // In some cases we have .(a) and .(b) extensions
- if (num == ')')
- num = filename[len - 2];
-
- const char *ext = strrchr(filename, '.');
- if (ext)
- len = ext - filename;
-
- if (!scumm_strnicmp(filename, subst.almostGameID, len)) {
- applySubstResFileName(subst, buf, bufsize, ext, num);
- return true;
- }
-
- return false;
-}
-
-int findSubstResFileName(SubstResFileNames &subst, const char *filename, int index) {
- if (index < 0)
- return -1;
-
- size_t len = strlen(filename);
- assert(len > 0);
-
- char num = filename[len - 1];
-
- // In some cases we have .(a) and .(b) extensions
- if (num == ')')
- num = filename[len - 2];
-
- const char *ext = strrchr(filename, '.');
- if (ext)
- len = ext - filename;
-
- int i;
- for (i = index; substResFileNameTable[i].almostGameID; i++) {
- if (!scumm_strnicmp(filename, substResFileNameTable[i].almostGameID, len)) {
- subst = substResFileNameTable[i];
- return i+1;
- }
- }
- subst = substResFileNameTable[i];
- return -1;
-}
-
ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
: Engine(syst),
_game(gs),
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 54b5d8356c..d3597d5209 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -31,6 +31,7 @@
#include "graphics/surface.h"
#include "scumm/gfx.h"
+#include "scumm/plugin.h"
#include "scumm/script.h"
#include "sound/mididrv.h"
@@ -65,7 +66,6 @@ class Sound;
struct Box;
struct BoxCoords;
struct FindObjectInRoom;
-struct ScummGameSettings;
// Use g_scumm from error() ONLY
extern ScummEngine *g_scumm;
@@ -346,39 +346,6 @@ enum ResTypes {
rtNumTypes = 22
};
-/**
- * Descriptor of a specific SCUMM game. Used internally to store
- * information about the tons of game variants that exist.
- */
-struct ScummGameSettings {
- const char *gameid;
- const char *extra;
- byte id, version, heversion;
- int midi; // MidiDriverFlags values
- uint32 features;
- Common::Platform platform;
-
-};
-
-
-enum GenMethods {
- kGenMac,
- kGenMacNoParens,
- kGenPC,
- kGenAsIs
-};
-
-struct SubstResFileNames {
- const char *almostGameID;
- const char *expandedName;
- GenMethods genMethod;
-};
-
-
-extern bool applySubstResFileName(const SubstResFileNames &subst, const char *filename, char *buf, int bufsize);
-extern int findSubstResFileName(SubstResFileNames &subst, const char *filename, int index);
-
-
/**