[Scummvm-cvs-logs] SF.net SVN: scummvm: [20752] scummvm/trunk

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Feb 18 03:17:01 CET 2006


Revision: 20752
Author:   fingolfin
Date:     2006-02-18 03:15:37 -0800 (Sat, 18 Feb 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm?rev=20752&view=rev

Log Message:
-----------
- renamed PLUGIN_getSupportedGames to PLUGIN_gameIDList for consistency
- renamed Engine_XXX_gameList to Engine_XXX_gameList for consistency
- added new Engine_XXX_findGameID / PLUGIN_findGameID function
- updated plugins code to take advantage of the new plugin API, to support
  obsolete gameids w/o showing them to the user

Modified Paths:
--------------
    scummvm/trunk/base/plugins.cpp
    scummvm/trunk/base/plugins.h
    scummvm/trunk/engines/gob/gob.cpp
    scummvm/trunk/engines/kyra/kyra.cpp
    scummvm/trunk/engines/lure/lure.cpp
    scummvm/trunk/engines/queen/queen.cpp
    scummvm/trunk/engines/saga/saga.cpp
    scummvm/trunk/engines/scumm/scumm.cpp
    scummvm/trunk/engines/simon/simon.cpp
    scummvm/trunk/engines/sky/sky.cpp
    scummvm/trunk/engines/sword1/sword1.cpp
    scummvm/trunk/engines/sword2/sword2.cpp
    scummvm/trunk/plugin.exp
Modified: scummvm/trunk/base/plugins.cpp
===================================================================
--- scummvm/trunk/base/plugins.cpp	2006-02-18 11:13:08 UTC (rev 20751)
+++ scummvm/trunk/base/plugins.cpp	2006-02-18 11:15:37 UTC (rev 20752)
@@ -32,6 +32,7 @@
 typedef Engine *(*EngineFactory)(GameDetector *detector, OSystem *syst);
 
 typedef const char *(*NameFunc)();
+typedef GameSettings (*GameIDQueryFunc)(const char *gameid);
 typedef GameList (*GameIDListFunc)();
 typedef DetectedGameList (*DetectFunc)(const FSList &fslist);
 
@@ -60,8 +61,8 @@
 
 #else
 
-PluginRegistrator::PluginRegistrator(const char *name, GameList games, EngineFactory ef, DetectFunc df)
-	: _name(name), _ef(ef), _df(df), _games(games) {
+PluginRegistrator::PluginRegistrator(const char *name, GameList games, GameIDQueryFunc qf, EngineFactory ef, DetectFunc df)
+	: _name(name), _qf(qf), _ef(ef), _df(df), _games(games) {
 	//printf("Automatically registered plugin '%s'\n", name);
 }
 
@@ -70,28 +71,13 @@
 
 #pragma mark -
 
-GameSettings Plugin::findGame(const char *gameName) const {
-	// Find the GameSettings for this game
-	assert(gameName);
-	GameList games = getSupportedGames();
-	GameSettings result = {NULL, NULL};
-	for (GameList::iterator g = games.begin(); g != games.end(); ++g) {
-		if (!scumm_stricmp(g->gameid, gameName)) {
-			result = *g;
-			break;
-		}
-	}
-	return result;
-}
-
-#pragma mark -
-
 #ifndef DYNAMIC_MODULES
 class StaticPlugin : public Plugin {
 	PluginRegistrator *_plugin;
 public:
 	StaticPlugin(PluginRegistrator *plugin)
 		: _plugin(plugin) {
+		assert(_plugin);
 	}
 	
 	~StaticPlugin() {
@@ -101,11 +87,19 @@
 	const char *getName() const { return _plugin->_name; }
 
 	Engine *createInstance(GameDetector *detector, OSystem *syst) const {
+		assert(_plugin->_ef);
 		return (*_plugin->_ef)(detector, syst);
 	}
 
 	GameList getSupportedGames() const { return _plugin->_games; }
+
+	GameSettings findGame(const char *gameid) const {
+		assert(_plugin->_qf);
+		return (*_plugin->_qf)(gameid);
+	}
+
 	DetectedGameList detectGames(const FSList &fslist) const {
+		assert(_plugin->_df);
 		return (*_plugin->_df)(fslist);
 	}
 };
@@ -120,6 +114,7 @@
 	Common::String _filename;
 
 	Common::String _name;
+	GameIDQueryFunc _qf;
 	EngineFactory _ef;
 	DetectFunc _df;
 	GameList _games;
@@ -128,7 +123,7 @@
 
 public:
 	DynamicPlugin(const Common::String &filename)
-		: _dlHandle(0), _filename(filename), _ef(0), _df(0), _games() {}
+		: _dlHandle(0), _filename(filename), _qf(0), _ef(0), _df(0), _games() {}
 
 	const char *getName() const					{ return _name.c_str(); }
 
@@ -138,6 +133,12 @@
 	}
 
 	GameList getSupportedGames() const { return _games; }
+
+	GameSettings findGame(const char *gameid) const {
+		assert(_qf);
+		return (*_qf)(gameid);
+	}
+
 	DetectedGameList detectGames(const FSList &fslist) const {
 		assert(_df);
 		return (*_df)(fslist);
@@ -196,13 +197,20 @@
 	_name = nameFunc();
 
 	// Query the plugin for the game ids it supports
-	GameIDListFunc gameListFunc = (GameIDListFunc)findSymbol("PLUGIN_getSupportedGames");
+	GameIDListFunc gameListFunc = (GameIDListFunc)findSymbol("PLUGIN_gameIDList");
 	if (!gameListFunc) {
 		unloadPlugin();
 		return false;
 	}
 	_games = gameListFunc();
 
+	// Retrieve the gameid query function
+	_qf = (GameIDQueryFunc)findSymbol("PLUGIN_findGameID");
+	if (!_qf) {
+		unloadPlugin();
+		return false;
+	}
+
 	// Retrieve the factory function
 	_ef = (EngineFactory)findSymbol("PLUGIN_createEngine");
 	if (!_ef) {
@@ -225,23 +233,18 @@
 }
 
 void DynamicPlugin::unloadPlugin() {
+	if (_dlHandle) {
 #if defined(UNIX) || defined(__DC__)
-	if (_dlHandle) {
 		if (dlclose(_dlHandle) != 0)
 			warning("Failed unloading plugin '%s' (%s)", _filename.c_str(), dlerror());
-	}
-}
-#else
-#if defined(_WIN32)
-	if (_dlHandle) {
+#elif defined(_WIN32)
 		if (!FreeLibrary((HMODULE)_dlHandle))
 			warning("Failed unloading plugin '%s'", _filename.c_str());
-	}
-}
 #else
 #error TODO
 #endif
-#endif
+	}
+}
 
 #endif	// DYNAMIC_MODULES
 

Modified: scummvm/trunk/base/plugins.h
===================================================================
--- scummvm/trunk/base/plugins.h	2006-02-18 11:13:08 UTC (rev 20751)
+++ scummvm/trunk/base/plugins.h	2006-02-18 11:15:37 UTC (rev 20752)
@@ -41,14 +41,16 @@
  * A detected game. Carries the GameSettings, but also (optionally)
  * information about the language and platform of the detected game.
  */
-struct DetectedGame : GameSettings {
+struct DetectedGame {
+	const char *gameid;
+	const char *description;
 	Common::Language language;
 	Common::Platform platform;
 	DetectedGame() : language(Common::UNK_LANG), platform(Common::kPlatformUnknown) {}
 	DetectedGame(const GameSettings &game,
 	             Common::Language l = Common::UNK_LANG,
 	             Common::Platform p = Common::kPlatformUnknown)
-		: GameSettings(game), language(l), platform(p) {}
+		: gameid(game.gameid), description(game.description), language(l), platform(p) {}
 };
 
 /** List of detected games. */
@@ -71,7 +73,7 @@
 	virtual int getVersion() const	{ return 0; }	// TODO!
 
 	virtual GameList getSupportedGames() const = 0;
-	virtual GameSettings findGame(const char *gameName) const;
+	virtual GameSettings findGame(const char *gameid) const = 0;
 	virtual DetectedGameList detectGames(const FSList &fslist) const = 0;
 
 	virtual Engine *createInstance(GameDetector *detector, OSystem *syst) const = 0;
@@ -84,6 +86,21 @@
  * makes it possible to compile the very same code in a module
  * both as a static and a dynamic plugin.
  *
+ * Each plugin has to define the following functions:
+ * - GameList Engine_##ID##_gameIDList()
+ *   -> returns a list of gameid/desc pairs. Only used to implement '--list-games'.
+ * - GameSettings Engine_##ID##_findGameID(const char *gameid)
+ *   -> asks the Engine for a GameSettings matching the gameid. If that is not
+ *      possible, the engine MUST set the gameid of the returned value to 0.
+ *      Note: This MUST succeed for every gameID on the list returned by
+ *      gameIDList(), but MAY also work for additional gameids (e.g. to support
+ *      obsolete targets).
+ * - DetectedGameList Engine_##ID##_detectGames(const FSList &fslist)
+ *   -> scans through the given file list (usually the contents of a directory),
+ *      and attempts to detects games present in that location.
+ * - Engine *Engine_##ID##_create(GameDetector *detector, OSystem *syst)
+ *   -> factory function, create an instance of the Engine class.
+ *
  * @todo	add some means to query the plugin API version etc.
  */
 
@@ -91,13 +108,19 @@
 #define REGISTER_PLUGIN(ID,name) \
 	PluginRegistrator *g_##ID##_PluginReg; \
 	void g_##ID##_PluginReg_alloc() { \
-		g_##ID##_PluginReg = new PluginRegistrator(name, Engine_##ID##_gameList(), Engine_##ID##_create, Engine_##ID##_detectGames);\
+		g_##ID##_PluginReg = new PluginRegistrator(name, \
+			Engine_##ID##_gameIDList(), \
+			Engine_##ID##_findGameID, \
+			Engine_##ID##_create, \
+			Engine_##ID##_detectGames \
+			);\
 	}
 #else
 #define REGISTER_PLUGIN(ID,name) \
 	extern "C" { \
 		PLUGIN_EXPORT const char *PLUGIN_name() { return name; } \
-		PLUGIN_EXPORT GameList PLUGIN_getSupportedGames() { return Engine_##ID##_gameList(); } \
+		PLUGIN_EXPORT GameList PLUGIN_gameIDList() { return Engine_##ID##_gameIDList(); } \
+		PLUGIN_EXPORT GameSettings PLUGIN_findGameID(const char *gameid) { return Engine_##ID##_findGameID(gameid); } \
 		PLUGIN_EXPORT Engine *PLUGIN_createEngine(GameDetector *detector, OSystem *syst) { return Engine_##ID##_create(detector, syst); } \
 		PLUGIN_EXPORT DetectedGameList PLUGIN_detectGames(const FSList &fslist) { return Engine_##ID##_detectGames(fslist); } \
 	}
@@ -111,17 +134,19 @@
 class PluginRegistrator {
 	friend class StaticPlugin;
 public:
+	typedef GameSettings (*GameIDQueryFunc)(const char *gameid);
 	typedef Engine *(*EngineFactory)(GameDetector *detector, OSystem *syst);
 	typedef DetectedGameList (*DetectFunc)(const FSList &fslist);
 
 protected:
 	const char *_name;
+	GameIDQueryFunc _qf;
 	EngineFactory _ef;
 	DetectFunc _df;
 	GameList _games;
 
 public:
-	PluginRegistrator(const char *name, GameList games, EngineFactory ef, DetectFunc df);
+	PluginRegistrator(const char *name, GameList games, GameIDQueryFunc qf, EngineFactory ef, DetectFunc df);
 };
 #endif
 

Modified: scummvm/trunk/engines/gob/gob.cpp
===================================================================
--- scummvm/trunk/engines/gob/gob.cpp	2006-02-18 11:13:08 UTC (rev 20751)
+++ scummvm/trunk/engines/gob/gob.cpp	2006-02-18 11:15:37 UTC (rev 20752)
@@ -266,7 +266,7 @@
 
 using namespace Gob;
 
-GameList Engine_GOB_gameList() {
+GameList Engine_GOB_gameIDList() {
 	GameList games;
 	const GameSettings *g = gob_list;
 
@@ -278,6 +278,16 @@
 	return games;
 }
 
+GameSettings Engine_GOB_findGameID(const char *gameid) {
+	const GameSettings *g = gob_list;
+	while (g->gameid) {
+		if (0 == strcmp(gameid, g->gameid))
+			break;
+		g++;
+	}
+	return *g;
+}
+
 DetectedGameList Engine_GOB_detectGames(const FSList &fslist) {
 	DetectedGameList detectedGames;
 	const GobGameSettings *g;

Modified: scummvm/trunk/engines/kyra/kyra.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra.cpp	2006-02-18 11:13:08 UTC (rev 20751)
+++ scummvm/trunk/engines/kyra/kyra.cpp	2006-02-18 11:15:37 UTC (rev 20752)
@@ -129,7 +129,7 @@
 	return Common::UNK_LANG;
 }
 
-GameList Engine_KYRA_gameList() {
+GameList Engine_KYRA_gameIDList() {
 	GameList games;
 	const GameSettings *g = kyra_list;
 
@@ -140,6 +140,16 @@
 	return games;
 }
 
+GameSettings Engine_KYRA_findGameID(const char *gameid) {
+	const GameSettings *g = kyra_list;
+	while (g->gameid) {
+		if (0 == strcmp(gameid, g->gameid))
+			break;
+		g++;
+	}
+	return *g;
+}
+
 DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) {
 	DetectedGameList detectedGames;
 	const KyraGameSettings *g;

Modified: scummvm/trunk/engines/lure/lure.cpp
===================================================================
--- scummvm/trunk/engines/lure/lure.cpp	2006-02-18 11:13:08 UTC (rev 20751)
+++ scummvm/trunk/engines/lure/lure.cpp	2006-02-18 11:15:37 UTC (rev 20752)
@@ -73,7 +73,7 @@
 	{ 0, 0 }
 };
 
-GameList Engine_LURE_gameList() {
+GameList Engine_LURE_gameIDList() {
 	GameList games;
 	const GameSettings *g = lure_list;
 
@@ -84,6 +84,16 @@
 	return games;
 }
 
+GameSettings Engine_LURE_findGameID(const char *gameid) {
+	const GameSettings *g = lure_list;
+	while (g->gameid) {
+		if (0 == strcmp(gameid, g->gameid))
+			break;
+		g++;
+	}
+	return *g;
+}
+
 DetectedGameList Engine_LURE_detectGames(const FSList &fslist) {
 	DetectedGameList detectedGames;
 	const LureGameSettings *g;

Modified: scummvm/trunk/engines/queen/queen.cpp
===================================================================
--- scummvm/trunk/engines/queen/queen.cpp	2006-02-18 11:13:08 UTC (rev 20751)
+++ scummvm/trunk/engines/queen/queen.cpp	2006-02-18 11:15:37 UTC (rev 20752)
@@ -62,17 +62,20 @@
 	{ 0, 0 }
 };
 
-GameList Engine_QUEEN_gameList() {
+GameList Engine_QUEEN_gameIDList() {
 	GameList games;
-	const GameSettings *g = queen_setting;
-
-	while (g->gameid) {
-		games.push_back(*g);
-		g++;
-	}
+	games.push_back(queen_setting[0]);
 	return games;
 }
 
+GameSettings Engine_QUEEN_findGameID(const char *gameid) {
+	if (0 == strcmp(gameid, queen_setting[0].gameid))
+		return queen_setting[0];
+	GameSettings dummy = { 0, 0 };
+	return dummy;
+}
+
+
 GameSettings determineTarget(uint32 size) {
 	switch (size) {
 	case 3724538:	//regular demo

Modified: scummvm/trunk/engines/saga/saga.cpp
===================================================================
--- scummvm/trunk/engines/saga/saga.cpp	2006-02-18 11:13:08 UTC (rev 20751)
+++ scummvm/trunk/engines/saga/saga.cpp	2006-02-18 11:15:37 UTC (rev 20752)
@@ -62,7 +62,7 @@
 	{0, 0}
 };
 
-GameList Engine_SAGA_gameList() {
+GameList Engine_SAGA_gameIDList() {
 	GameList games;
 	const GameSettings *g = saga_games;
 
@@ -74,6 +74,16 @@
 	return games;
 }
 
+GameSettings Engine_SAGA_findGameID(const char *gameid) {
+	const GameSettings *g = saga_games;
+	while (g->gameid) {
+		if (0 == strcmp(gameid, g->gameid))
+			break;
+		g++;
+	}
+	return *g;
+}
+
 DetectedGameList Engine_SAGA_detectGames(const FSList &fslist) {
 	return Saga::GAME_ProbeGame(fslist);
 }

Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2006-02-18 11:13:08 UTC (rev 20751)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2006-02-18 11:15:37 UTC (rev 20752)
@@ -91,15 +91,10 @@
 ScummEngine *g_scumm = 0;
 
 
-struct GameDescription {
-	const char *gameid;
-	const char *description;
-};
-
 /**
  * Lookup table mapping game IDs to game descriptions.
  */
-static GameDescription gameDescriptions[] = {
+static const GameSettings gameDescriptions[] = {
 	{ "atlantis", "Indiana Jones and the Fate of Atlantis" },
 	{ "indy3", "Indiana Jones and the Last Crusade" },
 	{ "loom", "Loom" },
@@ -175,7 +170,7 @@
 };
 
 static const char *findDescriptionFromGameID(const char *gameid) {
-	GameDescription *g = gameDescriptions;
+	const GameSettings *g = gameDescriptions;
 	while (g->gameid) {
 		if (!strcmp(g->gameid, gameid)) {
 			return g->description;
@@ -206,15 +201,10 @@
 };
 
 
-struct ObsoleteGameIDs {
+struct ObsoleteGameID {
 	const char *from;
 	const char *to;
 	Common::Platform platform;
-
-	GameSettings toGameSettings() const {
-		GameSettings dummy = { from, "Obsolete game ID" };
-		return dummy;
-	}
 };
 
 static const Common::Platform UNK = Common::kPlatformUnknown;
@@ -225,7 +215,7 @@
  *
  * We use an ugly macro 'UNK' here to make the following table more readable.
  */
-static ObsoleteGameIDs obsoleteGameIDsTable[] = {
+static const ObsoleteGameID obsoleteGameIDsTable[] = {
 	{"comidemo", "comi", UNK},
 	{"digdemo", "dig", UNK},
 	{"digdemoMac", "dig", Common::kPlatformMacintosh},
@@ -2970,22 +2960,41 @@
 
 using namespace Scumm;
 
-GameList Engine_SCUMM_gameList() {
-	const ScummGameSettings *g = scumm_settings;
-	const ObsoleteGameIDs *o = obsoleteGameIDsTable;
+GameList Engine_SCUMM_gameIDList() {
+	const GameSettings *g = gameDescriptions;
 	GameList games;
 	while (g->gameid) {
-		games.push_back(g->toGameSettings());
+		games.push_back(*g);
 		g++;
 	}
+	return games;
+}
 
+GameSettings Engine_SCUMM_findGameID(const char *gameid) {
+	// First search the list of supported game IDs.
+	const GameSettings *g = gameDescriptions;
+	while (g->gameid) {
+		if (0 == strcmp(gameid, g->gameid))
+			return *g;
+		g++;
+	}
+
+	// If we didn't find the gameid in the main list, check if it
+	// is an obsolete game id.
+	GameSettings gs = { 0, 0 };
+	const ObsoleteGameID *o = obsoleteGameIDsTable;
 	while (o->from) {
-		games.push_back(o->toGameSettings());
+		if (0 == strcmp(gameid, o->from)) {
+			gs.gameid = gameid;
+			gs.gameid = "Obsolete game ID";
+			return gs;
+		}
 		o++;
 	}
-	return games;
+	return gs;
 }
 
+
 enum {
 	kDetectNameMethodsCount = 8
 };
@@ -3350,7 +3359,7 @@
 	// We start by checking whether the specified game ID is obsolete.
 	// If that is the case, we automaticlaly upgrade the target to use
 	// the correct new game ID (and platform, if specified).
-	const ObsoleteGameIDs *o = obsoleteGameIDsTable;
+	const ObsoleteGameID *o = obsoleteGameIDsTable;
 	while (o->from) {
 		if (!scumm_stricmp(detector->_game.gameid, o->from)) {
 			// Match found, perform upgrade

Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp	2006-02-18 11:13:08 UTC (rev 20751)
+++ scummvm/trunk/engines/simon/simon.cpp	2006-02-18 11:15:37 UTC (rev 20752)
@@ -51,15 +51,10 @@
 
 using Common::File;
 
-struct ObsoleteTargets {
+struct ObsoleteGameID {
 	const char *from;
 	const char *to;
 	Common::Platform platform;
-
-	GameSettings toGameSettings() const {
-		GameSettings dummy = { from, "Obsolete Target" };
-		return dummy;
-	}
 };
 
 /**
@@ -67,7 +62,7 @@
  * corresponding new target and platform combination.
  *
  */
-static ObsoleteTargets obsoleteTargetsTable[] = {
+static const ObsoleteGameID obsoleteGameIDsTable[] = {
 	{"simon1acorn", "simon1", Common::kPlatformAcorn},
 	{"simon1amiga", "simon1", Common::kPlatformAmiga},
 	{"simon1cd32", "simon1", Common::kPlatformAmiga},
@@ -82,27 +77,15 @@
 };
 
 static const GameSettings simonGames[] = {
-	// Simon the Sorcerer 1 & 2 (not SCUMM games)
+	// Simon the Sorcerer 1 & 2
 	{"feeble", "The Feeble Files"},
 	{"simon1", "Simon the Sorcerer 1"},
 	{"simon2", "Simon the Sorcerer 2"},
 
-	{"simon1acorn", "Simon the Sorcerer 1 (Acorn)"},
-	{"simon1amiga", "Simon the Sorcerer 1 (Amiga)"},
-	{"simon1cd32", "Simon the Sorcerer 1 Talkie (Amiga CD32)"},
-	{"simon1demo", "Simon the Sorcerer 1 (DOS Demo)"},
-	{"simon1dos", "Simon the Sorcerer 1 (DOS)"},
-	{"simon1talkie", "Simon the Sorcerer 1 Talkie"},
-	{"simon1win", "Simon the Sorcerer 1 Talkie (Windows)"},
-	{"simon2dos", "Simon the Sorcerer 2 (DOS)"},
-	{"simon2talkie", "Simon the Sorcerer 2 Talkie"},
-	{"simon2win", "Simon the Sorcerer 2 Talkie (Windows)"},
-	{"simon2mac", "Simon the Sorcerer 2 Talkie (Amiga or Mac)"},
-
 	{NULL, NULL}
 };
 
-GameList Engine_SIMON_gameList() {
+GameList Engine_SIMON_gameIDList() {
 	GameList games;
 	const GameSettings *g = simonGames;
 	while (g->gameid) {
@@ -113,12 +96,36 @@
 	return games;
 }
 
+GameSettings Engine_SIMON_findGameID(const char *gameid) {
+	// First search the list of supported game IDs.
+	const GameSettings *g = simonGames;
+	while (g->gameid) {
+		if (0 == strcmp(gameid, g->gameid))
+			return *g;
+		g++;
+	}
+
+	// If we didn't find the gameid in the main list, check if it
+	// is an obsolete game id.
+	GameSettings gs = { 0, 0 };
+	const ObsoleteGameID *o = obsoleteGameIDsTable;
+	while (o->from) {
+		if (0 == strcmp(gameid, o->from)) {
+			gs.gameid = gameid;
+			gs.gameid = "Obsolete game ID";
+			return gs;
+		}
+		o++;
+	}
+	return gs;
+}
+
 DetectedGameList Engine_SIMON_detectGames(const FSList &fslist) {
 	return Simon::GAME_ProbeGame(fslist);
 }
 
 Engine *Engine_SIMON_create(GameDetector *detector, OSystem *syst) {
-	const ObsoleteTargets *o = obsoleteTargetsTable;
+	const ObsoleteGameID *o = obsoleteGameIDsTable;
 	while (o->from) {
 		if (!scumm_stricmp(detector->_game.gameid, o->from)) {
 			detector->_game.gameid = o->to;

Modified: scummvm/trunk/engines/sky/sky.cpp
===================================================================
--- scummvm/trunk/engines/sky/sky.cpp	2006-02-18 11:13:08 UTC (rev 20751)
+++ scummvm/trunk/engines/sky/sky.cpp	2006-02-18 11:15:37 UTC (rev 20752)
@@ -80,12 +80,19 @@
 static const GameSettings skySetting =
 	{"sky", "Beneath a Steel Sky" };
 
-GameList Engine_SKY_gameList() {
+GameList Engine_SKY_gameIDList() {
 	GameList games;
 	games.push_back(skySetting);
 	return games;
 }
 
+GameSettings Engine_SKY_findGameID(const char *gameid) {
+	if (0 == strcmp(gameid, skySetting.gameid))
+		return skySetting;
+	GameSettings dummy = { 0, 0 };
+	return dummy;
+}
+
 DetectedGameList Engine_SKY_detectGames(const FSList &fslist) {
 	DetectedGameList detectedGames;
 	// Iterate over all files in the given directory

Modified: scummvm/trunk/engines/sword1/sword1.cpp
===================================================================
--- scummvm/trunk/engines/sword1/sword1.cpp	2006-02-18 11:13:08 UTC (rev 20751)
+++ scummvm/trunk/engines/sword1/sword1.cpp	2006-02-18 11:15:37 UTC (rev 20752)
@@ -66,13 +66,22 @@
 	// the engine needs several more files to work, but checking these should be sufficient
 };
 
-GameList Engine_SWORD1_gameList() {
+GameList Engine_SWORD1_gameIDList() {
 	GameList games;
 	games.push_back(sword1FullSettings);
 	games.push_back(sword1DemoSettings);
 	return games;
 }
 
+GameSettings Engine_SWORD1_findGameID(const char *gameid) {
+	if (0 == strcmp(gameid, sword1FullSettings.gameid))
+		return sword1FullSettings;
+	if (0 == strcmp(gameid, sword1DemoSettings.gameid))
+		return sword1DemoSettings;
+	GameSettings dummy = { 0, 0 };
+	return dummy;
+}
+
 void Sword1CheckDirectory(const FSList &fslist, bool *filesFound) {
 	for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
 		if (!file->isDirectory()) {

Modified: scummvm/trunk/engines/sword2/sword2.cpp
===================================================================
--- scummvm/trunk/engines/sword2/sword2.cpp	2006-02-18 11:13:08 UTC (rev 20751)
+++ scummvm/trunk/engines/sword2/sword2.cpp	2006-02-18 11:15:37 UTC (rev 20752)
@@ -63,7 +63,7 @@
 	{NULL, NULL, 0, NULL}
 };
 
-GameList Engine_SWORD2_gameList() {
+GameList Engine_SWORD2_gameIDList() {
 	const Sword2GameSettings *g = sword2_settings;
 	GameList games;
 	while (g->gameid) {
@@ -73,6 +73,16 @@
 	return games;
 }
 
+GameSettings Engine_SWORD2_findGameID(const char *gameid) {
+	const Sword2GameSettings *g = sword2_settings;
+	while (g->gameid) {
+		if (0 == strcmp(gameid, g->gameid))
+			break;
+		g++;
+	}
+	return toGameSettings(*g);
+}
+
 DetectedGameList Engine_SWORD2_detectGames(const FSList &fslist) {
 	DetectedGameList detectedGames;
 	const Sword2GameSettings *g;

Modified: scummvm/trunk/plugin.exp
===================================================================
--- scummvm/trunk/plugin.exp	2006-02-18 11:13:08 UTC (rev 20751)
+++ scummvm/trunk/plugin.exp	2006-02-18 11:15:37 UTC (rev 20752)
@@ -1,4 +1,5 @@
 _PLUGIN_createEngine
 _PLUGIN_detectGames
-_PLUGIN_getSupportedGames
+_PLUGIN_gameIDList
+_PLUGIN_findGameID
 _PLUGIN_name







More information about the Scummvm-git-logs mailing list