diff options
author | Eugene Sandulenko | 2010-06-15 11:04:35 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2010-06-15 11:04:35 +0000 |
commit | b6940caaaa59a534774425104f48733f8277d82b (patch) | |
tree | ec4cd4a85baaf2c29156a0bb66528c568f3ea986 /engines | |
parent | 94c9f9cdd11c64810aa0333d503403e54413fc09 (diff) | |
download | scummvm-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')
-rw-r--r-- | engines/scumm/detection.cpp | 19 | ||||
-rw-r--r-- | engines/scumm/detection_tables.h | 9 |
2 files changed, 25 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) { diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h index 0b90af4ec4..db6d04b785 100644 --- a/engines/scumm/detection_tables.h +++ b/engines/scumm/detection_tables.h @@ -48,6 +48,15 @@ namespace Scumm { #pragma mark --- Tables --- #pragma mark - +/** + * This table contains list of directories which could contain game data + * and which should be looked into during detection. + */ +static const char *directoryGlobs[] = { + "rooms *", // Mac version of indy3/loom + 0 +}; + /** * This table contains all game IDs supported by the SCUMM engine, and maps |