AdvancedDetector changes:

* Renamed genGameList to gameIDList to make it match the corresponding
  plugin API function name
* removed the detectFunc param from detectGameForEngineCreation,
  as it *always* pointed to a straight wrapper around AdvancedDetector::detectAllGames
* as a consequence, removed the various GAME_detectGames functions from the
  engines, and removed the detectFunc param from ADVANCED_DETECTOR_DEFINE_PLUGIN

svn-id: r25547
This commit is contained in:
Max Horn 2007-02-13 14:55:11 +00:00
parent 08079c9dec
commit 4968e912ce
9 changed files with 17 additions and 58 deletions

View file

@ -50,7 +50,7 @@ namespace AdvancedDetector {
static ADList detectGame(const FSList *fslist, const Common::ADParams &params, Language language, Platform platform); static ADList detectGame(const FSList *fslist, const Common::ADParams &params, Language language, Platform platform);
GameList genGameList(const Common::ADParams &params) { GameList gameIDList(const Common::ADParams &params) {
if (params.singleid != NULL) { if (params.singleid != NULL) {
GameList gl; GameList gl;
@ -221,7 +221,6 @@ int detectBestMatchingGame(
} }
PluginError detectGameForEngineCreation( PluginError detectGameForEngineCreation(
GameList (*detectFunc)(const FSList &fslist),
const Common::ADParams &params const Common::ADParams &params
) { ) {
Common::String gameid = ConfMan.get("gameid"); Common::String gameid = ConfMan.get("gameid");
@ -232,7 +231,7 @@ PluginError detectGameForEngineCreation(
return kInvalidPathError; return kInvalidPathError;
} }
GameList detectedGames = detectFunc(fslist); GameList detectedGames = detectAllGames(fslist, params);
// We have single ID set, so we have a game if there are hits // We have single ID set, so we have a game if there are hits
if (params.singleid != NULL && detectedGames.size()) if (params.singleid != NULL && detectedGames.size())

View file

@ -107,7 +107,7 @@ namespace AdvancedDetector {
* Returns list of targets supported by the engine. * Returns list of targets supported by the engine.
* Distinguishes engines with single ID * Distinguishes engines with single ID
*/ */
GameList genGameList(const Common::ADParams &params); GameList gameIDList(const Common::ADParams &params);
/** /**
* Scan through the game descriptors specified in params and search for * Scan through the game descriptors specified in params and search for
@ -137,7 +137,6 @@ void upgradeTargetIfNecessary(const Common::ADParams &params);
// FIXME/TODO: Rename this function to something more sensible. // FIXME/TODO: Rename this function to something more sensible.
PluginError detectGameForEngineCreation( PluginError detectGameForEngineCreation(
GameList (*detectFunc)(const FSList &fslist),
const Common::ADParams &params const Common::ADParams &params
); );
@ -153,32 +152,32 @@ PluginError detectGameForEngineCreation(
} // End of namespace AdvancedDetector } // End of namespace AdvancedDetector
#define ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_FUNC(engine,factoryFunc,detectFunc,params) \ #define ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_FUNC(engine,factoryFunc,params) \
GameList Engine_##engine##_gameIDList() { \ GameList Engine_##engine##_gameIDList() { \
return Common::AdvancedDetector::genGameList(params); \ return Common::AdvancedDetector::gameIDList(params); \
} \ } \
GameDescriptor Engine_##engine##_findGameID(const char *gameid) { \ GameDescriptor Engine_##engine##_findGameID(const char *gameid) { \
return Common::AdvancedDetector::findGameID(gameid, params); \ return Common::AdvancedDetector::findGameID(gameid, params); \
} \ } \
GameList Engine_##engine##_detectGames(const FSList &fslist) { \ GameList Engine_##engine##_detectGames(const FSList &fslist) { \
return detectFunc(fslist); \ return Common::AdvancedDetector::detectAllGames(fslist, params); \
} \ } \
PluginError Engine_##engine##_create(OSystem *syst, Engine **engine) { \ PluginError Engine_##engine##_create(OSystem *syst, Engine **engine) { \
assert(syst); \ assert(syst); \
assert(engine); \ assert(engine); \
Common::AdvancedDetector::upgradeTargetIfNecessary(params); \ Common::AdvancedDetector::upgradeTargetIfNecessary(params); \
PluginError err = Common::AdvancedDetector::detectGameForEngineCreation(detectFunc, params); \ PluginError err = Common::AdvancedDetector::detectGameForEngineCreation(params); \
if (err == kNoError) \ if (err == kNoError) \
*engine = factoryFunc(syst); \ *engine = factoryFunc(syst); \
return err; \ return err; \
} \ } \
void dummyFuncToAllowTrailingSemicolon() void dummyFuncToAllowTrailingSemicolon()
#define ADVANCED_DETECTOR_DEFINE_PLUGIN(engine,className,detectFunc,params) \ #define ADVANCED_DETECTOR_DEFINE_PLUGIN(engine,className,params) \
static className *engine##_createInstance(OSystem *syst) { \ static Engine *engine##_createInstance(OSystem *syst) { \
return new className(syst); \ return new className(syst); \
} \ } \
ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_FUNC(engine,engine##_createInstance,detectFunc,params); \ ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_FUNC(engine,engine##_createInstance,params); \
void dummyFuncToAllowTrailingSemicolon() void dummyFuncToAllowTrailingSemicolon()

View file

@ -52,7 +52,6 @@ uint16 AgiEngine::getVersion() const {
return _gameDescription->version; return _gameDescription->version;
} }
static GameList GAME_detectGames(const FSList &fslist);
} }
static const PlainGameDescriptor agiGames[] = { static const PlainGameDescriptor agiGames[] = {
@ -1743,7 +1742,7 @@ static const Common::ADParams detectionParams = {
Common::kADFlagAugmentPreferredTarget Common::kADFlagAugmentPreferredTarget
}; };
ADVANCED_DETECTOR_DEFINE_PLUGIN(AGI, Agi::AgiEngine, Agi::GAME_detectGames, detectionParams); ADVANCED_DETECTOR_DEFINE_PLUGIN(AGI, Agi::AgiEngine, detectionParams);
REGISTER_PLUGIN(AGI, "AGI v2 + v3 Engine", "Sierra AGI Engine (C) Sierra On-Line Software"); REGISTER_PLUGIN(AGI, "AGI v2 + v3 Engine", "Sierra AGI Engine (C) Sierra On-Line Software");
@ -1758,9 +1757,5 @@ bool AgiEngine::initGame() {
return true; return true;
} }
GameList GAME_detectGames(const FSList &fslist) {
return Common::AdvancedDetector::detectAllGames(fslist, detectionParams);
}
} // End of namespace Agi } // End of namespace Agi

View file

@ -39,7 +39,6 @@ struct AGOSGameDescription {
uint32 features; uint32 features;
}; };
static GameList GAME_detectGames(const FSList &fslist);
} }
/** /**
@ -101,7 +100,7 @@ static const Common::ADParams detectionParams = {
Common::kADFlagAugmentPreferredTarget Common::kADFlagAugmentPreferredTarget
}; };
ADVANCED_DETECTOR_DEFINE_PLUGIN(AGOS, AGOS::AGOSEngine, AGOS::GAME_detectGames, detectionParams); ADVANCED_DETECTOR_DEFINE_PLUGIN(AGOS, AGOS::AGOSEngine, detectionParams);
REGISTER_PLUGIN(AGOS, "AGOS", "AGOS (C) Adventure Soft"); REGISTER_PLUGIN(AGOS, "AGOS", "AGOS (C) Adventure Soft");
@ -116,9 +115,6 @@ bool AGOSEngine::initGame() {
return true; return true;
} }
GameList GAME_detectGames(const FSList &fslist) {
return Common::AdvancedDetector::detectAllGames(fslist, detectionParams);
}
int AGOSEngine::getGameId() const { int AGOSEngine::getGameId() const {
return _gameDescription->gameId; return _gameDescription->gameId;

View file

@ -43,8 +43,6 @@ uint32 CineEngine::getFeatures() const { return _gameDescription->features; }
Common::Language CineEngine::getLanguage() const { return _gameDescription->desc.language; } Common::Language CineEngine::getLanguage() const { return _gameDescription->desc.language; }
Common::Platform CineEngine::getPlatform() const { return _gameDescription->desc.platform; } Common::Platform CineEngine::getPlatform() const { return _gameDescription->desc.platform; }
static GameList GAME_detectGames(const FSList &fslist);
} }
static const PlainGameDescriptor cineGames[] = { static const PlainGameDescriptor cineGames[] = {
@ -486,7 +484,7 @@ static const Common::ADParams detectionParams = {
Common::kADFlagAugmentPreferredTarget Common::kADFlagAugmentPreferredTarget
}; };
ADVANCED_DETECTOR_DEFINE_PLUGIN(CINE, Cine::CineEngine, Cine::GAME_detectGames, detectionParams); ADVANCED_DETECTOR_DEFINE_PLUGIN(CINE, Cine::CineEngine, detectionParams);
REGISTER_PLUGIN(CINE, "Cinematique evo 1 engine", "Future Wars & Operation Stealth (C) Delphine Software"); REGISTER_PLUGIN(CINE, "Cinematique evo 1 engine", "Future Wars & Operation Stealth (C) Delphine Software");
@ -501,8 +499,4 @@ bool CineEngine::initGame() {
return true; return true;
} }
GameList GAME_detectGames(const FSList &fslist) {
return Common::AdvancedDetector::detectAllGames(fslist, detectionParams);
}
} // End of namespace Cine } // End of namespace Cine

View file

@ -37,7 +37,6 @@ struct GOBGameDescription {
const char *startTotBase; const char *startTotBase;
}; };
static GameList GAME_detectGames(const FSList &fslist);
} }
using namespace Common; using namespace Common;
@ -918,7 +917,7 @@ static const ADParams detectionParams = {
kADFlagAugmentPreferredTarget | kADFlagFilebasedFallback kADFlagAugmentPreferredTarget | kADFlagFilebasedFallback
}; };
ADVANCED_DETECTOR_DEFINE_PLUGIN(GOB, Gob::GobEngine, Gob::GAME_detectGames, detectionParams); ADVANCED_DETECTOR_DEFINE_PLUGIN(GOB, Gob::GobEngine, detectionParams);
REGISTER_PLUGIN(GOB, "Gob Engine", "Goblins Games (C) Coktel Vision"); REGISTER_PLUGIN(GOB, "Gob Engine", "Goblins Games (C) Coktel Vision");
@ -949,8 +948,4 @@ bool GobEngine::detectGame() {
return true; return true;
} }
GameList GAME_detectGames(const FSList &fslist) {
return AdvancedDetector::detectAllGames(fslist, detectionParams);
}
} // End of namespace Parallaction } // End of namespace Parallaction

View file

@ -41,8 +41,6 @@ int Parallaction::getGameType() const { return _gameDescription->gameType; }
uint32 Parallaction::getFeatures() const { return _gameDescription->features; } uint32 Parallaction::getFeatures() const { return _gameDescription->features; }
Common::Language Parallaction::getLanguage() const { return _gameDescription->desc.language; } Common::Language Parallaction::getLanguage() const { return _gameDescription->desc.language; }
Common::Platform Parallaction::getPlatform() const { return _gameDescription->desc.platform; } Common::Platform Parallaction::getPlatform() const { return _gameDescription->desc.platform; }
static GameList GAME_detectGames(const FSList &fslist);
} }
static const PlainGameDescriptor parallactionGames[] = { static const PlainGameDescriptor parallactionGames[] = {
@ -100,7 +98,7 @@ static const Common::ADParams detectionParams = {
Common::kADFlagAugmentPreferredTarget Common::kADFlagAugmentPreferredTarget
}; };
ADVANCED_DETECTOR_DEFINE_PLUGIN(PARALLACTION, Parallaction::Parallaction, Parallaction::GAME_detectGames, detectionParams); ADVANCED_DETECTOR_DEFINE_PLUGIN(PARALLACTION, Parallaction::Parallaction, detectionParams);
REGISTER_PLUGIN(PARALLACTION, "Parallaction engine", "Nippon Safes Inc. (C) Dynabyte"); REGISTER_PLUGIN(PARALLACTION, "Parallaction engine", "Nippon Safes Inc. (C) Dynabyte");
@ -114,8 +112,4 @@ bool Parallaction::detectGame() {
return true; return true;
} }
GameList GAME_detectGames(const FSList &fslist) {
return Common::AdvancedDetector::detectAllGames(fslist, detectionParams);
}
} // End of namespace Parallaction } // End of namespace Parallaction

View file

@ -79,7 +79,6 @@ int SagaEngine::getPatchesCount() const { return _gameDescription->patchesCount;
const GamePatchDescription *SagaEngine::getPatchDescriptions() const { return _gameDescription->patchDescriptions; } const GamePatchDescription *SagaEngine::getPatchDescriptions() const { return _gameDescription->patchDescriptions; }
const Common::ADGameFileDescription *SagaEngine::getFilesDescriptions() const { return _gameDescription->desc.filesDescriptions; } const Common::ADGameFileDescription *SagaEngine::getFilesDescriptions() const { return _gameDescription->desc.filesDescriptions; }
static GameList GAME_detectGames(const FSList &fslist);
} }
static const PlainGameDescriptor sagaGames[] = { static const PlainGameDescriptor sagaGames[] = {
@ -120,7 +119,7 @@ static const Common::ADParams detectionParams = {
Common::kADFlagAugmentPreferredTarget Common::kADFlagAugmentPreferredTarget
}; };
ADVANCED_DETECTOR_DEFINE_PLUGIN(SAGA, Saga::SagaEngine, Saga::GAME_detectGames, detectionParams); ADVANCED_DETECTOR_DEFINE_PLUGIN(SAGA, Saga::SagaEngine, detectionParams);
REGISTER_PLUGIN(SAGA, "SAGA Engine", "Inherit the Earth (C) Wyrmkeep Entertainment"); REGISTER_PLUGIN(SAGA, "SAGA Engine", "Inherit the Earth (C) Wyrmkeep Entertainment");
@ -140,8 +139,4 @@ bool SagaEngine::initGame() {
return _resource->createContexts(); return _resource->createContexts();
} }
GameList GAME_detectGames(const FSList &fslist) {
return Common::AdvancedDetector::detectAllGames(fslist, detectionParams);
}
} // End of namespace Saga } // End of namespace Saga

View file

@ -28,10 +28,6 @@
#include "touche/touche.h" #include "touche/touche.h"
namespace Touche {
static GameList GAME_detectGames(const FSList &fslist);
}
static const PlainGameDescriptor toucheGames[] = { static const PlainGameDescriptor toucheGames[] = {
{"touche", "Touche: The Adventures of the Fifth Musketeer"}, {"touche", "Touche: The Adventures of the Fifth Musketeer"},
@ -116,7 +112,7 @@ static const Common::ADParams detectionParams = {
0 0
}; };
ADVANCED_DETECTOR_DEFINE_PLUGIN(TOUCHE, Touche::ToucheEngine, Touche::GAME_detectGames, detectionParams); ADVANCED_DETECTOR_DEFINE_PLUGIN(TOUCHE, Touche::ToucheEngine, detectionParams);
REGISTER_PLUGIN(TOUCHE, "Touche Engine", "Touche: The Adventures of the 5th Musketeer (C) Clipper Software"); REGISTER_PLUGIN(TOUCHE, "Touche Engine", "Touche: The Adventures of the 5th Musketeer (C) Clipper Software");
@ -131,8 +127,4 @@ bool ToucheEngine::detectGame() {
return true; return true;
} }
GameList GAME_detectGames(const FSList &fslist) {
return Common::AdvancedDetector::detectAllGames(fslist, detectionParams);
}
} // End of namespace Touche } // End of namespace Touche