2002-03-25 08:51:34 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2001 Ludvig Strigeus
|
|
|
|
* Copyright (C) 2001/2002 The ScummVM project
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2002-03-23 20:34:47 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
#include "scumm.h"
|
2002-04-19 11:12:27 +00:00
|
|
|
#include "sound/mididrv.h"
|
|
|
|
#include "sound/imuse.h"
|
2002-03-25 08:46:24 +00:00
|
|
|
#include "gameDetector.h"
|
2002-05-14 23:50:09 +00:00
|
|
|
#include "config-file.h"
|
2002-04-19 11:12:27 +00:00
|
|
|
|
2002-03-23 20:34:47 +00:00
|
|
|
|
2002-05-02 18:59:31 +00:00
|
|
|
#define CHECK_OPTION() if ((current_option != NULL) || (*s != '\0')) goto ShowHelpAndExit
|
|
|
|
#define HANDLE_OPTION() if ((*s == '\0') && (current_option == NULL)) goto ShowHelpAndExit; \
|
|
|
|
if ((*s != '\0') && (current_option != NULL)) goto ShowHelpAndExit; \
|
|
|
|
option = (*s == '\0' ? current_option : s); \
|
|
|
|
current_option = NULL
|
|
|
|
#define HANDLE_OPT_OPTION() if ((*s != '\0') && (current_option != NULL)) goto ShowHelpAndExit; \
|
|
|
|
if ((*s == '\0') && (current_option == NULL)) option = NULL; \
|
|
|
|
else option = (*s == '\0' ? current_option : s); \
|
|
|
|
current_option = NULL
|
2002-04-12 10:34:46 +00:00
|
|
|
|
|
|
|
static const char USAGE_STRING[] =
|
|
|
|
"ScummVM - Scumm Interpreter\n"
|
|
|
|
"Syntax:\n"
|
2002-04-26 14:13:39 +00:00
|
|
|
"\tscummvm [-v] [-d[<num>]] [-n] [-b<num>] [-t<num>] [-s<num>] [-p<path>] [-m<num>] [-f] game\n"
|
2002-04-12 10:34:46 +00:00
|
|
|
"Flags:\n"
|
2002-07-19 12:06:45 +00:00
|
|
|
"\t-a - specify game is amiga version\n"
|
|
|
|
"\t-b<num> - start in room <num>\n"
|
2002-04-27 21:06:48 +00:00
|
|
|
"\t-c<num> - use cdrom <num> for cd audio\n"
|
|
|
|
"\t-d[<num>] - enable debug output (debug level [1])\n"
|
|
|
|
"\t-e<mode> - set music engine (see readme.txt for details)\n"
|
|
|
|
"\t-f - fullscreen mode\n"
|
2002-04-27 22:12:36 +00:00
|
|
|
"\t-g<mode> - graphics mode (normal,2x,3x,2xsai,super2xsai,supereagle,advmame2x)\n"
|
2002-07-19 12:06:45 +00:00
|
|
|
"\t-l<file> - load config file instead of default\n"
|
|
|
|
"\t-m<num> - set music volume to <num> (0-100)\n"
|
|
|
|
"\t-n - no subtitles for speech\n"
|
|
|
|
"\t-p<path> - look for game in <path>\n"
|
|
|
|
"\t-s<num> - set sfx volume to <num> (0-255)\n"
|
|
|
|
"\t-t<num> - set music tempo (default- adlib: 0x1F0000, midi: 0x460000)\n"
|
|
|
|
"\t-v - show version info and exit\n"
|
2002-04-27 21:06:48 +00:00
|
|
|
#if defined(UNIX) || defined(UNIX_X11)
|
|
|
|
"\t-w[<file>] - write to config file [~/.scummvmrc]\n"
|
|
|
|
#else
|
|
|
|
"\t-w[<file>] - write to config file [scummvm.ini]\n"
|
|
|
|
#endif
|
2002-07-19 12:06:45 +00:00
|
|
|
"\t-x[<num>] - save game slot to load (default: autosave)\n"
|
|
|
|
"\t-y - set text speed (default: 60)\n"
|
2002-04-12 10:34:46 +00:00
|
|
|
;
|
2002-03-23 20:34:47 +00:00
|
|
|
|
2002-04-27 16:58:29 +00:00
|
|
|
void GameDetector::updateconfig()
|
|
|
|
{
|
2002-04-28 00:31:31 +00:00
|
|
|
const char * val;
|
2002-04-27 16:58:29 +00:00
|
|
|
|
2002-04-28 00:31:31 +00:00
|
|
|
if ((val = scummcfg->get("amiga")))
|
|
|
|
if (!scumm_stricmp(val, "true"))
|
|
|
|
_amiga = true;
|
|
|
|
else
|
|
|
|
_amiga = false;
|
2002-07-19 12:06:45 +00:00
|
|
|
if ((val = scummcfg->get("save_slot")))
|
|
|
|
_save_slot = atoi(val);
|
2002-04-27 16:58:29 +00:00
|
|
|
|
2002-05-07 05:12:39 +00:00
|
|
|
if ((val = scummcfg->get("cdrom")))
|
|
|
|
_cdrom = atoi(val);
|
|
|
|
|
|
|
|
if ((val = scummcfg->get("music_driver")))
|
|
|
|
if (!parseMusicDriver(val)) {
|
|
|
|
printf("Error in the config file: invalid music_driver.\n");
|
|
|
|
printf(USAGE_STRING);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
|
2002-04-28 00:31:31 +00:00
|
|
|
if ((val = scummcfg->get("fullscreen", "scummvm")))
|
|
|
|
if (!scumm_stricmp(val, "true"))
|
|
|
|
_fullScreen = true;
|
|
|
|
else
|
|
|
|
_fullScreen = false;
|
2002-04-27 16:58:29 +00:00
|
|
|
|
2002-05-07 05:12:39 +00:00
|
|
|
if ((val = scummcfg->get("gfx_mode")))
|
|
|
|
if ((_gfx_mode = parseGraphicsMode(val)) == -1) {
|
|
|
|
printf("Error in the config file: invalid gfx_mode.\n");
|
|
|
|
printf(USAGE_STRING);
|
|
|
|
exit(-1);
|
|
|
|
}
|
2002-04-27 16:58:29 +00:00
|
|
|
|
2002-04-28 00:31:31 +00:00
|
|
|
if ((val = scummcfg->get("music_volume")))
|
|
|
|
_music_volume = atoi(val);
|
2002-04-27 16:58:29 +00:00
|
|
|
|
2002-04-27 22:12:36 +00:00
|
|
|
if ((val = scummcfg->get("nosubtitles")))
|
|
|
|
if (!scumm_stricmp(val, "true"))
|
|
|
|
_noSubtitles = true;
|
|
|
|
else
|
|
|
|
_noSubtitles = false;
|
2002-04-27 16:58:29 +00:00
|
|
|
|
2002-05-07 05:12:39 +00:00
|
|
|
if ((val = scummcfg->get("path")))
|
2002-07-16 21:03:14 +00:00
|
|
|
_gameDataPath = strdup(val);
|
2002-04-27 16:58:29 +00:00
|
|
|
|
2002-05-07 05:12:39 +00:00
|
|
|
if ((val = scummcfg->get("sfx_volume")))
|
|
|
|
_sfx_volume = atoi(val);
|
2002-04-27 16:58:29 +00:00
|
|
|
|
2002-05-07 05:12:39 +00:00
|
|
|
if ((val = scummcfg->get("tempo")))
|
|
|
|
_gameTempo = strtol(val, NULL, 0);
|
|
|
|
|
|
|
|
if ((val = scummcfg->get("talkspeed")))
|
2002-05-07 08:53:27 +00:00
|
|
|
_talkSpeed = atoi(val);
|
2002-04-27 16:58:29 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void GameDetector::parseCommandLine(int argc, char **argv)
|
|
|
|
{
|
2002-05-05 19:06:51 +00:00
|
|
|
#if !defined(MACOS_CARBON)
|
2002-04-11 17:19:16 +00:00
|
|
|
int i;
|
|
|
|
char *s;
|
2002-05-02 18:59:31 +00:00
|
|
|
char *current_option = NULL;
|
|
|
|
char *option = NULL;
|
2002-07-19 12:06:45 +00:00
|
|
|
_save_slot = -1;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
|
|
|
// check for arguments
|
|
|
|
if (argc < 2) {
|
|
|
|
printf(USAGE_STRING);
|
|
|
|
//exit(1);
|
|
|
|
}
|
|
|
|
|
2002-04-27 16:58:29 +00:00
|
|
|
scummcfg->set_domain("game-specific");
|
2002-04-11 17:19:16 +00:00
|
|
|
/* Parse the arguments */
|
2002-05-02 18:59:31 +00:00
|
|
|
for (i = argc - 1; i >= 1; i--) {
|
2002-04-11 17:19:16 +00:00
|
|
|
s = argv[i];
|
|
|
|
|
2002-05-02 18:59:31 +00:00
|
|
|
if (s[0] == '-') {
|
2002-04-11 17:19:16 +00:00
|
|
|
s++;
|
2002-05-02 18:59:31 +00:00
|
|
|
switch (tolower(*s++)) {
|
|
|
|
case 'a':
|
|
|
|
CHECK_OPTION();
|
|
|
|
_amiga = true;
|
|
|
|
scummcfg->set("amiga", "true");
|
|
|
|
break;
|
|
|
|
case 'b':
|
|
|
|
HANDLE_OPTION();
|
|
|
|
_bootParam = atoi(option);
|
|
|
|
break;
|
|
|
|
case 'c':
|
|
|
|
HANDLE_OPTION();
|
|
|
|
_cdrom = atoi(option);
|
|
|
|
scummcfg->set("cdrom", _cdrom);
|
|
|
|
break;
|
|
|
|
case 'd':
|
|
|
|
_debugMode = true;
|
|
|
|
HANDLE_OPT_OPTION();
|
|
|
|
if (option != NULL)
|
|
|
|
_debugLevel = atoi(option);
|
|
|
|
debug(1,"Debugmode (level %d) on", _debugLevel);
|
|
|
|
break;
|
|
|
|
case 'e':
|
|
|
|
HANDLE_OPTION();
|
|
|
|
if (!parseMusicDriver(option))
|
|
|
|
goto ShowHelpAndExit;
|
|
|
|
scummcfg->set("music_driver", option);
|
|
|
|
break;
|
|
|
|
case 'f':
|
|
|
|
CHECK_OPTION();
|
|
|
|
_fullScreen = true;
|
|
|
|
scummcfg->set("fullscreen", "true", "scummvm");
|
|
|
|
break;
|
|
|
|
case 'g':
|
|
|
|
HANDLE_OPTION();
|
|
|
|
_gfx_mode = parseGraphicsMode(option);
|
|
|
|
if (_gfx_mode == -1)
|
|
|
|
goto ShowHelpAndExit;
|
|
|
|
scummcfg->set("gfx_mode", option, "scummvm");
|
|
|
|
break;
|
|
|
|
case 'l':
|
|
|
|
HANDLE_OPTION();
|
|
|
|
{
|
|
|
|
Config * newconfig = new Config(option, "scummvm");
|
|
|
|
scummcfg->merge_config(newconfig);
|
|
|
|
delete newconfig;
|
|
|
|
updateconfig();
|
2002-04-11 17:19:16 +00:00
|
|
|
break;
|
2002-05-02 18:59:31 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'm':
|
|
|
|
HANDLE_OPTION();
|
|
|
|
_music_volume = atoi(option);
|
2002-05-03 19:17:15 +00:00
|
|
|
scummcfg->set("music_volume", _music_volume);
|
2002-05-02 18:59:31 +00:00
|
|
|
break;
|
|
|
|
case 'n':
|
|
|
|
CHECK_OPTION();
|
|
|
|
_noSubtitles = true;
|
|
|
|
scummcfg->set("nosubtitles", "true");
|
|
|
|
break;
|
|
|
|
case 'p':
|
|
|
|
HANDLE_OPTION();
|
|
|
|
_gameDataPath = option;
|
|
|
|
scummcfg->set("path", _gameDataPath);
|
|
|
|
break;
|
|
|
|
case 'r':
|
2002-05-04 00:20:39 +00:00
|
|
|
HANDLE_OPTION();
|
|
|
|
// Ignore -r for now, to ensure backward compatibility.
|
2002-05-02 18:59:31 +00:00
|
|
|
break;
|
|
|
|
case 's':
|
|
|
|
HANDLE_OPTION();
|
|
|
|
_sfx_volume = atoi(option);
|
2002-05-03 19:17:15 +00:00
|
|
|
scummcfg->set("sfx_volume", _sfx_volume);
|
2002-05-02 18:59:31 +00:00
|
|
|
break;
|
|
|
|
case 't':
|
|
|
|
HANDLE_OPTION();
|
|
|
|
_gameTempo = strtol(option, 0, 0);
|
|
|
|
scummcfg->set("tempo", option);
|
|
|
|
break;
|
|
|
|
case 'v':
|
|
|
|
CHECK_OPTION();
|
|
|
|
printf("ScummVM " SCUMMVM_VERSION "\nBuilt on " __DATE__ " "
|
|
|
|
__TIME__ "\n");
|
2002-04-26 23:41:11 +00:00
|
|
|
#ifdef SCUMMVM_PLATFORM_VERSION
|
2002-05-02 18:59:31 +00:00
|
|
|
printf(" " SCUMMVM_PLATFORM_VERSION "\n");
|
2002-04-26 23:41:11 +00:00
|
|
|
#endif
|
2002-05-02 18:59:31 +00:00
|
|
|
exit(1);
|
|
|
|
case 'w':
|
|
|
|
_saveconfig = true;
|
2002-05-12 21:59:03 +00:00
|
|
|
scummcfg->set_writing(true);
|
2002-05-02 18:59:31 +00:00
|
|
|
HANDLE_OPT_OPTION();
|
|
|
|
if (option != NULL)
|
|
|
|
scummcfg->change_filename(option);
|
|
|
|
break;
|
2002-07-19 12:06:45 +00:00
|
|
|
case 'x':
|
|
|
|
_save_slot = 0;
|
|
|
|
HANDLE_OPT_OPTION();
|
|
|
|
if (option != NULL) {
|
|
|
|
_save_slot = atoi(option);
|
|
|
|
scummcfg->set("save_slot", _save_slot);
|
|
|
|
}
|
|
|
|
break;
|
2002-05-05 20:08:41 +00:00
|
|
|
case 'y':
|
|
|
|
HANDLE_OPTION();
|
|
|
|
_talkSpeed = atoi(option);
|
|
|
|
scummcfg->set("talkspeed", _talkSpeed);
|
|
|
|
break;
|
2002-05-02 18:59:31 +00:00
|
|
|
default:
|
|
|
|
goto ShowHelpAndExit;
|
2002-04-11 17:19:16 +00:00
|
|
|
}
|
|
|
|
} else {
|
2002-05-02 18:59:31 +00:00
|
|
|
if (i == (argc - 1)) {
|
|
|
|
_exe_name = s;
|
|
|
|
scummcfg->set_domain(s);
|
|
|
|
scummcfg->rename_domain("game-specific");
|
|
|
|
scummcfg->rename_domain(s);
|
|
|
|
updateconfig();
|
|
|
|
} else {
|
|
|
|
if (current_option == NULL)
|
|
|
|
current_option = s;
|
|
|
|
else
|
|
|
|
goto ShowHelpAndExit;
|
|
|
|
}
|
2002-04-11 17:19:16 +00:00
|
|
|
}
|
|
|
|
}
|
2002-04-27 16:58:29 +00:00
|
|
|
|
2002-05-12 21:59:03 +00:00
|
|
|
if (_exe_name)
|
2002-04-27 16:58:29 +00:00
|
|
|
scummcfg->flush();
|
2002-05-02 18:59:31 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
ShowHelpAndExit:
|
|
|
|
printf(USAGE_STRING);
|
|
|
|
exit(1);
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
#else
|
2002-04-28 00:31:31 +00:00
|
|
|
_midi_driver = MD_QTMUSIC;
|
2002-04-11 17:19:16 +00:00
|
|
|
_exe_name = *argv;
|
|
|
|
_gameDataPath = (char *)malloc(strlen(_exe_name) + 3);
|
|
|
|
sprintf(_gameDataPath, ":%s:", _exe_name);
|
|
|
|
#endif
|
2002-03-23 20:34:47 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2002-04-12 21:26:59 +00:00
|
|
|
int GameDetector::parseGraphicsMode(const char *s) {
|
|
|
|
struct GraphicsModes {
|
|
|
|
const char *name;
|
|
|
|
int id;
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct GraphicsModes gfx_modes[] = {
|
|
|
|
{"normal",GFX_NORMAL},
|
2002-05-04 00:06:40 +00:00
|
|
|
{"1x",GFX_NORMAL},
|
2002-04-12 21:26:59 +00:00
|
|
|
{"2x",GFX_DOUBLESIZE},
|
|
|
|
{"3x",GFX_TRIPLESIZE},
|
|
|
|
{"2xsai",GFX_2XSAI},
|
|
|
|
{"super2xsai",GFX_SUPER2XSAI},
|
|
|
|
{"supereagle",GFX_SUPEREAGLE},
|
2002-04-24 07:42:29 +00:00
|
|
|
{"advmame2x",GFX_ADVMAME2X}
|
2002-04-12 21:26:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const GraphicsModes *gm = gfx_modes;
|
|
|
|
int i;
|
|
|
|
for(i=0; i!=ARRAYSIZE(gfx_modes); i++,gm++) {
|
|
|
|
if (!scumm_stricmp(gm->name, s))
|
|
|
|
return gm->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2002-04-13 18:34:11 +00:00
|
|
|
bool GameDetector::parseMusicDriver(const char *s) {
|
|
|
|
struct MusicDrivers {
|
|
|
|
const char *name;
|
|
|
|
int id;
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct MusicDrivers music_drivers[] = {
|
|
|
|
{"auto",MD_AUTO},
|
|
|
|
{"null",MD_NULL},
|
|
|
|
{"windows",MD_WINDOWS},
|
|
|
|
{"seq",MD_SEQ},
|
|
|
|
{"qt",MD_QTMUSIC},
|
2002-04-26 13:18:49 +00:00
|
|
|
{"core",MD_COREAUDIO},
|
2002-04-13 18:34:11 +00:00
|
|
|
{"amidi",MD_AMIDI},
|
2002-05-07 22:07:28 +00:00
|
|
|
{"midiemu",MD_MIDIEMU},
|
2002-05-16 06:46:50 +00:00
|
|
|
{"alsa", MD_ALSA},
|
2002-04-13 18:34:11 +00:00
|
|
|
{"adlib",-1},
|
|
|
|
};
|
|
|
|
|
|
|
|
const MusicDrivers *md = music_drivers;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
_use_adlib = false;
|
|
|
|
|
|
|
|
for(i=0; i!=ARRAYSIZE(music_drivers); i++,md++) {
|
|
|
|
if (!scumm_stricmp(md->name, s)) {
|
|
|
|
if (md->id == -1) {
|
|
|
|
_use_adlib = true;
|
|
|
|
}
|
|
|
|
_midi_driver = md->id;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-23 20:34:47 +00:00
|
|
|
struct VersionSettings {
|
2002-04-11 17:19:16 +00:00
|
|
|
const char *filename;
|
|
|
|
const char *gamename;
|
|
|
|
byte id, major, middle, minor;
|
|
|
|
uint32 features;
|
2002-03-23 20:34:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
This is a list of all known SCUMM games. Commented games are not
|
|
|
|
supported at this time */
|
|
|
|
|
|
|
|
static const VersionSettings version_settings[] = {
|
2002-04-11 17:19:16 +00:00
|
|
|
/* Scumm Version 1 */
|
2002-03-23 20:34:47 +00:00
|
|
|
// {"maniac", "Maniac Mansion (C64)", GID_MANIAC64, 1, 0, 0,},
|
|
|
|
// {"zak", "Zak McKracken and the Alien Mindbenders (C64)", GID_ZAK64, 1, 0, 0,},
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
/* Scumm Version 2 */
|
2002-03-23 20:34:47 +00:00
|
|
|
// {"maniac", "Maniac Mansion", GID_MANIAC, 2, 0, 0,},
|
|
|
|
// {"zak", "Zak McKracken and the Alien Mindbenders", GID_ZAK, 2, 0, 0,},
|
|
|
|
// {"indy3", "Indiana Jones and the Last Crusade", GID_INDY3, 2, 0, 0,},
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
/* Scumm Version 3 */
|
|
|
|
{"indy3", "Indiana Jones and the Last Crusade (256)", GID_INDY3_256, 3, 0,
|
|
|
|
22,
|
|
|
|
GF_SMALL_HEADER | GF_USE_KEY | GF_SMALL_NAMES | GF_OLD256 |
|
|
|
|
GF_NO_SCALLING},
|
|
|
|
{"zak256", "Zak McKracken and the Alien Mindbenders (256)", GID_ZAK256, 3,
|
|
|
|
0, 0,
|
|
|
|
GF_SMALL_HEADER | GF_USE_KEY | GF_SMALL_NAMES | GF_OLD256 | GF_AUDIOTRACKS
|
|
|
|
| GF_NO_SCALLING},
|
|
|
|
{"loom", "Loom", GID_LOOM, 3, 5, 40,
|
|
|
|
GF_SMALL_HEADER | GF_USE_KEY | GF_SMALL_NAMES | GF_OLD_BUNDLE | GF_16COLOR
|
|
|
|
| GF_NO_SCALLING},
|
|
|
|
|
|
|
|
/* Scumm Version 4 */
|
|
|
|
{"monkeyEGA", "Monkey Island 1 (EGA)", GID_MONKEY_EGA, 4, 0, 67, GF_SMALL_HEADER | GF_USE_KEY | GF_16COLOR}, // EGA version
|
|
|
|
|
|
|
|
/* Scumm version 5 */
|
2002-04-25 03:37:56 +00:00
|
|
|
{"monkeyVGA", "Monkey Island 1 (256 color Floppy version)", GID_MONKEY_VGA, 5, 0, 16,
|
2002-04-26 02:53:40 +00:00
|
|
|
GF_SMALL_HEADER | GF_USE_KEY | GF_AUDIOTRACKS | GF_ADLIB_DEFAULT},
|
2002-04-11 17:19:16 +00:00
|
|
|
{"loomcd", "Loom (256 color CD version)", GID_LOOM256, 5, 1, 42,
|
2002-04-13 18:34:11 +00:00
|
|
|
GF_SMALL_HEADER | GF_USE_KEY | GF_AUDIOTRACKS | GF_ADLIB_DEFAULT},
|
2002-04-11 17:19:16 +00:00
|
|
|
{"monkey", "Monkey Island 1", GID_MONKEY, 5, 2, 2,
|
2002-04-26 13:41:39 +00:00
|
|
|
GF_USE_KEY | GF_AUDIOTRACKS | GF_ADLIB_DEFAULT},
|
2002-04-11 17:19:16 +00:00
|
|
|
{"monkey1", "Monkey Island 1 (alt)", GID_MONKEY, 5, 2, 2,
|
2002-04-13 18:34:11 +00:00
|
|
|
GF_USE_KEY | GF_AUDIOTRACKS | GF_ADLIB_DEFAULT},
|
2002-04-11 17:19:16 +00:00
|
|
|
{"monkey2", "Monkey Island 2: LeChuck's revenge", GID_MONKEY2, 5, 2, 2,
|
2002-04-13 18:34:11 +00:00
|
|
|
GF_USE_KEY | GF_ADLIB_DEFAULT},
|
2002-07-09 13:30:10 +00:00
|
|
|
{"atlantis", "Indiana Jones and the Fate of Atlantis", GID_INDY4, 5, 5, 0,
|
2002-04-13 18:34:11 +00:00
|
|
|
GF_USE_KEY | GF_ADLIB_DEFAULT},
|
2002-07-09 13:30:10 +00:00
|
|
|
{"playfate", "Indiana Jones and the Fate of Atlantis (Demo)", GID_INDY4,
|
2002-04-13 18:34:11 +00:00
|
|
|
5, 5, 0, GF_USE_KEY | GF_ADLIB_DEFAULT},
|
2002-04-11 17:19:16 +00:00
|
|
|
|
|
|
|
/* Scumm Version 6 */
|
|
|
|
{"tentacle", "Day Of The Tentacle", GID_TENTACLE, 6, 4, 2,
|
2002-04-13 18:34:11 +00:00
|
|
|
GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_ADLIB_DEFAULT},
|
2002-04-11 17:19:16 +00:00
|
|
|
{"dottdemo", "Day Of The Tentacle (Demo)", GID_TENTACLE, 6, 3, 2,
|
2002-04-13 18:34:11 +00:00
|
|
|
GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_ADLIB_DEFAULT},
|
2002-04-11 17:19:16 +00:00
|
|
|
{"samnmax", "Sam & Max", GID_SAMNMAX, 6, 4, 2,
|
2002-04-27 04:31:25 +00:00
|
|
|
GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER},
|
2002-04-11 17:19:16 +00:00
|
|
|
{"snmdemo", "Sam & Max (Demo)", GID_SAMNMAX, 6, 3, 0,
|
2002-06-27 10:40:37 +00:00
|
|
|
GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_ADLIB_DEFAULT},
|
|
|
|
|
|
|
|
{"puttdemo", "Putt Putt joins the parade (demo)", GID_SAMNMAX, 6, 3, 0,
|
|
|
|
GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_ADLIB_DEFAULT | GF_HUMONGOUS},
|
|
|
|
{"moondemo", "Putt Putt goes to the moon (demo)", GID_SAMNMAX, 6, 3, 0,
|
|
|
|
GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_ADLIB_DEFAULT | GF_HUMONGOUS},
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-06-29 10:28:43 +00:00
|
|
|
{"test", "Test demo game", GID_SAMNMAX, 6, 6, 6, GF_NEW_OPCODES | GF_AFTER_V6},
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
/* Scumm Version 7 */
|
|
|
|
{"ft", "Full Throttle", GID_FT, 7, 3, 0,
|
|
|
|
GF_NEW_OPCODES | GF_AFTER_V6 | GF_AFTER_V7},
|
|
|
|
{"dig", "The Dig", GID_DIG, 7, 5, 0,
|
|
|
|
GF_NEW_OPCODES | GF_AFTER_V6 | GF_AFTER_V7},
|
|
|
|
|
2002-04-12 10:34:46 +00:00
|
|
|
/* Simon the Sorcerer 1 & 2 (not SCUMM games) */
|
2002-04-12 21:26:59 +00:00
|
|
|
{"simon1dos", "Simon the Sorcerer 1 for DOS", GID_SIMON_FIRST+0, 99, 99, 99, 0},
|
2002-06-29 10:28:43 +00:00
|
|
|
{"simon2dos", "Simon the Sorcerer 2 for Dos", GID_SIMON_FIRST+1, 99, 99, 99, 0},
|
|
|
|
{"simon1win", "Simon the Sorcerer 1 for Windows", GID_SIMON_FIRST+2, 99, 99, 99, 0},
|
2002-04-12 10:34:46 +00:00
|
|
|
{"simon2win", "Simon the Sorcerer 2 for Windows", GID_SIMON_FIRST+3, 99, 99, 99, 0},
|
2002-04-26 23:41:11 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
/* Scumm Version 8 */
|
2002-07-04 15:48:17 +00:00
|
|
|
{"comi", "The Curse of Monkey Island", GID_CMI, 8, 1, 0, GF_NEW_OPCODES|GF_AFTER_V6|GF_AFTER_V7|GF_AFTER_V8},
|
2002-04-11 17:19:16 +00:00
|
|
|
{NULL, NULL}
|
2002-03-23 20:34:47 +00:00
|
|
|
};
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
bool GameDetector::detectGame()
|
|
|
|
{
|
|
|
|
const VersionSettings *gnl = version_settings;
|
|
|
|
|
|
|
|
_gameId = 0;
|
|
|
|
_gameText = NULL;
|
|
|
|
do {
|
|
|
|
if (!scumm_stricmp(_exe_name, gnl->filename)) {
|
|
|
|
_gameId = gnl->id;
|
|
|
|
_scummVersion = gnl->major;
|
|
|
|
|
|
|
|
_features = gnl->features;
|
|
|
|
_gameText = gnl->gamename;
|
|
|
|
debug(1, "Detected game '%s', version %d.%d.%d",
|
|
|
|
gnl->gamename, gnl->major, gnl->middle, gnl->minor);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} while ((++gnl)->filename);
|
|
|
|
|
|
|
|
debug(1, "Failed game detection");
|
|
|
|
|
|
|
|
return true;
|
2002-03-23 20:34:47 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
char *GameDetector::getGameName()
|
|
|
|
{
|
|
|
|
if (_gameText == NULL) {
|
|
|
|
char buf[256];
|
|
|
|
sprintf(buf, "Unknown game: \"%s\"", _exe_name);
|
2002-07-16 21:03:14 +00:00
|
|
|
return strdup(buf);
|
2002-04-11 17:19:16 +00:00
|
|
|
}
|
2002-07-16 21:03:14 +00:00
|
|
|
return strdup(_gameText);
|
2002-03-23 20:34:47 +00:00
|
|
|
}
|
|
|
|
|
2002-03-25 08:51:34 +00:00
|
|
|
int GameDetector::detectMain(int argc, char **argv)
|
2002-03-23 20:34:47 +00:00
|
|
|
{
|
2002-04-11 17:19:16 +00:00
|
|
|
_debugMode = 0; // off by default...
|
|
|
|
|
2002-04-26 23:41:11 +00:00
|
|
|
_noSubtitles = 0; // use by default - should this depend on soundtrack?
|
2002-04-12 21:26:59 +00:00
|
|
|
|
2002-05-05 20:08:41 +00:00
|
|
|
_talkSpeed = 60;
|
|
|
|
|
2002-05-01 22:20:59 +00:00
|
|
|
#ifndef _WIN32_WCE
|
|
|
|
_gfx_mode = GFX_DOUBLESIZE;
|
|
|
|
#else
|
2002-05-01 22:15:11 +00:00
|
|
|
_gfx_mode = GFX_NORMAL;
|
2002-05-01 22:20:59 +00:00
|
|
|
#endif
|
2002-04-15 18:07:56 +00:00
|
|
|
_sfx_volume = 100;
|
2002-05-03 18:05:33 +00:00
|
|
|
_music_volume = 60;
|
2002-04-15 18:07:56 +00:00
|
|
|
|
2002-04-20 17:41:42 +00:00
|
|
|
#if defined(USE_NULL_DRIVER)
|
2002-04-13 21:06:48 +00:00
|
|
|
_gfx_driver = GD_NULL;
|
2002-04-20 17:41:42 +00:00
|
|
|
#elif defined(__DC__)
|
|
|
|
_gfx_driver = GD_DC;
|
|
|
|
#elif defined(UNIX_X11)
|
|
|
|
_gfx_driver = GD_X;
|
|
|
|
#elif defined(__MORPHOS__)
|
|
|
|
_gfx_driver = GD_MORPHOS;
|
2002-04-21 21:52:17 +00:00
|
|
|
#elif defined(_WIN32_WCE)
|
2002-04-20 17:41:42 +00:00
|
|
|
_gfx_driver = GD_WINCE;
|
2002-05-05 20:04:26 +00:00
|
|
|
#elif defined(MACOS_CARBON)
|
|
|
|
_gfx_driver = GD_MAC;
|
2002-04-20 17:41:42 +00:00
|
|
|
#else
|
|
|
|
/* SDL is the default driver for now */
|
|
|
|
_gfx_driver = GD_SDL;
|
2002-04-13 21:06:48 +00:00
|
|
|
#endif
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
_gameDataPath = NULL;
|
|
|
|
_gameTempo = 0;
|
|
|
|
_soundCardType = 3;
|
|
|
|
|
2002-04-26 23:41:11 +00:00
|
|
|
|
2002-04-15 18:07:56 +00:00
|
|
|
|
2002-04-13 18:34:11 +00:00
|
|
|
_midi_driver = MD_AUTO;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-07-08 21:36:59 +00:00
|
|
|
#if defined(__DC__)
|
2002-04-16 23:24:59 +00:00
|
|
|
extern int dc_setup(GameDetector &detector);
|
|
|
|
dc_setup(*this);
|
2002-07-08 21:36:59 +00:00
|
|
|
#elif defined(MACOS_CARBON)
|
|
|
|
extern char* SelectGame();
|
|
|
|
char *game_name = SelectGame();
|
|
|
|
printf(game_name);
|
2002-04-16 23:24:59 +00:00
|
|
|
#else
|
2002-04-27 16:58:29 +00:00
|
|
|
_saveconfig = false;
|
|
|
|
updateconfig();
|
2002-05-03 18:05:33 +00:00
|
|
|
parseCommandLine(argc, argv);
|
2002-04-16 23:24:59 +00:00
|
|
|
#endif
|
2002-03-23 20:34:47 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
if (_exe_name == NULL) {
|
2002-03-25 00:45:09 +00:00
|
|
|
//launcherLoop();
|
|
|
|
//setWindowName(this);
|
|
|
|
warning("No game was specified...");
|
2002-04-11 17:19:16 +00:00
|
|
|
return (-1);
|
2002-03-25 00:45:09 +00:00
|
|
|
}
|
|
|
|
|
2002-03-23 20:34:47 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
if (!detectGame()) {
|
|
|
|
warning("Game detection failed. Using default settings");
|
|
|
|
_features = GF_DEFAULT;
|
|
|
|
_gameText = "Please choose a game";
|
|
|
|
}
|
2002-03-25 00:45:09 +00:00
|
|
|
|
2002-04-13 18:34:11 +00:00
|
|
|
/* Use the adlib sound driver if auto mode is selected,
|
|
|
|
* and the game is one of those that want adlib as
|
|
|
|
* default */
|
|
|
|
if (_midi_driver == MD_AUTO && _features&GF_ADLIB_DEFAULT) {
|
|
|
|
_use_adlib = true;
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
if (!_gameDataPath) {
|
2002-04-16 15:49:21 +00:00
|
|
|
warning("No path was provided. Assuming the data files are in the current directory");
|
2002-07-16 21:03:14 +00:00
|
|
|
_gameDataPath = strdup("");
|
2002-07-04 19:43:58 +00:00
|
|
|
} else if (_gameDataPath[strlen(_gameDataPath)-1] != '/'
|
|
|
|
#ifdef __MORPHOS__
|
|
|
|
&& _gameDataPath[strlen(_gameDataPath)-1] != ':'
|
|
|
|
#endif
|
|
|
|
&& _gameDataPath[strlen(_gameDataPath)-1] != '\\') {
|
2002-06-18 01:23:24 +00:00
|
|
|
char slashless[1024]; /* Append slash to path */
|
|
|
|
strcpy(slashless, _gameDataPath);
|
|
|
|
_gameDataPath = (char *)malloc((strlen(slashless) + 1) * sizeof(char));
|
|
|
|
sprintf(_gameDataPath, "%s/", slashless);
|
2002-04-11 17:19:16 +00:00
|
|
|
}
|
2002-03-23 20:34:47 +00:00
|
|
|
|
2002-04-17 03:11:37 +00:00
|
|
|
if (_amiga)
|
|
|
|
_features = _features | GF_AMIGA;
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
return (0);
|
|
|
|
}
|
2002-04-13 18:34:11 +00:00
|
|
|
|
|
|
|
OSystem *GameDetector::createSystem() {
|
|
|
|
/* auto is to use SDL */
|
|
|
|
switch(_gfx_driver) {
|
2002-04-20 17:41:42 +00:00
|
|
|
#if defined(UNIX_X11)
|
|
|
|
case GD_X:
|
|
|
|
return OSystem_X11_create();
|
|
|
|
#elif defined(__DC__)
|
|
|
|
case GD_DC:
|
2002-04-16 23:24:59 +00:00
|
|
|
return OSystem_Dreamcast_create();
|
2002-04-21 21:52:17 +00:00
|
|
|
#elif defined(_WIN32_WCE)
|
2002-04-20 17:41:42 +00:00
|
|
|
case GD_WINCE:
|
2002-04-19 06:23:49 +00:00
|
|
|
return OSystem_WINCE3_create();
|
2002-04-20 17:41:42 +00:00
|
|
|
#elif defined(__MORPHOS__)
|
2002-04-16 20:28:56 +00:00
|
|
|
case GD_MORPHOS:
|
|
|
|
return OSystem_MorphOS_create(_gameId, _gfx_mode, _fullScreen);
|
2002-05-05 20:04:26 +00:00
|
|
|
#elif defined(MACOS_CARBON)
|
|
|
|
case GD_MAC:
|
|
|
|
return OSystem_MAC_create(_gfx_mode, _fullScreen);
|
2002-04-20 17:41:42 +00:00
|
|
|
#elif defined(USE_NULL_DRIVER)
|
2002-04-13 21:06:48 +00:00
|
|
|
case GD_NULL:
|
|
|
|
return OSystem_NULL_create();
|
2002-04-20 17:41:42 +00:00
|
|
|
#else
|
|
|
|
case GD_SDL:
|
|
|
|
return OSystem_SDL_create(_gfx_mode, _fullScreen);
|
2002-04-16 23:24:59 +00:00
|
|
|
#endif
|
2002-04-13 18:34:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
error("Invalid graphics driver");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
MidiDriver *GameDetector::createMidi() {
|
|
|
|
int drv = _midi_driver;
|
|
|
|
|
2002-05-12 22:24:10 +00:00
|
|
|
#if defined (_WIN32_WCE)
|
|
|
|
/* Always use MIDI emulation on CE devices */
|
|
|
|
if (drv == MD_AUTO) drv = MD_MIDIEMU;
|
|
|
|
#endif
|
|
|
|
|
2002-04-19 06:23:49 +00:00
|
|
|
#if defined (WIN32) && !defined(_WIN32_WCE)
|
2002-04-13 18:34:11 +00:00
|
|
|
/* MD_WINDOWS is default MidiDriver on windows targets */
|
2002-04-26 23:41:11 +00:00
|
|
|
if (drv == MD_AUTO) drv = MD_WINDOWS;
|
2002-05-05 19:06:51 +00:00
|
|
|
#elif defined(__APPLE__) || defined(macintosh)
|
2002-04-26 13:18:49 +00:00
|
|
|
/* MD_QTMUSIC is default MidiDriver on MacOS targets */
|
2002-04-26 23:41:11 +00:00
|
|
|
if (drv == MD_AUTO) drv = MD_QTMUSIC;
|
2002-05-08 09:43:00 +00:00
|
|
|
#elif defined(UNIX) || defined(UNIX_X11)
|
2002-05-08 09:38:23 +00:00
|
|
|
/* MD_MIDIEMU is default MidiDriver on UNIX targets. */
|
|
|
|
/* FIXME: Attempt to detect if sequencer is available,
|
|
|
|
and use it in preference. */
|
|
|
|
if (drv == MD_AUTO) drv = MD_MIDIEMU;
|
2002-04-13 18:34:11 +00:00
|
|
|
#endif
|
2002-04-26 23:41:11 +00:00
|
|
|
|
2002-04-13 18:34:11 +00:00
|
|
|
switch(drv) {
|
|
|
|
case MD_AUTO:
|
2002-04-21 04:14:42 +00:00
|
|
|
case MD_NULL: return MidiDriver_NULL_create();
|
2002-05-07 22:07:28 +00:00
|
|
|
case MD_MIDIEMU: return MidiDriver_MIDIEMU_create();
|
2002-04-19 06:23:49 +00:00
|
|
|
#if defined(WIN32) && !defined(_WIN32_WCE)
|
2002-04-13 18:34:11 +00:00
|
|
|
case MD_WINDOWS: return MidiDriver_WIN_create();
|
2002-04-18 21:40:24 +00:00
|
|
|
#endif
|
2002-04-21 04:14:42 +00:00
|
|
|
#if defined(__MORPHOS__)
|
2002-04-18 21:40:24 +00:00
|
|
|
case MD_AMIDI: return MidiDriver_AMIDI_create();
|
2002-04-13 19:06:10 +00:00
|
|
|
#endif
|
2002-04-22 03:04:58 +00:00
|
|
|
#if defined(UNIX) && !defined(__BEOS__)
|
2002-05-07 22:07:28 +00:00
|
|
|
case MD_SEQ: return MidiDriver_SEQ_create();
|
2002-04-26 13:18:49 +00:00
|
|
|
#endif
|
2002-05-05 19:06:51 +00:00
|
|
|
#if defined(__APPLE__) || defined(macintosh)
|
2002-05-07 22:07:28 +00:00
|
|
|
case MD_QTMUSIC: return MidiDriver_QT_create();
|
2002-05-05 19:06:51 +00:00
|
|
|
#endif
|
|
|
|
#if defined(__APPLE__)
|
2002-05-07 22:07:28 +00:00
|
|
|
case MD_COREAUDIO: return MidiDriver_CORE_create();
|
2002-05-16 06:46:50 +00:00
|
|
|
#endif
|
|
|
|
#if defined(UNIX) && defined(USE_ALSA)
|
|
|
|
case MD_ALSA: return MidiDriver_ALSA_create();
|
2002-04-21 04:14:42 +00:00
|
|
|
#endif
|
2002-04-13 18:34:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
error("Invalid midi driver selected");
|
|
|
|
return NULL;
|
2002-04-16 20:28:56 +00:00
|
|
|
}
|