diff options
Diffstat (limited to 'base/main.cpp')
-rw-r--r-- | base/main.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/base/main.cpp b/base/main.cpp index d0da338e2a..20775f24db 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -32,6 +32,7 @@ */ #include "engines/engine.h" +#include "engines/metaengine.h" #include "base/commandLine.h" #include "base/plugins.h" #include "base/version.h" @@ -90,8 +91,8 @@ static bool launcherDialog(OSystem &system) { #endif // vector renderer debug } -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()); @@ -102,23 +103,26 @@ static const Plugin *detectPlugin() { ConfMan.set("gameid", gameid); // 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); + printf("User picked target '%s' (gameid '%s')...\n", ConfMan.getActiveDomainName().c_str(), gameid.c_str()); + printf(" Looking for a plugin supporting this gameid... "); + GameDescriptor game = EngineMan.findGame(gameid, &plugin); if (plugin == 0) { - printf("Failed game detection\n"); + printf("failed\n"); warning("%s is an invalid gameid. Use the --list-games option to list supported gameid", gameid.c_str()); return 0; + } else { + printf("%s\n", plugin->getName()); } // FIXME: Do we really need this one? - printf("Trying to start game '%s'\n", game.description().c_str()); + printf(" Starting '%s'\n", game.description().c_str()); return plugin; } // 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() != '/' @@ -151,7 +155,7 @@ static int runGame(const Plugin *plugin, OSystem &system, const Common::String & // Create the game engine Engine *engine = 0; - PluginError err = plugin->createInstance(&system, &engine); + PluginError err = (*plugin)->createInstance(&system, &engine); if (!engine || err != kNoError) { // TODO: Show an error dialog or so? // TODO: Also take 'err' into consideration... @@ -181,7 +185,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()) @@ -311,11 +315,11 @@ 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 - PluginManager::instance().unloadPluginsExcept(plugin); + PluginManager::instance().unloadPluginsExcept(PLUGIN_TYPE_ENGINE, plugin); // Try to run the game int result = runGame(plugin, system, specialDebug); @@ -342,7 +346,7 @@ extern "C" int scummvm_main(int argc, char *argv[]) { launcherDialog(system); } - PluginManager::instance().unloadPluginsExcept(NULL); + PluginManager::instance().unloadPlugins(); PluginManager::destroy(); Common::ConfigManager::destroy(); GUI::NewGui::destroy(); |