From b6940caaaa59a534774425104f48733f8277d82b Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 15 Jun 2010 11:04:35 +0000 Subject: 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 --- engines/scumm/detection.cpp | 19 ++++++++++++++++--- engines/scumm/detection_tables.h | 9 +++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) (limited to 'engines') 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::Listgameid; ++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 -- cgit v1.2.3