aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/dc/dcmain.cpp3
-rw-r--r--base/game.h3
-rw-r--r--base/main.cpp43
-rw-r--r--base/options.cpp2
-rw-r--r--gui/launcher.cpp2
5 files changed, 20 insertions, 33 deletions
diff --git a/backends/dc/dcmain.cpp b/backends/dc/dcmain.cpp
index 83544ae7c6..4b03ec1551 100644
--- a/backends/dc/dcmain.cpp
+++ b/backends/dc/dcmain.cpp
@@ -24,7 +24,6 @@
#include <common/stdafx.h>
#include <common/scummsys.h>
#include <base/engine.h>
-#include <base/game.h>
#include <base/main.h>
#include <base/plugins.h>
#include "dc.h"
@@ -224,7 +223,7 @@ int DCLauncherDialog::runModal()
ConfMan.set("path", dir, base);
// Set the target.
- Base::setTarget(base);
+ ConfMan.setActiveDomain(base);
return 0;
}
diff --git a/base/game.h b/base/game.h
index 066781bdf6..cdafb2f2ca 100644
--- a/base/game.h
+++ b/base/game.h
@@ -61,9 +61,6 @@ namespace Base {
// TODO: Find a better place for this function.
GameDescriptor findGame(const Common::String &gameName, const Plugin **plugin = NULL);
-// TODO: Find a better place for this function.
-void setTarget(const Common::String &name);
-
} // End of namespace Base
diff --git a/base/main.cpp b/base/main.cpp
index cdf7a5ca87..01c2031fcc 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -84,18 +84,6 @@ GameDescriptor findGame(const Common::String &gameName, const Plugin **plugin) {
return result;
}
-// TODO: Find a better place for this function.
-void setTarget(const Common::String &target) {
- ConfMan.setActiveDomain(target);
-
- // Make sure the gameid is set in the config manager, and that it is lowercase.
- Common::String gameid(target);
- if (ConfMan.hasKey("gameid"))
- gameid = ConfMan.get("gameid");
- gameid.toLowercase();
- ConfMan.set("gameid", gameid);
-}
-
} // End of namespace Base
@@ -157,14 +145,18 @@ static bool launcherDialog(OSystem &system) {
static const Plugin *detectMain() {
const Plugin *plugin = 0;
-
- if (ConfMan.getActiveDomainName().empty()) {
- warning("No game was specified...");
- return 0;
- }
- printf("Looking for %s\n", ConfMan.get("gameid").c_str());
- GameDescriptor game = Base::findGame(ConfMan.get("gameid"), &plugin);
+ // Make sure the gameid is set in the config manager, and that it is lowercase.
+ Common::String gameid(ConfMan.getActiveDomainName());
+ assert(!gameid.empty());
+ if (ConfMan.hasKey("gameid"))
+ gameid = ConfMan.get("gameid");
+ gameid.toLowercase();
+ 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);
if (plugin == 0) {
printf("Failed game detection\n");
@@ -177,7 +169,6 @@ static const Plugin *detectMain() {
Common::String gameDataPath(ConfMan.get("path"));
if (gameDataPath.empty()) {
warning("No path was provided. Assuming the data files are in the current directory");
- gameDataPath = "./";
} else if (gameDataPath.lastChar() != '/'
#if defined(__MORPHOS__) || defined(__amigaos4__)
&& gameDataPath.lastChar() != ':'
@@ -275,7 +266,6 @@ static int runGame(const Plugin *plugin, OSystem &system, const Common::String &
extern "C" int scummvm_main(int argc, char *argv[]) {
Common::String specialDebug;
Common::String command;
- bool running = true;
// Verify that the backend has been initialized (i.e. g_system has been set).
assert(g_system);
@@ -348,8 +338,8 @@ extern "C" int scummvm_main(int argc, char *argv[]) {
setupDummyPalette(system);
// Unless a game was specified, show the launcher dialog
- if (ConfMan.getActiveDomainName().empty()) {
- running = launcherDialog(system);
+ if (0 == ConfMan.getActiveDomain()) {
+ launcherDialog(system);
// Discard any command line options. Those that affect the graphics
// mode etc. already have should have been handled by the backend at
@@ -361,7 +351,7 @@ extern "C" int scummvm_main(int argc, char *argv[]) {
// FIXME: We're now looping the launcher. This, of course, doesn't
// work as well as it should. In theory everything should be destroyed
// cleanly, so this is now enabled to encourage people to fix bits :)
- while (running) {
+ while (0 != ConfMan.getActiveDomain()) {
// Verify the given game name is a valid supported game
const Plugin *plugin = detectMain();
if (plugin) {
@@ -377,13 +367,14 @@ extern "C" int scummvm_main(int argc, char *argv[]) {
// wanted to apply them to *all* games ever launched.
ConfMan.getDomain(Common::ConfigManager::kTransientDomain)->clear();
- // TODO: Unset the active config domain
+ // Clear the active config domain
+ ConfMan.setActiveDomain("");
// PluginManager::instance().unloadPlugins();
PluginManager::instance().loadPlugins();
}
- running = launcherDialog(system);
+ launcherDialog(system);
}
// Deinit the timer
diff --git a/base/options.cpp b/base/options.cpp
index ce6a3e3510..e01621af0a 100644
--- a/base/options.cpp
+++ b/base/options.cpp
@@ -665,7 +665,7 @@ bool processSettings(Common::String &command, Common::StringMap &settings) {
// whether there is a gameid matching that name.
if (!command.empty()) {
if (ConfMan.hasGameDomain(command) || Base::findGame(command).gameid.size() > 0) {
- Base::setTarget(command);
+ ConfMan.setActiveDomain(command);
} else {
usage("Unrecognized game target '%s'", command.c_str());
}
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 26d5e38bfd..92bc6b0fc8 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -737,7 +737,7 @@ void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
case kListItemDoubleClickedCmd:
// Print out what was selected
assert(item >= 0);
- Base::setTarget(_domains[item]);
+ ConfMan.setActiveDomain(_domains[item]);
close();
break;
case kListSelectionChangedCmd: