mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-02 08:19:19 +00:00
GUI: Implement MIDI drivers as GUI options.
Proper version of patch #2988641: "GSoC: Select drivers in GUI based on output types". So far only SCUMM engine supports this feature. svn-id: r49783
This commit is contained in:
parent
2bcafcb02d
commit
67bc711580
@ -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 }
|
||||
};
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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++;
|
||||
}
|
||||
|
||||
|
@ -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[] = {
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user