diff options
-rw-r--r-- | common/advancedDetector.cpp | 4 | ||||
-rw-r--r-- | common/advancedDetector.h | 5 | ||||
-rw-r--r-- | engines/agi/detection.cpp | 19 | ||||
-rw-r--r-- | engines/made/detection.cpp | 4 |
4 files changed, 8 insertions, 24 deletions
diff --git a/common/advancedDetector.cpp b/common/advancedDetector.cpp index 71b83d0d62..96e0a37e0f 100644 --- a/common/advancedDetector.cpp +++ b/common/advancedDetector.cpp @@ -205,7 +205,7 @@ GameList AdvancedMetaEngine::detectGames(const FSList &fslist) const { // Use fallback detector if there were no matches by other means if (matches.empty()) { - const Common::ADGameDescription *fallbackDesc = fallbackDetect(&fslist); + const Common::ADGameDescription *fallbackDesc = fallbackDetect(fslist); if (fallbackDesc != 0) { GameDescriptor desc(toGameDescriptor(*fallbackDesc, params.list)); updateGameDescriptor(desc, fallbackDesc, params); @@ -268,7 +268,7 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) if (agdDesc == 0) { // Use fallback detector if there were no matches by other means - agdDesc = fallbackDetect(NULL); + agdDesc = fallbackDetect(files); if (agdDesc != 0) { // Seems we found a fallback match. But first perform a basic // sanity check: the gameid must match. diff --git a/common/advancedDetector.h b/common/advancedDetector.h index d2a38d2835..522fd7b117 100644 --- a/common/advancedDetector.h +++ b/common/advancedDetector.h @@ -210,11 +210,8 @@ public: * 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. - * - * @note The fslist parameter may be 0 -- in that case, it is assumed - * that the callback searchs the current directory. */ - virtual const Common::ADGameDescription *fallbackDetect(const FSList *fslist) const { + virtual const Common::ADGameDescription *fallbackDetect(const FSList &fslist) const { return 0; } }; diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp index 880b8586e3..27b1e799bb 100644 --- a/engines/agi/detection.cpp +++ b/engines/agi/detection.cpp @@ -2127,7 +2127,7 @@ public: virtual SaveStateList listSaves(const char *target) const; virtual void removeSaveState(const char *target, int slot) const; - const Common::ADGameDescription *fallbackDetect(const Common::FSList *fslist) const; + const Common::ADGameDescription *fallbackDetect(const Common::FSList &fslist) const; }; bool AgiMetaEngine::hasFeature(MetaEngineFeature f) const { @@ -2203,7 +2203,7 @@ void AgiMetaEngine::removeSaveState(const char *target, int slot) const { g_system->getSavefileManager()->removeSavefile(filename.c_str()); } -const Common::ADGameDescription *AgiMetaEngine::fallbackDetect(const Common::FSList *fslist) const { +const Common::ADGameDescription *AgiMetaEngine::fallbackDetect(const Common::FSList &fslist) const { typedef Common::HashMap<Common::String, int32> IntMap; IntMap allFiles; bool matchedUsingFilenames = false; @@ -2212,24 +2212,11 @@ const Common::ADGameDescription *AgiMetaEngine::fallbackDetect(const Common::FSL WagFileParser wagFileParser; Common::FSNode wagFileNode; Common::String description; - Common::FSList fslistCurrentDir; // Only used if fslist == NULL // // Set the defaults for gameid and extra _gameid = "agi-fanmade"; _extra.clear(); - // Use the current directory for searching if fslist == NULL - if (fslist == NULL) { - Common::String path = ConfMan.get("path"); - - if (path.empty()) - path = "."; - - Common::FSNode fsCurrentDir(path); - fsCurrentDir.getChildren(fslistCurrentDir, Common::FSNode::kListFilesOnly); - fslist = &fslistCurrentDir; - } - // Set the default values for the fallback descriptor's ADGameDescription part. g_fallbackDesc.desc.language = Common::UNK_LANG; g_fallbackDesc.desc.platform = Common::kPlatformPC; @@ -2241,7 +2228,7 @@ const Common::ADGameDescription *AgiMetaEngine::fallbackDetect(const Common::FSL g_fallbackDesc.version = 0x2917; // First grab all filenames and at the same time count the number of *.wag files - for (Common::FSList::const_iterator file = fslist->begin(); file != fslist->end(); ++file) { + for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { if (file->isDirectory()) continue; Common::String filename = file->getName(); filename.toLowercase(); diff --git a/engines/made/detection.cpp b/engines/made/detection.cpp index 354e5bbb86..df9db57ecc 100644 --- a/engines/made/detection.cpp +++ b/engines/made/detection.cpp @@ -350,7 +350,7 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const; - const Common::ADGameDescription *fallbackDetect(const Common::FSList *fslist) const; + const Common::ADGameDescription *fallbackDetect(const Common::FSList &fslist) const; }; @@ -362,7 +362,7 @@ bool MadeMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common return gd != 0; } -const Common::ADGameDescription *MadeMetaEngine::fallbackDetect(const Common::FSList *fslist) const { +const Common::ADGameDescription *MadeMetaEngine::fallbackDetect(const Common::FSList &fslist) const { // Set the default values for the fallback descriptor's ADGameDescription part. Made::g_fallbackDesc.desc.language = Common::UNK_LANG; Made::g_fallbackDesc.desc.platform = Common::kPlatformPC; |