2002-03-25 08:51:34 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2001 Ludvig Strigeus
|
2006-01-18 17:39:49 +00:00
|
|
|
* Copyright (C) 2001-2006 The ScummVM project
|
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.
|
|
|
|
|
|
|
|
* 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.
|
|
|
|
|
|
|
|
* 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
|
|
|
*
|
2006-02-11 09:53:21 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2002-03-25 08:51:34 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2005-06-24 15:23:51 +00:00
|
|
|
#include "common/stdafx.h"
|
2003-10-02 22:52:57 +00:00
|
|
|
|
|
|
|
#include "base/engine.h"
|
2003-09-17 22:41:01 +00:00
|
|
|
#include "base/gameDetector.h"
|
|
|
|
#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"
|
2005-01-10 22:06:49 +00:00
|
|
|
#include "common/system.h"
|
2003-10-02 22:52:57 +00:00
|
|
|
|
2002-04-19 11:12:27 +00:00
|
|
|
#include "sound/mididrv.h"
|
2003-09-08 17:42:53 +00:00
|
|
|
#include "sound/mixer.h"
|
2002-04-19 11:12:27 +00:00
|
|
|
|
2004-12-15 12:30:58 +00:00
|
|
|
#ifdef UNIX
|
2004-12-24 00:31:51 +00:00
|
|
|
#include <errno.h>
|
2004-12-15 12:30:58 +00:00
|
|
|
#include <sys/stat.h>
|
2004-12-18 11:07:47 +00:00
|
|
|
#ifdef MACOSX
|
|
|
|
#define DEFAULT_SAVE_PATH "Documents/ScummVM Savegames"
|
|
|
|
#else
|
2004-12-15 12:30:58 +00:00
|
|
|
#define DEFAULT_SAVE_PATH ".scummvm"
|
|
|
|
#endif
|
2006-02-12 00:50:37 +00:00
|
|
|
#elif defined(__SYMBIAN32__)
|
2006-02-12 00:33:04 +00:00
|
|
|
#include <errno.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#define DEFAULT_SAVE_PATH "Savegames"
|
2004-12-15 12:30:58 +00:00
|
|
|
#endif
|
|
|
|
|
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! :)
|
2006-04-13 02:39:59 +00:00
|
|
|
#if defined(PALMOS_MODE) || defined(__SYMBIAN32__) || defined(__GP32__)
|
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"
|
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"
|
|
|
|
" -g, --gfx-mode=MODE Select graphics scaler (normal,2x,3x,2xsai,\n"
|
|
|
|
" super2xsai,supereagle,advmame2x,advmame3x,hq2x,\n"
|
|
|
|
" hq3x,tv2x,dotmatrix)\n"
|
|
|
|
" -e, --music-driver=MODE Select music driver (see README for details)\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"
|
|
|
|
" 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"
|
2006-02-14 23:31:25 +00:00
|
|
|
" --debugflags=FLAGS Enables engine specific debug flags\n"
|
|
|
|
" (separated by commas)\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"
|
2003-10-26 13:33:49 +00:00
|
|
|
" --cdrom=NUM CD drive to play CD audio from (default: 0 = first\n"
|
|
|
|
" drive)\n"
|
2003-12-27 13:52:48 +00:00
|
|
|
" --joystick[=NUM] Enable input with joystick (default: 0 = first\n"
|
2003-10-26 13:33:49 +00:00
|
|
|
" joystick)\n"
|
2006-04-02 17:51:04 +00:00
|
|
|
" --platform=WORD Specify platform of game (allowed values: 3do, acorn,\n"
|
2006-01-21 23:59:04 +00:00
|
|
|
" amiga, atari, c64, fmtowns, nes, mac, pc, segacd,\n"
|
|
|
|
" windows)\n"
|
2004-11-30 21:07:02 +00:00
|
|
|
" --savepath=PATH Path to where savegames are stored\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"
|
2003-10-26 13:33:49 +00:00
|
|
|
" --multi-midi Enable combination Adlib and native MIDI\n"
|
|
|
|
" --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"
|
2003-10-26 13:33:49 +00:00
|
|
|
" --aspect-ratio Enable aspect ratio correction\n"
|
2005-03-03 12:51:09 +00:00
|
|
|
" --render-mode=MODE Enable additional render modes (cga, ega, hercGreen,\n"
|
2005-04-10 14:33:44 +00:00
|
|
|
" hercAmber, amiga)\n"
|
2005-03-10 16:29:08 +00:00
|
|
|
" --force-1x-overlay Make inner GUI 320x200\n"
|
2002-12-28 12:20:55 +00:00
|
|
|
"\n"
|
2004-02-13 10:51:33 +00:00
|
|
|
#if !defined(DISABLE_SKY) || !defined(DISABLE_QUEEN)
|
|
|
|
" --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"
|
|
|
|
#ifndef DISABLE_SCUMM
|
2004-03-04 02:47:39 +00:00
|
|
|
" --demo-mode Start demo mode of Maniac Mansion\n"
|
2003-10-26 13:33:49 +00:00
|
|
|
" --tempo=NUM Set music tempo (in percent, 50-200) for SCUMM games\n"
|
|
|
|
" (default: 100)\n"
|
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-13 02:39:59 +00:00
|
|
|
#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__))
|
2006-04-02 20:11:50 +00:00
|
|
|
static Common::String s_appName("scummvm");
|
2006-04-11 18:19:54 +00:00
|
|
|
#else
|
|
|
|
static const char *s_appName = "scummvm";
|
|
|
|
#endif
|
2006-04-02 20:11:50 +00:00
|
|
|
|
|
|
|
static void usage(const char *s, ...) GCC_PRINTF(1, 2);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2006-04-13 02:39:59 +00:00
|
|
|
#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__))
|
2006-04-02 20:11:50 +00:00
|
|
|
printf(USAGE_STRING, s_appName.c_str(), buf, s_appName.c_str(), s_appName.c_str());
|
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
|
|
|
|
2003-03-06 16:27:06 +00:00
|
|
|
GameDetector::GameDetector() {
|
2003-05-17 03:06:16 +00:00
|
|
|
|
2003-10-08 21:59:23 +00:00
|
|
|
// Graphics
|
|
|
|
ConfMan.registerDefault("fullscreen", false);
|
|
|
|
ConfMan.registerDefault("aspect_ratio", false);
|
|
|
|
ConfMan.registerDefault("gfx_mode", "normal");
|
2005-02-20 00:17:22 +00:00
|
|
|
ConfMan.registerDefault("render_mode", "default");
|
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
|
|
|
|
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);
|
2003-10-08 21:59:23 +00:00
|
|
|
// ConfMan.registerDefault("music_driver", ???);
|
2002-08-18 23:29:40 +00:00
|
|
|
|
2003-10-08 21:59:23 +00:00
|
|
|
ConfMan.registerDefault("cdrom", 0);
|
2003-10-01 10:47:19 +00:00
|
|
|
|
2006-01-14 20:05:56 +00:00
|
|
|
// Game specific
|
2003-10-08 21:59:23 +00:00
|
|
|
ConfMan.registerDefault("path", "");
|
2004-01-29 21:54:03 +00:00
|
|
|
ConfMan.registerDefault("savepath", "");
|
2002-05-07 05:12:39 +00:00
|
|
|
|
2003-10-12 20:44:52 +00:00
|
|
|
// ConfMan.registerDefault("amiga", false);
|
2003-10-17 15:38:56 +00:00
|
|
|
ConfMan.registerDefault("platform", Common::kPlatformPC);
|
2003-10-08 21:59:23 +00:00
|
|
|
ConfMan.registerDefault("language", "en");
|
2005-03-12 00:55:46 +00:00
|
|
|
ConfMan.registerDefault("speech_mute", false);
|
2006-01-17 00:24:01 +00:00
|
|
|
ConfMan.registerDefault("sfx_mute", false);
|
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);
|
|
|
|
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
|
|
|
|
2004-08-01 06:52:56 +00:00
|
|
|
#if !defined(DISABLE_SCUMM) || !defined(DISABLE_SWORD2)
|
|
|
|
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
|
|
|
|
|
|
|
#ifndef DISABLE_SCUMM
|
|
|
|
ConfMan.registerDefault("demo_mode", false);
|
2003-10-08 21:59:23 +00:00
|
|
|
ConfMan.registerDefault("tempo", 0);
|
2003-07-29 12:13:39 +00:00
|
|
|
#endif
|
|
|
|
|
2004-02-13 10:51:33 +00:00
|
|
|
#if !defined(DISABLE_SKY) || !defined(DISABLE_QUEEN)
|
|
|
|
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);
|
2003-12-11 14:38:43 +00:00
|
|
|
#ifdef USE_ALSA
|
|
|
|
ConfMan.registerDefault("alsa_port", "65:0");
|
|
|
|
#endif
|
2002-05-07 05:12:39 +00:00
|
|
|
|
2005-07-30 21:11:48 +00:00
|
|
|
#ifdef DEFAULT_SAVE_PATH
|
2004-12-15 12:30:58 +00:00
|
|
|
char savePath[MAXPATHLEN];
|
|
|
|
#ifdef UNIX
|
|
|
|
struct stat sb;
|
2005-10-31 01:50:51 +00:00
|
|
|
const char *home = getenv("HOME");
|
2006-04-14 14:26:34 +00:00
|
|
|
if (home && *home && strlen(home) < MAXPATHLEN) {
|
2005-10-31 01:50:51 +00:00
|
|
|
snprintf(savePath, MAXPATHLEN, "%s/%s", home, DEFAULT_SAVE_PATH);
|
2004-12-15 12:30:58 +00:00
|
|
|
if (stat(savePath, &sb) == -1) {
|
|
|
|
/* create the dir if it does not exist */
|
|
|
|
if (errno == ENOENT) {
|
|
|
|
if (mkdir(savePath, 0755) != 0) {
|
|
|
|
perror("mkdir");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-01-02 19:52:05 +00:00
|
|
|
/* check that the dir is there */
|
2004-12-15 12:30:58 +00:00
|
|
|
if (stat(savePath, &sb) == 0) {
|
|
|
|
ConfMan.registerDefault("savepath", savePath);
|
|
|
|
}
|
|
|
|
}
|
2006-02-12 13:12:49 +00:00
|
|
|
#elif defined(__SYMBIAN32__)
|
2006-02-12 00:33:04 +00:00
|
|
|
strcpy(savePath, Symbian::GetExecutablePath());
|
|
|
|
strcat(savePath, DEFAULT_SAVE_PATH);
|
|
|
|
struct stat sb;
|
|
|
|
if (stat(savePath, &sb) == -1)
|
|
|
|
if (errno == ENOENT)// create the dir if it does not exist
|
|
|
|
if (mkdir(savePath, 0755) != 0)
|
|
|
|
error("mkdir for '%s' failed!", savePath);
|
|
|
|
ConfMan.registerDefault("savepath", savePath); // this should be enough...
|
2004-12-15 12:30:58 +00:00
|
|
|
#endif
|
2006-02-12 00:33:04 +00:00
|
|
|
#endif // #ifdef DEFAULT_SAVE_PATH
|
2004-12-15 12:30:58 +00:00
|
|
|
|
2003-10-08 21:59:23 +00:00
|
|
|
_dumpScripts = false;
|
2005-06-21 22:08:21 +00:00
|
|
|
|
|
|
|
#if defined(__SYMBIAN32__)
|
|
|
|
_force1xOverlay = true;
|
|
|
|
#else
|
2005-03-10 16:29:08 +00:00
|
|
|
_force1xOverlay = false;
|
2005-06-21 22:08:21 +00:00
|
|
|
#endif
|
2003-05-17 03:06:16 +00:00
|
|
|
|
2003-10-08 21:59:23 +00:00
|
|
|
_plugin = 0;
|
2002-04-27 16:58:29 +00:00
|
|
|
}
|
|
|
|
|
2006-03-09 02:52:51 +00:00
|
|
|
GameDescriptor GameDetector::findGame(const String &gameName, const Plugin **plugin) {
|
|
|
|
// Find the GameDescriptor for this target
|
2003-10-08 22:10:59 +00:00
|
|
|
const PluginList &plugins = PluginManager::instance().getPlugins();
|
2006-03-09 02:52:51 +00:00
|
|
|
GameDescriptor result;
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2004-02-05 00:19:57 +00:00
|
|
|
PluginList::const_iterator iter = plugins.begin();
|
2003-10-05 14:03:07 +00:00
|
|
|
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
|
2003-10-17 12:18:58 +00:00
|
|
|
result = (*iter)->findGame(gameName.c_str());
|
2006-03-09 02:52:51 +00:00
|
|
|
if (result.gameid.size() > 0) {
|
2003-09-17 22:41:01 +00:00
|
|
|
if (plugin)
|
2003-10-05 14:03:07 +00:00
|
|
|
*plugin = *iter;
|
2003-10-17 12:18:58 +00:00
|
|
|
break;
|
2003-09-17 22:41:01 +00:00
|
|
|
}
|
2003-09-08 15:38:34 +00:00
|
|
|
}
|
2003-10-17 12:18:58 +00:00
|
|
|
return result;
|
2003-09-08 15:38:34 +00:00
|
|
|
}
|
|
|
|
|
2003-10-17 19:39:13 +00:00
|
|
|
//
|
|
|
|
// Various macros used by the command line parser.
|
|
|
|
//
|
|
|
|
|
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) \
|
2003-10-17 19:39:13 +00:00
|
|
|
if (isLongCmd ? (!memcmp(s, longCmd"=", sizeof(longCmd"=") - 1)) : (shortCmdLower == shortCmd)) { \
|
|
|
|
if (isLongCmd) \
|
|
|
|
s += sizeof(longCmd"=") - 1; \
|
2006-04-02 20:29:54 +00:00
|
|
|
const char *option = s; \
|
|
|
|
if (*s == '\0') { option = s2; i++; } \
|
2006-04-02 20:11:50 +00:00
|
|
|
if (!option) option = defaultVal; \
|
|
|
|
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) \
|
|
|
|
if (!option) usage("Option '%s' requires an argument", argv[i]);
|
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
|
|
|
|
#define DO_OPTION_INT(shortCmd, longCmd) \
|
2006-04-02 20:11:50 +00:00
|
|
|
DO_OPTION_OPT(shortCmd, longCmd, 0) \
|
|
|
|
if (!option) usage("Option '%s' requires an argument", argv[i]); \
|
2005-04-22 21:49:29 +00:00
|
|
|
char *endptr = 0; \
|
2005-04-23 14:39:15 +00:00
|
|
|
int intValue; intValue = (int)strtol(option, &endptr, 10); \
|
2006-04-02 20:11:50 +00:00
|
|
|
if (endptr == NULL || *endptr != 0) 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) \
|
|
|
|
if (isLongCmd ? (!strcmp(s, longCmd) || !strcmp(s, "no-"longCmd)) : (shortCmdLower == shortCmd)) { \
|
2006-04-02 17:51:04 +00:00
|
|
|
bool boolValue = (shortCmdLower == s[1]); \
|
2003-10-17 19:39:13 +00:00
|
|
|
if (isLongCmd) { \
|
2005-04-22 21:49:29 +00:00
|
|
|
boolValue = !strcmp(s, longCmd); \
|
|
|
|
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".
|
2003-10-17 19:39:13 +00:00
|
|
|
#define DO_OPTION_CMD(shortCmd, longCmd) \
|
|
|
|
if (isLongCmd ? (!strcmp(s, longCmd)) : (shortCmdLower == shortCmd)) { \
|
|
|
|
if (isLongCmd) \
|
|
|
|
s += sizeof(longCmd) - 1; \
|
2006-04-02 17:51:04 +00:00
|
|
|
if (*s != '\0') goto unknownOption;
|
2003-10-17 19:39:13 +00:00
|
|
|
|
|
|
|
|
2006-04-02 20:11:50 +00:00
|
|
|
#define DO_LONG_OPTION_OPT(longCmd, d) DO_OPTION_OPT(0, longCmd, d)
|
2003-10-17 19:39:13 +00:00
|
|
|
#define DO_LONG_OPTION(longCmd) DO_OPTION(0, longCmd)
|
2005-04-22 21:49:29 +00:00
|
|
|
#define DO_LONG_OPTION_INT(longCmd) DO_OPTION_INT(0, longCmd)
|
2003-10-17 19:39:13 +00:00
|
|
|
#define DO_LONG_OPTION_BOOL(longCmd) DO_OPTION_BOOL(0, longCmd)
|
|
|
|
#define DO_LONG_OPTION_CMD(longCmd) DO_OPTION_CMD(0, longCmd)
|
|
|
|
|
|
|
|
// End an option handler
|
|
|
|
#define END_OPTION \
|
|
|
|
continue; \
|
|
|
|
}
|
|
|
|
|
2003-11-10 23:17:11 +00:00
|
|
|
|
2006-04-02 21:06:49 +00:00
|
|
|
Common::String GameDetector::parseCommandLine(Common::StringMap &settings, int argc, char **argv) {
|
2006-04-02 20:11:50 +00:00
|
|
|
const char *s, *s2;
|
|
|
|
|
|
|
|
// argv[0] contains the name of the executable.
|
|
|
|
if (argv && argv[0]) {
|
|
|
|
s = strchr(argv[0], '/');
|
|
|
|
s_appName = s ? s : argv[0];
|
|
|
|
}
|
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;
|
2005-04-23 14:39:15 +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 {
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2006-04-02 20:11:50 +00:00
|
|
|
char shortCmdLower = tolower(s[1]);
|
|
|
|
bool isLongCmd = (s[0] == '-' && s[1] == '-');
|
2003-10-17 19:39:13 +00:00
|
|
|
s += 2;
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2006-04-02 17:51:04 +00:00
|
|
|
DO_OPTION_CMD('h', "help")
|
|
|
|
printf(HELP_STRING, argv[0]);
|
|
|
|
exit(0);
|
|
|
|
END_OPTION
|
|
|
|
|
|
|
|
DO_OPTION_CMD('v', "version")
|
|
|
|
printf("%s\n", gScummVMFullVersion);
|
|
|
|
printf("Features compiled in: %s\n", gScummVMFeatures);
|
|
|
|
exit(0);
|
|
|
|
END_OPTION
|
|
|
|
|
|
|
|
DO_OPTION_CMD('t', "list-targets")
|
2006-04-02 21:06:49 +00:00
|
|
|
return "list-targets";
|
2006-04-02 17:51:04 +00:00
|
|
|
END_OPTION
|
|
|
|
|
|
|
|
DO_OPTION_CMD('z', "list-games")
|
2006-04-02 21:06:49 +00:00
|
|
|
return "list-games";
|
2006-04-02 17:51:04 +00:00
|
|
|
END_OPTION
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2003-10-17 19:39:13 +00:00
|
|
|
DO_OPTION('e', "music-driver")
|
2004-12-02 00:33:42 +00:00
|
|
|
if (MidiDriver::parseMusicDriver(option) < 0)
|
2006-04-02 20:11:50 +00:00
|
|
|
usage("Unrecognized music driver '%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_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
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2003-10-17 19:39:13 +00:00
|
|
|
DO_OPTION('g', "gfx-mode")
|
2004-02-24 22:39:42 +00:00
|
|
|
// Check whether 'option' specifies a valid graphics mode.
|
|
|
|
bool isValid = false;
|
|
|
|
if (!scumm_stricmp(option, "normal") || !scumm_stricmp(option, "default"))
|
|
|
|
isValid = true;
|
|
|
|
if (!isValid) {
|
|
|
|
const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes();
|
|
|
|
while (gm->name && !isValid) {
|
|
|
|
isValid = !scumm_stricmp(gm->name, option);
|
|
|
|
gm++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!isValid)
|
2006-04-02 20:11:50 +00:00
|
|
|
usage("Unrecognized graphics mode '%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('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")
|
|
|
|
// TODO: Verify whether the path is valid
|
|
|
|
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")
|
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")
|
2005-04-23 14:39:15 +00:00
|
|
|
// TODO: Verify whether the path is valid
|
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
|
|
|
|
|
2005-03-10 16:29:08 +00:00
|
|
|
DO_LONG_OPTION_BOOL("force-1x-overlay")
|
|
|
|
END_OPTION
|
|
|
|
|
2004-01-29 21:54:03 +00:00
|
|
|
DO_LONG_OPTION("savepath")
|
|
|
|
// TODO: Verify whether the path is valid
|
|
|
|
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-03-26 04:22:47 +00:00
|
|
|
DO_LONG_OPTION("target-md5")
|
|
|
|
END_OPTION
|
|
|
|
|
2003-07-29 12:13:39 +00:00
|
|
|
#ifndef DISABLE_SCUMM
|
2003-10-17 19:39:13 +00:00
|
|
|
DO_LONG_OPTION("tempo")
|
2005-07-30 21:11:48 +00:00
|
|
|
// Use the special value '0' for the base in (int)strtol.
|
2003-10-17 19:39:13 +00:00
|
|
|
// Doing that makes it possible to enter hex values
|
|
|
|
// as "0x1234", but also decimal values ("123").
|
2005-04-23 14:39:15 +00:00
|
|
|
int value = (int)strtol(option, 0, 0);
|
|
|
|
char buf[20];
|
|
|
|
snprintf(buf, sizeof(buf), "%d", value);
|
|
|
|
settings["tempo"] = buf;
|
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("demo-mode")
|
|
|
|
END_OPTION
|
|
|
|
#endif
|
2003-11-08 22:05:58 +00:00
|
|
|
|
2004-02-13 10:51:33 +00:00
|
|
|
#if !defined(DISABLE_SKY) || !defined(DISABLE_QUEEN)
|
|
|
|
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
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
return Common::String::emptyString;
|
2006-04-02 20:11:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-04-02 21:28:01 +00:00
|
|
|
void GameDetector::processSettings(Common::String &target, Common::StringMap &settings) {
|
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-04-02 21:28:01 +00:00
|
|
|
if (!target.empty()) {
|
|
|
|
if (ConfMan.hasGameDomain(target) || findGame(target).gameid.size() > 0) {
|
|
|
|
setTarget(target);
|
2006-04-02 17:51:04 +00:00
|
|
|
} else {
|
2006-04-02 21:28:01 +00:00
|
|
|
usage("Unrecognized game target '%s'", target.c_str());
|
2006-04-02 17:51:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 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.
|
2006-04-13 02:39:59 +00:00
|
|
|
#if !defined(MACOS_CARBON) && !defined(_WIN32_WCE) && !defined(PALMOS_MODE) && !defined(__GP32__)
|
2006-04-02 17:51:04 +00:00
|
|
|
if (!settings.contains("savepath")) {
|
|
|
|
const char *dir = getenv("SCUMMVM_SAVEPATH");
|
2006-04-14 14:26:34 +00:00
|
|
|
if (dir && *dir && strlen(dir) < MAXPATHLEN) {
|
2006-04-02 17:51:04 +00:00
|
|
|
// TODO: Verify whether the path is valid
|
|
|
|
settings["savepath"] = dir;
|
|
|
|
}
|
2003-10-18 00:25:13 +00:00
|
|
|
}
|
2006-04-02 17:51:04 +00:00
|
|
|
#endif
|
|
|
|
|
2006-04-02 20:11:50 +00:00
|
|
|
|
|
|
|
if (settings.contains("dump-scripts")) {
|
|
|
|
_dumpScripts = (settings["dump-scripts"] == "true");
|
|
|
|
settings.erase("dump-scripts"); // This option should not be passed to ConfMan.
|
|
|
|
}
|
|
|
|
|
|
|
|
if (settings.contains("force-1x-overlay")) {
|
|
|
|
_force1xOverlay = (settings["force-1x-overlay"] == "true");
|
|
|
|
settings.erase("force-1x-overlay"); // This option should not be passed to ConfMan.
|
|
|
|
}
|
|
|
|
|
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-04-02 20:11:50 +00:00
|
|
|
String key(x->_key);
|
|
|
|
String value(x->_value);
|
|
|
|
|
|
|
|
// Replace any "-" in the key by "_" (e.g. change "save-slot" to "save_slot").
|
|
|
|
for (String::iterator c = key.begin(); c != key.end(); ++c)
|
|
|
|
if (*c == '-')
|
|
|
|
*c = '_';
|
|
|
|
|
|
|
|
// Store it into ConfMan.
|
|
|
|
ConfMan.set(key, value, Common::ConfigManager::kTransientDomain);
|
2006-04-02 17:51:04 +00:00
|
|
|
}
|
2002-03-23 20:34:47 +00:00
|
|
|
}
|
|
|
|
|
2006-04-02 20:11:50 +00:00
|
|
|
|
2006-01-21 13:01:20 +00:00
|
|
|
void GameDetector::setTarget(const String &target) {
|
|
|
|
_targetName = target;
|
|
|
|
ConfMan.setActiveDomain(target);
|
2006-04-02 20:43:36 +00:00
|
|
|
|
|
|
|
if (ConfMan.hasKey("gameid"))
|
|
|
|
_gameid = ConfMan.get("gameid");
|
|
|
|
else
|
|
|
|
_gameid = _targetName;
|
2006-04-15 13:12:03 +00:00
|
|
|
|
|
|
|
// TODO: In the future, simply insert the gameid into the transient domain.
|
|
|
|
// That way, all code (including backends) can reliably access it.
|
|
|
|
//ConfMan.set("gameid", _gameid, Common::ConfigManager::kTransientDomain);
|
2002-09-30 00:55:47 +00:00
|
|
|
}
|
|
|
|
|
2003-09-20 00:37:09 +00:00
|
|
|
bool GameDetector::detectMain() {
|
2006-03-28 09:42:54 +00:00
|
|
|
if (_targetName.empty()) {
|
2002-03-25 00:45:09 +00:00
|
|
|
warning("No game was specified...");
|
2003-09-20 00:37:09 +00:00
|
|
|
return false;
|
2002-03-25 00:45:09 +00:00
|
|
|
}
|
|
|
|
|
2006-02-18 12:50:48 +00:00
|
|
|
printf("Looking for %s\n", _gameid.c_str());
|
2006-03-09 02:52:51 +00:00
|
|
|
GameDescriptor game = findGame(_gameid, &_plugin);
|
2006-02-18 12:50:48 +00:00
|
|
|
|
2006-03-09 02:52:51 +00:00
|
|
|
if (game.gameid.size() == 0) {
|
2006-02-18 12:50:48 +00:00
|
|
|
printf("Failed game detection\n");
|
2003-10-20 20:06:29 +00:00
|
|
|
warning("%s is an invalid target. Use the --list-targets option to list targets", _targetName.c_str());
|
2003-09-20 00:37:09 +00:00
|
|
|
return false;
|
2002-04-11 17:19:16 +00:00
|
|
|
}
|
2002-03-25 00:45:09 +00:00
|
|
|
|
2006-03-09 02:52:51 +00:00
|
|
|
printf("Trying to start game '%s'\n", game.description.c_str());
|
2006-02-18 12:50:48 +00:00
|
|
|
|
2003-10-08 21:59:23 +00:00
|
|
|
String gameDataPath(ConfMan.get("path"));
|
2006-03-28 09:42:54 +00:00
|
|
|
if (gameDataPath.empty()) {
|
2002-04-16 15:49:21 +00:00
|
|
|
warning("No path was provided. Assuming the data files are in the current directory");
|
2004-10-08 16:09:52 +00:00
|
|
|
gameDataPath = "./";
|
2003-10-08 21:59:23 +00:00
|
|
|
} else if (gameDataPath.lastChar() != '/'
|
2005-05-09 21:21:21 +00:00
|
|
|
#if defined(__MORPHOS__) || defined(__amigaos4__)
|
2003-10-08 21:59:23 +00:00
|
|
|
&& gameDataPath.lastChar() != ':'
|
2002-07-04 19:43:58 +00:00
|
|
|
#endif
|
2003-10-08 21:59:23 +00:00
|
|
|
&& gameDataPath.lastChar() != '\\') {
|
|
|
|
gameDataPath += '/';
|
2005-04-23 14:39:15 +00:00
|
|
|
ConfMan.set("path", gameDataPath, Common::ConfigManager::kTransientDomain);
|
2002-04-11 17:19:16 +00:00
|
|
|
}
|
2002-03-23 20:34:47 +00:00
|
|
|
|
2003-09-20 00:37:09 +00:00
|
|
|
return true;
|
2002-04-11 17:19:16 +00:00
|
|
|
}
|
2002-04-13 18:34:11 +00:00
|
|
|
|
2003-10-09 14:05:09 +00:00
|
|
|
Engine *GameDetector::createEngine(OSystem *sys) {
|
2003-09-17 22:41:01 +00:00
|
|
|
assert(_plugin);
|
2003-10-09 14:05:09 +00:00
|
|
|
return _plugin->createInstance(this, sys);
|
2003-09-08 17:13:40 +00:00
|
|
|
}
|
|
|
|
|
2005-05-10 23:48:48 +00:00
|
|
|
Audio::Mixer *GameDetector::createMixer() {
|
|
|
|
return new Audio::Mixer();
|
2003-09-08 17:42:53 +00:00
|
|
|
}
|