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
6 changed files with 53 additions and 10 deletions
|
@ -299,6 +299,14 @@ const struct GameOpt {
|
||||||
{ GUIO_NOSFX, "sndNoSFX" },
|
{ GUIO_NOSFX, "sndNoSFX" },
|
||||||
{ GUIO_NOMIDI, "sndNoMIDI" },
|
{ GUIO_NOMIDI, "sndNoMIDI" },
|
||||||
{ GUIO_NOLAUNCHLOAD, "launchNoLoad" },
|
{ GUIO_NOLAUNCHLOAD, "launchNoLoad" },
|
||||||
|
|
||||||
|
{ GUIO_MIDIPCSPK, "midiPCSpk" },
|
||||||
|
{ GUIO_MIDICMS, "midiCMS" },
|
||||||
|
{ GUIO_MIDIPCJR, "midiPCJr" },
|
||||||
|
{ GUIO_MIDIADLIB, "midiAdLib" },
|
||||||
|
{ GUIO_MIDITOWNS, "midiTowns" },
|
||||||
|
{ GUIO_MIDI, "midiMidi" },
|
||||||
|
|
||||||
{ GUIO_NONE, 0 }
|
{ GUIO_NONE, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,14 @@ enum GameGUIOption {
|
||||||
GUIO_NOSPEECH = (1 << 2),
|
GUIO_NOSPEECH = (1 << 2),
|
||||||
GUIO_NOSFX = (1 << 3),
|
GUIO_NOSFX = (1 << 3),
|
||||||
GUIO_NOMIDI = (1 << 4),
|
GUIO_NOMIDI = (1 << 4),
|
||||||
GUIO_NOLAUNCHLOAD = (1 << 5)
|
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);
|
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);
|
detectedGames.push_back(dg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -613,7 +613,12 @@ void OptionsDialog::addAudioControls(GuiObject *boss, const Common::String &pref
|
||||||
|
|
||||||
// Populate it
|
// Populate it
|
||||||
const MidiDriverDescription *md = MidiDriver::getAvailableMidiDrivers();
|
const MidiDriverDescription *md = MidiDriver::getAvailableMidiDrivers();
|
||||||
|
uint32 allFlags = MidiDriver::midiDriverFlags2GUIO(~0ul);
|
||||||
|
|
||||||
while (md->name) {
|
while (md->name) {
|
||||||
|
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);
|
_midiPopUp->appendEntry(_(md->description), md->id);
|
||||||
md++;
|
md++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,27 @@
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
#include "sound/mididrv.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. */
|
/** Internal list of all available 'midi' drivers. */
|
||||||
static const MidiDriverDescription s_musicDrivers[] = {
|
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. */
|
/** 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 MidiDriverType parseMusicDriver(const Common::String &str);
|
||||||
|
|
||||||
|
static uint32 midiDriverFlags2GUIO(uint32 flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of all available MidiDriver types.
|
* Get a list of all available MidiDriver types.
|
||||||
* @return list of all available midi drivers, terminated by a zero entry
|
* @return list of all available midi drivers, terminated by a zero entry
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue