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
This commit is contained in:
Eugene Sandulenko 2010-06-15 11:04:35 +00:00
parent 94c9f9cdd1
commit b6940caaaa
2 changed files with 25 additions and 3 deletions

View File

@ -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) {

View File

@ -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