[Scummvm-cvs-logs] SF.net SVN: scummvm:[49783] scummvm/trunk

sev at users.sourceforge.net sev at users.sourceforge.net
Tue Jun 15 12:56:13 CEST 2010


Revision: 49783
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49783&view=rev
Author:   sev
Date:     2010-06-15 10:56:12 +0000 (Tue, 15 Jun 2010)

Log Message:
-----------
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.

Modified Paths:
--------------
    scummvm/trunk/common/util.cpp
    scummvm/trunk/common/util.h
    scummvm/trunk/engines/scumm/detection.cpp
    scummvm/trunk/gui/options.cpp
    scummvm/trunk/sound/mididrv.cpp
    scummvm/trunk/sound/mididrv.h

Modified: scummvm/trunk/common/util.cpp
===================================================================
--- scummvm/trunk/common/util.cpp	2010-06-15 10:55:31 UTC (rev 49782)
+++ scummvm/trunk/common/util.cpp	2010-06-15 10:56:12 UTC (rev 49783)
@@ -293,12 +293,20 @@
 	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 }
 };
 

Modified: scummvm/trunk/common/util.h
===================================================================
--- scummvm/trunk/common/util.h	2010-06-15 10:55:31 UTC (rev 49782)
+++ scummvm/trunk/common/util.h	2010-06-15 10:56:12 UTC (rev 49783)
@@ -215,9 +215,16 @@
 	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);

Modified: scummvm/trunk/engines/scumm/detection.cpp
===================================================================
--- scummvm/trunk/engines/scumm/detection.cpp	2010-06-15 10:55:31 UTC (rev 49782)
+++ scummvm/trunk/engines/scumm/detection.cpp	2010-06-15 10:56:12 UTC (rev 49783)
@@ -883,7 +883,7 @@
 			}
 		}
 
-		dg.setGUIOptions(x->game.guioptions);
+		dg.setGUIOptions(x->game.guioptions | MidiDriver::midiDriverFlags2GUIO(x->game.midi));
 
 		detectedGames.push_back(dg);
 	}

Modified: scummvm/trunk/gui/options.cpp
===================================================================
--- scummvm/trunk/gui/options.cpp	2010-06-15 10:55:31 UTC (rev 49782)
+++ scummvm/trunk/gui/options.cpp	2010-06-15 10:56:12 UTC (rev 49783)
@@ -613,8 +613,13 @@
 
 	// 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++;
 	}
 

Modified: scummvm/trunk/sound/mididrv.cpp
===================================================================
--- scummvm/trunk/sound/mididrv.cpp	2010-06-15 10:55:31 UTC (rev 49782)
+++ scummvm/trunk/sound/mididrv.cpp	2010-06-15 10:56:12 UTC (rev 49783)
@@ -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[] = {
 

Modified: scummvm/trunk/sound/mididrv.h
===================================================================
--- scummvm/trunk/sound/mididrv.h	2010-06-15 10:55:31 UTC (rev 49782)
+++ scummvm/trunk/sound/mididrv.h	2010-06-15 10:56:12 UTC (rev 49783)
@@ -134,6 +134,8 @@
 	/** 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


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list