aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--base/plugins.cpp61
-rw-r--r--base/plugins.h37
-rw-r--r--engines/gob/gob.cpp12
-rw-r--r--engines/kyra/kyra.cpp12
-rw-r--r--engines/lure/lure.cpp12
-rw-r--r--engines/queen/queen.cpp17
-rw-r--r--engines/saga/saga.cpp12
-rw-r--r--engines/scumm/scumm.cpp51
-rw-r--r--engines/simon/simon.cpp51
-rw-r--r--engines/sky/sky.cpp9
-rw-r--r--engines/sword1/sword1.cpp11
-rw-r--r--engines/sword2/sword2.cpp12
-rw-r--r--plugin.exp3
13 files changed, 207 insertions, 93 deletions
diff --git a/base/plugins.cpp b/base/plugins.cpp
index 4a9201c79e..01d9e58abb 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -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 @@ typedef DetectedGameList (*DetectFunc)(const FSList &fslist);
#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 @@ PluginRegistrator::PluginRegistrator(const char *name, GameList games, EngineFac
#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 @@ public:
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 @@ class DynamicPlugin : public Plugin {
Common::String _filename;
Common::String _name;
+ GameIDQueryFunc _qf;
EngineFactory _ef;
DetectFunc _df;
GameList _games;
@@ -128,7 +123,7 @@ class DynamicPlugin : public Plugin {
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 @@ public:
}
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 @@ bool DynamicPlugin::loadPlugin() {
_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 @@ bool DynamicPlugin::loadPlugin() {
}
void DynamicPlugin::unloadPlugin() {
-#if defined(UNIX) || defined(__DC__)
if (_dlHandle) {
+#if defined(UNIX) || defined(__DC__)
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
diff --git a/base/plugins.h b/base/plugins.h
index 311725581d..2d778e2a51 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -41,14 +41,16 @@ typedef Common::Array<GameSettings> GameList;
* 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 @@ public:
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 @@ public:
* 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 @@ public:
#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 @@ public:
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
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp
index 2fe6455480..641470a194 100644
--- a/engines/gob/gob.cpp
+++ b/engines/gob/gob.cpp
@@ -266,7 +266,7 @@ int GobEngine::init(GameDetector &detector) {
using namespace Gob;
-GameList Engine_GOB_gameList() {
+GameList Engine_GOB_gameIDList() {
GameList games;
const GameSettings *g = gob_list;
@@ -278,6 +278,16 @@ GameList Engine_GOB_gameList() {
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;
diff --git a/engines/kyra/kyra.cpp b/engines/kyra/kyra.cpp
index c6c5df604f..a54bdc0a5b 100644
--- a/engines/kyra/kyra.cpp
+++ b/engines/kyra/kyra.cpp
@@ -129,7 +129,7 @@ static Common::Language convertKyraLang(uint32 features) {
return Common::UNK_LANG;
}
-GameList Engine_KYRA_gameList() {
+GameList Engine_KYRA_gameIDList() {
GameList games;
const GameSettings *g = kyra_list;
@@ -140,6 +140,16 @@ GameList Engine_KYRA_gameList() {
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;
diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp
index 96f15a7240..181f78d444 100644
--- a/engines/lure/lure.cpp
+++ b/engines/lure/lure.cpp
@@ -73,7 +73,7 @@ static const GameSettings lure_list[] = {
{ 0, 0 }
};
-GameList Engine_LURE_gameList() {
+GameList Engine_LURE_gameIDList() {
GameList games;
const GameSettings *g = lure_list;
@@ -84,6 +84,16 @@ GameList Engine_LURE_gameList() {
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;
diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp
index d7f3a80491..a5833d017b 100644
--- a/engines/queen/queen.cpp
+++ b/engines/queen/queen.cpp
@@ -62,17 +62,20 @@ static const GameSettings queen_setting[] = {
{ 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
diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp
index 45c12f616d..4222b93b08 100644
--- a/engines/saga/saga.cpp
+++ b/engines/saga/saga.cpp
@@ -62,7 +62,7 @@ static const GameSettings saga_games[] = {
{0, 0}
};
-GameList Engine_SAGA_gameList() {
+GameList Engine_SAGA_gameIDList() {
GameList games;
const GameSettings *g = saga_games;
@@ -74,6 +74,16 @@ GameList Engine_SAGA_gameList() {
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);
}
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index c09fefc143..695a1c9bc8 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -91,15 +91,10 @@ namespace Scumm {
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 GameDescription gameDescriptions[] = {
};
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 @@ enum {
};
-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 @@ static const Common::Platform UNK = Common::kPlatformUnknown;
*
* 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 @@ int ScummEngine::generateSubstResFileName(const char *filename, char *buf, int b
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 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) {
// 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
diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp
index 2ef92cb3e1..cd9c36d564 100644
--- a/engines/simon/simon.cpp
+++ b/engines/simon/simon.cpp
@@ -51,15 +51,10 @@ extern bool isSmartphone(void);
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 @@ struct ObsoleteTargets {
* 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 ObsoleteTargets obsoleteTargetsTable[] = {
};
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 @@ GameList Engine_SIMON_gameList() {
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;
diff --git a/engines/sky/sky.cpp b/engines/sky/sky.cpp
index 71cc74dc00..30e605fe4f 100644
--- a/engines/sky/sky.cpp
+++ b/engines/sky/sky.cpp
@@ -80,12 +80,19 @@ extern bool isSmartphone(void);
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
diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp
index 689c4625c3..47b4a9e780 100644
--- a/engines/sword1/sword1.cpp
+++ b/engines/sword1/sword1.cpp
@@ -66,13 +66,22 @@ static const char *g_filesToCheck[NUM_FILES_TO_CHECK] = { // these files have to
// 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()) {
diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp
index bcc1e36e86..56ae60b7ff 100644
--- a/engines/sword2/sword2.cpp
+++ b/engines/sword2/sword2.cpp
@@ -63,7 +63,7 @@ static const Sword2GameSettings sword2_settings[] = {
{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 @@ GameList Engine_SWORD2_gameList() {
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;
diff --git a/plugin.exp b/plugin.exp
index 23f74ecafe..c169088bcd 100644
--- a/plugin.exp
+++ b/plugin.exp
@@ -1,4 +1,5 @@
_PLUGIN_createEngine
_PLUGIN_detectGames
-_PLUGIN_getSupportedGames
+_PLUGIN_gameIDList
+_PLUGIN_findGameID
_PLUGIN_name