mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
ALL: sync with scummvm
This commit is contained in:
+16
-32
@@ -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[] =
|
||||
@@ -111,7 +113,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);
|
||||
@@ -797,7 +799,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
|
||||
|
||||
@@ -806,33 +809,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", gResidualFullVersion);
|
||||
printf("Features compiled in: %s\n", gResidualFeatures);
|
||||
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
|
||||
|
||||
@@ -870,26 +874,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("RESIDUAL_SAVEPATH");
|
||||
if (dir && *dir && strlen(dir) < MAXPATHLEN) {
|
||||
Common::FSNode saveDir(dir);
|
||||
if (!saveDir.exists()) {
|
||||
warning("Non-existent RESIDUAL_SAVEPATH save path. It will be ignored.");
|
||||
} else if (!saveDir.isWritable()) {
|
||||
warning("Non-writable RESIDUAL_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);
|
||||
@@ -904,7 +888,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
|
||||
|
||||
Reference in New Issue
Block a user