From 66826a8b9bd9f75010c513699ec31bfbfc822f39 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Sat, 7 Oct 2017 23:06:00 -0500 Subject: ENGINES: Continue to check file presence after a hash/size mismatch If an early file in the game's signature list has a hash/size mismatch, it is still necessary to continue to check the rest of the candidate files for existence, since the non-existence of candidate files is supposed to disqualify a game description as matching a game to an unknown variant. By quitting the file check early, the detector had been allowing descriptions to randomly match if there happened to be an early file in the detection list with the right name but wrong hash/size, even if some of the other signature files did not exist at all. --- engines/advancedDetector.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index 64f462a936..a66fe3d2a1 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -466,6 +466,7 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, cons bool allFilesPresent = true; int curFilesMatched = 0; + bool hashOrSizeMismatch = false; // Try to match all files for this game for (fileDesc = g->filesDescriptions; fileDesc->fileName; fileDesc++) { @@ -477,16 +478,21 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, cons break; } + if (hashOrSizeMismatch) + continue; + if (fileDesc->md5 != NULL && fileDesc->md5 != filesProps[tstr].md5) { debug(3, "MD5 Mismatch. Skipping (%s) (%s)", fileDesc->md5, filesProps[tstr].md5.c_str()); fileMissing = true; - break; + hashOrSizeMismatch = true; + continue; } if (fileDesc->fileSize != -1 && fileDesc->fileSize != filesProps[tstr].size) { debug(3, "Size Mismatch. Skipping"); fileMissing = true; - break; + hashOrSizeMismatch = true; + continue; } debug(3, "Matched file: %s", tstr.c_str()); -- cgit v1.2.3