From 5a1e994d02c9e47ba15f327248f410d88a90d841 Mon Sep 17 00:00:00 2001 From: Jamieson Christian Date: Sat, 17 May 2003 03:06:16 +0000 Subject: Added command line options for native MT-32 support and combination Adilb/native MIDI drivers. svn-id: r7594 --- README | 48 +++++++++++++++++++----------------- common/gameDetector.cpp | 65 ++++++++++++++++++++++++++++++++----------------- common/gameDetector.h | 3 +++ scumm/imuse.cpp | 18 ++++++++------ scumm/imuse.h | 4 ++- scumm/instrument.cpp | 16 +++++++----- scumm/instrument.h | 1 + scumm/scummvm.cpp | 2 ++ 8 files changed, 97 insertions(+), 60 deletions(-) diff --git a/README b/README index ebefaa82c1..082f24f654 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ ScummVM README -Last updated: 2003-05-05 +Last updated: 2003-05-16 Release version: 0.4.1cvs ------------------------------------------------------------------------ @@ -313,29 +313,31 @@ Command Line Options: scummvm [OPTIONS] [GAME] - [GAME] - Short name of game to load. For example, 'monkey' for Monkey Island. + [GAME] - Short name of game to load. For example, 'monkey' for Monkey Island. - -p - Path to where the game is installed. Default is Cwd. - -x[] - Save game slot to load (default: autosave) - -f - Full-screen mode. - -g - Select graphics scaler. See below. - -e - Select sound engine. See below. - -a - Enable amiga pal conversion, for playing Amiga versions - -q - Select language. See below. - -c - Drive to play cd audio from. E.g., 0 is first drive. - -m - Set the music volume, 0-255. Default is '192' - -o - Set the master volume, 0-255. Default is '192' - -s - Set the sfx volume, 0-255. Default is '192' - -t - Set music tempo. 50-200. Default is '100' (percent) - -n - Disable subtitles. Use with games that have voice. - -y - Set talk speed ('yak option'). Default is '60' - -l - Load alternate configuration file - -w[] - Write configuration file - -v - Show version information and exit - -z - Display list of games - -b - Start in room . - -d[] - Set debug verbosity to - -u - Dump scripts if a directory called 'dumps' exists in current directory + -p - Path to where the game is installed. Default is Cwd. + -x[] - Save game slot to load (default: autosave) + -f - Full-screen mode. + -g - Select graphics scaler. See below. + -e - Select sound engine. See below. + -a - Enable amiga pal conversion, for playing Amiga versions + -q - Select language. See below. + -c - Drive to play cd audio from. E.g., 0 is first drive. + -m - Set the music volume, 0-255. Default is '192' + -o - Set the master volume, 0-255. Default is '192' + -s - Set the sfx volume, 0-255. Default is '192' + -t - Set music tempo. 50-200. Default is '100' (percent) + -n - Disable subtitles. Use with games that have voice. + -y - Set talk speed ('yak option'). Default is '60' + -l - Load alternate configuration file + -w[] - Write configuration file + -v - Show version information and exit + -z - Display list of games + -b - Start in room . + -d[] - Set debug verbosity to + -u - Dump scripts if a directory called 'dumps' exists in current directory + --multi-midi - enable combination Adlib and native MIDI + --native-mt32 - true Roland MT-32 (disable GM emulation) Hot Keys: diff --git a/common/gameDetector.cpp b/common/gameDetector.cpp index 30aacaad93..a45ed45d0d 100644 --- a/common/gameDetector.cpp +++ b/common/gameDetector.cpp @@ -46,35 +46,38 @@ static const char USAGE_STRING[] = "Syntax:\n" "\tscummvm [-v] [-d[]] [-n] [-b] [-t] [-s] [-p] [-m] [-f] game\n" "Flags:\n" - "\t-p - look for game in \n" - "\t-x[] - load this savegame (default: 0 - autosave)\n" - "\t-f - fullscreen mode\n" - "\t-g - graphics mode (normal,2x,3x,2xsai,super2xsai,supereagle,advmame2x,tv2x,dotmatrix)\n" - "\t-e - set music engine (see README for details)\n" - "\t-a - specify game is amiga version\n" - "\t-q - specify language (en,de,fr,it,pt,es,ja,zh,ko,hb)\n" + "\t-p - look for game in \n" + "\t-x[] - load this savegame (default: 0 - autosave)\n" + "\t-f - fullscreen mode\n" + "\t-g - graphics mode (normal,2x,3x,2xsai,super2xsai,supereagle,advmame2x,tv2x,dotmatrix)\n" + "\t-e - set music engine (see README for details)\n" + "\t-a - specify game is amiga version\n" + "\t-q - specify language (en,de,fr,it,pt,es,ja,zh,ko,hb)\n" "\n" - "\t-c - use cdrom for cd audio\n" - "\t-m - set music volume to (0-255)\n" - "\t-o - set master volume to (0-255)\n" - "\t-s - set sfx volume to (0-255)\n" - "\t-t - set music tempo (default- adlib: 0x1D9000, midi: 0x4A0000)\n" + "\t-c - use cdrom for cd audio\n" + "\t-m - set music volume to (0-255)\n" + "\t-o - set master volume to (0-255)\n" + "\t-s - set sfx volume to (0-255)\n" + "\t-t - set music tempo (50-200, default 100%%)\n" "\n" - "\t-n - no subtitles for speech\n" - "\t-y - set text speed (default: 60)\n" + "\t-n - no subtitles for speech\n" + "\t-y - set text speed (default: 60)\n" "\n" - "\t-l - load config file instead of default\n" + "\t-l - load config file instead of default\n" #if defined(UNIX) - "\t-w[] - write to config file [~/.scummvmrc]\n" + "\t-w[] - write to config file [~/.scummvmrc]\n" #else - "\t-w[] - write to config file [scummvm.ini]\n" + "\t-w[] - write to config file [scummvm.ini]\n" #endif - "\t-v - show version info and exit\n" - "\t-z - display list of games\n" + "\t-v - show version info and exit\n" + "\t-z - display list of games\n" "\n" - "\t-b - start in room \n" - "\t-d[] - enable debug output (debug level [1])\n" - "\t-u - dump scripts\n" + "\t-b - start in room \n" + "\t-d[] - enable debug output (debug level [1])\n" + "\t-u - dump scripts\n" + "\n" + "\t--multi-midi - enable combination Adlib and native MIDI\n" + "\t--native-mt32 - true Roland MT-32 (disable GM emulation)\n" ; #endif // This contains a pointer to a list of all supported games. @@ -162,6 +165,9 @@ GameDetector::GameDetector() { _midi_driver = MD_AUTO; _features = 0; + _multi_midi = false; + _native_mt32 = false; + _cdrom = 0; _save_slot = 0; @@ -271,6 +277,9 @@ void GameDetector::updateconfig() { _gameTempo = strtol(val, NULL, 0); _talkSpeed = g_config->getInt("talkspeed", _talkSpeed); + + _multi_midi = g_config->getBool ("multi_midi"); + _native_mt32 = g_config->getBool ("native_mt32"); } void GameDetector::list_games() { @@ -445,6 +454,18 @@ void GameDetector::parseCommandLine(int argc, char **argv) { CHECK_OPTION(); list_games(); exit(1); + case '-': + // Long options. Let the fun begin! + if (!strcmp (s, "multi-midi")) { + _multi_midi = true; + g_config->setBool ("multi_midi", true); + } else if (!strcmp (s, "native-mt32")) { + _native_mt32 = true; + g_config->setBool ("native_mt32", true); + } else { + goto ShowHelpAndExit; + } + break; default: goto ShowHelpAndExit; } diff --git a/common/gameDetector.h b/common/gameDetector.h index 1547ac5250..bb080d642d 100644 --- a/common/gameDetector.h +++ b/common/gameDetector.h @@ -170,6 +170,9 @@ public: int _gfx_mode; bool _default_gfx_mode; + + bool _multi_midi; + bool _native_mt32; int _cdrom; int _save_slot; diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp index 83b434cc56..4b57e3e7a1 100644 --- a/scumm/imuse.cpp +++ b/scumm/imuse.cpp @@ -31,10 +31,6 @@ // the most common iMuse diagnostic messages. // #define IMUSE_DEBUG -// Unremark this statement to support simultaneous -// use of Adlib and native MIDI drivers. -// #define ADLIB_TOO - // // Some constants // @@ -290,6 +286,7 @@ class IMuseInternal { friend struct Player; private: + bool _enable_multi_midi; MidiDriver *_midi_adlib; MidiDriver *_midi_native; @@ -631,10 +628,7 @@ MidiDriver *IMuseInternal::getBestMidiDriver (int sound) { } #if !defined(__PALM_OS__) // Adlib not supported on PalmOS } else { - if (!_midi_adlib) { -#if !defined(ADLIB_TOO) - if (_midi_native) return NULL; -#endif + if (!_midi_adlib && (_enable_multi_midi || !_midi_native)) { _midi_adlib = MidiDriver_ADLIB_create(); initMidiDriver (_midi_adlib); } @@ -1652,6 +1646,14 @@ uint32 IMuseInternal::property(int prop, uint32 value) { if (value >= 50 && value <= 200) _tempoFactor = value; break; + + case IMuse::PROP_NATIVE_MT32: + Instrument::nativeMT32 (value > 0); + break; + + case IMuse::PROP_MULTI_MIDI: + _enable_multi_midi = (value > 0); + break; } return 0; } diff --git a/scumm/imuse.h b/scumm/imuse.h index 7f6bc12f52..5006d50f33 100644 --- a/scumm/imuse.h +++ b/scumm/imuse.h @@ -44,7 +44,9 @@ public: ~IMuse(); enum { - PROP_TEMPO_BASE = 1 + PROP_TEMPO_BASE = 1, + PROP_NATIVE_MT32 = 2, + PROP_MULTI_MIDI = 3 }; void on_timer (MidiDriver *midi); diff --git a/scumm/instrument.cpp b/scumm/instrument.cpp index 8ea8e8474d..266165f770 100644 --- a/scumm/instrument.cpp +++ b/scumm/instrument.cpp @@ -25,7 +25,7 @@ #include "scumm/instrument.h" #include "sound/mididrv.h" -#define NATIVE_MT32 false +static bool _native_mt32 = false; static const byte mt32_to_gm[128] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F @@ -239,7 +239,7 @@ public: void saveOrLoad (Serializer *s); void send (MidiChannel *mc); void copy_to (Instrument *dest) { dest->roland ((byte *) &_instrument); } - bool is_valid() { return (NATIVE_MT32 ? true : (_instrument_name[0] != '\0')); } + bool is_valid() { return (_native_mt32 ? true : (_instrument_name[0] != '\0')); } }; //////////////////////////////////////// @@ -248,6 +248,10 @@ public: // //////////////////////////////////////// +void Instrument::nativeMT32 (bool native) { + _native_mt32 = native; +} + void Instrument::clear() { if (_instrument) delete _instrument; @@ -339,7 +343,7 @@ void Instrument_Program::send (MidiChannel *mc) { if (_program > 127) return; - if (NATIVE_MT32) // if (mc->device()->mt32device()) + if (_native_mt32) // if (mc->device()->mt32device()) mc->programChange (_mt32 ? _program : _program /*gm_to_mt32 [_program]*/); else mc->programChange (_mt32 ? mt32_to_gm [_program] : _program); @@ -383,7 +387,7 @@ Instrument_Roland::Instrument_Roland (byte *data) { memcpy (&_instrument, data, sizeof (_instrument)); memcpy (&_instrument_name, &_instrument.common.name, sizeof (_instrument.common.name)); _instrument_name[10] = '\0'; - if (!NATIVE_MT32 && getEquivalentGM() >= 128) { + if (!_native_mt32 && getEquivalentGM() >= 128) { warning ("MT-32 instrument \"%s\" not supported yet", _instrument_name); _instrument_name[0] = '\0'; } @@ -404,7 +408,7 @@ void Instrument_Roland::saveOrLoad (Serializer *s) { s->loadBytes (&_instrument, sizeof (_instrument)); memcpy (&_instrument_name, &_instrument.common.name, sizeof (_instrument.common.name)); _instrument_name[10] = '\0'; - if (!NATIVE_MT32 && getEquivalentGM() >= 128) { + if (!_native_mt32 && getEquivalentGM() >= 128) { debug (2, "MT-32 custom instrument \"%s\" not supported", _instrument_name); _instrument_name[0] = '\0'; } @@ -412,7 +416,7 @@ void Instrument_Roland::saveOrLoad (Serializer *s) { } void Instrument_Roland::send (MidiChannel *mc) { - if (NATIVE_MT32) { // if (mc->device()->mt32device()) { + if (_native_mt32) { // if (mc->device()->mt32device()) { _instrument.device_id = mc->getNumber(); mc->device()->sysEx ((byte *) &_instrument, sizeof (_instrument)); } else { diff --git a/scumm/instrument.h b/scumm/instrument.h index c9dea601be..84b45771d7 100644 --- a/scumm/instrument.h +++ b/scumm/instrument.h @@ -52,6 +52,7 @@ public: }; Instrument() : _type (0), _instrument (0) { } + static void nativeMT32 (bool native); void clear(); void copy_to (Instrument *dest) { if (_instrument) _instrument->copy_to (dest); else dest->clear(); } diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 2de0097222..465fb1c612 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -604,6 +604,8 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst) if (_imuse) { if (detector->_gameTempo != 0) _imuse->property(IMuse::PROP_TEMPO_BASE, detector->_gameTempo); + _imuse->property (IMuse::PROP_MULTI_MIDI, detector->_multi_midi); + _imuse->property (IMuse::PROP_NATIVE_MT32, detector->_native_mt32); _imuse->set_music_volume(_sound->_sound_volume_music); } } -- cgit v1.2.3