[Scummvm-git-logs] scummvm master -> a56c6c487aa85a82cbb8590786e9c27e8ca5e121
sev-
noreply at scummvm.org
Thu Nov 3 20:39:38 UTC 2022
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:
a56c6c487a AD: Implement sanity checks for detection tables
Commit: a56c6c487aa85a82cbb8590786e9c27e8ca5e121
https://github.com/scummvm/scummvm/commit/a56c6c487aa85a82cbb8590786e9c27e8ca5e121
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-11-03T21:37:05+01:00
Commit Message:
AD: Implement sanity checks for detection tables
Changed paths:
engines/advancedDetector.cpp
engines/advancedDetector.h
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index 6f455e0e69e..5d5558e5014 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -876,6 +876,11 @@ void AdvancedMetaEngineDetection::preprocessDescriptions() {
g->gameId, getName(), g->filesDescriptions[0].md5);
}
}
+
+#ifndef RELEASE_BUILD
+ // Check the provided tables for sanity
+ detectClashes();
+#endif
}
Common::StringArray AdvancedMetaEngineDetection::getPathsFromEntry(const ADGameDescription *g) {
@@ -924,3 +929,31 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine)
return Common::Error();
}
+
+void AdvancedMetaEngineDetection::detectClashes() const {
+ // First, check that we do not have duplicated entries in _gameIds
+ Common::HashMap<Common::String, int, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> idsMap;
+
+
+ for (const PlainGameDescriptor *g = _gameIds; g->gameId; g++) {
+ if (idsMap.contains(g->gameId))
+ debug(0, "WARNING: Detection gameId for '%s' in engine '%s' has duplicates", g->gameId, getName());
+
+ idsMap[g->gameId] = 0;
+ }
+
+ for (const byte *descPtr = _gameDescriptors; ((const ADGameDescription *)descPtr)->gameId != nullptr; descPtr += _descItemSize) {
+ const ADGameDescription *g = (const ADGameDescription *)descPtr;
+
+ if (!idsMap.contains(g->gameId)) {
+ debug(0, "WARNING: Detection gameId for '%s' in engine '%s' is not present in gameids", g->gameId, getName());
+ } else {
+ idsMap[g->gameId]++;
+ }
+ }
+
+ for (auto &k : idsMap) {
+ if (k._value == 0 && k._key != getName())
+ debug(0, "WARNING: Detection gameId for '%s' in engine '%s' has no games in the detection table", k._key.c_str(), getName());
+ }
+}
diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h
index 5aa2e5046de..ab0d7113e06 100644
--- a/engines/advancedDetector.h
+++ b/engines/advancedDetector.h
@@ -408,6 +408,7 @@ private:
void initSubSystems(const ADGameDescription *gameDesc) const;
void preprocessDescriptions();
bool isEntryGrayListed(const ADGameDescription *g) const;
+ void detectClashes() const;
private:
Common::HashMap<Common::String, bool, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _grayListMap;
More information about the Scummvm-git-logs
mailing list