aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorMatthew Hoops2011-07-20 09:27:39 -0400
committerMatthew Hoops2011-07-20 09:27:39 -0400
commitad293b249e74dd1cfbdbd721d02145efbdaf9eca (patch)
treee568d96f6d7f64c5e58b4c7cd1c4fda7e649bfc7 /base
parentd7411acc2b1c7702280dbff1c3e1bafee528184b (diff)
parente25e85fbb047fef895ede97c3c2c73451631052c (diff)
downloadscummvm-rg350-ad293b249e74dd1cfbdbd721d02145efbdaf9eca.tar.gz
scummvm-rg350-ad293b249e74dd1cfbdbd721d02145efbdaf9eca.tar.bz2
scummvm-rg350-ad293b249e74dd1cfbdbd721d02145efbdaf9eca.zip
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'base')
-rw-r--r--base/commandLine.cpp37
-rw-r--r--base/main.cpp10
-rw-r--r--base/plugins.cpp43
-rw-r--r--base/plugins.h20
-rw-r--r--base/version.cpp5
5 files changed, 63 insertions, 52 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index e34cde4779..6550f60670 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -25,6 +25,8 @@
#define FORBIDDEN_SYMBOL_EXCEPTION_exit
+#include <limits.h>
+
#include "engines/metaengine.h"
#include "base/commandLine.h"
#include "base/plugins.h"
@@ -63,6 +65,9 @@ static const char HELP_STRING[] =
" -z, --list-games Display list of supported games and exit\n"
" -t, --list-targets Display list of configured targets and exit\n"
" --list-saves=TARGET Display a list of savegames for the game (TARGET) specified\n"
+#if defined (WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
+ " --console Enable the console window (default:enabled)\n"
+#endif
"\n"
" -c, --config=CONFIG Use alternate configuration file\n"
" -p, --path=PATH Path to where the game is installed\n"
@@ -179,13 +184,15 @@ void registerDefaults() {
ConfMan.registerDefault("native_mt32", false);
ConfMan.registerDefault("enable_gs", false);
ConfMan.registerDefault("midi_gain", 100);
-// ConfMan.registerDefault("music_driver", ???);
+ ConfMan.registerDefault("music_driver", "auto");
ConfMan.registerDefault("mt32_device", "null");
ConfMan.registerDefault("gm_device", "null");
ConfMan.registerDefault("cdrom", 0);
+ ConfMan.registerDefault("enable_unsupported_game_warning", true);
+
// Game specific
ConfMan.registerDefault("path", "");
ConfMan.registerDefault("platform", Common::kPlatformPC);
@@ -227,13 +234,6 @@ void registerDefaults() {
ConfMan.registerDefault("record_temp_file_name", "record.tmp");
ConfMan.registerDefault("record_time_file_name", "record.time");
-#if 0
- // NEW CODE TO HIDE CONSOLE FOR WIN32
-#ifdef WIN32
- // console hiding for win32
- ConfMan.registerDefault("show_console", false);
-#endif
-#endif
}
//
@@ -262,17 +262,19 @@ void registerDefaults() {
if (!option) usage("Option '%s' requires an argument", argv[isLongCmd ? i : i-1]);
// Use this for options which have a required integer value
+// (we don't check ERANGE because WinCE doesn't support errno, so we're stuck just rejecting LONG_MAX/LONG_MIN..)
#define DO_OPTION_INT(shortCmd, longCmd) \
DO_OPTION(shortCmd, longCmd) \
- char *endptr = 0; \
- strtol(option, &endptr, 0); \
- if (endptr == NULL || *endptr != 0) usage("--%s: Invalid number '%s'", longCmd, option);
+ char *endptr; \
+ long int retval = strtol(option, &endptr, 0); \
+ if (*endptr != '\0' || retval == LONG_MAX || retval == LONG_MIN) \
+ usage("--%s: Invalid number '%s'", longCmd, option);
// Use this for boolean options; this distinguishes between "-x" and "-X",
// resp. between "--some-option" and "--no-some-option".
#define DO_OPTION_BOOL(shortCmd, longCmd) \
if (isLongCmd ? (!strcmp(s+2, longCmd) || !strcmp(s+2, "no-"longCmd)) : (tolower(s[1]) == shortCmd)) { \
- bool boolValue = (islower(s[1]) != 0); \
+ bool boolValue = (islower(static_cast<unsigned char>(s[1])) != 0); \
s += 2; \
if (isLongCmd) { \
boolValue = !strcmp(s, longCmd); \
@@ -548,14 +550,11 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha
END_OPTION
#endif
-#if 0
- // NEW CODE TO HIDE CONSOLE FOR WIN32
-#ifdef WIN32
- // console hiding for win32
- DO_LONG_OPTION_BOOL("show-console")
+#if defined (WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
+ // Optional console window on Windows (default: enabled)
+ DO_LONG_OPTION_BOOL("console")
END_OPTION
#endif
-#endif
unknownOption:
// If we get till here, the option is unhandled and hence unknown.
@@ -663,7 +662,7 @@ static Common::Error listSaves(const char *target) {
" ---- ------------------------------------------------------\n");
for (SaveStateList::const_iterator x = saveList.begin(); x != saveList.end(); ++x) {
- printf(" %-4s %s\n", x->save_slot().c_str(), x->description().c_str());
+ printf(" %-4d %s\n", x->getSaveSlot(), x->getDescription().c_str());
// TODO: Could also iterate over the full hashmap, printing all key-value pairs
}
} else {
diff --git a/base/main.cpp b/base/main.cpp
index 906f4c9242..717ccb3344 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -333,7 +333,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
PluginManager::instance().init();
PluginManager::instance().loadAllPlugins(); // load plugins for cached plugin manager
-
+
// If we received an invalid music parameter via command line we check this here.
// We can't check this before loading the music plugins.
// On the other hand we cannot load the plugins before we know the file paths (in case of external plugins).
@@ -385,7 +385,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
system.getAudioCDManager();
MusicManager::instance();
Common::DebugManager::instance();
-
+
// Init the event manager. As the virtual keyboard is loaded here, it must
// take place after the backend is initiated and the screen has been setup
system.getEventManager()->init();
@@ -424,10 +424,10 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
PluginManager::instance().unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false);
// reallocate the config manager to get rid of any fragmentation
ConfMan.defragment();
- #endif
-
+ #endif
+
// Did an error occur ?
- if (result.getCode() != Common::kNoError) {
+ if (result.getCode() != Common::kNoError && result.getCode() != Common::kUserCanceled) {
// Shows an informative error dialog if starting the selected game failed.
GUI::displayErrorDialog(result, _("Error running game:"));
}
diff --git a/base/plugins.cpp b/base/plugins.cpp
index de135da946..8bb91aa338 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -106,6 +106,9 @@ public:
#if PLUGIN_ENABLED_STATIC(DRASCULA)
LINK_PLUGIN(DRASCULA)
#endif
+ #if PLUGIN_ENABLED_STATIC(DREAMWEB)
+ LINK_PLUGIN(DREAMWEB)
+ #endif
#if PLUGIN_ENABLED_STATIC(GOB)
LINK_PLUGIN(GOB)
#endif
@@ -313,7 +316,7 @@ PluginManager &PluginManager::instance() {
if (_instance)
return *_instance;
-#if defined(UNCACHED_PLUGINS) && defined(DYNAMIC_MODULES)
+#if defined(UNCACHED_PLUGINS) && defined(DYNAMIC_MODULES)
_instance = new PluginManagerUncached();
#else
_instance = new PluginManager();
@@ -348,7 +351,7 @@ void PluginManager::addPluginProvider(PluginProvider *pp) {
void PluginManagerUncached::init() {
unloadAllPlugins();
_allEnginePlugins.clear();
-
+
// Resize our pluginsInMem list to prevent fragmentation
_pluginsInMem[PLUGIN_TYPE_ENGINE].resize(2);
unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false); // empty the engine plugins
@@ -357,7 +360,7 @@ void PluginManagerUncached::init() {
pp != _providers.end();
++pp) {
PluginList pl((*pp)->getPlugins());
-
+
for (PluginList::iterator p = pl.begin(); p != pl.end(); ++p) {
// This is a 'hack' based on the assumption that we have no sound
// file plugins. Currently this is the case. If it changes, we
@@ -365,15 +368,15 @@ void PluginManagerUncached::init() {
// music or an engine plugin.
if ((*pp)->isFilePluginProvider()) {
_allEnginePlugins.push_back(*p);
- } else if ((*p)->loadPlugin()) { // and this is the proper method
+ } else if ((*p)->loadPlugin()) { // and this is the proper method
if ((*p)->getType() == PLUGIN_TYPE_ENGINE) {
(*p)->unloadPlugin();
_allEnginePlugins.push_back(*p);
} else { // add non-engine plugins to the 'in-memory' list
// these won't ever get unloaded
- addToPluginsInMemList(*p);
+ addToPluginsInMemList(*p);
}
- }
+ }
}
}
}
@@ -403,7 +406,7 @@ bool PluginManagerUncached::loadPluginFromGameId(const Common::String &gameId) {
bool PluginManagerUncached::loadPluginByFileName(const Common::String &filename) {
if (filename.empty())
return false;
-
+
unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false);
PluginList::iterator i;
@@ -417,7 +420,7 @@ bool PluginManagerUncached::loadPluginByFileName(const Common::String &filename)
return false;
}
-/**
+/**
* Update the config manager with a plugin file name that we found can handle
* the game.
**/
@@ -435,7 +438,7 @@ void PluginManagerUncached::updateConfigWithFileName(const Common::String &gameI
}
}
-void PluginManagerUncached::loadFirstPlugin() {
+void PluginManagerUncached::loadFirstPlugin() {
unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false);
// let's try to find one we can load
@@ -517,7 +520,7 @@ void PluginManager::addToPluginsInMemList(Plugin *plugin) {
bool found = false;
// The plugin is valid, see if it provides the same module as an
// already loaded one and should replace it.
-
+
PluginList::iterator pl = _pluginsInMem[plugin->getType()].begin();
while (!found && pl != _pluginsInMem[plugin->getType()].end()) {
if (!strcmp(plugin->getName(), (*pl)->getName())) {
@@ -540,9 +543,11 @@ void PluginManager::addToPluginsInMemList(Plugin *plugin) {
#include "engines/metaengine.h"
+namespace Common {
DECLARE_SINGLETON(EngineManager);
+}
-/**
+/**
* This function works for both cached and uncached PluginManagers.
* For the cached version, most of the logic here will short circuit.
*
@@ -554,24 +559,24 @@ GameDescriptor EngineManager::findGame(const Common::String &gameName, const Eng
// First look for the game using the plugins in memory. This is critical
// for calls coming from inside games
- result = findGameInLoadedPlugins(gameName, plugin);
+ result = findGameInLoadedPlugins(gameName, plugin);
if (!result.gameid().empty()) {
return result;
}
-
+
// Now look for the game using the gameId. This is much faster than scanning plugin
// by plugin
if (PluginMan.loadPluginFromGameId(gameName)) {
- result = findGameInLoadedPlugins(gameName, plugin);
+ result = findGameInLoadedPlugins(gameName, plugin);
if (!result.gameid().empty()) {
return result;
}
}
-
+
// We failed to find it using the gameid. Scan the list of plugins
PluginMan.loadFirstPlugin();
do {
- result = findGameInLoadedPlugins(gameName, plugin);
+ result = findGameInLoadedPlugins(gameName, plugin);
if (!result.gameid().empty()) {
// Update with new plugin file name
PluginMan.updateConfigWithFileName(gameName);
@@ -582,7 +587,7 @@ GameDescriptor EngineManager::findGame(const Common::String &gameName, const Eng
return result;
}
-/**
+/**
* Find the game within the plugins loaded in memory
**/
GameDescriptor EngineManager::findGameInLoadedPlugins(const Common::String &gameName, const EnginePlugin **plugin) const {
@@ -594,7 +599,7 @@ GameDescriptor EngineManager::findGameInLoadedPlugins(const Common::String &game
*plugin = 0;
EnginePlugin::List::const_iterator iter;
-
+
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
result = (**iter)->findGame(gameName.c_str());
if (!result.gameid().empty()) {
@@ -631,7 +636,9 @@ const EnginePlugin::List &EngineManager::getPlugins() const {
#include "audio/musicplugin.h"
+namespace Common {
DECLARE_SINGLETON(MusicManager);
+}
const MusicPlugin::List &MusicManager::getPlugins() const {
return (const MusicPlugin::List &)PluginManager::instance().getPlugins(PLUGIN_TYPE_MUSIC);
diff --git a/base/plugins.h b/base/plugins.h
index a1ae734159..fffb5fb910 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -143,7 +143,7 @@ extern int pluginTypeVersions[PLUGIN_TYPE_MAX];
// Abstract plugins
/**
- * Abstract base class for the plugin objects which handle plugins
+ * Abstract base class for the plugin objects which handle plugins
* instantiation. Subclasses for this may be used for engine plugins and other
* types of plugins. An existing PluginObject refers to an executable file
* loaded in memory and ready to run. The plugin, on the other hand, is just
@@ -310,7 +310,7 @@ protected:
bool tryLoadPlugin(Plugin *plugin);
void addToPluginsInMemList(Plugin *plugin);
-
+
static PluginManager *_instance;
PluginManager();
@@ -326,9 +326,9 @@ public:
virtual void init() {}
virtual void loadFirstPlugin() {}
virtual bool loadNextPlugin() { return false; }
- virtual bool loadPluginFromGameId(const Common::String &gameId) { return false; }
- virtual void updateConfigWithFileName(const Common::String &gameId) {}
-
+ virtual bool loadPluginFromGameId(const Common::String &gameId) { return false; }
+ virtual void updateConfigWithFileName(const Common::String &gameId) {}
+
// Functions used only by the cached PluginManager
virtual void loadAllPlugins();
void unloadAllPlugins();
@@ -338,7 +338,7 @@ public:
const PluginList &getPlugins(PluginType t) { return _pluginsInMem[t]; }
};
-/**
+/**
* Uncached version of plugin manager
* Keeps only one dynamic plugin in memory at a time
**/
@@ -349,15 +349,15 @@ protected:
PluginList::iterator _currentPlugin;
PluginManagerUncached() {}
- bool loadPluginByFileName(const Common::String &filename);
+ bool loadPluginByFileName(const Common::String &filename);
public:
virtual void init();
virtual void loadFirstPlugin();
virtual bool loadNextPlugin();
- virtual bool loadPluginFromGameId(const Common::String &gameId);
- virtual void updateConfigWithFileName(const Common::String &gameId);
-
+ virtual bool loadPluginFromGameId(const Common::String &gameId);
+ virtual void updateConfigWithFileName(const Common::String &gameId);
+
virtual void loadAllPlugins() {} // we don't allow this
};
diff --git a/base/version.cpp b/base/version.cpp
index 3083034714..c91698cba9 100644
--- a/base/version.cpp
+++ b/base/version.cpp
@@ -60,6 +60,11 @@ const char *gScummVMBuildDate = __DATE__ " " __TIME__;
const char *gScummVMVersionDate = SCUMMVM_VERSION " (" __DATE__ " " __TIME__ ")";
const char *gScummVMFullVersion = "ScummVM " SCUMMVM_VERSION " (" __DATE__ " " __TIME__ ")";
const char *gScummVMFeatures = ""
+#ifdef TAINTED_BUILD
+ // TAINTED means the build contains engines/subengines not enabled by default
+ "TAINTED "
+#endif
+
#ifdef USE_TREMOR
#ifdef USE_TREMOLO
// libTremolo is used on WinCE for better ogg performance