diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/advancedDetector.cpp | 39 | ||||
-rw-r--r-- | common/advancedDetector.h | 36 |
2 files changed, 5 insertions, 70 deletions
diff --git a/common/advancedDetector.cpp b/common/advancedDetector.cpp index b15477c5a2..3b235835f3 100644 --- a/common/advancedDetector.cpp +++ b/common/advancedDetector.cpp @@ -70,7 +70,7 @@ GameList gameIDList(const Common::ADParams ¶ms) { return GameList(params.list); } -static void upgradeTargetIfNecessary(const Common::ADParams ¶ms) { +void upgradeTargetIfNecessary(const Common::ADParams ¶ms) { if (params.obsoleteList == 0) return; @@ -264,43 +264,6 @@ EncapsulatedADGameDesc detectBestMatchingGame( return result; } -PluginError detectGameForEngineCreation( - const Common::ADParams ¶ms - ) { - - upgradeTargetIfNecessary(params); - - Common::String gameid = ConfMan.get("gameid"); - - FSList fslist; - FilesystemNode dir(ConfMan.get("path")); - if (!dir.getChildren(fslist, FilesystemNode::kListFilesOnly)) { - return kInvalidPathError; - } - - ADGameDescList matches = detectGame(&fslist, params, Common::UNK_LANG, Common::kPlatformUnknown); - - // We have single ID set, so we have a game if there are hits - if (params.singleid != NULL && matches.size()) - return kNoError; - - for (uint i = 0; i < matches.size(); i++) { - if (matches[i]->gameid == gameid) { - return kNoError; - } - } - - // Use fallback detector if there were no matches by other means - if (params.fallbackDetectFunc != NULL) { - EncapsulatedADGameDesc fallbackDesc = (*params.fallbackDetectFunc)(&fslist); - if (fallbackDesc.realDesc != 0 && (params.singleid != NULL || fallbackDesc.getGameID() == gameid)) { - return kNoError; - } - } - - return kNoGameDataFoundError; -} - void reportUnknown(StringMap &filesMD5, HashMap<String, int32, Common::CaseSensitiveString_Hash, Common::CaseSensitiveString_EqualTo> &filesSize) { // TODO: This message should be cleaned up / made more specific. // For example, we should specify at least which engine triggered this. diff --git a/common/advancedDetector.h b/common/advancedDetector.h index b98b7a45ff..9acd2d22be 100644 --- a/common/advancedDetector.h +++ b/common/advancedDetector.h @@ -236,22 +236,13 @@ GameList detectAllGames(const FSList &fslist, const Common::ADParams ¶ms); // FIXME/TODO: Rename this function to something more sensible. EncapsulatedADGameDesc detectBestMatchingGame(const Common::ADParams ¶ms); -// FIXME/TODO: Rename this function to something more sensible. -// Only used by ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_FUNC -PluginError detectGameForEngineCreation(const Common::ADParams ¶ms); +void upgradeTargetIfNecessary(const Common::ADParams ¶ms); +// FIXME/TODO: Rename this function to something more sensible. // Helper function to announce an unknown version of the game (useful for // fallback detection functions). void reportUnknown(StringList &files, int md5Bytes); -// FIXME: It would probably be good to merge detectBestMatchingGame -// and detectGameForEngineCreation into a single function. Right now, the -// detection code called priort to creating an engine instance -// (i.e. detectGameForEngineCreation) differs from the detection code the -// engines call internally (i.e. detectBestMatchingGame). This could lead -// to hard to debug and odd errors. - - } // End of namespace AdvancedDetector @@ -267,22 +258,11 @@ void reportUnknown(StringList &files, int md5Bytes); } \ void dummyFuncToAllowTrailingSemicolon() -#define _ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_PREDEFINED_FUNC(engine,factoryFunc,params) \ - _ADVANCED_DETECTOR_DEFINE_PLUGIN_HEAD(engine,params); \ - PluginError Engine_##engine##_create(OSystem *syst, Engine **engine) { \ - assert(syst); \ - assert(engine); \ - PluginError err = Common::AdvancedDetector::detectGameForEngineCreation(params); \ - if (err == kNoError) \ - *engine = factoryFunc(syst); \ - return err; \ - } \ - void dummyFuncToAllowTrailingSemicolon() - -#define ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_COMPLEX_CREATION(engine,factoryFunc,params) \ +#define ADVANCED_DETECTOR_DEFINE_PLUGIN(engine,factoryFunc,params) \ _ADVANCED_DETECTOR_DEFINE_PLUGIN_HEAD(engine,params); \ PluginError Engine_##engine##_create(OSystem *syst, Engine **engine) { \ assert(engine); \ + Common::AdvancedDetector::upgradeTargetIfNecessary(params); \ Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(params); \ if (encapsulatedDesc.realDesc == 0) { \ return kNoGameDataFoundError; \ @@ -294,14 +274,6 @@ void reportUnknown(StringList &files, int md5Bytes); } \ void dummyFuncToAllowTrailingSemicolon() -#define ADVANCED_DETECTOR_DEFINE_PLUGIN(engine,className,params) \ - static Engine *engine##_createInstance(OSystem *syst) { \ - return new className(syst); \ - } \ - _ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_PREDEFINED_FUNC(engine,engine##_createInstance,params); \ - void dummyFuncToAllowTrailingSemicolon() - - } // End of namespace Common #endif |