diff options
-rw-r--r-- | common/util.cpp | 18 | ||||
-rw-r--r-- | common/util.h | 13 | ||||
-rw-r--r-- | engines/scumm/detection.cpp | 2 | ||||
-rw-r--r-- | gui/options.cpp | 7 | ||||
-rw-r--r-- | sound/mididrv.cpp | 21 | ||||
-rw-r--r-- | sound/mididrv.h | 2 |
6 files changed, 53 insertions, 10 deletions
diff --git a/common/util.cpp b/common/util.cpp index 742eb0035d..895bcebef7 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -293,12 +293,20 @@ const struct GameOpt { uint32 option; const char *desc; } g_gameOptions[] = { - { GUIO_NOSUBTITLES, "sndNoSubs" }, - { GUIO_NOMUSIC, "sndNoMusic" }, - { GUIO_NOSPEECH, "sndNoSpeech" }, - { GUIO_NOSFX, "sndNoSFX" }, - { GUIO_NOMIDI, "sndNoMIDI" }, + { GUIO_NOSUBTITLES, "sndNoSubs" }, + { GUIO_NOMUSIC, "sndNoMusic" }, + { GUIO_NOSPEECH, "sndNoSpeech" }, + { GUIO_NOSFX, "sndNoSFX" }, + { GUIO_NOMIDI, "sndNoMIDI" }, { GUIO_NOLAUNCHLOAD, "launchNoLoad" }, + + { GUIO_MIDIPCSPK, "midiPCSpk" }, + { GUIO_MIDICMS, "midiCMS" }, + { GUIO_MIDIPCJR, "midiPCJr" }, + { GUIO_MIDIADLIB, "midiAdLib" }, + { GUIO_MIDITOWNS, "midiTowns" }, + { GUIO_MIDI, "midiMidi" }, + { GUIO_NONE, 0 } }; diff --git a/common/util.h b/common/util.h index 0b7a44f5b3..62c8f0d1fb 100644 --- a/common/util.h +++ b/common/util.h @@ -215,9 +215,16 @@ enum GameGUIOption { GUIO_NOSUBTITLES = (1 << 0), GUIO_NOMUSIC = (1 << 1), GUIO_NOSPEECH = (1 << 2), - GUIO_NOSFX = (1 << 3), - GUIO_NOMIDI = (1 << 4), - GUIO_NOLAUNCHLOAD = (1 << 5) + GUIO_NOSFX = (1 << 3), + GUIO_NOMIDI = (1 << 4), + GUIO_NOLAUNCHLOAD = (1 << 5), + + GUIO_MIDIPCSPK = (1 << 6), + GUIO_MIDICMS = (1 << 7), + GUIO_MIDIPCJR = (1 << 8), + GUIO_MIDIADLIB = (1 << 9), + GUIO_MIDITOWNS = (1 << 10), + GUIO_MIDI = (1 << 11) }; bool checkGameGUIOption(GameGUIOption option, const String &str); diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index d8b758c8b2..667dab91de 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -883,7 +883,7 @@ GameList ScummMetaEngine::detectGames(const Common::FSList &fslist) const { } } - dg.setGUIOptions(x->game.guioptions); + dg.setGUIOptions(x->game.guioptions | MidiDriver::midiDriverFlags2GUIO(x->game.midi)); detectedGames.push_back(dg); } diff --git a/gui/options.cpp b/gui/options.cpp index ad32bfd4e3..62262bf782 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -613,8 +613,13 @@ void OptionsDialog::addAudioControls(GuiObject *boss, const Common::String &pref // Populate it const MidiDriverDescription *md = MidiDriver::getAvailableMidiDrivers(); + uint32 allFlags = MidiDriver::midiDriverFlags2GUIO(~0ul); + while (md->name) { - _midiPopUp->appendEntry(_(md->description), md->id); + if (_domain == Common::ConfigManager::kApplicationDomain || // global dialog + !(_guioptions & allFlags) || // No flags are specified + _guioptions & (MidiDriver::midiDriverFlags2GUIO(md->flags))) // flag is present + _midiPopUp->appendEntry(_(md->description), md->id); md++; } diff --git a/sound/mididrv.cpp b/sound/mididrv.cpp index f7198056b4..c6e208ae47 100644 --- a/sound/mididrv.cpp +++ b/sound/mididrv.cpp @@ -31,6 +31,27 @@ #include "common/util.h" #include "sound/mididrv.h" +static const uint32 GUIOMapping[] = { + MDT_PCSPK, Common::GUIO_MIDIPCSPK, + MDT_CMS, Common::GUIO_MIDICMS, + MDT_PCJR, Common::GUIO_MIDIPCJR, + MDT_ADLIB, Common::GUIO_MIDIADLIB, + MDT_TOWNS, Common::GUIO_MIDITOWNS, + MDT_MIDI, Common::GUIO_MIDI, + 0, 0 +}; + +uint32 MidiDriver::midiDriverFlags2GUIO(uint32 flags) { + uint32 res = 0; + + for (int i = 0; GUIOMapping[i] || GUIOMapping[i + 1]; i += 2) { + if (flags & GUIOMapping[i]) + res |= GUIOMapping[i + 1]; + } + + return res; +} + /** Internal list of all available 'midi' drivers. */ static const MidiDriverDescription s_musicDrivers[] = { diff --git a/sound/mididrv.h b/sound/mididrv.h index 69cbb7ab65..2931e2571e 100644 --- a/sound/mididrv.h +++ b/sound/mididrv.h @@ -134,6 +134,8 @@ public: /** Get the id of the music driver matching the given driver name, or MD_AUTO if there is no match. */ static MidiDriverType parseMusicDriver(const Common::String &str); + static uint32 midiDriverFlags2GUIO(uint32 flags); + /** * Get a list of all available MidiDriver types. * @return list of all available midi drivers, terminated by a zero entry |