diff options
author | Colin Snover | 2017-10-07 23:06:00 -0500 |
---|---|---|
committer | Colin Snover | 2017-11-10 09:57:41 -0600 |
commit | 66826a8b9bd9f75010c513699ec31bfbfc822f39 (patch) | |
tree | b111911eeb80792c1e9b1396b8e2f576dc8a0c3e /engines/advancedDetector.cpp | |
parent | dda0f77bcf093dced1ad833982be8a9e0951a85e (diff) | |
download | scummvm-rg350-66826a8b9bd9f75010c513699ec31bfbfc822f39.tar.gz scummvm-rg350-66826a8b9bd9f75010c513699ec31bfbfc822f39.tar.bz2 scummvm-rg350-66826a8b9bd9f75010c513699ec31bfbfc822f39.zip |
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.
Diffstat (limited to 'engines/advancedDetector.cpp')
-rw-r--r-- | engines/advancedDetector.cpp | 10 |
1 files 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()); |