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
This commit is contained in:
parent
0b83afce03
commit
44a39ffbc6
22 changed files with 83 additions and 24 deletions
|
@ -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.
|
||||
|
|
|
@ -192,11 +192,19 @@ struct ADParams {
|
|||
uint32 guioptions;
|
||||
|
||||
/**
|
||||
*
|
||||
* Maximum depth of directories to look up
|
||||
* If set to 0, the depth is 1 level
|
||||
*/
|
||||
uint32 depth;
|
||||
|
||||
/**
|
||||
* Case-insensitive list of directory globs which could be used for
|
||||
* going deeper int directory structure.
|
||||
* @see String::matchString() method for format description.
|
||||
*
|
||||
* @note Last item must be 0
|
||||
*/
|
||||
const char **directoryGlobs;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -147,7 +147,9 @@ static const ADParams detectionParams = {
|
|||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NOSPEECH,
|
||||
// Maximum directory depth
|
||||
1
|
||||
1,
|
||||
// List of directory globs
|
||||
0
|
||||
};
|
||||
|
||||
using namespace Agi;
|
||||
|
|
|
@ -104,7 +104,9 @@ static const ADParams detectionParams = {
|
|||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NOLAUNCHLOAD,
|
||||
// Maximum directory depth
|
||||
2
|
||||
2,
|
||||
// List of directory globs
|
||||
0
|
||||
};
|
||||
|
||||
using namespace AGOS;
|
||||
|
|
|
@ -82,7 +82,9 @@ static const ADParams detectionParams = {
|
|||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NOSPEECH | Common::GUIO_NOMIDI,
|
||||
// Maximum directory depth
|
||||
1
|
||||
1,
|
||||
// List of directory globs
|
||||
0
|
||||
};
|
||||
|
||||
class CineMetaEngine : public AdvancedMetaEngine {
|
||||
|
|
|
@ -239,7 +239,9 @@ static const ADParams detectionParams = {
|
|||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NOSPEECH | Common::GUIO_NOMIDI,
|
||||
// Maximum directory depth
|
||||
1
|
||||
1,
|
||||
// List of directory globs
|
||||
0
|
||||
};
|
||||
|
||||
class CruiseMetaEngine : public AdvancedMetaEngine {
|
||||
|
|
|
@ -96,7 +96,9 @@ const ADParams detectionParams = {
|
|||
// Global GUI options
|
||||
Common::GUIO_NONE,
|
||||
// Maximum directory depth
|
||||
1
|
||||
1,
|
||||
// List of directory globs
|
||||
0
|
||||
};
|
||||
|
||||
class DraciMetaEngine : public AdvancedMetaEngine {
|
||||
|
|
|
@ -266,7 +266,9 @@ static const ADParams detectionParams = {
|
|||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NOMIDI,
|
||||
// Maximum directory depth
|
||||
1
|
||||
1,
|
||||
// List of directory globs
|
||||
0
|
||||
};
|
||||
|
||||
class DrasculaMetaEngine : public AdvancedMetaEngine {
|
||||
|
|
|
@ -109,7 +109,9 @@ static const ADParams detectionParams = {
|
|||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NOLAUNCHLOAD,
|
||||
// Maximum directory depth
|
||||
1
|
||||
1,
|
||||
// List of directory globs
|
||||
0
|
||||
};
|
||||
|
||||
class GobMetaEngine : public AdvancedMetaEngine {
|
||||
|
|
|
@ -178,7 +178,9 @@ static const ADParams detectionParams = {
|
|||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NOSUBTITLES | Common::GUIO_NOSFX,
|
||||
// Maximum directory depth
|
||||
1
|
||||
1,
|
||||
// List of directory globs
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -63,7 +63,9 @@ const ADParams detectionParams = {
|
|||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NONE,
|
||||
// Maximum directory depth
|
||||
1
|
||||
1,
|
||||
// List of directory globs
|
||||
0
|
||||
};
|
||||
|
||||
class KyraMetaEngine : public AdvancedMetaEngine {
|
||||
|
|
|
@ -198,7 +198,9 @@ static const ADParams detectionParams = {
|
|||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NOSPEECH,
|
||||
// Maximum directory depth
|
||||
1
|
||||
1,
|
||||
// List of directory globs
|
||||
0
|
||||
};
|
||||
|
||||
class LureMetaEngine : public AdvancedMetaEngine {
|
||||
|
|
|
@ -402,7 +402,9 @@ static const ADParams detectionParams = {
|
|||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NOMIDI,
|
||||
// Maximum directory depth
|
||||
1
|
||||
1,
|
||||
// List of directory globs
|
||||
0
|
||||
};
|
||||
|
||||
class M4MetaEngine : public AdvancedMetaEngine {
|
||||
|
|
|
@ -495,7 +495,9 @@ static const ADParams detectionParams = {
|
|||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NONE,
|
||||
// Maximum directory depth
|
||||
1
|
||||
1,
|
||||
// List of directory globs
|
||||
0
|
||||
};
|
||||
|
||||
class MadeMetaEngine : public AdvancedMetaEngine {
|
||||
|
|
|
@ -143,7 +143,9 @@ static const ADParams detectionParams = {
|
|||
// Additional GUI options (for every game)
|
||||
Common::GUIO_NONE,
|
||||
// Maximum directory depth
|
||||
2
|
||||
2,
|
||||
// List of directory globs
|
||||
0
|
||||
};
|
||||
|
||||
class MohawkMetaEngine : public AdvancedMetaEngine {
|
||||
|
|
|
@ -242,7 +242,9 @@ static const ADParams detectionParams = {
|
|||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NOLAUNCHLOAD,
|
||||
// Maximum directory depth
|
||||
1
|
||||
1,
|
||||
// List of directory globs
|
||||
0
|
||||
};
|
||||
|
||||
class ParallactionMetaEngine : public AdvancedMetaEngine {
|
||||
|
|
|
@ -124,7 +124,9 @@ static const ADParams detectionParams = {
|
|||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NONE,
|
||||
// Maximum directory depth
|
||||
1
|
||||
1,
|
||||
// List of directory globs
|
||||
0
|
||||
};
|
||||
|
||||
class SagaMetaEngine : public AdvancedMetaEngine {
|
||||
|
|
|
@ -312,7 +312,9 @@ static const ADParams detectionParams = {
|
|||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NONE,
|
||||
// Maximum directory depth
|
||||
1
|
||||
1,
|
||||
// List of directory globs
|
||||
0
|
||||
};
|
||||
|
||||
class SciMetaEngine : public AdvancedMetaEngine {
|
||||
|
|
|
@ -92,7 +92,8 @@ static const ADParams detectionParams = {
|
|||
0,
|
||||
0,
|
||||
Common::GUIO_NONE,
|
||||
1
|
||||
1,
|
||||
0
|
||||
};
|
||||
|
||||
#define MAX_SAVES 20
|
||||
|
|
|
@ -97,7 +97,9 @@ static const ADParams detectionParams = {
|
|||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NONE,
|
||||
// Maximum directory depth
|
||||
1
|
||||
1,
|
||||
// List of directory globs
|
||||
0
|
||||
};
|
||||
|
||||
class TinselMetaEngine : public AdvancedMetaEngine {
|
||||
|
|
|
@ -136,7 +136,9 @@ static const ADParams detectionParams = {
|
|||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NONE,
|
||||
// Maximum directory depth
|
||||
1
|
||||
1,
|
||||
// List of directory globs
|
||||
0
|
||||
};
|
||||
|
||||
class ToucheMetaEngine : public AdvancedMetaEngine {
|
||||
|
|
|
@ -115,7 +115,8 @@ static const ADParams detectionParams = {
|
|||
0,
|
||||
0,
|
||||
Common::GUIO_NONE,
|
||||
1
|
||||
1,
|
||||
0
|
||||
};
|
||||
|
||||
static const ADGameDescription tuckerDemoGameDescription = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue