2002-04-21 17:46:42 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2001 Ludvig Strigeus
|
2006-01-18 17:39:49 +00:00
|
|
|
* Copyright (C) 2001-2006 The ScummVM project
|
2002-04-21 17:46:42 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-04-21 17:46:42 +00:00
|
|
|
*
|
2006-02-11 09:53:21 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2002-04-21 17:46:42 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2003-05-29 23:13:15 +00:00
|
|
|
/*! \mainpage %ScummVM Source Reference
|
|
|
|
*
|
|
|
|
* These pages contains a cross referenced documentation for the %ScummVM source code,
|
|
|
|
* generated with Doxygen (http://www.doxygen.org) directly from the source.
|
|
|
|
* Currently not much is actually properly documented, but at least you can get an overview
|
|
|
|
* of almost all the classes, methods and variables, and how they interact.
|
|
|
|
*/
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2005-06-24 15:23:51 +00:00
|
|
|
#include "common/stdafx.h"
|
2006-05-04 23:57:49 +00:00
|
|
|
#include "backends/fs/fs.h"
|
2003-09-18 02:07:18 +00:00
|
|
|
#include "base/engine.h"
|
2006-05-04 23:29:56 +00:00
|
|
|
#include "base/options.h"
|
2003-09-17 22:41:01 +00:00
|
|
|
#include "base/plugins.h"
|
2004-02-09 01:27:27 +00:00
|
|
|
#include "base/version.h"
|
2003-10-08 21:59:23 +00:00
|
|
|
#include "common/config-manager.h"
|
2004-08-05 11:13:00 +00:00
|
|
|
#include "common/file.h"
|
2005-01-10 22:06:49 +00:00
|
|
|
#include "common/system.h"
|
2003-09-27 23:59:00 +00:00
|
|
|
#include "common/timer.h"
|
2002-09-26 12:29:10 +00:00
|
|
|
#include "gui/newgui.h"
|
|
|
|
#include "gui/message.h"
|
2004-12-14 01:02:55 +00:00
|
|
|
#include "sound/mididrv.h"
|
2002-04-12 21:26:59 +00:00
|
|
|
|
2006-04-02 09:56:11 +00:00
|
|
|
#if defined(_WIN32_WCE)
|
2005-07-30 21:11:48 +00:00
|
|
|
#include "backends/wince/CELauncherDialog.h"
|
2006-04-02 09:56:11 +00:00
|
|
|
#elif defined(__DC__)
|
2004-08-26 21:51:26 +00:00
|
|
|
#include "backends/dc/DCLauncherDialog.h"
|
2006-04-02 09:56:11 +00:00
|
|
|
#else
|
|
|
|
#include "gui/launcher.h"
|
2004-08-26 21:51:26 +00:00
|
|
|
#endif
|
|
|
|
|
2006-04-23 11:38:48 +00:00
|
|
|
|
2005-09-03 16:05:28 +00:00
|
|
|
#ifdef PALMOS_68K
|
2004-11-09 10:37:28 +00:00
|
|
|
#include "args.h"
|
|
|
|
#endif
|
|
|
|
|
2006-04-02 00:18:33 +00:00
|
|
|
#ifdef __SYMBIAN32__
|
|
|
|
#include "gui/Actions.h"
|
|
|
|
#endif
|
|
|
|
|
2006-05-04 23:24:09 +00:00
|
|
|
|
|
|
|
namespace Base {
|
|
|
|
|
|
|
|
// TODO: Find a better place for this function.
|
|
|
|
GameDescriptor findGame(const Common::String &gameName, const Plugin **plugin) {
|
|
|
|
// Find the GameDescriptor for this target
|
|
|
|
const PluginList &plugins = PluginManager::instance().getPlugins();
|
|
|
|
GameDescriptor result;
|
|
|
|
|
|
|
|
if (plugin)
|
|
|
|
*plugin = 0;
|
|
|
|
|
|
|
|
PluginList::const_iterator iter = plugins.begin();
|
|
|
|
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
|
|
|
|
result = (*iter)->findGame(gameName.c_str());
|
|
|
|
if (!result.gameid.empty()) {
|
|
|
|
if (plugin)
|
|
|
|
*plugin = *iter;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // End of namespace Base
|
|
|
|
|
|
|
|
|
2005-01-08 18:37:28 +00:00
|
|
|
static void setupDummyPalette(OSystem &system) {
|
2002-09-30 00:55:47 +00:00
|
|
|
// FIXME - mouse cursors are currently always set via 8 bit data.
|
|
|
|
// Thus for now we need to setup a dummy palette. On the long run, we might
|
2004-03-28 16:30:50 +00:00
|
|
|
// want to add a setMouseCursor_overlay() method to OSystem, which would serve
|
2002-09-30 00:55:47 +00:00
|
|
|
// two purposes:
|
|
|
|
// 1) allow for 16 bit mouse cursors in overlay mode
|
|
|
|
// 2) no need to backup & restore the mouse cursor before/after the overlay is shown
|
|
|
|
const byte dummy_palette[] = {
|
2005-07-30 21:11:48 +00:00
|
|
|
0, 0, 0, 0,
|
|
|
|
0, 0, 171, 0,
|
|
|
|
0, 171, 0, 0,
|
|
|
|
0, 171, 171, 0,
|
|
|
|
171, 0, 0, 0,
|
|
|
|
171, 0, 171, 0,
|
|
|
|
171, 87, 0, 0,
|
|
|
|
171, 171, 171, 0,
|
|
|
|
87, 87, 87, 0,
|
|
|
|
87, 87, 255, 0,
|
|
|
|
87, 255, 87, 0,
|
|
|
|
87, 255, 255, 0,
|
|
|
|
255, 87, 87, 0,
|
|
|
|
255, 87, 255, 0,
|
|
|
|
255, 255, 87, 0,
|
|
|
|
255, 255, 255, 0,
|
2002-09-30 00:55:47 +00:00
|
|
|
};
|
|
|
|
|
2005-01-01 18:53:47 +00:00
|
|
|
system.setPalette(dummy_palette, 0, 16);
|
2005-01-08 18:37:28 +00:00
|
|
|
}
|
|
|
|
|
2006-05-04 22:52:18 +00:00
|
|
|
static bool launcherDialog(OSystem &system) {
|
2005-01-08 18:37:28 +00:00
|
|
|
|
|
|
|
system.beginGFXTransaction();
|
|
|
|
// Set the user specified graphics mode (if any).
|
|
|
|
system.setGraphicsMode(ConfMan.get("gfx_mode").c_str());
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2005-03-09 23:07:32 +00:00
|
|
|
// Make GUI 640 x 400
|
2006-04-15 13:51:49 +00:00
|
|
|
system.initSize(320, 200, (ConfMan.getBool("force_1x_overlay") ? 1 : 2));
|
2005-01-08 18:37:28 +00:00
|
|
|
system.endGFXTransaction();
|
|
|
|
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2005-01-08 18:37:28 +00:00
|
|
|
// Clear the main screen
|
|
|
|
system.clearScreen();
|
|
|
|
|
|
|
|
// Setup a dummy palette, for the mouse cursor
|
|
|
|
setupDummyPalette(system);
|
2002-09-30 00:55:47 +00:00
|
|
|
|
2004-08-26 21:51:26 +00:00
|
|
|
#if defined(_WIN32_WCE)
|
2006-05-04 22:52:18 +00:00
|
|
|
CELauncherDialog dlg;
|
2004-08-26 21:51:26 +00:00
|
|
|
#elif defined(__DC__)
|
2006-05-04 22:52:18 +00:00
|
|
|
DCLauncherDialog dlg;
|
2004-08-26 21:51:26 +00:00
|
|
|
#else
|
2006-05-04 22:52:18 +00:00
|
|
|
GUI::LauncherDialog dlg;
|
2004-01-26 07:32:25 +00:00
|
|
|
#endif
|
2004-12-25 22:13:44 +00:00
|
|
|
return (dlg.runModal() != -1);
|
2002-09-30 00:55:47 +00:00
|
|
|
}
|
|
|
|
|
2006-05-04 23:24:09 +00:00
|
|
|
static const Plugin *detectMain() {
|
|
|
|
const Plugin *plugin = 0;
|
|
|
|
|
2006-05-05 00:26:03 +00:00
|
|
|
// 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);
|
2006-05-04 23:24:09 +00:00
|
|
|
|
|
|
|
if (plugin == 0) {
|
|
|
|
printf("Failed game detection\n");
|
2006-05-05 00:28:26 +00:00
|
|
|
warning("%s is an invalid gameid. Use the --list-games option to list supported gameid", gameid.c_str());
|
2006-05-04 23:24:09 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("Trying to start game '%s'\n", game.description.c_str());
|
|
|
|
|
|
|
|
Common::String gameDataPath(ConfMan.get("path"));
|
|
|
|
if (gameDataPath.empty()) {
|
|
|
|
warning("No path was provided. Assuming the data files are in the current directory");
|
|
|
|
} else if (gameDataPath.lastChar() != '/'
|
|
|
|
#if defined(__MORPHOS__) || defined(__amigaos4__)
|
|
|
|
&& gameDataPath.lastChar() != ':'
|
|
|
|
#endif
|
|
|
|
&& gameDataPath.lastChar() != '\\') {
|
|
|
|
gameDataPath += '/';
|
|
|
|
ConfMan.set("path", gameDataPath, Common::ConfigManager::kTransientDomain);
|
|
|
|
}
|
|
|
|
|
|
|
|
return plugin;
|
|
|
|
}
|
|
|
|
|
2006-04-15 20:36:41 +00:00
|
|
|
static int runGame(const Plugin *plugin, OSystem &system, const Common::String &edebuglevels) {
|
2006-03-25 04:17:17 +00:00
|
|
|
// We add it here, so MD5-based detection will be able to
|
|
|
|
// read mixed case files
|
2006-04-25 23:07:59 +00:00
|
|
|
if (ConfMan.hasKey("path")) {
|
2006-04-26 08:36:55 +00:00
|
|
|
Common::String path(ConfMan.get("path"));
|
|
|
|
FilesystemNode dir(path);
|
2006-05-03 20:49:33 +00:00
|
|
|
if (!dir.isDirectory()) {
|
2006-04-26 08:36:55 +00:00
|
|
|
warning("Game directory does not exist (%s)", path.c_str());
|
2006-04-25 23:07:59 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2006-04-26 08:36:55 +00:00
|
|
|
Common::File::addDefaultDirectory(path);
|
2006-04-25 23:07:59 +00:00
|
|
|
} else {
|
2006-04-04 23:30:41 +00:00
|
|
|
Common::File::addDefaultDirectory(".");
|
2006-04-25 23:07:59 +00:00
|
|
|
}
|
2006-03-25 04:17:17 +00:00
|
|
|
|
2005-05-05 12:03:40 +00:00
|
|
|
// Create the game engine
|
2006-04-29 00:27:20 +00:00
|
|
|
Engine *engine = 0;
|
|
|
|
PluginError err = plugin->createInstance(&system, &engine);
|
|
|
|
if (!engine || err != kNoError) {
|
2005-05-05 12:03:40 +00:00
|
|
|
// TODO: Show an error dialog or so?
|
2006-04-29 00:27:20 +00:00
|
|
|
// TODO: Also take 'err' into consideration...
|
2005-05-05 12:03:40 +00:00
|
|
|
//GUI::MessageDialog alert("ScummVM could not find any game in the specified directory!");
|
|
|
|
//alert.runModal();
|
2006-04-15 20:36:41 +00:00
|
|
|
warning("Failed to instantiate engine for target %s", ConfMan.getActiveDomainName().c_str());
|
2005-05-05 12:03:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-02-14 23:31:25 +00:00
|
|
|
// Now the engine should've set up all debug levels so we can use the command line arugments here
|
2006-02-23 18:14:41 +00:00
|
|
|
Common::enableSpecialDebugLevelList(edebuglevels);
|
2005-05-05 12:03:40 +00:00
|
|
|
|
2004-01-15 14:01:57 +00:00
|
|
|
// Set the window caption to the game name
|
2006-04-15 20:36:41 +00:00
|
|
|
Common::String caption(ConfMan.get("description"));
|
2004-01-15 14:01:57 +00:00
|
|
|
|
2006-05-04 23:24:09 +00:00
|
|
|
Common::String desc = Base::findGame(ConfMan.get("gameid")).description;
|
2006-03-28 09:42:54 +00:00
|
|
|
if (caption.empty() && !desc.empty())
|
2006-02-18 12:50:48 +00:00
|
|
|
caption = desc;
|
2006-03-28 09:42:54 +00:00
|
|
|
if (caption.empty())
|
2006-04-15 20:36:41 +00:00
|
|
|
caption = ConfMan.getActiveDomainName(); // Use the domain (=target) name
|
2006-03-28 09:42:54 +00:00
|
|
|
if (!caption.empty()) {
|
2005-01-01 18:53:47 +00:00
|
|
|
system.setWindowCaption(caption.c_str());
|
2004-01-15 14:01:57 +00:00
|
|
|
}
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2006-04-04 23:30:41 +00:00
|
|
|
if (ConfMan.hasKey("path"))
|
|
|
|
Common::File::addDefaultDirectoryRecursive(ConfMan.get("path"));
|
|
|
|
else
|
2006-04-05 06:58:18 +00:00
|
|
|
Common::File::addDefaultDirectory(".");
|
2006-03-25 04:17:17 +00:00
|
|
|
|
2004-11-23 00:03:25 +00:00
|
|
|
// Add extrapath (if any) to the directory search list
|
|
|
|
if (ConfMan.hasKey("extrapath"))
|
2006-03-25 04:17:17 +00:00
|
|
|
Common::File::addDefaultDirectoryRecursive(ConfMan.get("extrapath"));
|
2004-11-23 00:03:25 +00:00
|
|
|
|
|
|
|
if (ConfMan.hasKey("extrapath", Common::ConfigManager::kApplicationDomain))
|
2006-03-25 04:17:17 +00:00
|
|
|
Common::File::addDefaultDirectoryRecursive(ConfMan.get("extrapath", Common::ConfigManager::kApplicationDomain));
|
|
|
|
|
2006-03-25 19:30:10 +00:00
|
|
|
// As a last resort add current directory
|
|
|
|
Common::File::addDefaultDirectory(".");
|
2004-11-23 00:03:25 +00:00
|
|
|
|
|
|
|
int result;
|
|
|
|
|
2004-11-24 00:14:21 +00:00
|
|
|
// Init the engine (this might change the screen parameters
|
2006-04-15 20:36:41 +00:00
|
|
|
result = engine->init();
|
2004-02-25 08:03:31 +00:00
|
|
|
|
2004-11-23 00:03:25 +00:00
|
|
|
// Run the game engine if the initialization was successful.
|
|
|
|
if (result == 0) {
|
|
|
|
result = engine->go();
|
|
|
|
}
|
2004-01-15 14:01:57 +00:00
|
|
|
|
2006-02-14 23:31:25 +00:00
|
|
|
// We clear all debug levels again even though the engine should do it
|
|
|
|
Common::clearAllSpecialDebugLevels();
|
|
|
|
|
2004-01-15 14:01:57 +00:00
|
|
|
// Free up memory
|
|
|
|
delete engine;
|
2004-06-20 19:23:04 +00:00
|
|
|
|
|
|
|
// Stop all sound processing now (this prevents some race conditions later on)
|
2005-01-01 18:53:47 +00:00
|
|
|
system.clearSoundCallback();
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2006-04-01 21:52:33 +00:00
|
|
|
// Reset the file/directory mappings
|
|
|
|
Common::File::resetDefaultDirectories();
|
|
|
|
|
2004-11-23 00:03:25 +00:00
|
|
|
return result;
|
2004-03-16 23:51:41 +00:00
|
|
|
}
|
2004-01-15 14:01:57 +00:00
|
|
|
|
2006-04-02 00:08:22 +00:00
|
|
|
extern "C" int scummvm_main(int argc, char *argv[]) {
|
2006-04-02 20:27:56 +00:00
|
|
|
Common::String specialDebug;
|
2006-04-02 21:06:49 +00:00
|
|
|
Common::String command;
|
2002-05-14 11:32:16 +00:00
|
|
|
|
2006-04-02 20:27:56 +00:00
|
|
|
// Verify that the backend has been initialized (i.e. g_system has been set).
|
2006-04-02 14:16:31 +00:00
|
|
|
assert(g_system);
|
|
|
|
OSystem &system = *g_system;
|
2006-05-04 22:55:15 +00:00
|
|
|
|
|
|
|
// Register config manager defaults
|
2006-05-04 23:37:50 +00:00
|
|
|
Base::registerDefaults();
|
2006-04-02 14:16:31 +00:00
|
|
|
|
2006-04-02 20:27:56 +00:00
|
|
|
// Parse the command line
|
|
|
|
Common::StringMap settings;
|
2006-05-04 23:37:50 +00:00
|
|
|
command = Base::parseCommandLine(settings, argc, argv);
|
2006-05-05 00:00:39 +00:00
|
|
|
#ifdef PALMOS_68K
|
|
|
|
ArgsFree(argv);
|
|
|
|
#endif
|
2006-04-02 14:16:31 +00:00
|
|
|
|
2006-04-02 20:27:56 +00:00
|
|
|
// Load the config file (possibly overriden via command line):
|
|
|
|
if (settings.contains("config")) {
|
|
|
|
ConfMan.loadConfigFile(settings["config"]);
|
|
|
|
settings.erase("config");
|
|
|
|
} else {
|
2004-12-25 19:03:13 +00:00
|
|
|
ConfMan.loadDefaultConfigFile();
|
2006-04-02 20:27:56 +00:00
|
|
|
}
|
2004-02-07 04:53:59 +00:00
|
|
|
|
2006-04-02 21:38:36 +00:00
|
|
|
// Update the config file
|
|
|
|
ConfMan.set("versioninfo", gScummVMVersion, Common::ConfigManager::kApplicationDomain);
|
|
|
|
|
2006-05-05 00:03:21 +00:00
|
|
|
|
|
|
|
// Load and setup the debuglevel and the debug flags. We do this at the
|
|
|
|
// soonest possible moment to ensure debug output starts early on, if
|
|
|
|
// requested.
|
2006-04-02 21:32:23 +00:00
|
|
|
if (settings.contains("debuglevel")) {
|
|
|
|
gDebugLevel = (int)strtol(settings["debuglevel"].c_str(), 0, 10);
|
|
|
|
printf("Debuglevel (from command line): %d\n", gDebugLevel);
|
|
|
|
settings.erase("debuglevel"); // This option should not be passed to ConfMan.
|
|
|
|
} else if (ConfMan.hasKey("debuglevel"))
|
2005-04-23 13:52:27 +00:00
|
|
|
gDebugLevel = ConfMan.getInt("debuglevel");
|
2004-12-27 21:54:20 +00:00
|
|
|
|
2006-04-02 20:27:56 +00:00
|
|
|
if (settings.contains("debugflags")) {
|
|
|
|
specialDebug = settings["debugflags"];
|
|
|
|
settings.erase("debugflags");
|
2006-02-14 23:31:25 +00:00
|
|
|
}
|
|
|
|
|
2006-05-05 00:03:21 +00:00
|
|
|
// Load the plugins.
|
2003-10-08 22:10:59 +00:00
|
|
|
PluginManager::instance().loadPlugins();
|
2006-04-02 21:06:49 +00:00
|
|
|
|
2006-05-04 23:57:49 +00:00
|
|
|
// Process the remaining command line settings. Must be done after the
|
|
|
|
// config file and the plugins have been loaded.
|
|
|
|
if (!Base::processSettings(command, settings))
|
2006-04-25 21:31:55 +00:00
|
|
|
return 0;
|
2005-07-05 20:22:56 +00:00
|
|
|
|
2006-04-12 19:04:10 +00:00
|
|
|
#if defined(__SYMBIAN32__) || defined(_WIN32_WCE)
|
2006-05-05 00:03:21 +00:00
|
|
|
// Init keymap support.
|
2006-05-05 00:05:38 +00:00
|
|
|
// FIXME: Fingolfin seez: Now that we don't use a detector anymore, this
|
|
|
|
// could and should be moved to your OSystem::initBackend() method :-)
|
2006-04-21 20:50:28 +00:00
|
|
|
GUI::Actions::init();
|
2005-07-05 20:22:56 +00:00
|
|
|
#endif
|
|
|
|
|
2005-04-19 20:22:50 +00:00
|
|
|
// Init the backend. Must take place after all config data (including
|
|
|
|
// the command line params) was read.
|
|
|
|
system.initBackend();
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2003-10-05 13:10:28 +00:00
|
|
|
// Create the timer services
|
2005-05-10 23:17:38 +00:00
|
|
|
Common::g_timer = new Common::Timer(&system);
|
2002-04-12 21:26:59 +00:00
|
|
|
|
2002-11-14 14:20:41 +00:00
|
|
|
// Set initial window caption
|
2005-01-01 18:53:47 +00:00
|
|
|
system.setWindowCaption(gScummVMFullVersion);
|
2002-11-14 14:20:41 +00:00
|
|
|
|
2006-04-02 09:56:11 +00:00
|
|
|
// Setup a dummy palette, for the mouse cursor, in case an error
|
|
|
|
// dialog has to be shown. See bug #1097467.
|
|
|
|
setupDummyPalette(system);
|
|
|
|
|
2002-09-30 00:55:47 +00:00
|
|
|
// Unless a game was specified, show the launcher dialog
|
2006-05-05 00:26:03 +00:00
|
|
|
if (0 == ConfMan.getActiveDomain()) {
|
|
|
|
launcherDialog(system);
|
2006-04-15 13:21:02 +00:00
|
|
|
|
2006-04-15 13:12:03 +00:00
|
|
|
// Discard any command line options. Those that affect the graphics
|
|
|
|
// mode etc. already have should have been handled by the backend at
|
|
|
|
// this point. And the others (like bootparam etc.) should not
|
|
|
|
// blindly be passed to the first game launched from the launcher.
|
|
|
|
ConfMan.getDomain(Common::ConfigManager::kTransientDomain)->clear();
|
|
|
|
}
|
2002-09-30 00:55:47 +00:00
|
|
|
|
2004-10-10 16:31:15 +00:00
|
|
|
// 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 :)
|
2006-05-05 00:26:03 +00:00
|
|
|
while (0 != ConfMan.getActiveDomain()) {
|
2004-01-15 14:01:57 +00:00
|
|
|
// Verify the given game name is a valid supported game
|
2006-05-04 23:24:09 +00:00
|
|
|
const Plugin *plugin = detectMain();
|
2006-04-15 16:37:48 +00:00
|
|
|
if (plugin) {
|
2004-08-29 19:08:08 +00:00
|
|
|
// Unload all plugins not needed for this game,
|
|
|
|
// to save memory
|
2006-04-15 16:37:48 +00:00
|
|
|
PluginManager::instance().unloadPluginsExcept(plugin);
|
2004-08-29 19:08:08 +00:00
|
|
|
|
2006-04-15 20:36:41 +00:00
|
|
|
int result = runGame(plugin, system, specialDebug);
|
2004-12-05 17:35:24 +00:00
|
|
|
if (result == 0)
|
|
|
|
break;
|
2003-10-05 14:37:16 +00:00
|
|
|
|
2006-04-15 13:12:03 +00:00
|
|
|
// Discard any command line options. It's unlikely that the user
|
|
|
|
// wanted to apply them to *all* games ever launched.
|
|
|
|
ConfMan.getDomain(Common::ConfigManager::kTransientDomain)->clear();
|
|
|
|
|
2006-05-05 00:26:03 +00:00
|
|
|
// Clear the active config domain
|
|
|
|
ConfMan.setActiveDomain("");
|
2004-10-13 08:49:33 +00:00
|
|
|
|
2004-08-29 19:08:08 +00:00
|
|
|
// PluginManager::instance().unloadPlugins();
|
2004-11-11 14:01:11 +00:00
|
|
|
PluginManager::instance().loadPlugins();
|
2003-10-05 14:37:16 +00:00
|
|
|
}
|
2004-11-11 14:01:11 +00:00
|
|
|
|
2006-05-05 00:26:03 +00:00
|
|
|
launcherDialog(system);
|
2004-10-10 16:31:15 +00:00
|
|
|
}
|
2003-08-19 15:03:27 +00:00
|
|
|
|
2006-04-02 14:31:23 +00:00
|
|
|
// Deinit the timer
|
2005-05-10 23:17:38 +00:00
|
|
|
delete Common::g_timer;
|
2005-01-01 18:53:47 +00:00
|
|
|
|
2002-04-12 21:26:59 +00:00
|
|
|
return 0;
|
|
|
|
}
|