aboutsummaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorEugene Sandulenko2011-10-23 15:14:41 +0100
committerEugene Sandulenko2011-10-23 17:53:13 +0100
commit77c65648b1db8f8b7b245510681eafd856798d26 (patch)
treebe20ba4cc50090f8b4cbfe53acbe7cf94bdd74f1 /audio
parent2efcee52889c7ed1c46e669a3b3d4f0ab2aa1cd2 (diff)
downloadscummvm-rg350-77c65648b1db8f8b7b245510681eafd856798d26.tar.gz
scummvm-rg350-77c65648b1db8f8b7b245510681eafd856798d26.tar.bz2
scummvm-rg350-77c65648b1db8f8b7b245510681eafd856798d26.zip
AD: Swtich GUI options to a char array.
This eliminates nasty limitation of caping number of flags to 31. Current code has limitation of 255 flags, though. Only SCUMM engine is converted, rest do not even compile. Detection of fan talkie MI is broken as it has to be implemented differently.
Diffstat (limited to 'audio')
-rw-r--r--audio/mididrv.cpp39
-rw-r--r--audio/mididrv.h2
2 files changed, 22 insertions, 19 deletions
diff --git a/audio/mididrv.cpp b/audio/mididrv.cpp
index a89bafddf8..f638250dcd 100644
--- a/audio/mididrv.cpp
+++ b/audio/mididrv.cpp
@@ -55,27 +55,30 @@ const byte MidiDriver::_gmToMt32[128] = {
101, 103, 100, 120, 117, 113, 99, 128, 128, 128, 128, 124, 123, 128, 128, 128, // 7x
};
-static const uint32 GUIOMapping[] = {
- MT_PCSPK, Common::GUIO_MIDIPCSPK,
- MT_CMS, Common::GUIO_MIDICMS,
- MT_PCJR, Common::GUIO_MIDIPCJR,
- MT_ADLIB, Common::GUIO_MIDIADLIB,
- MT_C64, Common::GUIO_MIDIC64,
- MT_AMIGA, Common::GUIO_MIDIAMIGA,
- MT_APPLEIIGS, Common::GUIO_MIDIAPPLEIIGS,
- MT_TOWNS, Common::GUIO_MIDITOWNS,
- MT_PC98, Common::GUIO_MIDIPC98,
- MT_GM, Common::GUIO_MIDIGM,
- MT_MT32, Common::GUIO_MIDIMT32,
- 0, 0
+static const struct {
+ uint32 type;
+ const char *guio;
+} GUIOMapping[] = {
+ { MT_PCSPK, GUIO_MIDIPCSPK, },
+ { MT_CMS, GUIO_MIDICMS, },
+ { MT_PCJR, GUIO_MIDIPCJR, },
+ { MT_ADLIB, GUIO_MIDIADLIB, },
+ { MT_C64, GUIO_MIDIC64, },
+ { MT_AMIGA, GUIO_MIDIAMIGA, },
+ { MT_APPLEIIGS, GUIO_MIDIAPPLEIIGS, },
+ { MT_TOWNS, GUIO_MIDITOWNS, },
+ { MT_PC98, GUIO_MIDIPC98, },
+ { MT_GM, GUIO_MIDIGM, },
+ { MT_MT32, GUIO_MIDIMT32, },
+ { 0, 0 },
};
-uint32 MidiDriver::musicType2GUIO(uint32 musicType) {
- uint32 res = 0;
+Common::String MidiDriver::musicType2GUIO(uint32 musicType) {
+ Common::String res = "";
- for (int i = 0; GUIOMapping[i] || GUIOMapping[i + 1]; i += 2) {
- if (musicType == GUIOMapping[i] || musicType == (uint32)-1)
- res |= GUIOMapping[i + 1];
+ for (int i = 0; GUIOMapping[i].guio; i++) {
+ if (musicType == GUIOMapping[i].type || musicType == (uint32)-1)
+ res += GUIOMapping[i].guio;
}
return res;
diff --git a/audio/mididrv.h b/audio/mididrv.h
index e3f6461be9..cdf2943f2a 100644
--- a/audio/mididrv.h
+++ b/audio/mididrv.h
@@ -146,7 +146,7 @@ public:
kDeviceId
};
- static uint32 musicType2GUIO(uint32 musicType);
+ static Common::String musicType2GUIO(uint32 musicType);
/** Create music driver matching the given device handle, or NULL if there is no match. */
static MidiDriver *createMidi(DeviceHandle handle);