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

sev- noreply at scummvm.org
Sat Nov 27 19:32:05 UTC 2021


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

Summary:
0d1c4be0d5 DIRECTOR: Reenable entry with install.exe
eef0c2d529 AD: Implement blacklist for detection file names


Commit: 0d1c4be0d557b8254b375ec6f1286996bd9e633f
    https://github.com/scummvm/scummvm/commit/0d1c4be0d557b8254b375ec6f1286996bd9e633f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-11-27T20:30:28+01:00

Commit Message:
DIRECTOR: Reenable entry with install.exe

Changed paths:
    engines/director/detection_tables.h


diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index 1ae8254938..f2617ab226 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -5144,7 +5144,7 @@ static const DirectorGameDescription gameDescriptions[] = {
 	WINGAME2_l("affaires1", "", "StartMe.exe", "7c18c9a6af2694156bf09ed195c1ab09", 1819926,
 								"Main - 7.dxr", "ad34b9d4987fc84c238f0e88b174fbc9", 13068061, Common::FR_FRA, 702),
 
-//	WINGAME1t_l("allthelunar", "Installer", "install.exe", "f670d62dfbf3f42c475b4f09c68f1888", 1743796, Common::JA_JPN, 701),
+	WINGAME1t_l("allthelunar", "Installer", "install.exe", "f670d62dfbf3f42c475b4f09c68f1888", 1743796, Common::JA_JPN, 701),
 	MACGAME1_l("allthelunar", "Gallery", "xn--2bkwb2jyaf2iv50xg56c", "91723348f6414e84d024183554385275", 110811, Common::JA_JPN, 701),
 	WINGAME1t_l("allthelunar", "Gallery", "gallery.exe", "dc43ed7868f092e8f59a640766438b38", 13403016, Common::JA_JPN, 701),
 	MACGAME1_l("allthelunar", "Daifugo", "xn--pss84d253e", "d2404d3c2d1df0ca4125e85b1ca97e96", 22329996, Common::JA_JPN, 701),


Commit: eef0c2d529a15f22d621223bca266327dc882ae6
    https://github.com/scummvm/scummvm/commit/eef0c2d529a15f22d621223bca266327dc882ae6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-11-27T20:30:28+01:00

Commit Message:
AD: Implement blacklist for detection file names

When only files from the black list are present, we skip
file-based fallback detection for such entries, thus, entries
with 'game.exe', 'install.exe' etc will not generate false
"unknown md5" warnings.

Also, -d0 will report all such entries present in the tables.

Currently, we have 19 entries in AGS, 5 in Director and all 3 entries in ICB
which are violating this rule.

Changed paths:
    engines/advancedDetector.cpp
    engines/advancedDetector.h


diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index 2601a61193..5b9e9f06ab 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -577,6 +577,8 @@ ADDetectedGames AdvancedMetaEngineDetection::detectGame(const Common::FSNode &pa
 
 	debugC(3, kDebugGlobalDetection, "Starting detection for engine '%s' in dir '%s'", getEngineId(), parent.getPath().c_str());
 
+	sanityCheck();
+
 	// Check which files are included in some ADGameDescription *and* whether
 	// they are present. Compute MD5s and file sizes for the available files.
 	for (descPtr = _gameDescriptors; ((const ADGameDescription *)descPtr)->gameId != nullptr; descPtr += _descItemSize) {
@@ -664,6 +666,14 @@ ADDetectedGames AdvancedMetaEngineDetection::detectGame(const Common::FSNode &pa
 		// is really missing, but the developers should better know about such
 		// cases.
 		if (allFilesPresent && !gotAnyMatchesWithAllFiles) {
+			// Do sanity check
+			if (game.hasUnknownFiles && !sanityCheckEntry(g)) {
+				debugC(3, kDebugGlobalDetection, "Skipping game: %s (%s %s/%s) (%d), didn't pass sanity", g->gameId, g->extra,
+					getPlatformDescription(g->platform), getLanguageDescription(g->language), i);
+
+				continue;
+			}
+
 			if (matched.empty() || strcmp(matched.back().desc->gameId, g->gameId) != 0)
 				matched.push_back(game);
 		}
@@ -758,6 +768,20 @@ PlainGameDescriptor AdvancedMetaEngineDetection::findGame(const char *gameId) co
 	return PlainGameDescriptor::empty();
 }
 
+static const char *blackList[] = {
+	"game.exe",
+	"demo.exe",
+	"game",
+	"demo",
+	"data.z",
+	"data1.cab",
+	"data.cab",
+	"engine.exe",
+	"install.exe",
+	"play.exe",
+	0
+};
+
 AdvancedMetaEngineDetection::AdvancedMetaEngineDetection(const void *descs, uint descItemSize, const PlainGameDescriptor *gameIds, const ADExtraGuiOptionsMap *extraGuiOptions)
 	: _gameDescriptors((const byte *)descs), _descItemSize(descItemSize), _gameIds(gameIds),
 	  _extraGuiOptions(extraGuiOptions) {
@@ -769,6 +793,9 @@ AdvancedMetaEngineDetection::AdvancedMetaEngineDetection(const void *descs, uint
 	_directoryGlobs = NULL;
 	_matchFullPaths = false;
 	_maxAutogenLength = 15;
+
+	for (auto f = blackList; *f; f++)
+		_blackListMap.setVal(*f, true);
 }
 
 void AdvancedMetaEngineDetection::initSubSystems(const ADGameDescription *gameDesc) const {
@@ -779,6 +806,42 @@ void AdvancedMetaEngineDetection::initSubSystems(const ADGameDescription *gameDe
 #endif
 }
 
+void AdvancedMetaEngineDetection::sanityCheck() const {
+	// Check if the detection entries have only files from the blacklist
+	for (const byte *descPtr = _gameDescriptors; ((const ADGameDescription *)descPtr)->gameId != nullptr; descPtr += _descItemSize) {
+		const ADGameDescription *g = (const ADGameDescription *)descPtr;
+
+		bool blackIsPresent = false, nonBlackIsPresent = false;
+
+		for (const ADGameFileDescription *fileDesc = g->filesDescriptions; fileDesc->fileName; fileDesc++) {
+			if (_blackListMap.contains(fileDesc->fileName)) {
+				blackIsPresent = true;
+			} else {
+				nonBlackIsPresent = true;
+			}
+		}
+
+		if (blackIsPresent && !nonBlackIsPresent) {
+			debug(0, "WARNING: Detection entry for '%s' in engine '%s' contains only blacklisted names. Add more files to the entry (%s)",
+				g->gameId, getEngineId(), g->filesDescriptions[0].md5);
+		}
+	}
+}
+
+bool AdvancedMetaEngineDetection::sanityCheckEntry(const ADGameDescription *g) const {
+	bool blackIsPresent = false, nonBlackIsPresent = false;
+
+	for (const ADGameFileDescription *fileDesc = g->filesDescriptions; fileDesc->fileName; fileDesc++) {
+		if (_blackListMap.contains(fileDesc->fileName)) {
+			blackIsPresent = true;
+		} else {
+			nonBlackIsPresent = true;
+		}
+	}
+
+	return !(blackIsPresent && !nonBlackIsPresent);
+}
+
 Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) const {
 	PluginList pl = PluginMan.getPlugins(PLUGIN_TYPE_ENGINE);
 	if (pl.size() == 1) {
diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h
index c3a3a525ac..8e66e153c4 100644
--- a/engines/advancedDetector.h
+++ b/engines/advancedDetector.h
@@ -399,6 +399,11 @@ protected:
 
 private:
 	void initSubSystems(const ADGameDescription *gameDesc) const;
+	void sanityCheck() const;
+	bool sanityCheckEntry(const ADGameDescription *g) const;
+
+private:
+	Common::HashMap<Common::String, bool, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _blackListMap;
 
 protected:
 	/**




More information about the Scummvm-git-logs mailing list