aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2004-06-29 12:10:08 +0000
committerEugene Sandulenko2004-06-29 12:10:08 +0000
commit74bf51d3d6c2a39ce7243abd4aab213f0a872e42 (patch)
treea67ab9dbe0b428287a16a5c3a438b26a764aa95b
parent2c687d3388261e3ed3a4b14721f1d23e0a735607 (diff)
downloadscummvm-rg350-74bf51d3d6c2a39ce7243abd4aab213f0a872e42.tar.gz
scummvm-rg350-74bf51d3d6c2a39ce7243abd4aab213f0a872e42.tar.bz2
scummvm-rg350-74bf51d3d6c2a39ce7243abd4aab213f0a872e42.zip
Implement game detection based on MD5s. This lets us avoid multiple GIDs
for different versions of HE games. Right now there is just one game, but more to follow. svn-id: r14124
-rw-r--r--scumm/scumm.cpp43
-rw-r--r--scumm/scumm.h1
2 files changed, 43 insertions, 1 deletions
diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp
index 2c1ff66b2e..815af134f4 100644
--- a/scumm/scumm.cpp
+++ b/scumm/scumm.cpp
@@ -194,7 +194,7 @@ static const ScummGameSettings scumm_settings[] = {
// Humongous Entertainment Scumm Version 6
{"puttputt", "Putt-Putt Joins The Parade", GID_HEGAME, 6, 60, MDT_ADLIB | MDT_NATIVE,
- GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0},
+ GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS, 0},
{"puttdemo", "Putt-Putt Joins The Parade (Demo)", GID_PUTTDEMO, 6, 0, MDT_ADLIB | MDT_NATIVE,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS, 0},
{"moondemo", "Putt-Putt Goes To The Moon (Demo)", GID_HEGAME, 6, 60, MDT_ADLIB | MDT_NATIVE,
@@ -337,6 +337,18 @@ static const ScummGameSettings scumm_settings[] = {
{NULL, NULL, 0, 0, 0, MDT_NONE, 0, 0}
};
+// This additional table is used for titles where GF_MULTIPLE_VERSIONS is specified.
+// Now these are HE games. Some of them were released for different versions of SPUTM,
+// and instead of multiplying GIDs this table is used.
+//
+// Use main table to specify default flags and this table to override defaults.
+static const ScummGameSettings he_md5_settings[] = {
+ {"0b3222aaa7efcf283eb621e0cefd26cc", "Putt-Putt Joins The Parade (early version)", GID_HEGAME, 6, 60, MDT_ADLIB | MDT_NATIVE,
+ GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS, 0},
+ {NULL, NULL, 0, 0, 0, MDT_NONE, 0, 0}
+};
+
+
static int compareMD5Table(const void *a, const void *b) {
const char *key = (const char *)a;
const MD5Table *elem = (const MD5Table *)b;
@@ -3038,6 +3050,35 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) {
ScummGameSettings game = *g;
+ if (game.features & GF_MULTIPLE_VERSIONS) {
+ uint8 md5sum[16];
+ char buf[256];
+ const char *name = game.name;
+ char md5str[32+1];
+
+ if (game.features & GF_HUMONGOUS)
+ sprintf(buf, "%s.he0", name);
+ else
+ sprintf(buf, "%s.000", name);
+
+ if (md5_file(buf, md5sum, ConfMan.get("path").c_str())) {
+ for (int j = 0; j < 16; j++) {
+ sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
+ }
+ }
+
+ g = he_md5_settings;
+ while (g->name) {
+ if (!scumm_stricmp(md5str, g->name))
+ break;
+ g++;
+ }
+ if (g->name) {
+ game = *g;
+ game.name = name;
+ }
+ }
+
if (ConfMan.hasKey("amiga")) {
warning("Configuration key 'amiga' is deprecated. Use 'platform=amiga' instead");
if (ConfMan.getBool("amiga"))
diff --git a/scumm/scumm.h b/scumm/scumm.h
index ec8286b233..cd77f2cb7e 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -108,6 +108,7 @@ enum GameFeatures {
GF_NO_SCALING = 1 << 12,
GF_FEW_LOCALS = 1 << 13,
GF_HUMONGOUS = 1 << 14,
+ GF_MULTIPLE_VERSIONS = 1 << 15,
GF_FMTOWNS = 1 << 17,
GF_AMIGA = 1 << 18,