2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2002-03-25 08:51:34 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2014-02-18 01:34:18 +00:00
|
|
|
*
|
2002-03-25 08:51:34 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2014-02-18 01:34:18 +00:00
|
|
|
*
|
2002-03-25 08:51:34 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-03-25 08:51:34 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-05-02 12:42:08 +00:00
|
|
|
// FIXME: Avoid using printf
|
|
|
|
#define FORBIDDEN_SYMBOL_EXCEPTION_printf
|
|
|
|
|
2011-05-23 17:36:45 +00:00
|
|
|
#define FORBIDDEN_SYMBOL_EXCEPTION_exit
|
|
|
|
|
2011-06-24 17:07:03 +00:00
|
|
|
#include <limits.h>
|
2011-06-23 08:27:54 +00:00
|
|
|
|
2008-05-13 09:30:23 +00:00
|
|
|
#include "engines/metaengine.h"
|
2006-05-09 14:16:43 +00:00
|
|
|
#include "base/commandLine.h"
|
2003-09-17 22:41:01 +00:00
|
|
|
#include "base/plugins.h"
|
2004-02-09 01:27:27 +00:00
|
|
|
#include "base/version.h"
|
2003-10-02 22:52:57 +00:00
|
|
|
|
2003-10-08 21:59:23 +00:00
|
|
|
#include "common/config-manager.h"
|
2012-02-22 14:33:29 +00:00
|
|
|
#include "common/fs.h"
|
|
|
|
#include "common/rendermode.h"
|
2005-01-10 22:06:49 +00:00
|
|
|
#include "common/system.h"
|
2011-04-24 08:34:27 +00:00
|
|
|
#include "common/textconsole.h"
|
2003-10-02 22:52:57 +00:00
|
|
|
|
2009-01-02 21:24:13 +00:00
|
|
|
#include "gui/ThemeEngine.h"
|
2009-01-02 20:21:21 +00:00
|
|
|
|
2011-11-23 16:01:04 +00:00
|
|
|
#include "audio/musicplugin.h"
|
|
|
|
|
2006-05-04 23:57:49 +00:00
|
|
|
#define DETECTOR_TESTING_HACK
|
2009-06-07 12:47:10 +00:00
|
|
|
#define UPGRADE_ALL_TARGETS_HACK
|
2006-05-04 23:57:49 +00:00
|
|
|
|
2006-05-04 23:37:50 +00:00
|
|
|
namespace Base {
|
|
|
|
|
2008-11-13 12:45:35 +00:00
|
|
|
#ifndef DISABLE_COMMAND_LINE
|
|
|
|
|
2006-04-02 17:51:04 +00:00
|
|
|
static const char USAGE_STRING[] =
|
|
|
|
"%s: %s\n"
|
|
|
|
"Usage: %s [OPTIONS]... [GAME]\n"
|
|
|
|
"\n"
|
|
|
|
"Try '%s --help' for more options.\n"
|
|
|
|
;
|
|
|
|
|
2003-11-07 02:31:44 +00:00
|
|
|
// DONT FIXME: DO NOT ORDER ALPHABETICALLY, THIS IS ORDERED BY IMPORTANCE/CATEGORY! :)
|
2016-04-06 06:12:02 +00:00
|
|
|
#if defined(__SYMBIAN32__) || defined(__GP32__) || defined(ANDROID) || defined(__DS__) || defined(__3DS__)
|
2006-04-02 17:51:04 +00:00
|
|
|
static const char HELP_STRING[] = "NoUsageString"; // save more data segment space
|
2003-04-30 12:43:56 +00:00
|
|
|
#else
|
2006-04-02 17:51:04 +00:00
|
|
|
static const char HELP_STRING[] =
|
2003-08-04 12:42:40 +00:00
|
|
|
"ScummVM - Graphical Adventure Game Interpreter\n"
|
2006-04-02 17:51:04 +00:00
|
|
|
"Usage: %s [OPTIONS]... [GAME]\n"
|
2003-10-26 13:33:49 +00:00
|
|
|
" -v, --version Display ScummVM version information and exit\n"
|
|
|
|
" -h, --help Display a brief help text and exit\n"
|
|
|
|
" -z, --list-games Display list of supported games and exit\n"
|
|
|
|
" -t, --list-targets Display list of configured targets and exit\n"
|
2014-08-19 19:15:33 +00:00
|
|
|
" --list-saves=TARGET Display a list of saved games for the game (TARGET) specified\n"
|
2016-10-29 16:49:58 +00:00
|
|
|
" --auto-detect Display a list of games from current or specified directory\n"
|
2016-11-07 19:29:40 +00:00
|
|
|
" and start the first one. Use --path=PATH before --auto-detect\n"
|
|
|
|
" to specify a directory.\n"
|
2012-03-17 21:02:16 +00:00
|
|
|
#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
|
2011-06-30 01:17:58 +00:00
|
|
|
" --console Enable the console window (default:enabled)\n"
|
|
|
|
#endif
|
2002-12-28 12:20:55 +00:00
|
|
|
"\n"
|
2004-02-07 04:53:59 +00:00
|
|
|
" -c, --config=CONFIG Use alternate configuration file\n"
|
2003-10-26 13:33:49 +00:00
|
|
|
" -p, --path=PATH Path to where the game is installed\n"
|
|
|
|
" -x, --save-slot[=NUM] Save game slot to load (default: autosave)\n"
|
|
|
|
" -f, --fullscreen Force full-screen mode\n"
|
|
|
|
" -F, --no-fullscreen Force windowed mode\n"
|
2007-05-26 12:01:33 +00:00
|
|
|
" -g, --gfx-mode=MODE Select graphics scaler (1x,2x,3x,2xsai,super2xsai,\n"
|
|
|
|
" supereagle,advmame2x,advmame3x,hq2x,hq3x,tv2x,\n"
|
|
|
|
" dotmatrix)\n"
|
2016-10-12 21:32:36 +00:00
|
|
|
" --filtering Force filtered graphics mode\n"
|
|
|
|
" --no-filtering Force unfiltered graphics mode\n"
|
2009-01-02 20:21:21 +00:00
|
|
|
" --gui-theme=THEME Select GUI theme\n"
|
2006-06-14 19:32:26 +00:00
|
|
|
" --themepath=PATH Path to where GUI themes are stored\n"
|
2009-01-02 20:36:51 +00:00
|
|
|
" --list-themes Display list of all usable GUI themes\n"
|
2003-10-26 13:33:49 +00:00
|
|
|
" -e, --music-driver=MODE Select music driver (see README for details)\n"
|
2011-11-23 16:01:04 +00:00
|
|
|
" --list-audio-devices List all available audio devices\n"
|
2003-10-26 21:08:53 +00:00
|
|
|
" -q, --language=LANG Select language (en,de,fr,it,pt,es,jp,zh,kr,se,gb,\n"
|
2004-01-06 12:28:24 +00:00
|
|
|
" hb,ru,cz)\n"
|
2003-10-26 13:33:49 +00:00
|
|
|
" -m, --music-volume=NUM Set the music volume, 0-255 (default: 192)\n"
|
|
|
|
" -s, --sfx-volume=NUM Set the sfx volume, 0-255 (default: 192)\n"
|
2004-04-06 11:50:35 +00:00
|
|
|
" -r, --speech-volume=NUM Set the speech volume, 0-255 (default: 192)\n"
|
2006-01-14 20:05:56 +00:00
|
|
|
" --midi-gain=NUM Set the gain for MIDI playback, 0-1000 (default:\n"
|
2006-10-07 21:22:32 +00:00
|
|
|
" 100) (only supported by some MIDI drivers)\n"
|
2003-12-02 08:09:14 +00:00
|
|
|
" -n, --subtitles Enable subtitles (use with games that have voice)\n"
|
2003-10-26 13:33:49 +00:00
|
|
|
" -b, --boot-param=NUM Pass number to the boot script (boot param)\n"
|
|
|
|
" -d, --debuglevel=NUM Set debug verbosity level\n"
|
2009-04-21 19:49:47 +00:00
|
|
|
" --debugflags=FLAGS Enable engine specific debug flags\n"
|
2006-02-14 23:31:25 +00:00
|
|
|
" (separated by commas)\n"
|
2016-08-13 19:04:42 +00:00
|
|
|
" --debug-channels-only Show only the specified debug channels\n"
|
2003-10-26 13:33:49 +00:00
|
|
|
" -u, --dump-scripts Enable script dumping if a directory called 'dumps'\n"
|
|
|
|
" exists in the current directory\n"
|
2002-12-28 12:20:55 +00:00
|
|
|
"\n"
|
2015-10-01 23:12:07 +00:00
|
|
|
" --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"
|
2009-04-21 19:49:47 +00:00
|
|
|
" --joystick[=NUM] Enable joystick input (default: 0 = first joystick)\n"
|
2007-03-03 12:59:48 +00:00
|
|
|
" --platform=WORD Specify platform of game (allowed values: 2gs, 3do,\n"
|
2009-01-02 20:36:51 +00:00
|
|
|
" acorn, amiga, atari, c64, fmtowns, nes, mac, pc, pc98,\n"
|
|
|
|
" pce, segacd, wii, windows)\n"
|
2014-08-19 19:15:33 +00:00
|
|
|
" --savepath=PATH Path to where saved games are stored\n"
|
2007-10-28 11:27:00 +00:00
|
|
|
" --extrapath=PATH Extra path to additional game data\n"
|
2005-04-13 12:36:19 +00:00
|
|
|
" --soundfont=FILE Select the SoundFont for MIDI playback (only\n"
|
2005-04-13 00:11:49 +00:00
|
|
|
" supported by some MIDI drivers)\n"
|
2009-05-13 21:02:50 +00:00
|
|
|
" --multi-midi Enable combination AdLib and native MIDI\n"
|
2003-10-26 13:33:49 +00:00
|
|
|
" --native-mt32 True Roland MT-32 (disable GM emulation)\n"
|
2005-04-13 00:11:49 +00:00
|
|
|
" --enable-gs Enable Roland GS mode for MIDI playback\n"
|
2004-07-16 10:24:29 +00:00
|
|
|
" --output-rate=RATE Select output sample rate in Hz (e.g. 22050)\n"
|
2009-05-13 21:02:50 +00:00
|
|
|
" --opl-driver=DRIVER Select AdLib (OPL) emulator (db, mame)\n"
|
2003-10-26 13:33:49 +00:00
|
|
|
" --aspect-ratio Enable aspect ratio correction\n"
|
2016-01-21 22:21:10 +00:00
|
|
|
" --render-mode=MODE Enable additional render modes (hercGreen, hercAmber,\n"
|
|
|
|
" cga, ega, vga, amiga, fmtowns, pc9821, pc9801, 2gs,\n"
|
2016-02-05 11:38:28 +00:00
|
|
|
" atari, macintosh)\n"
|
2013-05-16 21:18:09 +00:00
|
|
|
#ifdef ENABLE_EVENTRECORDER
|
|
|
|
" --record-mode=MODE Specify record mode for event recorder (record, playback,\n"
|
|
|
|
" passthrough [default])\n"
|
2013-07-05 12:42:36 +00:00
|
|
|
" --record-file-name=FILE Specify record file name\n"
|
2013-05-16 21:18:09 +00:00
|
|
|
" --disable-display Disable any gfx output. Used for headless events\n"
|
|
|
|
" playback by Event Recorder\n"
|
|
|
|
#endif
|
2002-12-28 12:20:55 +00:00
|
|
|
"\n"
|
2008-05-06 03:00:26 +00:00
|
|
|
#if defined(ENABLE_SKY) || defined(ENABLE_QUEEN)
|
2004-02-13 10:51:33 +00:00
|
|
|
" --alt-intro Use alternative intro for CD versions of Beneath a\n"
|
2004-08-14 19:11:20 +00:00
|
|
|
" Steel Sky and Flight of the Amazon Queen\n"
|
2003-10-26 13:33:49 +00:00
|
|
|
#endif
|
2004-08-14 19:11:20 +00:00
|
|
|
" --copy-protection Enable copy protection in SCUMM games, when\n"
|
|
|
|
" ScummVM disables it by default.\n"
|
2005-10-18 19:05:22 +00:00
|
|
|
" --talkspeed=NUM Set talk speed for games (default: 60)\n"
|
2008-11-14 22:37:32 +00:00
|
|
|
#if defined(ENABLE_SCUMM) || defined(ENABLE_GROOVIE)
|
|
|
|
" --demo-mode Start demo mode of Maniac Mansion or The 7th Guest\n"
|
|
|
|
#endif
|
2016-10-24 08:22:47 +00:00
|
|
|
#if defined(ENABLE_DIRECTOR)
|
|
|
|
" --start-movie=NAME Start movie for Director\n"
|
|
|
|
#endif
|
2008-05-06 03:00:26 +00:00
|
|
|
#ifdef ENABLE_SCUMM
|
2003-10-26 13:33:49 +00:00
|
|
|
" --tempo=NUM Set music tempo (in percent, 50-200) for SCUMM games\n"
|
|
|
|
" (default: 100)\n"
|
2009-09-26 09:31:05 +00:00
|
|
|
#ifdef ENABLE_SCUMM_7_8
|
|
|
|
" --dimuse-tempo=NUM Set internal Digital iMuse tempo (10 - 100) per second\n"
|
|
|
|
" (default: 10)\n"
|
|
|
|
#endif
|
2003-07-05 00:57:03 +00:00
|
|
|
#endif
|
2003-07-04 06:54:47 +00:00
|
|
|
"\n"
|
2003-10-26 21:08:53 +00:00
|
|
|
"The meaning of boolean long options can be inverted by prefixing them with\n"
|
|
|
|
"\"no-\", e.g. \"--no-aspect-ratio\".\n"
|
2002-04-12 10:34:46 +00:00
|
|
|
;
|
2003-04-30 12:43:56 +00:00
|
|
|
#endif
|
2003-03-01 22:04:48 +00:00
|
|
|
|
2006-04-11 18:19:54 +00:00
|
|
|
static const char *s_appName = "scummvm";
|
2006-04-02 20:11:50 +00:00
|
|
|
|
2013-01-02 18:28:25 +00:00
|
|
|
static void NORETURN_PRE usage(const char *s, ...) GCC_PRINTF(1, 2) NORETURN_POST;
|
2006-04-02 20:11:50 +00:00
|
|
|
|
|
|
|
static void usage(const char *s, ...) {
|
2006-04-02 17:51:04 +00:00
|
|
|
char buf[STRINGBUFLEN];
|
|
|
|
va_list va;
|
|
|
|
|
|
|
|
va_start(va, s);
|
|
|
|
vsnprintf(buf, STRINGBUFLEN, s, va);
|
|
|
|
va_end(va);
|
|
|
|
|
2012-03-17 21:02:16 +00:00
|
|
|
#if !(defined(__GP32__) || defined(__SYMBIAN32__) || defined(__DS__))
|
2007-02-03 18:09:09 +00:00
|
|
|
printf(USAGE_STRING, s_appName, buf, s_appName, s_appName);
|
2006-04-11 18:19:54 +00:00
|
|
|
#endif
|
2006-04-02 17:51:04 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
2004-12-15 12:30:58 +00:00
|
|
|
|
2008-11-13 12:45:35 +00:00
|
|
|
#endif // DISABLE_COMMAND_LINE
|
|
|
|
|
|
|
|
|
2006-05-04 23:37:50 +00:00
|
|
|
void registerDefaults() {
|
2003-05-17 03:06:16 +00:00
|
|
|
|
2003-10-08 21:59:23 +00:00
|
|
|
// Graphics
|
|
|
|
ConfMan.registerDefault("fullscreen", false);
|
2016-10-12 21:32:36 +00:00
|
|
|
ConfMan.registerDefault("filtering", false);
|
2003-10-08 21:59:23 +00:00
|
|
|
ConfMan.registerDefault("aspect_ratio", false);
|
|
|
|
ConfMan.registerDefault("gfx_mode", "normal");
|
2005-02-20 00:17:22 +00:00
|
|
|
ConfMan.registerDefault("render_mode", "default");
|
2009-08-10 18:03:54 +00:00
|
|
|
ConfMan.registerDefault("desired_screen_aspect_ratio", "auto");
|
2003-09-05 16:30:05 +00:00
|
|
|
|
2003-10-08 21:59:23 +00:00
|
|
|
// Sound & Music
|
2003-10-15 23:16:52 +00:00
|
|
|
ConfMan.registerDefault("music_volume", 192);
|
|
|
|
ConfMan.registerDefault("sfx_volume", 192);
|
2004-04-06 11:50:35 +00:00
|
|
|
ConfMan.registerDefault("speech_volume", 192);
|
2002-04-27 16:58:29 +00:00
|
|
|
|
2006-05-04 21:14:50 +00:00
|
|
|
ConfMan.registerDefault("music_mute", false);
|
|
|
|
ConfMan.registerDefault("sfx_mute", false);
|
|
|
|
ConfMan.registerDefault("speech_mute", false);
|
2010-01-09 19:32:39 +00:00
|
|
|
ConfMan.registerDefault("mute", false);
|
2006-05-04 21:14:50 +00:00
|
|
|
|
2003-10-08 21:59:23 +00:00
|
|
|
ConfMan.registerDefault("multi_midi", false);
|
|
|
|
ConfMan.registerDefault("native_mt32", false);
|
2005-04-13 00:11:49 +00:00
|
|
|
ConfMan.registerDefault("enable_gs", false);
|
2006-01-14 20:05:56 +00:00
|
|
|
ConfMan.registerDefault("midi_gain", 100);
|
2002-08-18 23:29:40 +00:00
|
|
|
|
2011-07-04 15:18:08 +00:00
|
|
|
ConfMan.registerDefault("music_driver", "auto");
|
2011-03-01 10:22:19 +00:00
|
|
|
ConfMan.registerDefault("mt32_device", "null");
|
|
|
|
ConfMan.registerDefault("gm_device", "null");
|
|
|
|
|
2003-10-08 21:59:23 +00:00
|
|
|
ConfMan.registerDefault("cdrom", 0);
|
2003-10-01 10:47:19 +00:00
|
|
|
|
2011-04-25 20:26:38 +00:00
|
|
|
ConfMan.registerDefault("enable_unsupported_game_warning", true);
|
|
|
|
|
2006-01-14 20:05:56 +00:00
|
|
|
// Game specific
|
2003-10-08 21:59:23 +00:00
|
|
|
ConfMan.registerDefault("path", "");
|
2013-05-02 22:26:58 +00:00
|
|
|
ConfMan.registerDefault("platform", Common::kPlatformDOS);
|
2003-10-08 21:59:23 +00:00
|
|
|
ConfMan.registerDefault("language", "en");
|
2003-12-21 16:15:37 +00:00
|
|
|
ConfMan.registerDefault("subtitles", false);
|
2003-10-08 21:59:23 +00:00
|
|
|
ConfMan.registerDefault("boot_param", 0);
|
2006-04-15 13:50:44 +00:00
|
|
|
ConfMan.registerDefault("dump_scripts", false);
|
2003-10-08 21:59:23 +00:00
|
|
|
ConfMan.registerDefault("save_slot", -1);
|
2006-04-01 21:55:45 +00:00
|
|
|
ConfMan.registerDefault("autosave_period", 5 * 60); // By default, trigger autosave every 5 minutes
|
2003-07-05 00:57:03 +00:00
|
|
|
|
2008-05-06 03:00:26 +00:00
|
|
|
#if defined(ENABLE_SCUMM) || defined(ENABLE_SWORD2)
|
2004-08-01 06:52:56 +00:00
|
|
|
ConfMan.registerDefault("object_labels", true);
|
|
|
|
#endif
|
|
|
|
|
2003-12-11 06:08:43 +00:00
|
|
|
ConfMan.registerDefault("copy_protection", false);
|
2003-10-08 21:59:23 +00:00
|
|
|
ConfMan.registerDefault("talkspeed", 60);
|
2005-10-18 19:05:22 +00:00
|
|
|
|
2008-11-14 22:37:32 +00:00
|
|
|
#if defined(ENABLE_SCUMM) || defined(ENABLE_GROOVIE)
|
2005-10-18 19:05:22 +00:00
|
|
|
ConfMan.registerDefault("demo_mode", false);
|
2008-11-14 22:37:32 +00:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_SCUMM
|
2003-10-08 21:59:23 +00:00
|
|
|
ConfMan.registerDefault("tempo", 0);
|
2009-09-26 09:31:05 +00:00
|
|
|
#ifdef ENABLE_SCUMM_7_8
|
|
|
|
ConfMan.registerDefault("dimuse_tempo", 10);
|
|
|
|
#endif
|
2003-07-29 12:13:39 +00:00
|
|
|
#endif
|
|
|
|
|
2008-05-06 03:00:26 +00:00
|
|
|
#if defined(ENABLE_SKY) || defined(ENABLE_QUEEN)
|
2004-02-13 10:51:33 +00:00
|
|
|
ConfMan.registerDefault("alt_intro", false);
|
2003-10-08 21:59:23 +00:00
|
|
|
#endif
|
2002-12-21 00:27:10 +00:00
|
|
|
|
2003-10-08 21:59:23 +00:00
|
|
|
// Miscellaneous
|
|
|
|
ConfMan.registerDefault("joystick_num", -1);
|
|
|
|
ConfMan.registerDefault("confirm_exit", false);
|
2005-10-18 03:52:21 +00:00
|
|
|
ConfMan.registerDefault("disable_sdl_parachute", false);
|
2002-05-07 05:12:39 +00:00
|
|
|
|
2013-05-16 21:18:09 +00:00
|
|
|
ConfMan.registerDefault("disable_display", false);
|
2007-09-19 13:55:05 +00:00
|
|
|
ConfMan.registerDefault("record_mode", "none");
|
|
|
|
ConfMan.registerDefault("record_file_name", "record.bin");
|
2010-10-24 18:34:08 +00:00
|
|
|
|
2012-06-29 14:09:28 +00:00
|
|
|
ConfMan.registerDefault("gui_saveload_chooser", "grid");
|
2012-09-26 00:11:39 +00:00
|
|
|
ConfMan.registerDefault("gui_saveload_last_pos", "0");
|
2012-12-27 14:08:54 +00:00
|
|
|
|
2013-01-27 18:11:20 +00:00
|
|
|
ConfMan.registerDefault("gui_browser_show_hidden", false);
|
|
|
|
|
2012-12-27 14:08:54 +00:00
|
|
|
#ifdef USE_FLUIDSYNTH
|
2012-12-27 20:43:33 +00:00
|
|
|
// The settings are deliberately stored the same way as in Qsynth. The
|
|
|
|
// FluidSynth music driver is responsible for transforming them into
|
|
|
|
// their appropriate values.
|
|
|
|
ConfMan.registerDefault("fluidsynth_chorus_activate", true);
|
2012-12-27 14:08:54 +00:00
|
|
|
ConfMan.registerDefault("fluidsynth_chorus_nr", 3);
|
2012-12-27 20:43:33 +00:00
|
|
|
ConfMan.registerDefault("fluidsynth_chorus_level", 100);
|
2012-12-27 14:08:54 +00:00
|
|
|
ConfMan.registerDefault("fluidsynth_chorus_speed", 30);
|
2012-12-27 20:43:33 +00:00
|
|
|
ConfMan.registerDefault("fluidsynth_chorus_depth", 80);
|
2012-12-27 14:08:54 +00:00
|
|
|
ConfMan.registerDefault("fluidsynth_chorus_waveform", "sine");
|
|
|
|
|
2012-12-27 20:43:33 +00:00
|
|
|
ConfMan.registerDefault("fluidsynth_reverb_activate", true);
|
2012-12-27 14:08:54 +00:00
|
|
|
ConfMan.registerDefault("fluidsynth_reverb_roomsize", 20);
|
|
|
|
ConfMan.registerDefault("fluidsynth_reverb_damping", 0);
|
2012-12-27 20:43:33 +00:00
|
|
|
ConfMan.registerDefault("fluidsynth_reverb_width", 1);
|
2012-12-27 14:08:54 +00:00
|
|
|
ConfMan.registerDefault("fluidsynth_reverb_level", 90);
|
|
|
|
|
|
|
|
ConfMan.registerDefault("fluidsynth_misc_interpolation", "4th");
|
|
|
|
#endif
|
2002-04-27 16:58:29 +00:00
|
|
|
}
|
|
|
|
|
2003-10-17 19:39:13 +00:00
|
|
|
//
|
|
|
|
// Various macros used by the command line parser.
|
|
|
|
//
|
|
|
|
|
2008-11-13 12:45:35 +00:00
|
|
|
#ifndef DISABLE_COMMAND_LINE
|
|
|
|
|
2005-04-22 21:49:29 +00:00
|
|
|
// Use this for options which have an *optional* value
|
2006-04-02 20:11:50 +00:00
|
|
|
#define DO_OPTION_OPT(shortCmd, longCmd, defaultVal) \
|
2006-07-22 15:16:28 +00:00
|
|
|
if (isLongCmd ? (!strcmp(s+2, longCmd) || !memcmp(s+2, longCmd"=", sizeof(longCmd"=") - 1)) : (tolower(s[1]) == shortCmd)) { \
|
2006-04-15 13:50:44 +00:00
|
|
|
s += 2; \
|
2006-07-22 15:16:28 +00:00
|
|
|
if (isLongCmd) { \
|
|
|
|
s += sizeof(longCmd) - 1; \
|
|
|
|
if (*s == '=') \
|
|
|
|
s++; \
|
|
|
|
} \
|
2006-04-02 20:29:54 +00:00
|
|
|
const char *option = s; \
|
2006-07-22 15:16:28 +00:00
|
|
|
if (*s == '\0' && !isLongCmd) { option = s2; i++; } \
|
2007-05-27 07:37:08 +00:00
|
|
|
if (!option || *option == '\0') option = defaultVal; \
|
2006-04-02 20:11:50 +00:00
|
|
|
if (option) settings[longCmd] = option;
|
2003-10-17 19:39:13 +00:00
|
|
|
|
2005-04-22 21:49:29 +00:00
|
|
|
// Use this for options which have a required (string) value
|
2003-10-17 19:39:13 +00:00
|
|
|
#define DO_OPTION(shortCmd, longCmd) \
|
2006-04-02 20:11:50 +00:00
|
|
|
DO_OPTION_OPT(shortCmd, longCmd, 0) \
|
2007-05-27 07:37:08 +00:00
|
|
|
if (!option) usage("Option '%s' requires an argument", argv[isLongCmd ? i : i-1]);
|
2003-10-17 19:39:13 +00:00
|
|
|
|
2005-04-22 21:49:29 +00:00
|
|
|
// Use this for options which have a required integer value
|
2011-06-24 17:07:03 +00:00
|
|
|
// (we don't check ERANGE because WinCE doesn't support errno, so we're stuck just rejecting LONG_MAX/LONG_MIN..)
|
2005-04-22 21:49:29 +00:00
|
|
|
#define DO_OPTION_INT(shortCmd, longCmd) \
|
2007-05-27 07:37:08 +00:00
|
|
|
DO_OPTION(shortCmd, longCmd) \
|
2011-06-23 14:34:31 +00:00
|
|
|
char *endptr; \
|
2011-06-24 17:07:03 +00:00
|
|
|
long int retval = strtol(option, &endptr, 0); \
|
|
|
|
if (*endptr != '\0' || retval == LONG_MAX || retval == LONG_MIN) \
|
2011-06-03 23:00:24 +00:00
|
|
|
usage("--%s: Invalid number '%s'", longCmd, option);
|
2005-04-22 21:49:29 +00:00
|
|
|
|
|
|
|
// Use this for boolean options; this distinguishes between "-x" and "-X",
|
|
|
|
// resp. between "--some-option" and "--no-some-option".
|
2003-10-17 19:39:13 +00:00
|
|
|
#define DO_OPTION_BOOL(shortCmd, longCmd) \
|
2012-03-15 09:40:04 +00:00
|
|
|
if (isLongCmd ? (!strcmp(s+2, longCmd) || !strcmp(s+2, "no-" longCmd)) : (tolower(s[1]) == shortCmd)) { \
|
2012-02-20 15:03:39 +00:00
|
|
|
bool boolValue = (Common::isLower(s[1]) != 0); \
|
2006-04-15 13:50:44 +00:00
|
|
|
s += 2; \
|
2003-10-17 19:39:13 +00:00
|
|
|
if (isLongCmd) { \
|
2005-04-22 21:49:29 +00:00
|
|
|
boolValue = !strcmp(s, longCmd); \
|
2012-03-15 09:40:04 +00:00
|
|
|
s += boolValue ? (sizeof(longCmd) - 1) : (sizeof("no-" longCmd) - 1); \
|
2003-10-17 19:39:13 +00:00
|
|
|
} \
|
2006-04-02 18:02:16 +00:00
|
|
|
if (*s != '\0') goto unknownOption; \
|
2006-04-02 20:11:50 +00:00
|
|
|
const char *option = boolValue ? "true" : "false"; \
|
|
|
|
settings[longCmd] = option;
|
2003-10-17 19:39:13 +00:00
|
|
|
|
2005-04-22 21:49:29 +00:00
|
|
|
// Use this for options which never have a value, i.e. for 'commands', like "--help".
|
2006-05-04 23:57:49 +00:00
|
|
|
#define DO_COMMAND(shortCmd, longCmd) \
|
2006-04-15 13:50:44 +00:00
|
|
|
if (isLongCmd ? (!strcmp(s+2, longCmd)) : (tolower(s[1]) == shortCmd)) { \
|
|
|
|
s += 2; \
|
2003-10-17 19:39:13 +00:00
|
|
|
if (isLongCmd) \
|
|
|
|
s += sizeof(longCmd) - 1; \
|
2006-05-04 23:57:49 +00:00
|
|
|
if (*s != '\0') goto unknownOption; \
|
|
|
|
return longCmd;
|
2003-10-17 19:39:13 +00:00
|
|
|
|
|
|
|
|
2006-05-04 23:57:49 +00:00
|
|
|
#define DO_LONG_OPTION_OPT(longCmd, d) DO_OPTION_OPT(0, longCmd, d)
|
|
|
|
#define DO_LONG_OPTION(longCmd) DO_OPTION(0, longCmd)
|
|
|
|
#define DO_LONG_OPTION_INT(longCmd) DO_OPTION_INT(0, longCmd)
|
|
|
|
#define DO_LONG_OPTION_BOOL(longCmd) DO_OPTION_BOOL(0, longCmd)
|
|
|
|
#define DO_LONG_COMMAND(longCmd) DO_COMMAND(0, longCmd)
|
2003-10-17 19:39:13 +00:00
|
|
|
|
|
|
|
// End an option handler
|
|
|
|
#define END_OPTION \
|
|
|
|
continue; \
|
|
|
|
}
|
|
|
|
|
2013-04-23 22:40:46 +00:00
|
|
|
// End an option handler
|
|
|
|
#define END_COMMAND \
|
|
|
|
}
|
|
|
|
|
2003-11-10 23:17:11 +00:00
|
|
|
|
2009-03-21 16:07:46 +00:00
|
|
|
Common::String parseCommandLine(Common::StringMap &settings, int argc, const char * const *argv) {
|
2006-04-02 20:11:50 +00:00
|
|
|
const char *s, *s2;
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2013-01-02 18:28:25 +00:00
|
|
|
if (!argv)
|
|
|
|
return Common::String();
|
|
|
|
|
2006-04-02 20:11:50 +00:00
|
|
|
// argv[0] contains the name of the executable.
|
2013-01-02 18:28:25 +00:00
|
|
|
if (argv[0]) {
|
2006-05-04 23:59:12 +00:00
|
|
|
s = strrchr(argv[0], '/');
|
|
|
|
s_appName = s ? (s+1) : argv[0];
|
2006-04-02 20:11:50 +00:00
|
|
|
}
|
2006-04-02 17:51:04 +00:00
|
|
|
|
|
|
|
// We store all command line settings into a string map.
|
2005-04-23 14:39:15 +00:00
|
|
|
|
2006-04-02 17:51:04 +00:00
|
|
|
// Iterate over all command line arguments and parse them into our string map.
|
2006-04-02 20:11:50 +00:00
|
|
|
for (int i = 1; i < argc; ++i) {
|
|
|
|
s = argv[i];
|
|
|
|
s2 = (i < argc-1) ? argv[i+1] : 0;
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2006-04-02 17:51:04 +00:00
|
|
|
if (s[0] != '-') {
|
|
|
|
// The argument doesn't start with a dash, so it's not an option.
|
|
|
|
// Hence it must be the target name. We currently enforce that
|
|
|
|
// this always comes last.
|
|
|
|
if (i != argc - 1)
|
2006-04-02 20:11:50 +00:00
|
|
|
usage("Stray argument '%s'", s);
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2006-04-02 21:28:01 +00:00
|
|
|
// We defer checking whether this is a valid target to a later point.
|
|
|
|
return s;
|
2003-10-17 19:39:13 +00:00
|
|
|
} else {
|
2016-03-13 21:51:23 +00:00
|
|
|
// 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.
|
2017-02-06 21:54:50 +00:00
|
|
|
// When using XCode it also adds -NSDocumentRevisionsDebugMode YES argument if XCode option
|
|
|
|
// "Allow debugging when using document Versions Browser" is on (which is the default).
|
2016-03-13 21:51:23 +00:00
|
|
|
#ifdef MACOSX
|
|
|
|
if (strncmp(s, "-psn_", 5) == 0)
|
|
|
|
continue;
|
2017-02-06 21:54:50 +00:00
|
|
|
if (strcmp(s, "-NSDocumentRevisionsDebugMode") == 0) {
|
|
|
|
++i; // Also skip the YES that follows
|
|
|
|
continue;
|
|
|
|
}
|
2016-03-13 21:51:23 +00:00
|
|
|
#endif
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2006-04-02 20:11:50 +00:00
|
|
|
bool isLongCmd = (s[0] == '-' && s[1] == '-');
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2006-05-04 23:57:49 +00:00
|
|
|
DO_COMMAND('h', "help")
|
2013-04-23 22:40:46 +00:00
|
|
|
END_COMMAND
|
2006-04-02 17:51:04 +00:00
|
|
|
|
2006-05-04 23:57:49 +00:00
|
|
|
DO_COMMAND('v', "version")
|
2013-04-23 22:40:46 +00:00
|
|
|
END_COMMAND
|
2006-04-02 17:51:04 +00:00
|
|
|
|
2006-05-04 23:57:49 +00:00
|
|
|
DO_COMMAND('t', "list-targets")
|
2013-04-23 22:40:46 +00:00
|
|
|
END_COMMAND
|
2006-04-02 17:51:04 +00:00
|
|
|
|
2006-05-04 23:57:49 +00:00
|
|
|
DO_COMMAND('z', "list-games")
|
2013-04-23 22:40:46 +00:00
|
|
|
END_COMMAND
|
2006-04-02 17:51:04 +00:00
|
|
|
|
2016-03-19 14:23:44 +00:00
|
|
|
DO_LONG_COMMAND("auto-detect")
|
|
|
|
END_COMMAND
|
|
|
|
|
2009-06-07 12:47:10 +00:00
|
|
|
#ifdef DETECTOR_TESTING_HACK
|
2006-05-04 23:57:49 +00:00
|
|
|
// HACK FIXME TODO: This command is intentionally *not* documented!
|
|
|
|
DO_LONG_COMMAND("test-detector")
|
2013-04-23 22:40:46 +00:00
|
|
|
END_COMMAND
|
2009-06-07 12:47:10 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef UPGRADE_ALL_TARGETS_HACK
|
|
|
|
// HACK FIXME TODO: This command is intentionally *not* documented!
|
|
|
|
DO_LONG_COMMAND("upgrade-targets")
|
2013-04-23 22:40:46 +00:00
|
|
|
END_COMMAND
|
2009-06-07 12:47:10 +00:00
|
|
|
#endif
|
2006-04-25 21:31:55 +00:00
|
|
|
|
2008-02-04 10:15:21 +00:00
|
|
|
DO_LONG_OPTION("list-saves")
|
|
|
|
// FIXME: Need to document this.
|
2014-08-19 19:15:33 +00:00
|
|
|
// TODO: Make the argument optional. If no argument is given, list all saved games
|
2008-02-04 10:15:21 +00:00
|
|
|
// for all configured targets.
|
|
|
|
return "list-saves";
|
|
|
|
END_OPTION
|
2006-04-02 17:51:04 +00:00
|
|
|
|
2004-02-07 04:53:59 +00:00
|
|
|
DO_OPTION('c', "config")
|
|
|
|
END_OPTION
|
|
|
|
|
2005-04-22 21:49:29 +00:00
|
|
|
DO_OPTION_INT('b', "boot-param")
|
2003-10-17 19:39:13 +00:00
|
|
|
END_OPTION
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2006-04-02 20:11:50 +00:00
|
|
|
DO_OPTION_OPT('d', "debuglevel", "0")
|
2003-10-17 19:39:13 +00:00
|
|
|
END_OPTION
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2006-02-14 23:31:25 +00:00
|
|
|
DO_LONG_OPTION("debugflags")
|
|
|
|
END_OPTION
|
|
|
|
|
2016-08-13 19:04:42 +00:00
|
|
|
DO_LONG_OPTION_BOOL("debug-channels-only")
|
|
|
|
END_OPTION
|
|
|
|
|
2003-10-17 19:39:13 +00:00
|
|
|
DO_OPTION('e', "music-driver")
|
|
|
|
END_OPTION
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2011-11-23 16:01:04 +00:00
|
|
|
DO_LONG_COMMAND("list-audio-devices")
|
2013-04-23 22:40:46 +00:00
|
|
|
END_COMMAND
|
2011-11-23 16:01:04 +00:00
|
|
|
|
2005-04-22 21:49:29 +00:00
|
|
|
DO_LONG_OPTION_INT("output-rate")
|
2004-07-16 10:24:29 +00:00
|
|
|
END_OPTION
|
|
|
|
|
2003-10-17 19:39:13 +00:00
|
|
|
DO_OPTION_BOOL('f', "fullscreen")
|
|
|
|
END_OPTION
|
2016-10-24 08:22:47 +00:00
|
|
|
|
2016-10-12 21:32:36 +00:00
|
|
|
DO_LONG_OPTION_BOOL("filtering")
|
|
|
|
END_OPTION
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2013-05-16 21:18:09 +00:00
|
|
|
#ifdef ENABLE_EVENTRECORDER
|
|
|
|
DO_LONG_OPTION_INT("disable-display")
|
|
|
|
END_OPTION
|
|
|
|
|
|
|
|
DO_LONG_OPTION("record-mode")
|
|
|
|
END_OPTION
|
|
|
|
|
|
|
|
DO_LONG_OPTION("record-file-name")
|
|
|
|
END_OPTION
|
|
|
|
#endif
|
|
|
|
|
2009-05-13 20:57:37 +00:00
|
|
|
DO_LONG_OPTION("opl-driver")
|
|
|
|
END_OPTION
|
|
|
|
|
2003-10-17 19:39:13 +00:00
|
|
|
DO_OPTION('g', "gfx-mode")
|
|
|
|
END_OPTION
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2005-04-22 21:49:29 +00:00
|
|
|
DO_OPTION_INT('m', "music-volume")
|
2003-10-17 19:39:13 +00:00
|
|
|
END_OPTION
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2003-12-02 08:09:14 +00:00
|
|
|
DO_OPTION_BOOL('n', "subtitles")
|
2003-10-17 19:39:13 +00:00
|
|
|
END_OPTION
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2003-10-17 19:39:13 +00:00
|
|
|
DO_OPTION('p', "path")
|
2008-10-02 16:58:59 +00:00
|
|
|
Common::FSNode path(option);
|
2007-09-18 20:16:33 +00:00
|
|
|
if (!path.exists()) {
|
2007-06-16 17:20:46 +00:00
|
|
|
usage("Non-existent game path '%s'", option);
|
2007-09-18 20:16:33 +00:00
|
|
|
} else if (!path.isReadable()) {
|
2007-06-16 17:20:46 +00:00
|
|
|
usage("Non-readable game path '%s'", option);
|
|
|
|
}
|
2003-10-17 19:39:13 +00:00
|
|
|
END_OPTION
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2003-10-17 19:39:13 +00:00
|
|
|
DO_OPTION('q', "language")
|
2003-10-17 15:35:46 +00:00
|
|
|
if (Common::parseLanguage(option) == Common::UNK_LANG)
|
2006-04-02 20:11:50 +00:00
|
|
|
usage("Unrecognized language '%s'", option);
|
2003-10-17 19:39:13 +00:00
|
|
|
END_OPTION
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2005-04-22 21:49:29 +00:00
|
|
|
DO_OPTION_INT('s', "sfx-volume")
|
2003-10-17 19:39:13 +00:00
|
|
|
END_OPTION
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2005-04-22 21:49:29 +00:00
|
|
|
DO_OPTION_INT('r', "speech-volume")
|
2004-04-05 18:24:36 +00:00
|
|
|
END_OPTION
|
|
|
|
|
2006-01-14 20:05:56 +00:00
|
|
|
DO_LONG_OPTION_INT("midi-gain")
|
|
|
|
END_OPTION
|
|
|
|
|
2003-10-17 19:39:13 +00:00
|
|
|
DO_OPTION_BOOL('u', "dump-scripts")
|
|
|
|
END_OPTION
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2006-04-02 20:11:50 +00:00
|
|
|
DO_OPTION_OPT('x', "save-slot", "0")
|
2003-10-17 19:39:13 +00:00
|
|
|
END_OPTION
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2005-04-22 21:49:29 +00:00
|
|
|
DO_LONG_OPTION_INT("cdrom")
|
2003-10-17 19:39:13 +00:00
|
|
|
END_OPTION
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2006-04-02 20:11:50 +00:00
|
|
|
DO_LONG_OPTION_OPT("joystick", "0")
|
2007-01-24 00:07:23 +00:00
|
|
|
settings["joystick_num"] = option;
|
|
|
|
settings.erase("joystick");
|
2003-10-17 19:39:13 +00:00
|
|
|
END_OPTION
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2003-10-17 19:39:13 +00:00
|
|
|
DO_LONG_OPTION("platform")
|
|
|
|
int platform = Common::parsePlatform(option);
|
|
|
|
if (platform == Common::kPlatformUnknown)
|
2006-04-02 20:11:50 +00:00
|
|
|
usage("Unrecognized platform '%s'", option);
|
2003-10-17 19:39:13 +00:00
|
|
|
END_OPTION
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2005-04-10 14:33:44 +00:00
|
|
|
DO_LONG_OPTION("soundfont")
|
2008-10-02 16:58:59 +00:00
|
|
|
Common::FSNode path(option);
|
2007-09-18 20:16:33 +00:00
|
|
|
if (!path.exists()) {
|
2007-06-16 17:20:46 +00:00
|
|
|
usage("Non-existent soundfont path '%s'", option);
|
2007-09-18 20:16:33 +00:00
|
|
|
} else if (!path.isReadable()) {
|
2007-06-16 17:20:46 +00:00
|
|
|
usage("Non-readable soundfont path '%s'", option);
|
|
|
|
}
|
2005-04-10 14:33:44 +00:00
|
|
|
END_OPTION
|
|
|
|
|
2005-10-18 03:52:21 +00:00
|
|
|
DO_LONG_OPTION_BOOL("disable-sdl-parachute")
|
|
|
|
END_OPTION
|
|
|
|
|
2003-10-17 19:39:13 +00:00
|
|
|
DO_LONG_OPTION_BOOL("multi-midi")
|
|
|
|
END_OPTION
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2003-10-17 19:39:13 +00:00
|
|
|
DO_LONG_OPTION_BOOL("native-mt32")
|
2005-04-13 00:11:49 +00:00
|
|
|
END_OPTION
|
|
|
|
|
|
|
|
DO_LONG_OPTION_BOOL("enable-gs")
|
2003-10-17 19:39:13 +00:00
|
|
|
END_OPTION
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2003-10-17 19:39:13 +00:00
|
|
|
DO_LONG_OPTION_BOOL("aspect-ratio")
|
|
|
|
END_OPTION
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2005-02-20 00:17:22 +00:00
|
|
|
DO_LONG_OPTION("render-mode")
|
|
|
|
int renderMode = Common::parseRenderMode(option);
|
|
|
|
if (renderMode == Common::kRenderDefault)
|
2006-04-02 20:11:50 +00:00
|
|
|
usage("Unrecognized render mode '%s'", option);
|
2005-02-20 00:17:22 +00:00
|
|
|
END_OPTION
|
|
|
|
|
2004-01-29 21:54:03 +00:00
|
|
|
DO_LONG_OPTION("savepath")
|
2008-10-02 16:58:59 +00:00
|
|
|
Common::FSNode path(option);
|
2007-09-18 20:16:33 +00:00
|
|
|
if (!path.exists()) {
|
2014-08-19 19:15:33 +00:00
|
|
|
usage("Non-existent saved games path '%s'", option);
|
2007-09-18 20:16:33 +00:00
|
|
|
} else if (!path.isWritable()) {
|
2014-08-19 19:15:33 +00:00
|
|
|
usage("Non-writable saved games path '%s'", option);
|
2007-06-16 17:20:46 +00:00
|
|
|
}
|
2004-01-29 21:54:03 +00:00
|
|
|
END_OPTION
|
|
|
|
|
2007-10-28 11:27:00 +00:00
|
|
|
DO_LONG_OPTION("extrapath")
|
2008-10-02 16:58:59 +00:00
|
|
|
Common::FSNode path(option);
|
2007-10-28 11:27:00 +00:00
|
|
|
if (!path.exists()) {
|
|
|
|
usage("Non-existent extra path '%s'", option);
|
|
|
|
} else if (!path.isReadable()) {
|
|
|
|
usage("Non-readable extra path '%s'", option);
|
|
|
|
}
|
|
|
|
END_OPTION
|
|
|
|
|
2005-10-18 19:05:22 +00:00
|
|
|
DO_LONG_OPTION_INT("talkspeed")
|
|
|
|
END_OPTION
|
|
|
|
|
|
|
|
DO_LONG_OPTION_BOOL("copy-protection")
|
|
|
|
END_OPTION
|
|
|
|
|
2006-01-31 17:52:56 +00:00
|
|
|
DO_LONG_OPTION("gui-theme")
|
|
|
|
END_OPTION
|
|
|
|
|
2006-06-14 19:32:26 +00:00
|
|
|
DO_LONG_OPTION("themepath")
|
2008-10-02 16:58:59 +00:00
|
|
|
Common::FSNode path(option);
|
2007-09-18 20:16:33 +00:00
|
|
|
if (!path.exists()) {
|
2007-06-16 17:20:46 +00:00
|
|
|
usage("Non-existent theme path '%s'", option);
|
2007-09-18 20:16:33 +00:00
|
|
|
} else if (!path.isReadable()) {
|
2007-06-16 17:20:46 +00:00
|
|
|
usage("Non-readable theme path '%s'", option);
|
|
|
|
}
|
2006-06-14 19:32:26 +00:00
|
|
|
END_OPTION
|
|
|
|
|
2009-01-02 20:21:21 +00:00
|
|
|
DO_LONG_COMMAND("list-themes")
|
2013-04-23 22:40:46 +00:00
|
|
|
END_COMMAND
|
2009-01-02 20:21:21 +00:00
|
|
|
|
2006-03-26 04:22:47 +00:00
|
|
|
DO_LONG_OPTION("target-md5")
|
|
|
|
END_OPTION
|
|
|
|
|
2008-05-06 03:00:26 +00:00
|
|
|
#ifdef ENABLE_SCUMM
|
2006-04-15 13:58:01 +00:00
|
|
|
DO_LONG_OPTION_INT("tempo")
|
2003-10-17 19:39:13 +00:00
|
|
|
END_OPTION
|
2009-09-26 09:31:05 +00:00
|
|
|
#ifdef ENABLE_SCUMM_7_8
|
|
|
|
DO_LONG_OPTION_INT("dimuse-tempo")
|
|
|
|
END_OPTION
|
|
|
|
#endif
|
2008-11-14 22:37:32 +00:00
|
|
|
#endif
|
|
|
|
#if defined(ENABLE_SCUMM) || defined(ENABLE_GROOVIE)
|
2003-10-17 19:39:13 +00:00
|
|
|
DO_LONG_OPTION_BOOL("demo-mode")
|
|
|
|
END_OPTION
|
|
|
|
#endif
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2008-05-06 03:00:26 +00:00
|
|
|
#if defined(ENABLE_SKY) || defined(ENABLE_QUEEN)
|
2004-02-13 10:51:33 +00:00
|
|
|
DO_LONG_OPTION_BOOL("alt-intro")
|
2003-10-17 19:39:13 +00:00
|
|
|
END_OPTION
|
2003-07-05 00:57:03 +00:00
|
|
|
#endif
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2007-11-13 08:06:15 +00:00
|
|
|
#ifdef IPHONE
|
|
|
|
// This is automatically set when launched from the Springboard.
|
|
|
|
DO_LONG_OPTION_OPT("launchedFromSB", 0)
|
|
|
|
END_OPTION
|
|
|
|
#endif
|
2007-09-19 13:55:05 +00:00
|
|
|
|
2012-03-17 21:02:16 +00:00
|
|
|
#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
|
2011-06-30 01:17:58 +00:00
|
|
|
// Optional console window on Windows (default: enabled)
|
|
|
|
DO_LONG_OPTION_BOOL("console")
|
2010-10-24 18:34:08 +00:00
|
|
|
END_OPTION
|
|
|
|
#endif
|
|
|
|
|
2016-10-24 08:22:47 +00:00
|
|
|
#if defined(ENABLE_DIRECTOR)
|
|
|
|
DO_LONG_OPTION("start-movie")
|
|
|
|
END_OPTION
|
|
|
|
#endif
|
|
|
|
|
2006-04-02 17:51:04 +00:00
|
|
|
unknownOption:
|
2003-10-17 19:39:13 +00:00
|
|
|
// If we get till here, the option is unhandled and hence unknown.
|
2006-04-02 20:11:50 +00:00
|
|
|
usage("Unrecognized option '%s'", argv[i]);
|
2002-04-11 17:19:16 +00:00
|
|
|
}
|
|
|
|
}
|
2006-04-02 21:06:49 +00:00
|
|
|
|
2008-11-13 12:45:35 +00:00
|
|
|
return Common::String();
|
2006-04-02 20:11:50 +00:00
|
|
|
}
|
|
|
|
|
2006-05-04 23:57:49 +00:00
|
|
|
/** List all supported game IDs, i.e. all games which any loaded plugin supports. */
|
|
|
|
static void listGames() {
|
|
|
|
printf("Game ID Full Title \n"
|
|
|
|
"-------------------- ------------------------------------------------------\n");
|
|
|
|
|
2008-05-26 00:28:48 +00:00
|
|
|
const EnginePlugin::List &plugins = EngineMan.getPlugins();
|
2013-01-02 18:28:25 +00:00
|
|
|
for (EnginePlugin::List::const_iterator iter = plugins.begin(); iter != plugins.end(); ++iter) {
|
2008-05-13 09:30:23 +00:00
|
|
|
GameList list = (**iter)->getSupportedGames();
|
2006-05-04 23:57:49 +00:00
|
|
|
for (GameList::iterator v = list.begin(); v != list.end(); ++v) {
|
2007-01-20 21:27:57 +00:00
|
|
|
printf("%-20s %s\n", v->gameid().c_str(), v->description().c_str());
|
2006-05-04 23:57:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/** List all targets which are configured in the config file. */
|
|
|
|
static void listTargets() {
|
|
|
|
printf("Target Description \n"
|
|
|
|
"-------------------- ------------------------------------------------------\n");
|
|
|
|
|
2006-07-31 13:41:21 +00:00
|
|
|
using namespace Common;
|
|
|
|
const ConfigManager::DomainMap &domains = ConfMan.getGameDomains();
|
2008-02-04 10:15:21 +00:00
|
|
|
ConfigManager::DomainMap::const_iterator iter;
|
2010-10-12 21:54:43 +00:00
|
|
|
|
|
|
|
Common::Array<Common::String> targets;
|
|
|
|
targets.reserve(domains.size());
|
|
|
|
|
2006-05-04 23:57:49 +00:00
|
|
|
for (iter = domains.begin(); iter != domains.end(); ++iter) {
|
|
|
|
Common::String name(iter->_key);
|
2010-03-29 20:31:23 +00:00
|
|
|
Common::String description(iter->_value.getVal("description"));
|
2006-05-04 23:57:49 +00:00
|
|
|
|
|
|
|
if (description.empty()) {
|
|
|
|
// FIXME: At this point, we should check for a "gameid" override
|
|
|
|
// to find the proper desc. In fact, the platform probably should
|
|
|
|
// be taken into account, too.
|
|
|
|
Common::String gameid(name);
|
2008-05-12 00:26:29 +00:00
|
|
|
GameDescriptor g = EngineMan.findGame(gameid);
|
2007-01-21 00:29:03 +00:00
|
|
|
if (g.description().size() > 0)
|
|
|
|
description = g.description();
|
2006-05-04 23:57:49 +00:00
|
|
|
}
|
|
|
|
|
2010-11-01 16:02:28 +00:00
|
|
|
targets.push_back(Common::String::format("%-20s %s", name.c_str(), description.c_str()));
|
2006-05-04 23:57:49 +00:00
|
|
|
}
|
2010-10-12 21:54:43 +00:00
|
|
|
|
|
|
|
Common::sort(targets.begin(), targets.end());
|
|
|
|
|
|
|
|
for (Common::Array<Common::String>::const_iterator i = targets.begin(), end = targets.end(); i != end; ++i)
|
|
|
|
printf("%s\n", i->c_str());
|
2006-05-04 23:57:49 +00:00
|
|
|
}
|
|
|
|
|
2008-02-04 10:15:21 +00:00
|
|
|
/** List all saves states for the given target. */
|
2010-05-21 18:25:01 +00:00
|
|
|
static Common::Error listSaves(const char *target) {
|
|
|
|
Common::Error result = Common::kNoError;
|
|
|
|
|
2008-02-04 10:15:21 +00:00
|
|
|
// FIXME HACK
|
|
|
|
g_system->initBackend();
|
|
|
|
|
|
|
|
// Grab the "target" domain, if any
|
|
|
|
const Common::ConfigManager::Domain *domain = ConfMan.getDomain(target);
|
|
|
|
|
2008-10-21 16:01:06 +00:00
|
|
|
// Set up the game domain as newly active domain, so
|
|
|
|
// target specific savepath will be checked
|
|
|
|
Common::String oldDomain = ConfMan.getActiveDomainName();
|
|
|
|
ConfMan.setActiveDomain(target);
|
|
|
|
|
2008-02-04 10:15:21 +00:00
|
|
|
// Grab the gameid from the domain resp. use the target as gameid
|
|
|
|
Common::String gameid;
|
|
|
|
if (domain)
|
2010-03-29 20:31:23 +00:00
|
|
|
gameid = domain->getVal("gameid");
|
2008-02-04 10:15:21 +00:00
|
|
|
if (gameid.empty())
|
|
|
|
gameid = target;
|
|
|
|
gameid.toLowercase(); // Normalize it to lower case
|
|
|
|
|
|
|
|
// Find the plugin that will handle the specified gameid
|
2008-05-12 00:26:29 +00:00
|
|
|
const EnginePlugin *plugin = 0;
|
|
|
|
GameDescriptor game = EngineMan.findGame(gameid, &plugin);
|
2008-02-04 10:15:21 +00:00
|
|
|
|
|
|
|
if (!plugin) {
|
2011-04-18 16:19:53 +00:00
|
|
|
return Common::Error(Common::kEnginePluginNotFound,
|
|
|
|
Common::String::format("target '%s', gameid '%s", target, gameid.c_str()));
|
2008-02-04 10:15:21 +00:00
|
|
|
}
|
|
|
|
|
2010-05-03 19:18:55 +00:00
|
|
|
if (!(*plugin)->hasFeature(MetaEngine::kSupportsListSaves)) {
|
|
|
|
// TODO: Include more info about the target (desc, engine name, ...) ???
|
2011-04-18 16:19:53 +00:00
|
|
|
return Common::Error(Common::kEnginePluginNotSupportSaves,
|
|
|
|
Common::String::format("target '%s', gameid '%s", target, gameid.c_str()));
|
2010-05-03 19:18:55 +00:00
|
|
|
} else {
|
2014-08-19 19:15:33 +00:00
|
|
|
// Query the plugin for a list of saved games
|
2010-05-03 19:18:55 +00:00
|
|
|
SaveStateList saveList = (*plugin)->listSaves(target);
|
|
|
|
|
2011-04-18 16:19:53 +00:00
|
|
|
if (saveList.size() > 0) {
|
|
|
|
// TODO: Include more info about the target (desc, engine name, ...) ???
|
|
|
|
printf("Save states for target '%s' (gameid '%s'):\n", target, gameid.c_str());
|
|
|
|
printf(" Slot Description \n"
|
|
|
|
" ---- ------------------------------------------------------\n");
|
2010-05-21 18:25:01 +00:00
|
|
|
|
2011-04-18 16:19:53 +00:00
|
|
|
for (SaveStateList::const_iterator x = saveList.begin(); x != saveList.end(); ++x) {
|
2011-07-02 18:25:32 +00:00
|
|
|
printf(" %-4d %s\n", x->getSaveSlot(), x->getDescription().c_str());
|
2011-04-18 16:19:53 +00:00
|
|
|
// TODO: Could also iterate over the full hashmap, printing all key-value pairs
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
printf("There are no save states for target '%s' (gameid '%s'):\n", target, gameid.c_str());
|
2010-05-03 19:18:55 +00:00
|
|
|
}
|
2008-02-04 10:15:21 +00:00
|
|
|
}
|
2008-10-21 16:01:06 +00:00
|
|
|
|
|
|
|
// Revert to the old active domain
|
|
|
|
ConfMan.setActiveDomain(oldDomain);
|
2010-05-21 18:25:01 +00:00
|
|
|
|
|
|
|
return result;
|
2008-02-04 10:15:21 +00:00
|
|
|
}
|
|
|
|
|
2009-01-02 20:21:21 +00:00
|
|
|
/** Lists all usable themes */
|
|
|
|
static void listThemes() {
|
2009-01-02 21:24:13 +00:00
|
|
|
typedef Common::List<GUI::ThemeEngine::ThemeDescriptor> ThList;
|
2009-01-02 20:21:21 +00:00
|
|
|
ThList thList;
|
2009-01-02 21:24:13 +00:00
|
|
|
GUI::ThemeEngine::listUsableThemes(thList);
|
2009-01-02 20:21:21 +00:00
|
|
|
|
|
|
|
printf("Theme Description\n");
|
|
|
|
printf("-------------- ------------------------------------------------\n");
|
|
|
|
|
|
|
|
for (ThList::const_iterator i = thList.begin(); i != thList.end(); ++i)
|
|
|
|
printf("%-14s %s\n", i->id.c_str(), i->name.c_str());
|
|
|
|
}
|
|
|
|
|
2011-11-23 16:01:04 +00:00
|
|
|
/** Lists all output devices */
|
|
|
|
static void listAudioDevices() {
|
|
|
|
MusicPlugin::List pluginList = MusicMan.getPlugins();
|
|
|
|
|
|
|
|
printf("ID Description\n");
|
|
|
|
printf("------------------------------ ------------------------------------------------\n");
|
|
|
|
|
|
|
|
for (MusicPlugin::List::const_iterator i = pluginList.begin(), iend = pluginList.end(); i != iend; ++i) {
|
|
|
|
MusicDevices deviceList = (**i)->getDevices();
|
|
|
|
for (MusicDevices::iterator j = deviceList.begin(), jend = deviceList.end(); j != jend; ++j) {
|
|
|
|
printf("%-30s %s\n", Common::String::format("\"%s\"", j->getCompleteId().c_str()).c_str(), j->getCompleteName().c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-29 16:49:58 +00:00
|
|
|
/** Display all games in the given directory, or current directory if empty */
|
2016-11-07 19:29:40 +00:00
|
|
|
static bool autoDetect(Common::String path) {
|
2016-10-29 16:49:58 +00:00
|
|
|
if (path.empty())
|
|
|
|
path = ".";
|
2016-03-19 14:23:44 +00:00
|
|
|
//Current directory
|
2016-10-29 16:49:58 +00:00
|
|
|
Common::FSNode dir(path);
|
2016-03-19 17:56:08 +00:00
|
|
|
|
2016-03-19 14:23:44 +00:00
|
|
|
Common::FSList files;
|
2016-03-19 17:56:08 +00:00
|
|
|
|
2016-03-19 14:23:44 +00:00
|
|
|
//Collect all files from directory
|
|
|
|
dir.getChildren(files, Common::FSNode::kListAll);
|
2016-03-19 17:56:08 +00:00
|
|
|
|
2016-03-19 14:23:44 +00:00
|
|
|
GameList candidates(EngineMan.detectGames(files));
|
|
|
|
if (candidates.empty()) {
|
2016-10-29 16:49:58 +00:00
|
|
|
printf("ScummVM could not find any game in %s\n", path.c_str());
|
2016-11-07 19:29:40 +00:00
|
|
|
return false;
|
2016-03-19 14:23:44 +00:00
|
|
|
}
|
2016-11-07 19:29:40 +00:00
|
|
|
|
|
|
|
// 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;
|
2016-03-19 14:23:44 +00:00
|
|
|
}
|
2008-02-04 10:15:21 +00:00
|
|
|
|
2006-05-04 23:57:49 +00:00
|
|
|
#ifdef DETECTOR_TESTING_HACK
|
|
|
|
static void runDetectorTest() {
|
|
|
|
// HACK: The following code can be used to test the detection code of our
|
|
|
|
// engines. Basically, it loops over all targets, and calls the detector
|
|
|
|
// for the given path. It then prints out the result and also checks
|
|
|
|
// whether the result agrees with the settings of the target.
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2006-05-04 23:57:49 +00:00
|
|
|
const Common::ConfigManager::DomainMap &domains = ConfMan.getGameDomains();
|
|
|
|
Common::ConfigManager::DomainMap::const_iterator iter = domains.begin();
|
|
|
|
int success = 0, failure = 0;
|
|
|
|
for (iter = domains.begin(); iter != domains.end(); ++iter) {
|
|
|
|
Common::String name(iter->_key);
|
2010-03-29 20:31:23 +00:00
|
|
|
Common::String gameid(iter->_value.getVal("gameid"));
|
|
|
|
Common::String path(iter->_value.getVal("path"));
|
2006-05-04 23:57:49 +00:00
|
|
|
printf("Looking at target '%s', gameid '%s', path '%s' ...\n",
|
|
|
|
name.c_str(), gameid.c_str(), path.c_str());
|
|
|
|
if (path.empty()) {
|
|
|
|
printf(" ... no path specified, skipping\n");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (gameid.empty()) {
|
|
|
|
gameid = name;
|
|
|
|
}
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2008-10-02 16:58:59 +00:00
|
|
|
Common::FSNode dir(path);
|
2008-09-03 11:22:51 +00:00
|
|
|
Common::FSList files;
|
2008-10-02 16:58:59 +00:00
|
|
|
if (!dir.getChildren(files, Common::FSNode::kListAll)) {
|
2006-05-04 23:57:49 +00:00
|
|
|
printf(" ... invalid path, skipping\n");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2008-05-12 00:26:29 +00:00
|
|
|
GameList candidates(EngineMan.detectGames(files));
|
2006-05-04 23:57:49 +00:00
|
|
|
bool gameidDiffers = false;
|
2007-01-20 21:27:57 +00:00
|
|
|
GameList::iterator x;
|
2006-06-01 22:43:19 +00:00
|
|
|
for (x = candidates.begin(); x != candidates.end(); ++x) {
|
2007-01-20 21:27:57 +00:00
|
|
|
gameidDiffers |= (scumm_stricmp(gameid.c_str(), x->gameid().c_str()) != 0);
|
2006-05-04 23:57:49 +00:00
|
|
|
}
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2006-05-04 23:57:49 +00:00
|
|
|
if (candidates.empty()) {
|
|
|
|
printf(" FAILURE: No games detected\n");
|
|
|
|
failure++;
|
|
|
|
} else if (candidates.size() > 1) {
|
|
|
|
if (gameidDiffers) {
|
2008-07-29 00:49:44 +00:00
|
|
|
printf(" WARNING: Multiple games detected, some/all with wrong gameid\n");
|
2006-05-04 23:57:49 +00:00
|
|
|
} else {
|
2009-06-07 12:47:10 +00:00
|
|
|
printf(" WARNING: Multiple games detected, but all have matching gameid\n");
|
2006-05-04 23:57:49 +00:00
|
|
|
}
|
|
|
|
failure++;
|
|
|
|
} else if (gameidDiffers) {
|
|
|
|
printf(" FAILURE: Wrong gameid detected\n");
|
|
|
|
failure++;
|
|
|
|
} else {
|
|
|
|
printf(" SUCCESS: Game was detected correctly\n");
|
|
|
|
success++;
|
|
|
|
}
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2006-06-01 22:43:19 +00:00
|
|
|
for (x = candidates.begin(); x != candidates.end(); ++x) {
|
2006-05-04 23:57:49 +00:00
|
|
|
printf(" gameid '%s', desc '%s', language '%s', platform '%s'\n",
|
2007-01-20 21:27:57 +00:00
|
|
|
x->gameid().c_str(),
|
|
|
|
x->description().c_str(),
|
|
|
|
Common::getLanguageCode(x->language()),
|
|
|
|
Common::getPlatformCode(x->platform()));
|
2006-05-04 23:57:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
int total = domains.size();
|
|
|
|
printf("Detector test run: %d fail, %d success, %d skipped, out of %d\n",
|
|
|
|
failure, success, total - failure - success, total);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-06-07 12:47:10 +00:00
|
|
|
#ifdef UPGRADE_ALL_TARGETS_HACK
|
|
|
|
void upgradeTargets() {
|
|
|
|
// HACK: The following upgrades all your targets to the latest and
|
|
|
|
// greatest. Right now that means updating the guioptions and (optionally)
|
|
|
|
// also the game descriptions.
|
|
|
|
// Basically, it loops over all targets, and calls the detector for the
|
|
|
|
// given path. It then compares the result with the settings of the target.
|
|
|
|
// If the basics seem to match, it updates the guioptions.
|
|
|
|
|
|
|
|
printf("Upgrading all your existing targets\n");
|
|
|
|
|
2013-08-08 01:55:02 +00:00
|
|
|
Common::ConfigManager::DomainMap::iterator iter = ConfMan.beginGameDomains();
|
|
|
|
for (; iter != ConfMan.endGameDomains(); ++iter) {
|
2009-06-07 12:47:10 +00:00
|
|
|
Common::ConfigManager::Domain &dom = iter->_value;
|
|
|
|
Common::String name(iter->_key);
|
2010-03-29 20:31:23 +00:00
|
|
|
Common::String gameid(dom.getVal("gameid"));
|
|
|
|
Common::String path(dom.getVal("path"));
|
2009-06-07 12:47:10 +00:00
|
|
|
printf("Looking at target '%s', gameid '%s' ...\n",
|
|
|
|
name.c_str(), gameid.c_str());
|
|
|
|
if (path.empty()) {
|
|
|
|
printf(" ... no path specified, skipping\n");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (gameid.empty()) {
|
|
|
|
gameid = name;
|
|
|
|
}
|
|
|
|
gameid.toLowercase(); // TODO: Is this paranoia? Maybe we should just assume all lowercase, always?
|
|
|
|
|
|
|
|
Common::FSNode dir(path);
|
|
|
|
Common::FSList files;
|
|
|
|
if (!dir.getChildren(files, Common::FSNode::kListAll)) {
|
|
|
|
printf(" ... invalid path, skipping\n");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2010-03-29 20:31:23 +00:00
|
|
|
Common::Language lang = Common::parseLanguage(dom.getVal("language"));
|
|
|
|
Common::Platform plat = Common::parsePlatform(dom.getVal("platform"));
|
|
|
|
Common::String desc(dom.getVal("description"));
|
2009-06-07 12:47:10 +00:00
|
|
|
|
|
|
|
GameList candidates(EngineMan.detectGames(files));
|
|
|
|
GameDescriptor *g = 0;
|
|
|
|
|
|
|
|
// We proceed as follows:
|
|
|
|
// * If detection failed to produce candidates, skip.
|
|
|
|
// * If there is a unique detector match, trust it.
|
|
|
|
// * If there are multiple match, run over them comparing gameid, language and platform.
|
|
|
|
// If we end up with a unique match, use it. Otherwise, skip.
|
|
|
|
if (candidates.size() == 0) {
|
|
|
|
printf(" ... failed to detect game, skipping\n");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (candidates.size() > 1) {
|
|
|
|
// Scan over all candidates, check if there is a unique match for gameid, language and platform
|
|
|
|
GameList::iterator x;
|
|
|
|
int matchesFound = 0;
|
|
|
|
for (x = candidates.begin(); x != candidates.end(); ++x) {
|
|
|
|
if (x->gameid() == gameid && x->language() == lang && x->platform() == plat) {
|
|
|
|
matchesFound++;
|
|
|
|
g = &(*x);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (matchesFound != 1) {
|
|
|
|
printf(" ... detected multiple games, could not establish unique match, skipping\n");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Unique match -> use it
|
|
|
|
g = &candidates[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
// At this point, g points to a GameDescriptor which we can use to update
|
|
|
|
// the target referred to by dom. We update several things
|
|
|
|
|
|
|
|
// Always set the gameid explicitly (in case of legacy targets)
|
|
|
|
dom["gameid"] = g->gameid();
|
|
|
|
|
|
|
|
// Always set the GUI options. The user should not modify them, and engines might
|
|
|
|
// gain more features over time, so we want to keep this list up-to-date.
|
|
|
|
if (g->contains("guioptions")) {
|
|
|
|
printf(" -> update guioptions to '%s'\n", (*g)["guioptions"].c_str());
|
|
|
|
dom["guioptions"] = (*g)["guioptions"];
|
|
|
|
} else if (dom.contains("guioptions")) {
|
|
|
|
dom.erase("guioptions");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update the language setting but only if none has been set yet.
|
|
|
|
if (lang == Common::UNK_LANG && g->language() != Common::UNK_LANG) {
|
2009-06-07 17:05:58 +00:00
|
|
|
printf(" -> set language to '%s'\n", Common::getLanguageCode(g->language()));
|
2009-06-07 12:47:10 +00:00
|
|
|
dom["language"] = (*g)["language"];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update the platform setting but only if none has been set yet.
|
|
|
|
if (plat == Common::kPlatformUnknown && g->platform() != Common::kPlatformUnknown) {
|
2009-06-07 17:05:58 +00:00
|
|
|
printf(" -> set platform to '%s'\n", Common::getPlatformCode(g->platform()));
|
2009-06-07 12:47:10 +00:00
|
|
|
dom["platform"] = (*g)["platform"];
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: We could also update the description. But not everybody will want that.
|
|
|
|
// Esp. because for some games (e.g. the combined Zak/Loom FM-TOWNS demo etc.)
|
|
|
|
// ScummVM still generates an incorrect description string. So, the description
|
|
|
|
// should only be updated if the user explicitly requests this.
|
|
|
|
#if 0
|
|
|
|
if (desc != g->description()) {
|
|
|
|
printf(" -> update desc from '%s' to\n '%s' ?\n", desc.c_str(), g->description().c_str());
|
|
|
|
dom["description"] = (*g)["description"];
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
// Finally, save our changes to disk
|
|
|
|
ConfMan.flushToDisk();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-11-13 12:45:35 +00:00
|
|
|
#else // DISABLE_COMMAND_LINE
|
|
|
|
|
|
|
|
|
2009-03-21 16:07:46 +00:00
|
|
|
Common::String parseCommandLine(Common::StringMap &settings, int argc, const char * const *argv) {
|
2008-11-13 12:45:35 +00:00
|
|
|
return Common::String();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif // DISABLE_COMMAND_LINE
|
|
|
|
|
|
|
|
|
2011-05-23 17:36:45 +00:00
|
|
|
bool processSettings(Common::String &command, Common::StringMap &settings, Common::Error &err) {
|
|
|
|
err = Common::kNoError;
|
2006-05-04 23:57:49 +00:00
|
|
|
|
2008-11-13 12:45:35 +00:00
|
|
|
#ifndef DISABLE_COMMAND_LINE
|
|
|
|
|
2006-05-04 23:57:49 +00:00
|
|
|
// Handle commands passed via the command line (like --list-targets and
|
|
|
|
// --list-games). This must be done after the config file and the plugins
|
|
|
|
// have been loaded.
|
|
|
|
if (command == "list-targets") {
|
|
|
|
listTargets();
|
2011-05-23 17:36:45 +00:00
|
|
|
return true;
|
2006-05-04 23:57:49 +00:00
|
|
|
} else if (command == "list-games") {
|
|
|
|
listGames();
|
2011-05-23 17:36:45 +00:00
|
|
|
return true;
|
2008-02-04 10:15:21 +00:00
|
|
|
} else if (command == "list-saves") {
|
2011-05-23 17:36:45 +00:00
|
|
|
err = listSaves(settings["list-saves"].c_str());
|
|
|
|
return true;
|
2009-01-02 20:21:21 +00:00
|
|
|
} else if (command == "list-themes") {
|
|
|
|
listThemes();
|
2011-05-23 17:36:45 +00:00
|
|
|
return true;
|
2011-11-23 16:01:04 +00:00
|
|
|
} else if (command == "list-audio-devices") {
|
|
|
|
listAudioDevices();
|
|
|
|
return true;
|
2006-05-04 23:57:49 +00:00
|
|
|
} else if (command == "version") {
|
|
|
|
printf("%s\n", gScummVMFullVersion);
|
|
|
|
printf("Features compiled in: %s\n", gScummVMFeatures);
|
2011-05-23 17:36:45 +00:00
|
|
|
return true;
|
2006-05-04 23:57:49 +00:00
|
|
|
} else if (command == "help") {
|
2006-05-23 14:19:38 +00:00
|
|
|
printf(HELP_STRING, s_appName);
|
2011-05-23 17:36:45 +00:00
|
|
|
return true;
|
2016-03-19 17:56:08 +00:00
|
|
|
} else if (command == "auto-detect") {
|
2016-11-07 19:29:40 +00:00
|
|
|
// If auto-detects succeed, we want to return false so that the game is started
|
|
|
|
return !autoDetect(settings["path"]);
|
|
|
|
//return true;
|
2006-05-04 23:57:49 +00:00
|
|
|
}
|
|
|
|
#ifdef DETECTOR_TESTING_HACK
|
|
|
|
else if (command == "test-detector") {
|
|
|
|
runDetectorTest();
|
2011-05-23 17:36:45 +00:00
|
|
|
return true;
|
2006-05-04 23:57:49 +00:00
|
|
|
}
|
|
|
|
#endif
|
2009-06-07 12:47:10 +00:00
|
|
|
#ifdef UPGRADE_ALL_TARGETS_HACK
|
|
|
|
else if (command == "upgrade-targets") {
|
|
|
|
upgradeTargets();
|
2011-05-23 17:36:45 +00:00
|
|
|
return true;
|
2009-06-07 12:47:10 +00:00
|
|
|
}
|
|
|
|
#endif
|
2006-04-02 20:11:50 +00:00
|
|
|
|
2008-11-13 12:45:35 +00:00
|
|
|
#endif // DISABLE_COMMAND_LINE
|
|
|
|
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2006-04-02 17:51:04 +00:00
|
|
|
// If a target was specified, check whether there is either a game
|
|
|
|
// domain (i.e. a target) matching this argument, or alternatively
|
|
|
|
// whether there is a gameid matching that name.
|
2006-05-04 23:57:49 +00:00
|
|
|
if (!command.empty()) {
|
2008-05-12 00:26:29 +00:00
|
|
|
GameDescriptor gd = EngineMan.findGame(command);
|
2007-01-28 10:29:22 +00:00
|
|
|
if (ConfMan.hasGameDomain(command) || !gd.gameid().empty()) {
|
2007-06-11 08:38:23 +00:00
|
|
|
bool idCameFromCommandLine = false;
|
|
|
|
|
|
|
|
// WORKAROUND: Fix for bug #1719463: "DETECTOR: Launching
|
|
|
|
// undefined target adds launcher entry"
|
|
|
|
//
|
|
|
|
// We designate gameids which come strictly from command line
|
|
|
|
// so AdvancedDetector will not save config file with invalid
|
|
|
|
// gameid in case target autoupgrade was performed
|
|
|
|
if (!ConfMan.hasGameDomain(command)) {
|
|
|
|
idCameFromCommandLine = true;
|
|
|
|
}
|
|
|
|
|
2006-05-05 00:26:03 +00:00
|
|
|
ConfMan.setActiveDomain(command);
|
2007-06-11 08:38:23 +00:00
|
|
|
|
|
|
|
if (idCameFromCommandLine)
|
|
|
|
ConfMan.set("id_came_from_command_line", "1");
|
|
|
|
|
2006-04-02 17:51:04 +00:00
|
|
|
} else {
|
2008-11-13 12:45:35 +00:00
|
|
|
#ifndef DISABLE_COMMAND_LINE
|
2006-05-04 23:57:49 +00:00
|
|
|
usage("Unrecognized game target '%s'", command.c_str());
|
2008-11-13 12:45:35 +00:00
|
|
|
#endif // DISABLE_COMMAND_LINE
|
2006-04-02 17:51:04 +00:00
|
|
|
}
|
|
|
|
}
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2006-04-02 17:51:04 +00:00
|
|
|
|
2005-04-23 14:39:15 +00:00
|
|
|
// Finally, store the command line settings into the config manager.
|
2006-04-02 17:51:04 +00:00
|
|
|
for (Common::StringMap::const_iterator x = settings.begin(); x != settings.end(); ++x) {
|
2006-05-04 23:24:09 +00:00
|
|
|
Common::String key(x->_key);
|
|
|
|
Common::String value(x->_value);
|
2006-04-02 20:11:50 +00:00
|
|
|
|
|
|
|
// Replace any "-" in the key by "_" (e.g. change "save-slot" to "save_slot").
|
2006-05-04 23:24:09 +00:00
|
|
|
for (Common::String::iterator c = key.begin(); c != key.end(); ++c)
|
2006-04-02 20:11:50 +00:00
|
|
|
if (*c == '-')
|
|
|
|
*c = '_';
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2006-04-02 20:11:50 +00:00
|
|
|
// Store it into ConfMan.
|
|
|
|
ConfMan.set(key, value, Common::ConfigManager::kTransientDomain);
|
2006-04-02 17:51:04 +00:00
|
|
|
}
|
2006-05-04 23:57:49 +00:00
|
|
|
|
2011-05-23 17:36:45 +00:00
|
|
|
return false;
|
2002-03-23 20:34:47 +00:00
|
|
|
}
|
2006-05-04 23:37:50 +00:00
|
|
|
|
|
|
|
} // End of namespace Base
|