diff options
Diffstat (limited to 'base/commandLine.cpp')
-rw-r--r-- | base/commandLine.cpp | 69 |
1 files changed, 66 insertions, 3 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 19702ea36d..2d7b9f2d9f 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -57,7 +57,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) || defined(__DS__) +#if defined(__SYMBIAN32__) || defined(__GP32__) || defined(ANDROID) || defined(__DS__) || defined(__3DS__) static const char HELP_STRING[] = "NoUsageString"; // save more data segment space #else static const char HELP_STRING[] = @@ -68,6 +68,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 saved games for the game (TARGET) specified\n" + " --auto-detect Display a list of games from current or specified directory\n" + " and start the first one. Use --path=PATH before --auto-detect\n" + " to specify a directory.\n" #if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) " --console Enable the console window (default:enabled)\n" #endif @@ -80,6 +83,8 @@ static const char HELP_STRING[] = " -g, --gfx-mode=MODE Select graphics scaler (1x,2x,3x,2xsai,super2xsai,\n" " supereagle,advmame2x,advmame3x,hq2x,hq3x,tv2x,\n" " dotmatrix)\n" + " --filtering Force filtered graphics mode\n" + " --no-filtering Force unfiltered graphics mode\n" " --gui-theme=THEME Select GUI theme\n" " --themepath=PATH Path to where GUI themes are stored\n" " --list-themes Display list of all usable GUI themes\n" @@ -97,11 +102,13 @@ static const char HELP_STRING[] = " -d, --debuglevel=NUM Set debug verbosity level\n" " --debugflags=FLAGS Enable engine specific debug flags\n" " (separated by commas)\n" + " --debug-channels-only Show only the specified debug channels\n" " -u, --dump-scripts Enable script dumping if a directory called 'dumps'\n" " exists in the current directory\n" "\n" - " --cdrom=NUM CD drive to play CD audio from (default: 0 = first\n" - " drive)\n" + " --cdrom=DRIVE CD drive to play CD audio from; can either be a\n" + " drive, path, or numeric index (default: 0 = best\n" + " choice drive)\n" " --joystick[=NUM] Enable joystick input (default: 0 = first joystick)\n" " --platform=WORD Specify platform of game (allowed values: 2gs, 3do,\n" " acorn, amiga, atari, c64, fmtowns, nes, mac, pc, pc98,\n" @@ -137,6 +144,9 @@ static const char HELP_STRING[] = #if defined(ENABLE_SCUMM) || defined(ENABLE_GROOVIE) " --demo-mode Start demo mode of Maniac Mansion or The 7th Guest\n" #endif +#if defined(ENABLE_DIRECTOR) + " --start-movie=NAME Start movie for Director\n" +#endif #ifdef ENABLE_SCUMM " --tempo=NUM Set music tempo (in percent, 50-200) for SCUMM games\n" " (default: 100)\n" @@ -176,6 +186,7 @@ void registerDefaults() { // Graphics ConfMan.registerDefault("fullscreen", false); + ConfMan.registerDefault("filtering", false); ConfMan.registerDefault("aspect_ratio", false); ConfMan.registerDefault("gfx_mode", "normal"); ConfMan.registerDefault("render_mode", "default"); @@ -373,6 +384,12 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha // We defer checking whether this is a valid target to a later point. return s; } else { + // On MacOS X prior to 10.9 the OS is sometimes adding a -psn_X_XXXXXX argument (where X are digits) + // to pass the process serial number. We need to ignore it to avoid an error. +#ifdef MACOSX + if (strncmp(s, "-psn_", 5) == 0) + continue; +#endif bool isLongCmd = (s[0] == '-' && s[1] == '-'); @@ -388,6 +405,9 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha DO_COMMAND('z', "list-games") END_COMMAND + DO_LONG_COMMAND("auto-detect") + END_COMMAND + #ifdef DETECTOR_TESTING_HACK // HACK FIXME TODO: This command is intentionally *not* documented! DO_LONG_COMMAND("test-detector") @@ -419,6 +439,9 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha DO_LONG_OPTION("debugflags") END_OPTION + DO_LONG_OPTION_BOOL("debug-channels-only") + END_OPTION + DO_OPTION('e', "music-driver") END_OPTION @@ -431,6 +454,9 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha DO_OPTION_BOOL('f', "fullscreen") END_OPTION + DO_LONG_OPTION_BOOL("filtering") + END_OPTION + #ifdef ENABLE_EVENTRECORDER DO_LONG_OPTION_INT("disable-display") END_OPTION @@ -599,6 +625,11 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha END_OPTION #endif +#if defined(ENABLE_DIRECTOR) + DO_LONG_OPTION("start-movie") + END_OPTION +#endif + unknownOption: // If we get till here, the option is unhandled and hence unknown. usage("Unrecognized option '%s'", argv[i]); @@ -746,6 +777,34 @@ static void listAudioDevices() { } } +/** Display all games in the given directory, or current directory if empty */ +static bool autoDetect(Common::String path) { + if (path.empty()) + path = "."; + //Current directory + Common::FSNode dir(path); + + Common::FSList files; + + //Collect all files from directory + dir.getChildren(files, Common::FSNode::kListAll); + + GameList candidates(EngineMan.detectGames(files)); + if (candidates.empty()) { + printf("ScummVM could not find any game in %s\n", path.c_str()); + return false; + } + + // Print all the candidate found + printf("ID Description\n"); + printf("-------------------- ---------------------------------------------------------\n"); + for (GameList::iterator v = candidates.begin(); v != candidates.end(); ++v) { + printf("%-20s %s\n", v->gameid().c_str(), v->description().c_str()); + } + // Set the active domain to the first one to start it. + ConfMan.setActiveDomain(candidates.begin()->gameid()); + return true; +} #ifdef DETECTOR_TESTING_HACK static void runDetectorTest() { @@ -972,6 +1031,10 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo } else if (command == "help") { printf(HELP_STRING, s_appName); return true; + } else if (command == "auto-detect") { + // If auto-detects succeed, we want to return false so that the game is started + return !autoDetect(settings["path"]); + //return true; } #ifdef DETECTOR_TESTING_HACK else if (command == "test-detector") { |