aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorMatthew Hoops2011-06-03 01:14:16 -0400
committerMatthew Hoops2011-06-03 01:14:16 -0400
commit224c71e483e09931ba386555ff3b436b9defe63d (patch)
tree8e6178331a7bbd3ee1be318d3fc7a7c7f478468f /base
parentd4c92983920cfe3b25a22d91e12c750e591b917e (diff)
parent547fd1bdcabcba0e741eb31100ba99ff73399d24 (diff)
downloadscummvm-rg350-224c71e483e09931ba386555ff3b436b9defe63d.tar.gz
scummvm-rg350-224c71e483e09931ba386555ff3b436b9defe63d.tar.bz2
scummvm-rg350-224c71e483e09931ba386555ff3b436b9defe63d.zip
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'base')
-rw-r--r--base/commandLine.cpp48
-rw-r--r--base/commandLine.h21
-rw-r--r--base/main.cpp3
-rw-r--r--base/plugins.h2
-rw-r--r--base/version.cpp4
5 files changed, 42 insertions, 36 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 1ca4a642c8..e34cde4779 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -23,6 +23,8 @@
// FIXME: Avoid using printf
#define FORBIDDEN_SYMBOL_EXCEPTION_printf
+#define FORBIDDEN_SYMBOL_EXCEPTION_exit
+
#include "engines/metaengine.h"
#include "base/commandLine.h"
#include "base/plugins.h"
@@ -50,7 +52,7 @@ static const char USAGE_STRING[] =
;
// DONT FIXME: DO NOT ORDER ALPHABETICALLY, THIS IS ORDERED BY IMPORTANCE/CATEGORY! :)
-#if defined(__SYMBIAN32__) || defined(__GP32__) || defined(ANDROID)
+#if defined(__SYMBIAN32__) || defined(__GP32__) || defined(ANDROID) || defined(__DS__)
static const char HELP_STRING[] = "NoUsageString"; // save more data segment space
#else
static const char HELP_STRING[] =
@@ -144,7 +146,7 @@ static void usage(const char *s, ...) {
vsnprintf(buf, STRINGBUFLEN, s, va);
va_end(va);
-#if !(defined(__GP32__) || defined (__SYMBIAN32__))
+#if !(defined(__GP32__) || defined (__SYMBIAN32__) || defined(__DS__))
printf(USAGE_STRING, s_appName, buf, s_appName, s_appName);
#endif
exit(1);
@@ -885,7 +887,8 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha
#endif // DISABLE_COMMAND_LINE
-Common::Error processSettings(Common::String &command, Common::StringMap &settings) {
+bool processSettings(Common::String &command, Common::StringMap &settings, Common::Error &err) {
+ err = Common::kNoError;
#ifndef DISABLE_COMMAND_LINE
@@ -894,33 +897,34 @@ Common::Error processSettings(Common::String &command, Common::StringMap &settin
// have been loaded.
if (command == "list-targets") {
listTargets();
- return Common::kNoError;
+ return true;
} else if (command == "list-games") {
listGames();
- return Common::kNoError;
+ return true;
} else if (command == "list-saves") {
- return listSaves(settings["list-saves"].c_str());
+ err = listSaves(settings["list-saves"].c_str());
+ return true;
} else if (command == "list-themes") {
listThemes();
- return Common::kNoError;
+ return true;
} else if (command == "version") {
printf("%s\n", gScummVMFullVersion);
printf("Features compiled in: %s\n", gScummVMFeatures);
- return Common::kNoError;
+ return true;
} else if (command == "help") {
printf(HELP_STRING, s_appName);
- return Common::kNoError;
+ return true;
}
#ifdef DETECTOR_TESTING_HACK
else if (command == "test-detector") {
runDetectorTest();
- return Common::kNoError;
+ return true;
}
#endif
#ifdef UPGRADE_ALL_TARGETS_HACK
else if (command == "upgrade-targets") {
upgradeTargets();
- return Common::kNoError;
+ return true;
}
#endif
@@ -958,26 +962,6 @@ Common::Error processSettings(Common::String &command, Common::StringMap &settin
}
- // The user can override the savepath with the SCUMMVM_SAVEPATH
- // environment variable. This is weaker than a --savepath on the
- // command line, but overrides the default savepath, hence it is
- // handled here, just before the command line gets parsed.
-#if !defined(_WIN32_WCE) && !defined(__GP32__) && !defined(ANDROID)
- if (!settings.contains("savepath")) {
- const char *dir = getenv("SCUMMVM_SAVEPATH");
- if (dir && *dir && strlen(dir) < MAXPATHLEN) {
- Common::FSNode saveDir(dir);
- if (!saveDir.exists()) {
- warning("Non-existent SCUMMVM_SAVEPATH save path. It will be ignored");
- } else if (!saveDir.isWritable()) {
- warning("Non-writable SCUMMVM_SAVEPATH save path. It will be ignored");
- } else {
- settings["savepath"] = dir;
- }
- }
- }
-#endif
-
// Finally, store the command line settings into the config manager.
for (Common::StringMap::const_iterator x = settings.begin(); x != settings.end(); ++x) {
Common::String key(x->_key);
@@ -992,7 +976,7 @@ Common::Error processSettings(Common::String &command, Common::StringMap &settin
ConfMan.set(key, value, Common::ConfigManager::kTransientDomain);
}
- return Common::kArgumentNotProcessed;
+ return false;
}
} // End of namespace Base
diff --git a/base/commandLine.h b/base/commandLine.h
index 4e611d97bf..2798ab0934 100644
--- a/base/commandLine.h
+++ b/base/commandLine.h
@@ -32,9 +32,28 @@ class String;
namespace Base {
+/**
+ * Register various defaults with the ConfigManager.
+ */
void registerDefaults();
+
+/**
+ * Parse the command line for options and a command; the options
+ * are stored in the map 'settings, the command (if any) is returned.
+ */
Common::String parseCommandLine(Common::StringMap &settings, int argc, const char * const *argv);
-Common::Error processSettings(Common::String &command, Common::StringMap &settings);
+
+/**
+ * Process the command line options and arguments.
+ * Returns true if everything was handled and ScummVM should quit
+ * (e.g. because "--help" was specified, and handled).
+ *
+ * @param[in] command the command as returned by parseCommandLine
+ * @param[in] settings the settings as returned by parseCommandLine
+ * @param[out] err indicates whether any error occurred, and which
+ * @return true if the command was completely processed and ScummVM should quit, false otherwise
+ */
+bool processSettings(Common::String &command, Common::StringMap &settings, Common::Error &err);
} // End of namespace Base
diff --git a/base/main.cpp b/base/main.cpp
index 4ed70a5587..906f4c9242 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -349,8 +349,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
Common::Error res;
// TODO: deal with settings that require plugins to be loaded
- res = Base::processSettings(command, settings);
- if (res.getCode() != Common::kArgumentNotProcessed) {
+ if (Base::processSettings(command, settings, res)) {
if (res.getCode() != Common::kNoError)
warning("%s", res.getDesc().c_str());
return res.getCode();
diff --git a/base/plugins.h b/base/plugins.h
index 247564171d..a1ae734159 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -80,7 +80,7 @@ extern int pluginTypeVersions[PLUGIN_TYPE_MAX];
(ENABLE_##ID && !PLUGIN_ENABLED_DYNAMIC(ID))
#define PLUGIN_ENABLED_DYNAMIC(ID) \
- (ENABLE_##ID && (ENABLE_##ID == DYNAMIC_PLUGIN) && DYNAMIC_MODULES)
+ (ENABLE_##ID && (ENABLE_##ID == DYNAMIC_PLUGIN) && defined(DYNAMIC_MODULES))
// see comments in backends/plugins/elf/elf-provider.cpp
#if defined(USE_ELF_LOADER) && defined(ELF_LOADER_CXA_ATEXIT)
diff --git a/base/version.cpp b/base/version.cpp
index 6a670c1a40..3083034714 100644
--- a/base/version.cpp
+++ b/base/version.cpp
@@ -112,5 +112,9 @@ const char *gScummVMFeatures = ""
#ifdef USE_THEORADEC
"Theora "
#endif
+
+#ifdef USE_FAAD
+ "AAC "
+#endif
;