aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/detection.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2010-06-15 11:04:35 +0000
committerEugene Sandulenko2010-06-15 11:04:35 +0000
commitb6940caaaa59a534774425104f48733f8277d82b (patch)
treeec4cd4a85baaf2c29156a0bb66528c568f3ea986 /engines/scumm/detection.cpp
parent94c9f9cdd11c64810aa0333d503403e54413fc09 (diff)
downloadscummvm-rg350-b6940caaaa59a534774425104f48733f8277d82b.tar.gz
scummvm-rg350-b6940caaaa59a534774425104f48733f8277d82b.tar.bz2
scummvm-rg350-b6940caaaa59a534774425104f48733f8277d82b.zip
SCUMM: Added directory globs for in-depth search.
The code was compied from AdvancedDetector. Currently it is set up to detect Mac indy3/loom which contains it data in Rooms 1, Roooms 2 and Rooms 3 directories. svn-id: r49798
Diffstat (limited to 'engines/scumm/detection.cpp')
-rw-r--r--engines/scumm/detection.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index 21da732064..c164ac38fd 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -381,7 +381,7 @@ static void computeGameSettingsFromMD5(const Common::FSList &fslist, const GameF
}
}
-static void composeFileHashMap(const Common::FSList &fslist, DescMap &fileMD5Map, int depth) {
+static void composeFileHashMap(const Common::FSList &fslist, DescMap &fileMD5Map, int depth, const char **globs) {
if (depth <= 0)
return;
@@ -395,10 +395,23 @@ static void composeFileHashMap(const Common::FSList &fslist, DescMap &fileMD5Map
d.md5Entry = 0;
fileMD5Map[file->getName()] = d;
} else {
+ if (!directoryGlobs)
+ continue;
+
+ bool matched = false;
+ for (const char *glob = *globs; *glob; glob++)
+ if (file->getName().matchString(glob, true)) {
+ matched = true;
+ break;
+ }
+
+ if (!matched)
+ continue;
+
Common::FSList files;
if (file->getChildren(files, Common::FSNode::kListAll)) {
- composeFileHashMap(files, fileMD5Map, depth - 1);
+ composeFileHashMap(files, fileMD5Map, depth - 1, directoryGlobs);
}
}
}
@@ -410,7 +423,7 @@ static void detectGames(const Common::FSList &fslist, Common::List<DetectorResul
char md5str[32+1];
// Dive one level down since mac indy3/loom has its files split into directories. See Bug #1438631
- composeFileHashMap(fslist, fileMD5Map, 2);
+ composeFileHashMap(fslist, fileMD5Map, 2, directoryGlobs);
// Iterate over all filename patterns.
for (const GameFilenamePattern *gfp = gameFilenamesTable; gfp->gameid; ++gfp) {