diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/advancedDetector.cpp | 42 | ||||
-rw-r--r-- | engines/advancedDetector.h | 7 | ||||
-rw-r--r-- | engines/agi/detection.cpp | 4 | ||||
-rw-r--r-- | engines/agos/detection.cpp | 4 | ||||
-rw-r--r-- | engines/cine/detection.cpp | 4 | ||||
-rw-r--r-- | engines/cruise/detection.cpp | 4 | ||||
-rw-r--r-- | engines/draci/detection.cpp | 4 | ||||
-rw-r--r-- | engines/drascula/detection.cpp | 4 | ||||
-rw-r--r-- | engines/gob/detection.cpp | 4 | ||||
-rw-r--r-- | engines/groovie/detection.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/detection.cpp | 4 | ||||
-rw-r--r-- | engines/lure/detection.cpp | 4 | ||||
-rw-r--r-- | engines/m4/detection.cpp | 4 | ||||
-rw-r--r-- | engines/made/detection.cpp | 4 | ||||
-rw-r--r-- | engines/mohawk/detection.cpp | 4 | ||||
-rw-r--r-- | engines/parallaction/detection.cpp | 4 | ||||
-rw-r--r-- | engines/saga/detection.cpp | 4 | ||||
-rw-r--r-- | engines/sci/detection.cpp | 4 | ||||
-rw-r--r-- | engines/teenagent/detection.cpp | 3 | ||||
-rw-r--r-- | engines/tinsel/detection.cpp | 4 | ||||
-rw-r--r-- | engines/touche/detection.cpp | 4 | ||||
-rw-r--r-- | engines/tucker/detection.cpp | 3 |
22 files changed, 95 insertions, 32 deletions
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index b149b43ad7..f4932a1055 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -340,24 +340,24 @@ static void reportUnknown(const Common::FSNode &path, const SizeMD5Map &filesSiz static ADGameDescList detectGameFilebased(const FileMap &allFiles, const ADParams ¶ms); -static ADGameDescList detectGame(const Common::FSList &fslist, const ADParams ¶ms, Common::Language language, Common::Platform platform, const Common::String &extra) { - FileMap allFiles; - SizeMD5Map filesSizeMD5; - - const ADGameFileDescription *fileDesc; - const ADGameDescription *g; - const byte *descPtr; +static void composeFileHashMap(const Common::FSList &fslist, FileMap &allFiles, int depth) { + if (depth == 0) + return; if (fslist.empty()) - return ADGameDescList(); - Common::FSNode parent = fslist.begin()->getParent(); - debug(3, "Starting detection in dir '%s'", parent.getPath().c_str()); + return; // First we compose a hashmap of all files in fslist. // Includes nifty stuff like removing trailing dots and ignoring case. for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { - if (file->isDirectory()) - continue; + if (file->isDirectory()) { + Common::FSList files; + + if (!file->getChildren(files, Common::FSNode::kListAll)) + continue; + + composeFileHashMap(files, allFiles, depth - 1); + } Common::String tstr = file->getName(); @@ -367,6 +367,24 @@ static ADGameDescList detectGame(const Common::FSList &fslist, const ADParams &p allFiles[tstr] = *file; // Record the presence of this file } +} + +static ADGameDescList detectGame(const Common::FSList &fslist, const ADParams ¶ms, Common::Language language, Common::Platform platform, const Common::String &extra) { + FileMap allFiles; + SizeMD5Map filesSizeMD5; + + const ADGameFileDescription *fileDesc; + const ADGameDescription *g; + const byte *descPtr; + + if (fslist.empty()) + return ADGameDescList(); + Common::FSNode parent = fslist.begin()->getParent(); + debug(3, "Starting detection in dir '%s'", parent.getPath().c_str()); + + // 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)); // Check which files are included in some ADGameDescription *and* present // in fslist. Compute MD5s and file sizes for these files. diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h index 370d958ce6..a48dd0c1d2 100644 --- a/engines/advancedDetector.h +++ b/engines/advancedDetector.h @@ -190,6 +190,13 @@ struct ADParams { * enum for the list. */ uint32 guioptions; + + /** + * + * Maximum depth of directories to look up + * If set to 0, the depth is 1 level + */ + uint32 depth; }; diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp index e72647d5e2..1c2638fc89 100644 --- a/engines/agi/detection.cpp +++ b/engines/agi/detection.cpp @@ -979,7 +979,9 @@ static const ADParams detectionParams = { // Flags 0, // Additional GUI options (for every game} - Common::GUIO_NOSPEECH | Common::GUIO_NOMIDI + Common::GUIO_NOSPEECH | Common::GUIO_NOMIDI, + // Maximum directory depth + 1 }; } // End of namespace Agi diff --git a/engines/agos/detection.cpp b/engines/agos/detection.cpp index 39974f9d53..d22ee720d7 100644 --- a/engines/agos/detection.cpp +++ b/engines/agos/detection.cpp @@ -102,7 +102,9 @@ static const ADParams detectionParams = { // Flags 0, // Additional GUI options (for every game} - Common::GUIO_NOLAUNCHLOAD + Common::GUIO_NOLAUNCHLOAD, + // Maximum directory depth + 1 }; using namespace AGOS; diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp index fcfa1f7f20..1cf9ed5fad 100644 --- a/engines/cine/detection.cpp +++ b/engines/cine/detection.cpp @@ -569,7 +569,9 @@ static const ADParams detectionParams = { // Flags 0, // Additional GUI options (for every game} - Common::GUIO_NOSPEECH | Common::GUIO_NOMIDI + Common::GUIO_NOSPEECH | Common::GUIO_NOMIDI, + // Maximum directory depth + 1 }; class CineMetaEngine : public AdvancedMetaEngine { diff --git a/engines/cruise/detection.cpp b/engines/cruise/detection.cpp index e1f12b734e..9088b8261e 100644 --- a/engines/cruise/detection.cpp +++ b/engines/cruise/detection.cpp @@ -237,7 +237,9 @@ static const ADParams detectionParams = { // Flags 0, // Additional GUI options (for every game} - Common::GUIO_NOSPEECH | Common::GUIO_NOMIDI + Common::GUIO_NOSPEECH | Common::GUIO_NOMIDI, + // Maximum directory depth + 1 }; class CruiseMetaEngine : public AdvancedMetaEngine { diff --git a/engines/draci/detection.cpp b/engines/draci/detection.cpp index c3204fc656..39834ab5fa 100644 --- a/engines/draci/detection.cpp +++ b/engines/draci/detection.cpp @@ -94,7 +94,9 @@ const ADParams detectionParams = { // Flags 0, // Global GUI options - Common::GUIO_NONE + Common::GUIO_NONE, + // Maximum directory depth + 1 }; class DraciMetaEngine : public AdvancedMetaEngine { diff --git a/engines/drascula/detection.cpp b/engines/drascula/detection.cpp index 76d48b7b89..a0781e0bff 100644 --- a/engines/drascula/detection.cpp +++ b/engines/drascula/detection.cpp @@ -264,7 +264,9 @@ static const ADParams detectionParams = { // Flags 0, // Additional GUI options (for every game} - Common::GUIO_NOMIDI + Common::GUIO_NOMIDI, + // Maximum directory depth + 1 }; class DrasculaMetaEngine : public AdvancedMetaEngine { diff --git a/engines/gob/detection.cpp b/engines/gob/detection.cpp index 1f8bfdc138..feb76fe091 100644 --- a/engines/gob/detection.cpp +++ b/engines/gob/detection.cpp @@ -5094,7 +5094,9 @@ static const ADParams detectionParams = { // Flags 0, // Additional GUI options (for every game} - Common::GUIO_NOLAUNCHLOAD + Common::GUIO_NOLAUNCHLOAD, + // Maximum directory depth + 1 }; class GobMetaEngine : public AdvancedMetaEngine { diff --git a/engines/groovie/detection.cpp b/engines/groovie/detection.cpp index ec401e7d24..1f7156b2fc 100644 --- a/engines/groovie/detection.cpp +++ b/engines/groovie/detection.cpp @@ -176,7 +176,9 @@ static const ADParams detectionParams = { // Flags kADFlagUseExtraAsHint, // Additional GUI options (for every game} - Common::GUIO_NOSUBTITLES | Common::GUIO_NOSFX + Common::GUIO_NOSUBTITLES | Common::GUIO_NOSFX, + // Maximum directory depth + 1 }; diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp index 6e9359e7fc..90a107099f 100644 --- a/engines/kyra/detection.cpp +++ b/engines/kyra/detection.cpp @@ -1226,7 +1226,9 @@ const ADParams detectionParams = { // Flags 0, // Additional GUI options (for every game} - Common::GUIO_NONE + Common::GUIO_NONE, + // Maximum directory depth + 1 }; } // End of anonymous namespace diff --git a/engines/lure/detection.cpp b/engines/lure/detection.cpp index 36c1cf237d..d8c7b483f8 100644 --- a/engines/lure/detection.cpp +++ b/engines/lure/detection.cpp @@ -196,7 +196,9 @@ static const ADParams detectionParams = { // Flags kADFlagUseExtraAsHint, // Additional GUI options (for every game} - Common::GUIO_NOSPEECH + Common::GUIO_NOSPEECH, + // Maximum directory depth + 1 }; class LureMetaEngine : public AdvancedMetaEngine { diff --git a/engines/m4/detection.cpp b/engines/m4/detection.cpp index 9493226c1a..80a899f1ac 100644 --- a/engines/m4/detection.cpp +++ b/engines/m4/detection.cpp @@ -400,7 +400,9 @@ static const ADParams detectionParams = { // Flags 0, // Additional GUI options (for every game} - Common::GUIO_NOMIDI + Common::GUIO_NOMIDI, + // Maximum directory depth + 1 }; class M4MetaEngine : public AdvancedMetaEngine { diff --git a/engines/made/detection.cpp b/engines/made/detection.cpp index 1dfc0c3f83..081bb98006 100644 --- a/engines/made/detection.cpp +++ b/engines/made/detection.cpp @@ -493,7 +493,9 @@ static const ADParams detectionParams = { // Flags 0, // Additional GUI options (for every game} - Common::GUIO_NONE + Common::GUIO_NONE, + // Maximum directory depth + 1 }; class MadeMetaEngine : public AdvancedMetaEngine { diff --git a/engines/mohawk/detection.cpp b/engines/mohawk/detection.cpp index 7f2e0cb312..44c3bc4f6d 100644 --- a/engines/mohawk/detection.cpp +++ b/engines/mohawk/detection.cpp @@ -1011,7 +1011,9 @@ static const ADParams detectionParams = { // Flags 0, // Additional GUI options (for every game) - Common::GUIO_NONE + Common::GUIO_NONE, + // Maximum directory depth + 1 }; class MohawkMetaEngine : public AdvancedMetaEngine { diff --git a/engines/parallaction/detection.cpp b/engines/parallaction/detection.cpp index e5e2b22644..2ecaf1c2d6 100644 --- a/engines/parallaction/detection.cpp +++ b/engines/parallaction/detection.cpp @@ -240,7 +240,9 @@ static const ADParams detectionParams = { // Flags 0, // Additional GUI options (for every game} - Common::GUIO_NOLAUNCHLOAD + Common::GUIO_NOLAUNCHLOAD, + // Maximum directory depth + 1 }; class ParallactionMetaEngine : public AdvancedMetaEngine { diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp index 1c2c6bacff..b57b056806 100644 --- a/engines/saga/detection.cpp +++ b/engines/saga/detection.cpp @@ -122,7 +122,9 @@ static const ADParams detectionParams = { // Flags 0, // Additional GUI options (for every game} - Common::GUIO_NONE + Common::GUIO_NONE, + // Maximum directory depth + 1 }; class SagaMetaEngine : public AdvancedMetaEngine { diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index 579414b3ea..7f0a27c14f 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -310,7 +310,9 @@ static const ADParams detectionParams = { // Flags 0, // Additional GUI options (for every game} - Common::GUIO_NONE + Common::GUIO_NONE, + // Maximum directory depth + 1 }; class SciMetaEngine : public AdvancedMetaEngine { diff --git a/engines/teenagent/detection.cpp b/engines/teenagent/detection.cpp index 258bd982ed..4c61e20b7a 100644 --- a/engines/teenagent/detection.cpp +++ b/engines/teenagent/detection.cpp @@ -91,7 +91,8 @@ static const ADParams detectionParams = { "teenagent", 0, 0, - Common::GUIO_NONE + Common::GUIO_NONE, + 1 }; #define MAX_SAVES 20 diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp index 70a2f475ee..a70b75f136 100644 --- a/engines/tinsel/detection.cpp +++ b/engines/tinsel/detection.cpp @@ -637,7 +637,9 @@ static const ADParams detectionParams = { // Flags 0, // Additional GUI options (for every game} - Common::GUIO_NONE + Common::GUIO_NONE, + // Maximum directory depth + 1 }; class TinselMetaEngine : public AdvancedMetaEngine { diff --git a/engines/touche/detection.cpp b/engines/touche/detection.cpp index 65a6a29bcc..72f87a2f3f 100644 --- a/engines/touche/detection.cpp +++ b/engines/touche/detection.cpp @@ -134,7 +134,9 @@ static const ADParams detectionParams = { Touche::fileBasedFallback, // file-based detection data to enable not yet known versions to start kADFlagPrintWarningOnFileBasedFallback, // Additional GUI options (for every game} - Common::GUIO_NONE + Common::GUIO_NONE, + // Maximum directory depth + 1 }; class ToucheMetaEngine : public AdvancedMetaEngine { diff --git a/engines/tucker/detection.cpp b/engines/tucker/detection.cpp index b4f30cb7fd..7f88a8ff2f 100644 --- a/engines/tucker/detection.cpp +++ b/engines/tucker/detection.cpp @@ -114,7 +114,8 @@ static const ADParams detectionParams = { "tucker", 0, 0, - Common::GUIO_NONE + Common::GUIO_NONE, + 1 }; static const ADGameDescription tuckerDemoGameDescription = { |