[Scummvm-devel] templates, visuals, getDevices()

Rainer M. Canavan rainer at canavan.de
Sun Mar 1 22:04:55 CET 2009


Hi,

to compile the branch-0-13-0, I had to make some minor adjustments 
to common/list.h, common/hashmap.h and engines/groovie/graphics.cpp.
If those changes don't break builds with gcc and other compilers,
I'd appreciate if they could be appiled to branch and trunk.

There's a problem with the main menu and the ctrl-F5 in-game 
scummvm menu (or SDL?) on one of my machines, the modern theme 
is mint green instead of red/orange, but all game graphics are OK. 
The visual of the scummvm window is as follows:

    visual id:    0x39
    class:    TrueColor
    depth:    15 planes
    available colormap entries:    32 per subfield
    red, green, blue masks:    0x1f, 0x3e0, 0x7c00
    significant bits in color specification:    8 bits

On another box where things look normal, the masks are reversed:
    red, green, blue masks:    0x7c00, 0x3e0, 0x1f

The second patch is an attempt to populate the getDevices()
function of the dmedia midi driver.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: scummvm-common-templates.patch
URL: <http://lists.scummvm.org/pipermail/scummvm-devel/attachments/20090301/e233589f/attachment.ksh>
-------------- next part --------------

Index: backends/midi/dmedia.cpp
===================================================================
--- backends/midi/dmedia.cpp	(revision 39046)
+++ backends/midi/dmedia.cpp	(working copy)
@@ -31,6 +31,7 @@
 
 #include "common/scummsys.h"
 #include "common/util.h"
+#include "common/config-manager.h"
 #include "sound/musicplugin.h"
 #include "sound/mpu401.h"
 
@@ -71,12 +72,14 @@
 
 int MidiDriver_DMEDIA::open() {
 	int numinterfaces;
+	int i;
+	const char *var;
+	char *portName;
 
 	if (_isOpen)
 		return MERR_ALREADY_OPEN;
 	_isOpen = true;
 
-	warning("dmedia init");
 	numinterfaces = mdInit();
 	if (numinterfaces <= 0) {
 		fprintf(stderr,"No MIDI interfaces configured.\n");
@@ -90,9 +93,18 @@
 	}
 		else
 	{
-		_midiportName = mdGetName(0);
-		warning("SCUMMVM_MIDIPORT environment variable not set, using Port %s", _midiportName);
-		_deviceNum = 0;
+		var = ConfMan.get("dmedia_port").c_str();
+		if (strlen(var)>0) {
+			for (i=0; i<numinterfaces; i++)
+			{
+				portName = mdGetName(i);
+				if (0==strcmp(var, portName)) {
+					_deviceNum = i;
+					_midiportName = portName;
+				}
+			}
+
+		}
 	}
 
 	_midiPort = mdOpenOutPort(_midiportName);
@@ -172,6 +184,7 @@
 
 	if (mdSend(_midiPort, &event, 1) != 1) {
 		fprintf(stderr,"failed sending MIDI SYSEX event (dump follows...)\n");
+		for (int i=0; i<event.msglen; i++) warning("%02x ",(int)event.msg[i]);
 	}
 }
 
@@ -193,10 +206,25 @@
 };
 
 MusicDevices DMediaMusicPlugin::getDevices() const {
+	int numinterfaces;
+	int i;
+	char *portName;
 	MusicDevices devices;
 	// TODO: Return a different music type depending on the configuration
-	// TODO: List the available devices
-	devices.push_back(MusicDevice(this, "", MT_GM));
+	// warning("DMedia getDevices");
+
+	numinterfaces = mdInit();
+	if (numinterfaces <= 0) {
+		fprintf(stderr,"No MIDI interfaces configured.\n");
+	}
+
+	for (i=0; i<numinterfaces; i++)
+	{
+		portName = mdGetName(0);
+		fprintf(stderr,"device %i %s\n", i, portName);
+		devices.push_back(MusicDevice(this, portName, MT_GM));
+	}
+
 	return devices;
 }
 


More information about the Scummvm-devel mailing list