[Scummvm-git-logs] scummvm master -> 32a41530f4447aa89ff1392c154fb1db2bb53fe9

sev- sev at scummvm.org
Sat Nov 6 16:14:14 UTC 2021


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

Summary:
7c739daedc ENGINES: Allow specifying the md5 calculation method and report it for unknown md5s
74baaf020b AD: Pass on information on MD5 calculation method, so it could be reported for unknown md5s
9e1edd78ca AD: Improved debug output
32a41530f4 ENGINE: Print out mixed md5s when more than one method was used for a file


Commit: 7c739daedcfb84bffd0735085ee230dde81f0b43
    https://github.com/scummvm/scummvm/commit/7c739daedcfb84bffd0735085ee230dde81f0b43
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-11-06T18:11:37+02:00

Commit Message:
ENGINES: Allow specifying the md5 calculation method and report it for unknown md5s

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


diff --git a/engines/game.cpp b/engines/game.cpp
index 3599a4fea1..c4618ed26f 100644
--- a/engines/game.cpp
+++ b/engines/game.cpp
@@ -221,8 +221,16 @@ Common::U32String generateUnknownGameReport(const DetectedGames &detectedGames,
 
 	report += Common::U32String("\n\n");
 
-	for (FilePropertiesMap::const_iterator file = matchedFiles.begin(); file != matchedFiles.end(); ++file)
-		report += Common::String::format("  {\"%s\", 0, \"%s\", %lld},\n", file->_key.c_str(), file->_value.md5.c_str(), (long long)file->_value.size);
+	for (FilePropertiesMap::const_iterator file = matchedFiles.begin(); file != matchedFiles.end(); ++file) {
+		Common::String addon;
+
+		if (file->_value.md5prop & kMD5MacResFork)
+			addon += ", ADGF_MACRESFORK";
+		if (file->_value.md5prop & kMD5Tail)
+			addon += ", ADGF_TAILMD5";
+
+		report += Common::String::format("  {\"%s\", 0, \"%s\", %lld}%s,\n", file->_key.c_str(), file->_value.md5.c_str(), (long long)file->_value.size, addon.c_str());
+	}
 
 	report += Common::U32String("\n");
 
diff --git a/engines/game.h b/engines/game.h
index 063d7d5f1d..e7c112a3c9 100644
--- a/engines/game.h
+++ b/engines/game.h
@@ -98,6 +98,16 @@ enum GameSupportLevel {
 	kWarningGame      // we want to ask user to proceed and provide them with an explanation
 };
 
+/**
+ * This enum is used to indicate the method of MD5 calculation used for a particular file.
+ * The result is used for the more fine tuned reporting of unknown MD5s
+ */
+
+enum MD5Properties {
+	kMD5Head		= 0 << 1,	// the MD5 is calculated from the head, default
+	kMD5Tail		= 1 << 1,	// the MD5 is calculated from the tail
+	kMD5MacResFork	= 1 << 2	// the MD5 is calculated from the Mac Resource fork (head or tail)
+};
 
 /**
  * A record describing the properties of a file. Used on the existing
@@ -106,8 +116,9 @@ enum GameSupportLevel {
 struct FileProperties {
 	int64 size;
 	Common::String md5;
+	MD5Properties md5prop;
 
-	FileProperties() : size(-1) {}
+	FileProperties() : size(-1), md5prop(kMD5Head) {}
 };
 
 /**


Commit: 74baaf020bd4dd85d0d67759de3d1cd819376a3e
    https://github.com/scummvm/scummvm/commit/74baaf020bd4dd85d0d67759de3d1cd819376a3e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-11-06T18:11:37+02:00

Commit Message:
AD: Pass on information on MD5 calculation method, so it could be reported for unknown md5s

Changed paths:
    engines/advancedDetector.cpp


diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index 8d6cb9f810..c49247f506 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -186,6 +186,16 @@ DetectedGame AdvancedMetaEngineDetection::toDetectedGame(const ADDetectedGame &a
 	game.hasUnknownFiles = adGame.hasUnknownFiles;
 	game.matchedFiles = adGame.matchedFiles;
 
+	// Now specify the computation method for each file entry.
+	// TODO: This could be potentially overridden by use of upper part of adGame.fileType
+	// so, individual files could have their own computation method
+	for (FilePropertiesMap::iterator file = game.matchedFiles.begin(); file != game.matchedFiles.end(); ++file) {
+		if (desc->flags & ADGF_MACRESFORK)
+			file->_value.md5prop = (MD5Properties)(file->_value.md5prop | kMD5MacResFork);
+		if (desc->flags & ADGF_TAILMD5)
+			file->_value.md5prop = (MD5Properties)(file->_value.md5prop | kMD5Tail);
+	}
+
 	if (extraInfo && !extraInfo->targetID.empty()) {
 		game.preferredTarget = generatePreferredTarget(desc, _maxAutogenLength, extraInfo->targetID);
 	} else {


Commit: 9e1edd78ca0e41d4455de6ee267f1679f290a1e7
    https://github.com/scummvm/scummvm/commit/9e1edd78ca0e41d4455de6ee267f1679f290a1e7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-11-06T18:11:37+02:00

Commit Message:
AD: Improved debug output

Changed paths:
    engines/advancedDetector.cpp


diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index c49247f506..945e2ecd60 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -496,6 +496,7 @@ namespace Common {
 	DECLARE_SINGLETON(MD5CacheManager);
 }
 
+// Sync with engines/game.cpp
 static char flagsToMD5Prefix(uint32 flags) {
 	if (flags & ADGF_MACRESFORK) {
 		if (flags & ADGF_TAILMD5)
@@ -575,7 +576,7 @@ ADDetectedGames AdvancedMetaEngineDetection::detectGame(const Common::FSNode &pa
 	const ADGameDescription *g;
 	const byte *descPtr;
 
-	debugC(3, kDebugGlobalDetection, "Starting detection in dir '%s'", parent.getPath().c_str());
+	debugC(3, kDebugGlobalDetection, "Starting detection for engine '%s' in dir '%s'", getEngineId(), parent.getPath().c_str());
 
 	// Check which files are included in some ADGameDescription *and* whether
 	// they are present. Compute MD5s and file sizes for the available files.
@@ -691,6 +692,8 @@ ADDetectedGames AdvancedMetaEngineDetection::detectGame(const Common::FSNode &pa
 		}
 	}
 
+	debugC(2, "Totally found %d matches", matched.size());
+
 	return matched;
 }
 


Commit: 32a41530f4447aa89ff1392c154fb1db2bb53fe9
    https://github.com/scummvm/scummvm/commit/32a41530f4447aa89ff1392c154fb1db2bb53fe9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-11-06T18:11:37+02:00

Commit Message:
ENGINE: Print out mixed md5s when more than one method was used for a file

Changed paths:
    engines/game.cpp


diff --git a/engines/game.cpp b/engines/game.cpp
index c4618ed26f..2872f4c38a 100644
--- a/engines/game.cpp
+++ b/engines/game.cpp
@@ -165,6 +165,19 @@ Common::U32String DetectionResults::generateUnknownGameReport(bool translate, ui
 	return ::generateUnknownGameReport(_detectedGames, translate, false, wordwrapAt);
 }
 
+// Sync with engines/advancedDetector.cpp
+static char flagsToMD5Prefix(uint32 flags) {
+	if (flags & kMD5MacResFork) {
+		if (flags & kMD5Tail)
+			return 'e';
+		return 'm';
+	}
+	if (flags & kMD5Tail)
+		return 't';
+
+	return 'f';
+}
+
 Common::U32String generateUnknownGameReport(const DetectedGames &detectedGames, bool translate, bool fullPath, uint32 wordwrapAt) {
 	assert(!detectedGames.empty());
 
@@ -211,7 +224,8 @@ Common::U32String generateUnknownGameReport(const DetectedGames &detectedGames,
 
 		// Consolidate matched files across all engines and detection entries
 		for (FilePropertiesMap::const_iterator it = game.matchedFiles.begin(); it != game.matchedFiles.end(); it++) {
-			matchedFiles.setVal(it->_key, it->_value);
+			Common::String key = Common::String::format("%c:%s", flagsToMD5Prefix(it->_value.md5prop), it->_key.c_str());
+			matchedFiles.setVal(key, it->_value);
 		}
 	}
 
@@ -229,7 +243,9 @@ Common::U32String generateUnknownGameReport(const DetectedGames &detectedGames,
 		if (file->_value.md5prop & kMD5Tail)
 			addon += ", ADGF_TAILMD5";
 
-		report += Common::String::format("  {\"%s\", 0, \"%s\", %lld}%s,\n", file->_key.c_str(), file->_value.md5.c_str(), (long long)file->_value.size, addon.c_str());
+		report += Common::String::format("  {\"%s\", 0, \"%s\", %lld}%s,\n",
+			&file->_key.c_str()[2], // Skip the md5 prefix
+			file->_value.md5.c_str(), (long long)file->_value.size, addon.c_str());
 	}
 
 	report += Common::U32String("\n");




More information about the Scummvm-git-logs mailing list