- Added an engine plugin manager and moved engine specific functionality into it

- base/plugins.* reorganization

svn-id: r32045
This commit is contained in:
Jordi Vilalta Prat 2008-05-12 00:26:29 +00:00
parent bb03596744
commit 2c9968fe80
11 changed files with 162 additions and 144 deletions

View file

@ -77,8 +77,8 @@ static bool launcherDialog(OSystem &system) {
return (dlg.runModal() != -1);
}
static const Plugin *detectPlugin() {
const Plugin *plugin = 0;
static const EnginePlugin *detectPlugin() {
const EnginePlugin *plugin = 0;
// Make sure the gameid is set in the config manager, and that it is lowercase.
Common::String gameid(ConfMan.getActiveDomainName());
@ -90,7 +90,7 @@ static const Plugin *detectPlugin() {
// Query the plugins and find one that will handle the specified gameid
printf("Looking for %s\n", gameid.c_str());
GameDescriptor game = Base::findGame(gameid, &plugin);
GameDescriptor game = EngineMan.findGame(gameid, &plugin);
if (plugin == 0) {
printf("Failed game detection\n");
@ -105,7 +105,7 @@ static const Plugin *detectPlugin() {
}
// TODO: specify the possible return values here
static int runGame(const Plugin *plugin, OSystem &system, const Common::String &edebuglevels) {
static int runGame(const EnginePlugin *plugin, OSystem &system, const Common::String &edebuglevels) {
Common::String gameDataPath(ConfMan.get("path"));
if (gameDataPath.empty()) {
} else if (gameDataPath.lastChar() != '/'
@ -168,7 +168,7 @@ static int runGame(const Plugin *plugin, OSystem &system, const Common::String &
// Set the window caption to the game name
Common::String caption(ConfMan.get("description"));
Common::String desc = Base::findGame(ConfMan.get("gameid")).description();
Common::String desc = EngineMan.findGame(ConfMan.get("gameid")).description();
if (caption.empty() && !desc.empty())
caption = desc;
if (caption.empty())
@ -298,7 +298,7 @@ extern "C" int scummvm_main(int argc, char *argv[]) {
// cleanly, so this is now enabled to encourage people to fix bits :)
while (0 != ConfMan.getActiveDomain()) {
// Try to find a plugin which feels responsible for the specified game.
const Plugin *plugin = detectPlugin();
const EnginePlugin *plugin = detectPlugin();
if (plugin) {
// Unload all plugins not needed for this game,
// to save memory