aboutsummaryrefslogtreecommitdiff
path: root/base/commandLine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'base/commandLine.cpp')
-rw-r--r--base/commandLine.cpp37
1 files changed, 18 insertions, 19 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 {