aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2007-08-13 08:58:04 +0000
committerEugene Sandulenko2007-08-13 08:58:04 +0000
commit7dcb8503a34d5f286ba3aad56fdc5bdabda57862 (patch)
treef7460b3d2751f6188a3a5ed9aad0e70765e30309
parent7a04b16d73560c56106296808bd9b532d2217c94 (diff)
downloadscummvm-rg350-7dcb8503a34d5f286ba3aad56fdc5bdabda57862.tar.gz
scummvm-rg350-7dcb8503a34d5f286ba3aad56fdc5bdabda57862.tar.bz2
scummvm-rg350-7dcb8503a34d5f286ba3aad56fdc5bdabda57862.zip
Add possibility to serve engines with complex Engine class instantiation
svn-id: r28582
-rw-r--r--common/advancedDetector.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/common/advancedDetector.h b/common/advancedDetector.h
index 5066ba71e9..1817f634a6 100644
--- a/common/advancedDetector.h
+++ b/common/advancedDetector.h
@@ -252,7 +252,7 @@ PluginError detectGameForEngineCreation(const Common::ADParams &params);
} // End of namespace AdvancedDetector
-#define ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_FUNC(engine,factoryFunc,params) \
+#define _ADVANCED_DETECTOR_DEFINE_PLUGIN_HEAD(engine,params) \
GameList Engine_##engine##_gameIDList() { \
return Common::AdvancedDetector::gameIDList(params); \
} \
@@ -262,6 +262,10 @@ PluginError detectGameForEngineCreation(const Common::ADParams &params);
GameList Engine_##engine##_detectGames(const FSList &fslist) { \
return Common::AdvancedDetector::detectAllGames(fslist, params); \
} \
+ 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); \
@@ -272,11 +276,26 @@ PluginError detectGameForEngineCreation(const Common::ADParams &params);
} \
void dummyFuncToAllowTrailingSemicolon()
+#define ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_COMPLEX_CREATION(engine,factoryFunc,params) \
+ _ADVANCED_DETECTOR_DEFINE_PLUGIN_HEAD(engine,params); \
+ PluginError Engine_##engine##_create(OSystem *syst, Engine **engine) { \
+ assert(engine); \
+ Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(params); \
+ if (encapsulatedDesc.realDesc == 0) { \
+ return kNoGameDataFoundError; \
+ } \
+ if (!factoryFunc(syst,engine,encapsulatedDesc)) { \
+ return kNoGameDataFoundError; \
+ } \
+ return kNoError; \
+ } \
+ 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_FUNC(engine,engine##_createInstance,params); \
+ _ADVANCED_DETECTOR_DEFINE_PLUGIN_WITH_PREDEFINED_FUNC(engine,engine##_createInstance,params); \
void dummyFuncToAllowTrailingSemicolon()