diff options
author | Max Horn | 2011-06-14 18:11:14 +0200 |
---|---|---|
committer | Max Horn | 2011-06-14 18:52:11 +0200 |
commit | 01f806c2dbd06d42c8e56b0a46493cf5d5a68a11 (patch) | |
tree | 3e1f3233f760aa21e7af0122a07c666374120093 | |
parent | 879c3c78177ee2ff95c0d22f82d3448877d6fa98 (diff) | |
download | scummvm-rg350-01f806c2dbd06d42c8e56b0a46493cf5d5a68a11.tar.gz scummvm-rg350-01f806c2dbd06d42c8e56b0a46493cf5d5a68a11.tar.bz2 scummvm-rg350-01f806c2dbd06d42c8e56b0a46493cf5d5a68a11.zip |
DETECTOR: Treat file based fallback like any other fallback method
-rw-r--r-- | engines/advancedDetector.cpp | 10 | ||||
-rw-r--r-- | engines/advancedDetector.h | 17 | ||||
-rw-r--r-- | engines/gob/detection.cpp | 5 | ||||
-rw-r--r-- | engines/mohawk/detection.cpp | 6 | ||||
-rw-r--r-- | engines/toon/detection.cpp | 6 | ||||
-rw-r--r-- | engines/touche/detection.cpp | 6 |
6 files changed, 24 insertions, 26 deletions
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index c9f4f38b77..82efb0d840 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -472,24 +472,19 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, cons } // Filename based fallback - if (_fileBasedFallback != 0) { - g = detectGameFilebased(allFiles); - if (g) - matched.push_back(g); - } } return matched; } -const ADGameDescription *AdvancedMetaEngine::detectGameFilebased(const FileMap &allFiles) const { +const ADGameDescription *AdvancedMetaEngine::detectGameFilebased(const FileMap &allFiles, const ADFileBasedFallback *fileBasedFallback) const { const ADFileBasedFallback *ptr; const char* const* filenames; int maxNumMatchedFiles = 0; const ADGameDescription *matchedDesc = 0; - for (ptr = _fileBasedFallback; ptr->desc; ++ptr) { + for (ptr = fileBasedFallback; ptr->desc; ++ptr) { const ADGameDescription *agdesc = (const ADGameDescription *)ptr->desc; int numMatchedFiles = 0; bool fileMissing = false; @@ -566,7 +561,6 @@ AdvancedMetaEngine::AdvancedMetaEngine(const void *descs, uint descItemSize, con _md5Bytes = 5000; _singleid = NULL; - _fileBasedFallback = NULL; _flags = 0; _guioptions = Common::GUIO_NONE; _maxScanDepth = 1; diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h index c48e4a9815..300ce7bbb5 100644 --- a/engines/advancedDetector.h +++ b/engines/advancedDetector.h @@ -173,16 +173,6 @@ protected: const char *_singleid; /** - * List of files for file-based fallback detection (optional). - * This is used if the regular MD5 based detection failed to - * detect anything. - * As usual this list is terminated by an all-zero entry. - * - * @todo Properly explain this - */ - const ADFileBasedFallback *_fileBasedFallback; - - /** * A bitmask of flags which can be used to configure the behavior * of the AdvancedDetector. Refer to ADFlags for a list of flags * that can be ORed together and passed here. @@ -234,8 +224,7 @@ protected: /** * An (optional) generic fallback detect function which is invoked - * if both the regular MD5 based detection as well as the file - * based fallback failed to detect anything. + * if the regular MD5 based detection failed to detect anything. */ virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const { return 0; @@ -256,7 +245,7 @@ protected: ADGameDescList detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra) const; /** - * Iterates over all ADFileBasedFallback records inside _fileBasedFallback. + * Iterates over all ADFileBasedFallback records inside fileBasedFallback. * This then returns the record (or rather, the ADGameDescription * contained in it) for which all files described by it are present, and * among those the one with the maximal number of matching files. @@ -265,7 +254,7 @@ protected: * @param allFiles a map describing all present files * @param fileBasedFallback a list of ADFileBasedFallback records, zero-terminated */ - const ADGameDescription *detectGameFilebased(const FileMap &allFiles) const; + const ADGameDescription *detectGameFilebased(const FileMap &allFiles, const ADFileBasedFallback *fileBasedFallback) const; // TODO void updateGameDescriptor(GameDescriptor &desc, const ADGameDescription *realDesc) const; diff --git a/engines/gob/detection.cpp b/engines/gob/detection.cpp index 2050539d60..9a554b5429 100644 --- a/engines/gob/detection.cpp +++ b/engines/gob/detection.cpp @@ -91,7 +91,6 @@ class GobMetaEngine : public AdvancedMetaEngine { public: GobMetaEngine() : AdvancedMetaEngine(Gob::gameDescriptions, sizeof(Gob::GOBGameDescription), gobGames) { _singleid = "gob"; - _fileBasedFallback = Gob::fileBased; _guioptions = Common::GUIO_NOLAUNCHLOAD; } @@ -99,6 +98,10 @@ public: return Engines::findGameID(gameid, _gameids, obsoleteGameIDsTable); } + virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const { + return detectGameFilebased(allFiles, Gob::fileBased); + } + virtual const char *getName() const { return "Gob"; } diff --git a/engines/mohawk/detection.cpp b/engines/mohawk/detection.cpp index e6f60e3cb5..f0c657897d 100644 --- a/engines/mohawk/detection.cpp +++ b/engines/mohawk/detection.cpp @@ -162,10 +162,14 @@ class MohawkMetaEngine : public AdvancedMetaEngine { public: MohawkMetaEngine() : AdvancedMetaEngine(Mohawk::gameDescriptions, sizeof(Mohawk::MohawkGameDescription), mohawkGames) { _singleid = "mohawk"; - _fileBasedFallback = Mohawk::fileBased; _maxScanDepth = 2; _directoryGlobs = directoryGlobs; } + + virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const { + return detectGameFilebased(allFiles, Mohawk::fileBased); + } + virtual const char *getName() const { return "Mohawk"; } diff --git a/engines/toon/detection.cpp b/engines/toon/detection.cpp index e72c61ac68..810a37720a 100644 --- a/engines/toon/detection.cpp +++ b/engines/toon/detection.cpp @@ -121,10 +121,14 @@ class ToonMetaEngine : public AdvancedMetaEngine { public: ToonMetaEngine() : AdvancedMetaEngine(Toon::gameDescriptions, sizeof(ADGameDescription), toonGames) { _singleid = "toon"; - _fileBasedFallback = Toon::fileBasedFallback; _maxScanDepth = 3; _directoryGlobs = directoryGlobs; } + + virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const { + return detectGameFilebased(allFiles, Toon::fileBasedFallback); + } + virtual const char *getName() const { return "Toon"; } diff --git a/engines/touche/detection.cpp b/engines/touche/detection.cpp index d1dde96f59..723fecec3a 100644 --- a/engines/touche/detection.cpp +++ b/engines/touche/detection.cpp @@ -131,11 +131,15 @@ public: ToucheMetaEngine() : AdvancedMetaEngine(Touche::gameDescriptions, sizeof(ADGameDescription), toucheGames) { _md5Bytes = 4096; _singleid = "touche"; - _fileBasedFallback = Touche::fileBasedFallback; _flags = kADFlagPrintWarningOnFileBasedFallback; _maxScanDepth = 2; _directoryGlobs = directoryGlobs; } + + virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const { + return detectGameFilebased(allFiles, Touche::fileBasedFallback); + } + virtual const char *getName() const { return "Touche"; } |