[Scummvm-git-logs] scummvm master -> f71dc0d8ab8db048c0b2bdc0b838ac9623571441

sev- sev at scummvm.org
Wed Jan 31 21:01:31 CET 2018


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
f71dc0d8ab SCUMM: Check for and flag demos correctly


Commit: f71dc0d8ab8db048c0b2bdc0b838ac9623571441
    https://github.com/scummvm/scummvm/commit/f71dc0d8ab8db048c0b2bdc0b838ac9623571441
Author: Henrik "Henke37" Andersson (henke at henke37.cjb.net)
Date: 2018-01-31T21:01:28+01:00

Commit Message:
SCUMM: Check for and flag demos correctly

Rewrote the detection matching to use the extra field like the other
two.

This requires extensive testing due to touching code shared for a lot of
games and being sensitive to individual versions of games.

Changed paths:
    engines/scumm/detection.cpp
    engines/scumm/detection_tables.h


diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index 0aa993a..0592d80 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -489,42 +489,45 @@ static void computeGameSettingsFromMD5(const Common::FSList &fslist, const GameF
 
 	// Compute the precise game settings using gameVariantsTable.
 	for (const GameSettings *g = gameVariantsTable; g->gameid; ++g) {
-		if (g->gameid[0] == 0 || !scumm_stricmp(md5Entry->gameid, g->gameid)) {
-			// The gameid either matches, or is empty. The latter indicates
-			// a generic entry, currently used for some generic HE settings.
-			if (g->variant == 0 || !scumm_stricmp(md5Entry->variant, g->variant)) {
-				// Perfect match found, use it and stop the loop
-				dr.game = *g;
-				dr.game.gameid = md5Entry->gameid;
-
-				// Set the platform value. The value from the MD5 record has
-				// highest priority; if missing (i.e. set to unknown) we try
-				// to use that from the filename pattern record instead.
-				if (md5Entry->platform != Common::kPlatformUnknown) {
-					dr.game.platform = md5Entry->platform;
-				} else if (gfp->platform != Common::kPlatformUnknown) {
-					dr.game.platform = gfp->platform;
-				}
+		if (g->gameid[0] != 0 && scumm_stricmp(md5Entry->gameid, g->gameid)) continue;
+		// The gameid either matches, or is empty. The latter indicates
+		// a generic entry, currently used for some generic HE settings.
+
+		if (g->variant != 0 && scumm_stricmp(md5Entry->variant, g->variant)) continue;
+		// Variant matches too
+
+		if (g->preferredTag != 0 && scumm_stricmp(md5Entry->extra, g->preferredTag)) continue;
+		// OH, and do check the extra field in the entry too, otherwise we miss demos
+
+		dr.game = *g;
+		dr.game.gameid = md5Entry->gameid;
+
+		// Set the platform value. The value from the MD5 record has
+		// highest priority; if missing (i.e. set to unknown) we try
+		// to use that from the filename pattern record instead.
+		if (md5Entry->platform != Common::kPlatformUnknown) {
+			dr.game.platform = md5Entry->platform;
+		} else if (gfp->platform != Common::kPlatformUnknown) {
+			dr.game.platform = gfp->platform;
+		}
 
-				// HACK: Special case to distinguish the V1 demo from the full version
-				// (since they have identical MD5):
-				if (dr.game.id == GID_MANIAC && !strcmp(gfp->pattern, "%02d.MAN")) {
-					dr.extra = "V1 Demo";
-					dr.game.features = GF_DEMO;
-				}
+		// HACK: Special case to distinguish the V1 demo from the full version
+		// (since they have identical MD5):
+		if (dr.game.id == GID_MANIAC && !strcmp(gfp->pattern, "%02d.MAN")) {
+			dr.extra = "V1 Demo";
+			dr.game.features = GF_DEMO;
+		}
 
-				// HACK: Try to detect languages for translated games
-				if (dr.language == UNK_LANG) {
-					dr.language = detectLanguage(fslist, dr.game.id);
-				}
+		// HACK: Try to detect languages for translated games
+		if (dr.language == UNK_LANG) {
+			dr.language = detectLanguage(fslist, dr.game.id);
+		}
 
-				// HACK: Detect between 68k and PPC versions
-				if (dr.game.platform == Common::kPlatformMacintosh && dr.game.version >= 5 && dr.game.heversion == 0 && strstr(gfp->pattern, "Data"))
-					dr.game.features |= GF_MAC_CONTAINER;
+		// HACK: Detect between 68k and PPC versions
+		if (dr.game.platform == Common::kPlatformMacintosh && dr.game.version >= 5 && dr.game.heversion == 0 && strstr(gfp->pattern, "Data"))
+			dr.game.features |= GF_MAC_CONTAINER;
 
-				break;
-			}
-		}
+		break;
 	}
 }
 
diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h
index 65891e0..5162da8 100644
--- a/engines/scumm/detection_tables.h
+++ b/engines/scumm/detection_tables.h
@@ -236,12 +236,12 @@ static const GameSettings gameVariantsTable[] = {
 	{"loom", "VGA",      "vga", GID_LOOM, 4, 0, MDT_NONE,                         GF_AUDIOTRACKS,             Common::kPlatformDOS, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
 	{"loom", "Steam",  "steam", GID_LOOM, 4, 0, MDT_NONE,                         GF_AUDIOTRACKS,  UNK, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
 
-	{"pass", 0, 0, GID_PASS, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB, GF_16COLOR, Common::kPlatformDOS, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
+	{"pass", 0, 0, GID_PASS, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB, GF_DEMO | GF_16COLOR, Common::kPlatformDOS, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
 
 	{"monkey", "VGA",      "vga", GID_MONKEY_VGA, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO1(GUIO_NOSPEECH)},
 	{"monkey", "EGA",      "ega", GID_MONKEY_EGA, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, GF_16COLOR,     Common::kPlatformDOS, GUIO1(GUIO_NOSPEECH)},
 	{"monkey", "No AdLib", "ega", GID_MONKEY_EGA, 4, 0, MDT_PCSPK | MDT_PCJR,                        GF_16COLOR,     Common::kPlatformAtariST, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
-	{"monkey", "Demo",     "ega", GID_MONKEY_EGA, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB,            GF_16COLOR,     Common::kPlatformDOS, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
+	{"monkey", "Demo",     "ega", GID_MONKEY_EGA, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB, GF_DEMO | GF_16COLOR,     Common::kPlatformDOS, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
 	{"monkey", "CD",           0, GID_MONKEY,     5, 0, MDT_ADLIB,                        GF_AUDIOTRACKS, UNK, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
 	{"monkey", "FM-TOWNS",     0, GID_MONKEY,     5, 0, MDT_TOWNS,                        GF_AUDIOTRACKS, Common::kPlatformFMTowns, GUIO4(GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_MIDITOWNS, GUIO_NOASPECT)},
 	{"monkey", "SEGA",         0, GID_MONKEY,     5, 0, MDT_NONE,                         GF_AUDIOTRACKS, Common::kPlatformSegaCD, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
@@ -251,16 +251,21 @@ static const GameSettings gameVariantsTable[] = {
 	{"monkey2", "FM-TOWNS", 0, GID_MONKEY2,  5, 0, MDT_PCSPK | MDT_TOWNS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, Common::kPlatformFMTowns, GUIO5(GUIO_NOSPEECH, GUIO_MIDITOWNS, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_NOASPECT)},
 	{"monkey2", "SE Talkie",0, GID_MONKEY2,  5, 0, MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO0()},
 
-	{"atlantis", "", 0, GID_INDY4,    5, 0, MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO0()},
+	{"atlantis", "Demo", 0, GID_INDY4,    5, 0, MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, GF_DEMO, UNK, GUIO0()},
+	{"atlantis", "", 0, GID_INDY4,    5, 0, MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO0() },
 	{"atlantis", "Steam", "steam", GID_INDY4,    5, 0, MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO0()},
 	{"atlantis", "Floppy", 0, GID_INDY4,    5, 0, MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO1(GUIO_NOSPEECH)},
 	{"atlantis", "FM-TOWNS", 0, GID_INDY4,    5, 0, MDT_TOWNS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, Common::kPlatformFMTowns, GUIO4(GUIO_MIDITOWNS, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_NOASPECT)},
 
-	{"tentacle", "", 0, GID_TENTACLE, 6, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM, GF_USE_KEY, UNK, GUIO0()},
+	{"tentacle", "Demo", 0, GID_TENTACLE, 6, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM, GF_USE_KEY | GF_DEMO, UNK, GUIO0()},
+	{"tentacle", "", 0, GID_TENTACLE, 6, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM, GF_USE_KEY, UNK, GUIO0() },
 	{"tentacle", "Floppy", 0, GID_TENTACLE, 6, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM, GF_USE_KEY, UNK, GUIO1(GUIO_NOSPEECH)},
 
-	{"samnmax",  "", 0, GID_SAMNMAX,  6, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM, GF_USE_KEY, UNK, GUIO0()},
-	{"samnmax",  "Floppy", 0, GID_SAMNMAX,  6, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM, GF_USE_KEY, UNK, GUIO1(GUIO_NOSPEECH)},
+	{"samnmax",  "", "", GID_SAMNMAX,  6, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM, GF_USE_KEY, UNK, GUIO0()},
+	{"samnmax",  "Demo", "", GID_SAMNMAX,  6, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM, GF_DEMO | GF_USE_KEY, UNK, GUIO0()},
+	{"samnmax",  "Floppy", "", GID_SAMNMAX,  6, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM, GF_USE_KEY, UNK, GUIO1(GUIO_NOSPEECH)},
+	{"samnmax",  "Demo", "", GID_SAMNMAX,  6, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM, GF_DEMO | GF_USE_KEY, UNK, GUIO1(GUIO_NOSPEECH)},
+	{"samnmax",  "WIP Demo", "", GID_SAMNMAX,  6, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM, GF_DEMO | GF_USE_KEY, UNK, GUIO1(GUIO_NOSPEECH)},
 
 #ifdef ENABLE_SCUMM_7_8
 	{"ft",   "", 0, GID_FT,  7, 0, MDT_NONE, 0, UNK, GUIO1(GUIO_NOMIDI)},





More information about the Scummvm-git-logs mailing list