Moved SIMON plugin interface code from simon.cpp to game.cpp
svn-id: r21180
This commit is contained in:
parent
04151343a7
commit
6b988a51bd
3 changed files with 113 additions and 109 deletions
|
@ -25,7 +25,6 @@
|
|||
#include "backends/fs/fs.h"
|
||||
|
||||
#include "base/gameDetector.h"
|
||||
#include "base/plugins.h"
|
||||
|
||||
#include "common/config-manager.h"
|
||||
#include "common/file.h"
|
||||
|
@ -51,102 +50,6 @@ extern bool isSmartphone(void);
|
|||
|
||||
using Common::File;
|
||||
|
||||
struct ObsoleteGameID {
|
||||
const char *from;
|
||||
const char *to;
|
||||
Common::Platform platform;
|
||||
};
|
||||
|
||||
/**
|
||||
* Conversion table mapping old obsolete target names to the
|
||||
* corresponding new target and platform combination.
|
||||
*
|
||||
*/
|
||||
static const ObsoleteGameID obsoleteGameIDsTable[] = {
|
||||
{"simon1acorn", "simon1", Common::kPlatformAcorn},
|
||||
{"simon1amiga", "simon1", Common::kPlatformAmiga},
|
||||
{"simon1cd32", "simon1", Common::kPlatformAmiga},
|
||||
{"simon1dos", "simon1", Common::kPlatformPC},
|
||||
{"simon1talkie", "simon1", Common::kPlatformPC},
|
||||
{"simon1win", "simon1", Common::kPlatformWindows},
|
||||
{"simon2dos", "simon2", Common::kPlatformPC},
|
||||
{"simon2talkie", "simon2", Common::kPlatformPC},
|
||||
{"simon2mac", "simon2", Common::kPlatformMacintosh},
|
||||
{"simon2win", "simon2", Common::kPlatformWindows},
|
||||
{NULL, NULL, Common::kPlatformUnknown}
|
||||
};
|
||||
|
||||
static const PlainGameDescriptor simonGames[] = {
|
||||
// Simon the Sorcerer 1 & 2
|
||||
{"feeble", "The Feeble Files"},
|
||||
{"simon1", "Simon the Sorcerer 1"},
|
||||
{"simon2", "Simon the Sorcerer 2"},
|
||||
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
GameList Engine_SIMON_gameIDList() {
|
||||
GameList games;
|
||||
const PlainGameDescriptor *g = simonGames;
|
||||
while (g->gameid) {
|
||||
games.push_back(*g);
|
||||
g++;
|
||||
}
|
||||
|
||||
return games;
|
||||
}
|
||||
|
||||
GameDescriptor Engine_SIMON_findGameID(const char *gameid) {
|
||||
// First search the list of supported game IDs.
|
||||
const PlainGameDescriptor *g = simonGames;
|
||||
while (g->gameid) {
|
||||
if (0 == scumm_stricmp(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.
|
||||
GameDescriptor gs;
|
||||
const ObsoleteGameID *o = obsoleteGameIDsTable;
|
||||
while (o->from) {
|
||||
if (0 == scumm_stricmp(gameid, o->from)) {
|
||||
gs.gameid = gameid;
|
||||
gs.description = "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 ObsoleteGameID *o = obsoleteGameIDsTable;
|
||||
while (o->from) {
|
||||
if (!scumm_stricmp(detector->_gameid.c_str(), o->from)) {
|
||||
detector->_gameid = o->to;
|
||||
|
||||
ConfMan.set("gameid", o->to);
|
||||
|
||||
if (o->platform != Common::kPlatformUnknown)
|
||||
ConfMan.set("platform", Common::getPlatformCode(o->platform));
|
||||
|
||||
warning("Target upgraded from %s to %s", o->from, o->to);
|
||||
ConfMan.flushToDisk();
|
||||
break;
|
||||
}
|
||||
o++;
|
||||
}
|
||||
|
||||
return new Simon::SimonEngine(syst);
|
||||
}
|
||||
|
||||
REGISTER_PLUGIN(SIMON, "Simon the Sorcerer")
|
||||
|
||||
namespace Simon {
|
||||
|
||||
#ifdef PALMOS_68K
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue