[Scummvm-cvs-logs] CVS: scummvm/scumm scumm.cpp,1.70,1.71 scumm.h,1.420,1.421

Eugene Sandulenko sev at users.sourceforge.net
Tue Jun 29 05:11:01 CEST 2004


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv930

Modified Files:
	scumm.cpp scumm.h 
Log Message:
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.


Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- scumm.cpp	29 Jun 2004 09:57:01 -0000	1.70
+++ scumm.cpp	29 Jun 2004 12:10:08 -0000	1.71
@@ -194,7 +194,7 @@
 
 	// 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 @@
 	{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 @@
 
 	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"))

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.420
retrieving revision 1.421
diff -u -d -r1.420 -r1.421
--- scumm.h	29 Jun 2004 09:57:01 -0000	1.420
+++ scumm.h	29 Jun 2004 12:10:08 -0000	1.421
@@ -108,6 +108,7 @@
 	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,





More information about the Scummvm-git-logs mailing list