diff options
author | Eugene Sandulenko | 2010-06-15 10:59:23 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2010-06-15 10:59:23 +0000 |
commit | 44a39ffbc66dbc9f019f041a47aaf9ba5a24d19f (patch) | |
tree | f86f55e3d62f5c0ebc309ba69f9fab30214acb5f /engines/advancedDetector.cpp | |
parent | 0b83afce03572eb513dd2802a8ad4c0377600f84 (diff) | |
download | scummvm-rg350-44a39ffbc66dbc9f019f041a47aaf9ba5a24d19f.tar.gz scummvm-rg350-44a39ffbc66dbc9f019f041a47aaf9ba5a24d19f.tar.bz2 scummvm-rg350-44a39ffbc66dbc9f019f041a47aaf9ba5a24d19f.zip |
AdvancedDetector: Add new parameter directoryGlobs.
Without this parameter mass detection gave tons of false alarms.
Use globbing for narrowing down the depth search.
svn-id: r49788
Diffstat (limited to 'engines/advancedDetector.cpp')
-rw-r--r-- | engines/advancedDetector.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index ee0c5c7c62..974970ff0f 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -341,7 +341,7 @@ static void reportUnknown(const Common::FSNode &path, const SizeMD5Map &filesSiz static ADGameDescList detectGameFilebased(const FileMap &allFiles, const ADParams ¶ms); -static void composeFileHashMap(const Common::FSList &fslist, FileMap &allFiles, int depth) { +static void composeFileHashMap(const Common::FSList &fslist, FileMap &allFiles, int depth, const char **directoryGlobs) { if (depth <= 0) return; @@ -354,10 +354,23 @@ static void composeFileHashMap(const Common::FSList &fslist, FileMap &allFiles, if (file->isDirectory()) { Common::FSList files; + if (!directoryGlobs) + continue; + + bool matched = false; + for (const char *glob = *directoryGlobs; *glob; glob++) + if (file->getName().matchString(glob, true)) { + matched = true; + break; + } + + if (!matched) + continue; + if (!file->getChildren(files, Common::FSNode::kListAll)) continue; - composeFileHashMap(files, allFiles, depth - 1); + composeFileHashMap(files, allFiles, depth - 1, directoryGlobs); } Common::String tstr = file->getName(); @@ -385,7 +398,7 @@ static ADGameDescList detectGame(const Common::FSList &fslist, const ADParams &p // First we compose a hashmap of all files in fslist. // Includes nifty stuff like removing trailing dots and ignoring case. - composeFileHashMap(fslist, allFiles, (params.depth == 0 ? 1 : params.depth)); + composeFileHashMap(fslist, allFiles, (params.depth == 0 ? 1 : params.depth), params.directoryGlobs); // Check which files are included in some ADGameDescription *and* present // in fslist. Compute MD5s and file sizes for these files. |