Added command line options for

native MT-32 support and
combination Adilb/native MIDI drivers.

svn-id: r7594
This commit is contained in:
Jamieson Christian 2003-05-17 03:06:16 +00:00
parent 1f7ebc70d8
commit 5a1e994d02
8 changed files with 97 additions and 60 deletions

4
README
View file

@ -1,5 +1,5 @@
ScummVM README ScummVM README
Last updated: 2003-05-05 Last updated: 2003-05-16
Release version: 0.4.1cvs Release version: 0.4.1cvs
------------------------------------------------------------------------ ------------------------------------------------------------------------
@ -336,6 +336,8 @@ Command Line Options:
-b<num> - Start in room <num>. -b<num> - Start in room <num>.
-d[<num>] - Set debug verbosity to <num> -d[<num>] - Set debug verbosity to <num>
-u - Dump scripts if a directory called 'dumps' exists in current directory -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: Hot Keys:

View file

@ -58,7 +58,7 @@ static const char USAGE_STRING[] =
"\t-m<num> - set music volume to <num> (0-255)\n" "\t-m<num> - set music volume to <num> (0-255)\n"
"\t-o<num> - set master volume to <num> (0-255)\n" "\t-o<num> - set master volume to <num> (0-255)\n"
"\t-s<num> - set sfx volume to <num> (0-255)\n" "\t-s<num> - set sfx volume to <num> (0-255)\n"
"\t-t<num> - set music tempo (default- adlib: 0x1D9000, midi: 0x4A0000)\n" "\t-t<num> - set music tempo (50-200, default 100%%)\n"
"\n" "\n"
"\t-n - no subtitles for speech\n" "\t-n - no subtitles for speech\n"
"\t-y - set text speed (default: 60)\n" "\t-y - set text speed (default: 60)\n"
@ -75,6 +75,9 @@ static const char USAGE_STRING[] =
"\t-b<num> - start in room <num>\n" "\t-b<num> - start in room <num>\n"
"\t-d[<num>] - enable debug output (debug level [1])\n" "\t-d[<num>] - enable debug output (debug level [1])\n"
"\t-u - dump scripts\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 #endif
// This contains a pointer to a list of all supported games. // This contains a pointer to a list of all supported games.
@ -162,6 +165,9 @@ GameDetector::GameDetector() {
_midi_driver = MD_AUTO; _midi_driver = MD_AUTO;
_features = 0; _features = 0;
_multi_midi = false;
_native_mt32 = false;
_cdrom = 0; _cdrom = 0;
_save_slot = 0; _save_slot = 0;
@ -271,6 +277,9 @@ void GameDetector::updateconfig() {
_gameTempo = strtol(val, NULL, 0); _gameTempo = strtol(val, NULL, 0);
_talkSpeed = g_config->getInt("talkspeed", _talkSpeed); _talkSpeed = g_config->getInt("talkspeed", _talkSpeed);
_multi_midi = g_config->getBool ("multi_midi");
_native_mt32 = g_config->getBool ("native_mt32");
} }
void GameDetector::list_games() { void GameDetector::list_games() {
@ -445,6 +454,18 @@ void GameDetector::parseCommandLine(int argc, char **argv) {
CHECK_OPTION(); CHECK_OPTION();
list_games(); list_games();
exit(1); 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: default:
goto ShowHelpAndExit; goto ShowHelpAndExit;
} }

View file

@ -171,6 +171,9 @@ public:
int _gfx_mode; int _gfx_mode;
bool _default_gfx_mode; bool _default_gfx_mode;
bool _multi_midi;
bool _native_mt32;
int _cdrom; int _cdrom;
int _save_slot; int _save_slot;

View file

@ -31,10 +31,6 @@
// the most common iMuse diagnostic messages. // the most common iMuse diagnostic messages.
// #define IMUSE_DEBUG // #define IMUSE_DEBUG
// Unremark this statement to support simultaneous
// use of Adlib and native MIDI drivers.
// #define ADLIB_TOO
// //
// Some constants // Some constants
// //
@ -290,6 +286,7 @@ class IMuseInternal {
friend struct Player; friend struct Player;
private: private:
bool _enable_multi_midi;
MidiDriver *_midi_adlib; MidiDriver *_midi_adlib;
MidiDriver *_midi_native; MidiDriver *_midi_native;
@ -631,10 +628,7 @@ MidiDriver *IMuseInternal::getBestMidiDriver (int sound) {
} }
#if !defined(__PALM_OS__) // Adlib not supported on PalmOS #if !defined(__PALM_OS__) // Adlib not supported on PalmOS
} else { } else {
if (!_midi_adlib) { if (!_midi_adlib && (_enable_multi_midi || !_midi_native)) {
#if !defined(ADLIB_TOO)
if (_midi_native) return NULL;
#endif
_midi_adlib = MidiDriver_ADLIB_create(); _midi_adlib = MidiDriver_ADLIB_create();
initMidiDriver (_midi_adlib); initMidiDriver (_midi_adlib);
} }
@ -1652,6 +1646,14 @@ uint32 IMuseInternal::property(int prop, uint32 value) {
if (value >= 50 && value <= 200) if (value >= 50 && value <= 200)
_tempoFactor = value; _tempoFactor = value;
break; break;
case IMuse::PROP_NATIVE_MT32:
Instrument::nativeMT32 (value > 0);
break;
case IMuse::PROP_MULTI_MIDI:
_enable_multi_midi = (value > 0);
break;
} }
return 0; return 0;
} }

View file

@ -44,7 +44,9 @@ public:
~IMuse(); ~IMuse();
enum { enum {
PROP_TEMPO_BASE = 1 PROP_TEMPO_BASE = 1,
PROP_NATIVE_MT32 = 2,
PROP_MULTI_MIDI = 3
}; };
void on_timer (MidiDriver *midi); void on_timer (MidiDriver *midi);

View file

@ -25,7 +25,7 @@
#include "scumm/instrument.h" #include "scumm/instrument.h"
#include "sound/mididrv.h" #include "sound/mididrv.h"
#define NATIVE_MT32 false static bool _native_mt32 = false;
static const byte mt32_to_gm[128] = { static const byte mt32_to_gm[128] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F // 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 saveOrLoad (Serializer *s);
void send (MidiChannel *mc); void send (MidiChannel *mc);
void copy_to (Instrument *dest) { dest->roland ((byte *) &_instrument); } 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() { void Instrument::clear() {
if (_instrument) if (_instrument)
delete _instrument; delete _instrument;
@ -339,7 +343,7 @@ void Instrument_Program::send (MidiChannel *mc) {
if (_program > 127) if (_program > 127)
return; return;
if (NATIVE_MT32) // if (mc->device()->mt32device()) if (_native_mt32) // if (mc->device()->mt32device())
mc->programChange (_mt32 ? _program : _program /*gm_to_mt32 [_program]*/); mc->programChange (_mt32 ? _program : _program /*gm_to_mt32 [_program]*/);
else else
mc->programChange (_mt32 ? mt32_to_gm [_program] : _program); 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, data, sizeof (_instrument));
memcpy (&_instrument_name, &_instrument.common.name, sizeof (_instrument.common.name)); memcpy (&_instrument_name, &_instrument.common.name, sizeof (_instrument.common.name));
_instrument_name[10] = '\0'; _instrument_name[10] = '\0';
if (!NATIVE_MT32 && getEquivalentGM() >= 128) { if (!_native_mt32 && getEquivalentGM() >= 128) {
warning ("MT-32 instrument \"%s\" not supported yet", _instrument_name); warning ("MT-32 instrument \"%s\" not supported yet", _instrument_name);
_instrument_name[0] = '\0'; _instrument_name[0] = '\0';
} }
@ -404,7 +408,7 @@ void Instrument_Roland::saveOrLoad (Serializer *s) {
s->loadBytes (&_instrument, sizeof (_instrument)); s->loadBytes (&_instrument, sizeof (_instrument));
memcpy (&_instrument_name, &_instrument.common.name, sizeof (_instrument.common.name)); memcpy (&_instrument_name, &_instrument.common.name, sizeof (_instrument.common.name));
_instrument_name[10] = '\0'; _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); debug (2, "MT-32 custom instrument \"%s\" not supported", _instrument_name);
_instrument_name[0] = '\0'; _instrument_name[0] = '\0';
} }
@ -412,7 +416,7 @@ void Instrument_Roland::saveOrLoad (Serializer *s) {
} }
void Instrument_Roland::send (MidiChannel *mc) { 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(); _instrument.device_id = mc->getNumber();
mc->device()->sysEx ((byte *) &_instrument, sizeof (_instrument)); mc->device()->sysEx ((byte *) &_instrument, sizeof (_instrument));
} else { } else {

View file

@ -52,6 +52,7 @@ public:
}; };
Instrument() : _type (0), _instrument (0) { } Instrument() : _type (0), _instrument (0) { }
static void nativeMT32 (bool native);
void clear(); void clear();
void copy_to (Instrument *dest) { if (_instrument) _instrument->copy_to (dest); else dest->clear(); } void copy_to (Instrument *dest) { if (_instrument) _instrument->copy_to (dest); else dest->clear(); }

View file

@ -604,6 +604,8 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst)
if (_imuse) { if (_imuse) {
if (detector->_gameTempo != 0) if (detector->_gameTempo != 0)
_imuse->property(IMuse::PROP_TEMPO_BASE, detector->_gameTempo); _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); _imuse->set_music_volume(_sound->_sound_volume_music);
} }
} }