[Scummvm-cvs-logs] SF.net SVN: scummvm: [28582] scummvm/trunk/common/advancedDetector.h

sev at users.sourceforge.net sev at users.sourceforge.net
Mon Aug 13 10:58:04 CEST 2007


Revision: 28582
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28582&view=rev
Author:   sev
Date:     2007-08-13 01:58:04 -0700 (Mon, 13 Aug 2007)

Log Message:
-----------
Add possibility to serve engines with complex Engine class instantiation

Modified Paths:
--------------
    scummvm/trunk/common/advancedDetector.h

Modified: scummvm/trunk/common/advancedDetector.h
===================================================================
--- scummvm/trunk/common/advancedDetector.h	2007-08-13 08:51:40 UTC (rev 28581)
+++ scummvm/trunk/common/advancedDetector.h	2007-08-13 08:58:04 UTC (rev 28582)
@@ -252,7 +252,7 @@
 } // 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 @@
 	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 @@
 	} \
 	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()
 
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list