[Scummvm-cvs-logs] SF.net SVN: scummvm: [32720] scummvm/branches/gsoc2008-rtl

cpage88 at users.sourceforge.net cpage88 at users.sourceforge.net
Mon Jun 16 21:06:48 CEST 2008


Revision: 32720
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32720&view=rev
Author:   cpage88
Date:     2008-06-16 12:06:48 -0700 (Mon, 16 Jun 2008)

Log Message:
-----------
Merged revisions 32668-32669,32676,32687-32689,32693,32695,32698-32701,32705 via svnmerge from 
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk

Modified Paths:
--------------
    scummvm/branches/gsoc2008-rtl/backends/midi/alsa.cpp
    scummvm/branches/gsoc2008-rtl/backends/midi/camd.cpp
    scummvm/branches/gsoc2008-rtl/backends/midi/coreaudio.cpp
    scummvm/branches/gsoc2008-rtl/backends/midi/coremidi.cpp
    scummvm/branches/gsoc2008-rtl/backends/midi/dmedia.cpp
    scummvm/branches/gsoc2008-rtl/backends/midi/quicktime.cpp
    scummvm/branches/gsoc2008-rtl/backends/midi/seq.cpp
    scummvm/branches/gsoc2008-rtl/backends/midi/timidity.cpp
    scummvm/branches/gsoc2008-rtl/backends/midi/windows.cpp
    scummvm/branches/gsoc2008-rtl/backends/midi/ypa1.cpp
    scummvm/branches/gsoc2008-rtl/backends/midi/zodiac.cpp
    scummvm/branches/gsoc2008-rtl/backends/platform/null/null.cpp
    scummvm/branches/gsoc2008-rtl/base/plugins.cpp
    scummvm/branches/gsoc2008-rtl/base/plugins.h
    scummvm/branches/gsoc2008-rtl/dists/msvc7/scummvm.vcproj
    scummvm/branches/gsoc2008-rtl/dists/msvc71/scummvm.vcproj
    scummvm/branches/gsoc2008-rtl/dists/msvc8/scummvm.vcproj
    scummvm/branches/gsoc2008-rtl/dists/msvc9/scummvm.vcproj
    scummvm/branches/gsoc2008-rtl/engines/cine/part.cpp
    scummvm/branches/gsoc2008-rtl/engines/cine/unpack.cpp
    scummvm/branches/gsoc2008-rtl/engines/cine/unpack.h
    scummvm/branches/gsoc2008-rtl/engines/made/database.cpp
    scummvm/branches/gsoc2008-rtl/engines/made/database.h
    scummvm/branches/gsoc2008-rtl/engines/made/detection.cpp
    scummvm/branches/gsoc2008-rtl/engines/made/made.cpp
    scummvm/branches/gsoc2008-rtl/engines/made/made.h
    scummvm/branches/gsoc2008-rtl/engines/made/screen.h
    scummvm/branches/gsoc2008-rtl/engines/made/script.cpp
    scummvm/branches/gsoc2008-rtl/engines/made/scriptfuncs.cpp
    scummvm/branches/gsoc2008-rtl/sound/module.mk
    scummvm/branches/gsoc2008-rtl/sound/null.cpp
    scummvm/branches/gsoc2008-rtl/sound/softsynth/adlib.cpp
    scummvm/branches/gsoc2008-rtl/sound/softsynth/fluidsynth.cpp
    scummvm/branches/gsoc2008-rtl/sound/softsynth/mt32.cpp
    scummvm/branches/gsoc2008-rtl/sound/softsynth/ym2612.cpp

Added Paths:
-----------
    scummvm/branches/gsoc2008-rtl/sound/musicplugin.cpp
    scummvm/branches/gsoc2008-rtl/sound/musicplugin.h

Removed Paths:
-------------
    scummvm/branches/gsoc2008-rtl/sound/midiplugin.h

Property Changed:
----------------
    scummvm/branches/gsoc2008-rtl/


Property changes on: scummvm/branches/gsoc2008-rtl
___________________________________________________________________
Name: svnmerge-integrated
   - /scummvm/branches/gsoc2008-gui:1-31703 /scummvm/branches/gsoc2008-tfmx:1-31765 /scummvm/trunk:1-32666
   + /scummvm/branches/gsoc2008-gui:1-31703 /scummvm/branches/gsoc2008-tfmx:1-31765 /scummvm/trunk:1-32719

Modified: scummvm/branches/gsoc2008-rtl/backends/midi/alsa.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/midi/alsa.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/backends/midi/alsa.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -28,7 +28,7 @@
 
 #include "common/config-manager.h"
 #include "common/util.h"
-#include "sound/midiplugin.h"
+#include "sound/musicplugin.h"
 #include "sound/mpu401.h"
 
 #include <alsa/asoundlib.h>
@@ -79,7 +79,7 @@
 }
 
 int MidiDriver_ALSA::open() {
-	char *var;
+	const char *var;
 
 	if (_isOpen)
 		return MERR_ALREADY_OPEN;
@@ -87,7 +87,8 @@
 
 	if (!(var = getenv("SCUMMVM_PORT"))) {
 		// use config option if no var specified
-		if (parse_addr(ConfMan.get("alsa_port").c_str(), &seq_client, &seq_port) < 0) {
+		var = ConfMan.get("alsa_port").c_str();
+		if (parse_addr(var, &seq_client, &seq_port) < 0) {
 			error("Invalid port %s", var);
 			return -1;
 		}
@@ -241,23 +242,18 @@
 
 // Plugin interface
 
-class AlsaMidiPlugin : public MidiPluginObject {
+class AlsaMusicPlugin : public MusicPluginObject {
 public:
-	virtual const char *getName() const {
+	const char *getName() const {
 		return "ALSA";
 	}
 
-	virtual const char *getId() const {
+	const char *getId() const {
 		return "alsa";
 	}
 
-	virtual int getCapabilities() const {
-		return MDT_MIDI;
-	}
-
-	virtual Common::StringList getDevices() const;
-
-	virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+	MusicDevices getDevices() const;
+	PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
 };
 
 #define perm_ok(pinfo,bits) ((snd_seq_port_info_get_capability(pinfo) & (bits)) == (bits))
@@ -271,8 +267,8 @@
 	return 0;
 }
 
-Common::StringList AlsaMidiPlugin::getDevices() const {
-	Common::StringList devices;
+MusicDevices AlsaMusicPlugin::getDevices() const {
+	MusicDevices devices;
 
 	snd_seq_t *seq;
 	if (snd_seq_open(&seq, "default", SND_SEQ_OPEN_DUPLEX, 0) < 0)
@@ -292,7 +288,8 @@
 		while (!found_valid_port && snd_seq_query_next_port(seq, pinfo) >= 0) {
 			if (check_permission(pinfo)) {
 				found_valid_port = true;
-				devices.push_back(snd_seq_client_info_get_name(cinfo));
+				// TODO: Return a different music type depending on the configuration
+				devices.push_back(MusicDevice(this, snd_seq_client_info_get_name(cinfo), MT_GM));
 				//snd_seq_client_info_get_client(cinfo) : snd_seq_port_info_get_port(pinfo)
 			}
 		}
@@ -302,7 +299,7 @@
 	return devices;
 }
 
-PluginError AlsaMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+PluginError AlsaMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
 	*mididriver = new MidiDriver_ALSA();
 
 	return kNoError;
@@ -311,16 +308,16 @@
 MidiDriver *MidiDriver_ALSA_create(Audio::Mixer *mixer) {
 	MidiDriver *mididriver;
 
-	AlsaMidiPlugin p;
+	AlsaMusicPlugin p;
 	p.createInstance(mixer, &mididriver);
 
 	return mididriver;
 }
 
 //#if PLUGIN_ENABLED_DYNAMIC(ALSA)
-	//REGISTER_PLUGIN_DYNAMIC(ALSA, PLUGIN_TYPE_MIDI, AlsaMidiPlugin);
+	//REGISTER_PLUGIN_DYNAMIC(ALSA, PLUGIN_TYPE_MUSIC, AlsaMusicPlugin);
 //#else
-	REGISTER_PLUGIN_STATIC(ALSA, PLUGIN_TYPE_MIDI, AlsaMidiPlugin);
+	REGISTER_PLUGIN_STATIC(ALSA, PLUGIN_TYPE_MUSIC, AlsaMusicPlugin);
 //#endif
 
 #endif

Modified: scummvm/branches/gsoc2008-rtl/backends/midi/camd.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/midi/camd.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/backends/midi/camd.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -28,7 +28,7 @@
 
 #include "common/endian.h"
 #include "common/util.h"
-#include "sound/midiplugin.h"
+#include "sound/musicplugin.h"
 #include "sound/mpu401.h"
 
 #include <proto/camd.h>
@@ -166,26 +166,29 @@
 
 // Plugin interface
 
-class CamdMidiPlugin : public MidiPluginObject {
+class CamdMusicPlugin : public MusicPluginObject {
 public:
-	virtual const char *getName() const {
+	const char *getName() const {
 		return "CAMD";
 	}
 
-	virtual const char *getId() const {
+	const char *getId() const {
 		return "camd";
 	}
 
-	virtual int getCapabilities() const {
-		return MDT_MIDI;
-	}
+	MusicDevices getDevices() const;
+	PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+};
 
-	//virtual Common::StringList getDevices() const;
+MusicDevices CamdMusicPlugin::getDevices() const {
+	MusicDevices devices;
+	// TODO: Return a different music type depending on the configuration
+	// TODO: List the available devices
+	devices.push_back(MusicDevice(this, "", MT_GM));
+	return devices;
+}
 
-	virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
-};
-
-PluginError CamdMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+PluginError CamdMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
 	*mididriver = new MidiDriver_CAMD();
 
 	return kNoError;
@@ -194,16 +197,16 @@
 MidiDriver *MidiDriver_CAMD_create(Audio::Mixer *mixer) {
 	MidiDriver *mididriver;
 
-	CamdMidiPlugin p;
+	CamdMusicPlugin p;
 	p.createInstance(mixer, &mididriver);
 
 	return mididriver;
 }
 
 //#if PLUGIN_ENABLED_DYNAMIC(CAMD)
-	//REGISTER_PLUGIN_DYNAMIC(CAMD, PLUGIN_TYPE_MIDI, CamdMidiPlugin);
+	//REGISTER_PLUGIN_DYNAMIC(CAMD, PLUGIN_TYPE_MUSIC, CamdMusicPlugin);
 //#else
-	REGISTER_PLUGIN_STATIC(CAMD, PLUGIN_TYPE_MIDI, CamdMidiPlugin);
+	REGISTER_PLUGIN_STATIC(CAMD, PLUGIN_TYPE_MUSIC, CamdMusicPlugin);
 //#endif
 
 #endif

Modified: scummvm/branches/gsoc2008-rtl/backends/midi/coreaudio.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/midi/coreaudio.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/backends/midi/coreaudio.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -37,7 +37,7 @@
 
 #include "common/config-manager.h"
 #include "common/util.h"
-#include "sound/midiplugin.h"
+#include "sound/musicplugin.h"
 #include "sound/mpu401.h"
 
 #include <AudioToolbox/AUGraph.h>
@@ -207,24 +207,29 @@
 
 // Plugin interface
 
-class CoreAudioMidiPlugin : public MidiPluginObject {
+class CoreAudioMusicPlugin : public MusicPluginObject {
 public:
-	virtual const char *getName() const {
+	const char *getName() const {
 		return "CoreAudio";
 	}
 
-	virtual const char *getId() const {
+	const char *getId() const {
 		return "core";
 	}
 
-	virtual int getCapabilities() const {
-		return MDT_MIDI;
-	}
-
-	virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+	MusicDevices getDevices() const;
+	PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
 };
 
-PluginError CoreAudioMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+MusicDevices CoreAudioMusicPlugin::getDevices() const {
+	MusicDevices devices;
+	// TODO: Return a different music type depending on the configuration
+	// TODO: List the available devices
+	devices.push_back(MusicDevice(this, "", MT_GM));
+	return devices;
+}
+
+PluginError CoreAudioMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
 	*mididriver = new MidiDriver_CORE();
 
 	return kNoError;
@@ -233,16 +238,16 @@
 MidiDriver *MidiDriver_CORE_create(Audio::Mixer *mixer) {
 	MidiDriver *mididriver;
 
-	CoreAudioMidiPlugin p;
+	CoreAudioMusicPlugin p;
 	p.createInstance(mixer, &mididriver);
 
 	return mididriver;
 }
 
 //#if PLUGIN_ENABLED_DYNAMIC(COREAUDIO)
-	//REGISTER_PLUGIN_DYNAMIC(COREAUDIO, PLUGIN_TYPE_MIDI, CoreAudioMidiPlugin);
+	//REGISTER_PLUGIN_DYNAMIC(COREAUDIO, PLUGIN_TYPE_MUSIC, CoreAudioMusicPlugin);
 //#else
-	REGISTER_PLUGIN_STATIC(COREAUDIO, PLUGIN_TYPE_MIDI, CoreAudioMidiPlugin);
+	REGISTER_PLUGIN_STATIC(COREAUDIO, PLUGIN_TYPE_MUSIC, CoreAudioMusicPlugin);
 //#endif
 
 #endif // MACOSX

Modified: scummvm/branches/gsoc2008-rtl/backends/midi/coremidi.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/midi/coremidi.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/backends/midi/coremidi.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -26,7 +26,7 @@
 
 #include "common/config-manager.h"
 #include "common/util.h"
-#include "sound/midiplugin.h"
+#include "sound/musicplugin.h"
 #include "sound/mpu401.h"
 
 #include <CoreMIDI/CoreMIDI.h>
@@ -179,24 +179,29 @@
 
 // Plugin interface
 
-class CoreMIDIMidiPlugin : public MidiPluginObject {
+class CoreMIDIMusicPlugin : public MusicPluginObject {
 public:
-	virtual const char *getName() const {
+	const char *getName() const {
 		return "CoreMIDI";
 	}
 
-	virtual const char *getId() const {
+	const char *getId() const {
 		return "coremidi";
 	}
 
-	virtual int getCapabilities() const {
-		return MDT_MIDI;
-	}
-
-	virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+	MusicDevices getDevices() const;
+	PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
 };
 
-PluginError CoreMIDIMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+MusicDevices CoreMIDIMusicPlugin::getDevices() const {
+	MusicDevices devices;
+	// TODO: Return a different music type depending on the configuration
+	// TODO: List the available devices
+	devices.push_back(MusicDevice(this, "", MT_GM));
+	return devices;
+}
+
+PluginError CoreMIDIMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
 	*mididriver = new MidiDriver_CoreMIDI();
 
 	return kNoError;
@@ -205,16 +210,16 @@
 MidiDriver *MidiDriver_CoreMIDI_create(Audio::Mixer *mixer) {
 	MidiDriver *mididriver;
 
-	CoreMIDIMidiPlugin p;
+	CoreMIDIMusicPlugin p;
 	p.createInstance(mixer, &mididriver);
 
 	return mididriver;
 }
 
 //#if PLUGIN_ENABLED_DYNAMIC(COREMIDI)
-	//REGISTER_PLUGIN_DYNAMIC(COREMIDI, PLUGIN_TYPE_MIDI, CoreMIDIMidiPlugin);
+	//REGISTER_PLUGIN_DYNAMIC(COREMIDI, PLUGIN_TYPE_MUSIC, CoreMIDIMusicPlugin);
 //#else
-	REGISTER_PLUGIN_STATIC(COREMIDI, PLUGIN_TYPE_MIDI, CoreMIDIMidiPlugin);
+	REGISTER_PLUGIN_STATIC(COREMIDI, PLUGIN_TYPE_MUSIC, CoreMIDIMusicPlugin);
 //#endif
 
 #endif // MACOSX

Modified: scummvm/branches/gsoc2008-rtl/backends/midi/dmedia.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/midi/dmedia.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/backends/midi/dmedia.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -31,7 +31,7 @@
 
 #include "common/scummsys.h"
 #include "common/util.h"
-#include "sound/midiplugin.h"
+#include "sound/musicplugin.h"
 #include "sound/mpu401.h"
 
 #include <dmedia/midi.h>
@@ -178,24 +178,29 @@
 
 // Plugin interface
 
-class DMediaMidiPlugin : public MidiPluginObject {
+class DMediaMusicPlugin : public MusicPluginObject {
 public:
-	virtual const char *getName() const {
+	const char *getName() const {
 		return "DMedia";
 	}
 
-	virtual const char *getId() const {
+	const char *getId() const {
 		return "dmedia";
 	}
 
-	virtual int getCapabilities() const {
-		return MDT_MIDI;
-	}
-
-	virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+	MusicDevices getDevices() const;
+	PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
 };
 
-PluginError DMediaMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+MusicDevices DMediaMusicPlugin::getDevices() const {
+	MusicDevices devices;
+	// TODO: Return a different music type depending on the configuration
+	// TODO: List the available devices
+	devices.push_back(MusicDevice(this, "", MT_GM));
+	return devices;
+}
+
+PluginError DMediaMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
 	*mididriver = new MidiDriver_DMEDIA();
 
 	return kNoError;
@@ -204,16 +209,16 @@
 MidiDriver *MidiDriver_DMEDIA_create(Audio::Mixer *mixer) {
 	MidiDriver *mididriver;
 
-	DMediaMidiPlugin p;
+	DMediaMusicPlugin p;
 	p.createInstance(mixer, &mididriver);
 
 	return mididriver;
 }
 
 //#if PLUGIN_ENABLED_DYNAMIC(DMEDIA)
-	//REGISTER_PLUGIN_DYNAMIC(DMEDIA, PLUGIN_TYPE_MIDI, DMediaMidiPlugin);
+	//REGISTER_PLUGIN_DYNAMIC(DMEDIA, PLUGIN_TYPE_MUSIC, DMediaMusicPlugin);
 //#else
-	REGISTER_PLUGIN_STATIC(DMEDIA, PLUGIN_TYPE_MIDI, DMediaMidiPlugin);
+	REGISTER_PLUGIN_STATIC(DMEDIA, PLUGIN_TYPE_MUSIC, DMediaMusicPlugin);
 //#endif
 
 #endif

Modified: scummvm/branches/gsoc2008-rtl/backends/midi/quicktime.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/midi/quicktime.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/backends/midi/quicktime.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -38,7 +38,7 @@
 
 #include "common/endian.h"
 #include "common/util.h"
-#include "sound/midiplugin.h"
+#include "sound/musicplugin.h"
 #include "sound/mpu401.h"
 
 #if defined(MACOSX)
@@ -265,24 +265,29 @@
 
 // Plugin interface
 
-class QuickTimeMidiPlugin : public MidiPluginObject {
+class QuickTimeMusicPlugin : public MusicPluginObject {
 public:
-	virtual const char *getName() const {
+	const char *getName() const {
 		return "QuickTime";
 	}
 
-	virtual const char *getId() const {
+	const char *getId() const {
 		return "qt";
 	}
 
-	virtual int getCapabilities() const {
-		return MDT_MIDI;
-	}
-
-	virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+	MusicDevices getDevices() const;
+	PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
 };
 
-PluginError QuickTimeMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+MusicDevices QuickTimeMusicPlugin::getDevices() const {
+	MusicDevices devices;
+	// TODO: Return a different music type depending on the configuration
+	// TODO: List the available devices
+	devices.push_back(MusicDevice(this, "", MT_GM));
+	return devices;
+}
+
+PluginError QuickTimeMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
 	*mididriver = new MidiDriver_QT();
 
 	return kNoError;
@@ -291,16 +296,16 @@
 MidiDriver *MidiDriver_QT_create(Audio::Mixer *mixer) {
 	MidiDriver *mididriver;
 
-	QuickTimeMidiPlugin p;
+	QuickTimeMusicPlugin p;
 	p.createInstance(mixer, &mididriver);
 
 	return mididriver;
 }
 
 //#if PLUGIN_ENABLED_DYNAMIC(QUICKTIME)
-	//REGISTER_PLUGIN_DYNAMIC(QUICKTIME, PLUGIN_TYPE_MIDI, QuickTimeMidiPlugin);
+	//REGISTER_PLUGIN_DYNAMIC(QUICKTIME, PLUGIN_TYPE_MUSIC, QuickTimeMusicPlugin);
 //#else
-	REGISTER_PLUGIN_STATIC(QUICKTIME, PLUGIN_TYPE_MIDI, QuickTimeMidiPlugin);
+	REGISTER_PLUGIN_STATIC(QUICKTIME, PLUGIN_TYPE_MUSIC, QuickTimeMusicPlugin);
 //#endif
 
 #endif // MACOSX || macintosh

Modified: scummvm/branches/gsoc2008-rtl/backends/midi/seq.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/midi/seq.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/backends/midi/seq.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -31,7 +31,7 @@
 #if defined(UNIX) && !defined(__BEOS__) && !defined(__MAEMO__)
 
 #include "common/util.h"
-#include "sound/midiplugin.h"
+#include "sound/musicplugin.h"
 #include "sound/mpu401.h"
 
 #include <fcntl.h>
@@ -173,24 +173,29 @@
 
 // Plugin interface
 
-class SeqMidiPlugin : public MidiPluginObject {
+class SeqMusicPlugin : public MusicPluginObject {
 public:
-	virtual const char *getName() const {
+	const char *getName() const {
 		return "SEQ";
 	}
 
-	virtual const char *getId() const {
+	const char *getId() const {
 		return "seq";
 	}
 
-	virtual int getCapabilities() const {
-		return MDT_MIDI;
-	}
-
-	virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+	MusicDevices getDevices() const;
+	PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
 };
 
-PluginError SeqMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+MusicDevices SeqMusicPlugin::getDevices() const {
+	MusicDevices devices;
+	// TODO: Return a different music type depending on the configuration
+	// TODO: List the available devices
+	devices.push_back(MusicDevice(this, "", MT_GM));
+	return devices;
+}
+
+PluginError SeqMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
 	*mididriver = new MidiDriver_SEQ();
 
 	return kNoError;
@@ -199,16 +204,16 @@
 MidiDriver *MidiDriver_SEQ_create(Audio::Mixer *mixer) {
 	MidiDriver *mididriver;
 
-	SeqMidiPlugin p;
+	SeqMusicPlugin p;
 	p.createInstance(mixer, &mididriver);
 
 	return mididriver;
 }
 
 //#if PLUGIN_ENABLED_DYNAMIC(SEQ)
-	//REGISTER_PLUGIN_DYNAMIC(SEQ, PLUGIN_TYPE_MIDI, SeqMidiPlugin);
+	//REGISTER_PLUGIN_DYNAMIC(SEQ, PLUGIN_TYPE_MUSIC, SeqMusicPlugin);
 //#else
-	REGISTER_PLUGIN_STATIC(SEQ, PLUGIN_TYPE_MIDI, SeqMidiPlugin);
+	REGISTER_PLUGIN_STATIC(SEQ, PLUGIN_TYPE_MUSIC, SeqMusicPlugin);
 //#endif
 
 #endif

Modified: scummvm/branches/gsoc2008-rtl/backends/midi/timidity.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/midi/timidity.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/backends/midi/timidity.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -37,7 +37,7 @@
 #if defined (UNIX)
 
 #include "common/util.h"
-#include "sound/midiplugin.h"
+#include "sound/musicplugin.h"
 #include "sound/mpu401.h"
 
 #include <fcntl.h>
@@ -514,24 +514,27 @@
 
 // Plugin interface
 
-class TimidityMidiPlugin : public MidiPluginObject {
+class TimidityMusicPlugin : public MusicPluginObject {
 public:
-	virtual const char *getName() const {
+	const char *getName() const {
 		return "TiMidity";
 	}
 
-	virtual const char *getId() const {
+	const char *getId() const {
 		return "timidity";
 	}
 
-	virtual int getCapabilities() const {
-		return MDT_MIDI;
-	}
-
-	virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+	MusicDevices getDevices() const;
+	PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
 };
 
-PluginError TimidityMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+MusicDevices TimidityMusicPlugin::getDevices() const {
+	MusicDevices devices;
+	devices.push_back(MusicDevice(this, "", MT_GM));
+	return devices;
+}
+
+PluginError TimidityMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
 	*mididriver = new MidiDriver_TIMIDITY();
 
 	return kNoError;
@@ -540,16 +543,16 @@
 MidiDriver *MidiDriver_TIMIDITY_create(Audio::Mixer *mixer) {
 	MidiDriver *mididriver;
 
-	TimidityMidiPlugin p;
+	TimidityMusicPlugin p;
 	p.createInstance(mixer, &mididriver);
 
 	return mididriver;
 }
 
 //#if PLUGIN_ENABLED_DYNAMIC(TIMIDITY)
-	//REGISTER_PLUGIN_DYNAMIC(TIMIDITY, PLUGIN_TYPE_MIDI, TimidityMidiPlugin);
+	//REGISTER_PLUGIN_DYNAMIC(TIMIDITY, PLUGIN_TYPE_MUSIC, TimidityMusicPlugin);
 //#else
-	REGISTER_PLUGIN_STATIC(TIMIDITY, PLUGIN_TYPE_MIDI, TimidityMidiPlugin);
+	REGISTER_PLUGIN_STATIC(TIMIDITY, PLUGIN_TYPE_MUSIC, TimidityMusicPlugin);
 //#endif
 
 #endif // defined (UNIX)

Modified: scummvm/branches/gsoc2008-rtl/backends/midi/windows.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/midi/windows.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/backends/midi/windows.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -28,7 +28,7 @@
 // winnt.h defines ARRAYSIZE, but we want our own one...
 #undef ARRAYSIZE
 
-#include "sound/midiplugin.h"
+#include "sound/musicplugin.h"
 #include "sound/mpu401.h"
 
 #include <mmsystem.h>
@@ -147,24 +147,29 @@
 
 // Plugin interface
 
-class WindowsMidiPlugin : public MidiPluginObject {
+class WindowsMusicPlugin : public MusicPluginObject {
 public:
-	virtual const char *getName() const {
+	const char *getName() const {
 		return "Windows MIDI";
 	}
 
-	virtual const char *getId() const {
+	const char *getId() const {
 		return "windows";
 	}
 
-	virtual int getCapabilities() const {
-		return MDT_MIDI;
-	}
-
-	virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+	MusicDevices getDevices() const;
+	PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
 };
 
-PluginError WindowsMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+MusicDevices WindowsMusicPlugin::getDevices() const {
+	MusicDevices devices;
+	// TODO: Return a different music type depending on the configuration
+	// TODO: List the available devices
+	devices.push_back(MusicDevice(this, "", MT_GM));
+	return devices;
+}
+
+PluginError WindowsMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
 	*mididriver = new MidiDriver_WIN();
 
 	return kNoError;
@@ -173,16 +178,16 @@
 MidiDriver *MidiDriver_WIN_create(Audio::Mixer *mixer) {
 	MidiDriver *mididriver;
 
-	WindowsMidiPlugin p;
+	WindowsMusicPlugin p;
 	p.createInstance(mixer, &mididriver);
 
 	return mididriver;
 }
 
 //#if PLUGIN_ENABLED_DYNAMIC(WINDOWS)
-	//REGISTER_PLUGIN_DYNAMIC(WINDOWS, PLUGIN_TYPE_MIDI, WindowsMidiPlugin);
+	//REGISTER_PLUGIN_DYNAMIC(WINDOWS, PLUGIN_TYPE_MUSIC, WindowsMusicPlugin);
 //#else
-	REGISTER_PLUGIN_STATIC(WINDOWS, PLUGIN_TYPE_MIDI, WindowsMidiPlugin);
+	REGISTER_PLUGIN_STATIC(WINDOWS, PLUGIN_TYPE_MUSIC, WindowsMusicPlugin);
 //#endif
 
 #endif

Modified: scummvm/branches/gsoc2008-rtl/backends/midi/ypa1.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/midi/ypa1.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/backends/midi/ypa1.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -23,7 +23,7 @@
  */
 
 #include "common/util.h"
-#include "sound/midiplugin.h"
+#include "sound/musicplugin.h"
 #include "sound/mpu401.h"
 
 #include "Pa1Lib.h"
@@ -106,24 +106,29 @@
 
 // Plugin interface
 
-class YamahaPa1MidiPlugin : public MidiPluginObject {
+class YamahaPa1MusicPlugin : public MusicPluginObject {
 public:
-	virtual const char *getName() const {
+	const char *getName() const {
 		return "Yamaha Pa1";
 	}
 
-	virtual const char *getId() const {
+	const char *getId() const {
 		return "ypa1";
 	}
 
-	virtual int getCapabilities() const {
-		return MDT_MIDI;
-	}
-
-	virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+	MusicDevices getDevices() const;
+	PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
 };
 
-PluginError YamahaPa1MidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+MusicDevices YamahaPa1MusicPlugin::getDevices() const {
+	MusicDevices devices;
+	// TODO: Return a different music type depending on the configuration
+	// TODO: List the available devices
+	devices.push_back(MusicDevice(this, "", MT_GM));
+	return devices;
+}
+
+PluginError YamahaPa1MusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
 	*mididriver = new MidiDriver_YamahaPa1();
 
 	return kNoError;
@@ -132,14 +137,14 @@
 MidiDriver *MidiDriver_YamahaPa1_create(Audio::Mixer *mixer) {
 	MidiDriver *mididriver;
 
-	YamahaPa1MidiPlugin p;
+	YamahaPa1MusicPlugin p;
 	p.createInstance(mixer, &mididriver);
 
 	return mididriver;
 }
 
 //#if PLUGIN_ENABLED_DYNAMIC(YPA1)
-	//REGISTER_PLUGIN_DYNAMIC(YPA1, PLUGIN_TYPE_MIDI, YamahaPa1MidiPlugin);
+	//REGISTER_PLUGIN_DYNAMIC(YPA1, PLUGIN_TYPE_MUSIC, YamahaPa1MusicPlugin);
 //#else
-	REGISTER_PLUGIN_STATIC(YPA1, PLUGIN_TYPE_MIDI, YamahaPa1MidiPlugin);
+	REGISTER_PLUGIN_STATIC(YPA1, PLUGIN_TYPE_MUSIC, YamahaPa1MusicPlugin);
 //#endif

Modified: scummvm/branches/gsoc2008-rtl/backends/midi/zodiac.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/midi/zodiac.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/backends/midi/zodiac.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -23,7 +23,7 @@
  */
 
 #include "common/util.h"
-#include "sound/midiplugin.h"
+#include "sound/musicplugin.h"
 #include "sound/mpu401.h"
 
 #ifndef DISABLE_TAPWAVE
@@ -124,24 +124,29 @@
 
 // Plugin interface
 
-class ZodiacMidiPlugin : public MidiPluginObject {
+class ZodiacMusicPlugin : public MusicPluginObject {
 public:
-	virtual const char *getName() const {
+	const char *getName() const {
 		return "Tapwave Zodiac";
 	}
 
-	virtual const char *getId() const {
+	const char *getId() const {
 		return "zodiac";
 	}
 
-	virtual int getCapabilities() const {
-		return MDT_MIDI;
-	}
-
-	virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+	MusicDevices getDevices() const;
+	PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
 };
 
-PluginError ZodiacMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+MusicDevices ZodiacMusicPlugin::getDevices() const {
+	MusicDevices devices;
+	// TODO: Return a different music type depending on the configuration
+	// TODO: List the available devices
+	devices.push_back(MusicDevice(this, "", MT_GM));
+	return devices;
+}
+
+PluginError ZodiacMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
 	*mididriver = new MidiDriver_Zodiac();
 
 	return kNoError;
@@ -150,16 +155,16 @@
 MidiDriver *MidiDriver_Zodiac_create(Audio::Mixer *mixer) {
 	MidiDriver *mididriver;
 
-	ZodiacMidiPlugin p;
+	ZodiacMusicPlugin p;
 	p.createInstance(mixer, &mididriver);
 
 	return mididriver;
 }
 
 //#if PLUGIN_ENABLED_DYNAMIC(ZODIAC)
-	//REGISTER_PLUGIN_DYNAMIC(ZODIAC, PLUGIN_TYPE_MIDI, ZodiacMidiPlugin);
+	//REGISTER_PLUGIN_DYNAMIC(ZODIAC, PLUGIN_TYPE_MUSIC, ZodiacMusicPlugin);
 //#else
-	REGISTER_PLUGIN_STATIC(ZODIAC, PLUGIN_TYPE_MIDI, ZodiacMidiPlugin);
+	REGISTER_PLUGIN_STATIC(ZODIAC, PLUGIN_TYPE_MUSIC, ZodiacMusicPlugin);
 //#endif
 
 #endif

Modified: scummvm/branches/gsoc2008-rtl/backends/platform/null/null.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/null/null.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/null/null.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -102,6 +102,7 @@
 
 	virtual Common::SaveFileManager *getSavefileManager();
 	virtual Audio::Mixer *getMixer();
+	virtual void getTimeAndDate(struct tm &t) const;
 	virtual Common::TimerManager *getTimerManager();
 };
 
@@ -295,6 +296,9 @@
 	return _timer;
 }
 
+void OSystem_NULL::getTimeAndDate(struct tm &t) const {
+}
+
 OSystem *OSystem_NULL_create() {
 	return new OSystem_NULL();
 }

Modified: scummvm/branches/gsoc2008-rtl/base/plugins.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/base/plugins.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/base/plugins.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -35,7 +35,7 @@
 
 int pluginTypeVersions[PLUGIN_TYPE_MAX] = {
 	PLUGIN_TYPE_ENGINE_VERSION,
-	PLUGIN_TYPE_MIDI_VERSION,
+	PLUGIN_TYPE_MUSIC_VERSION,
 };
 
 
@@ -144,7 +144,7 @@
 		LINK_PLUGIN(TOUCHE)
 		#endif
 
-		// MIDI plugins
+		// Music plugins
 		// TODO: Use defines to disable or enable each MIDI driver as a
 		// static/dynamic plugin, like it's done for the engines
 		LINK_PLUGIN(NULL)
@@ -393,12 +393,12 @@
 }
 
 
-// MIDI plugins
+// Music plugins
 
-#include "sound/midiplugin.h"
+#include "sound/musicplugin.h"
 
-DECLARE_SINGLETON(MidiManager);
+DECLARE_SINGLETON(MusicManager);
 
-const MidiPlugin::List &MidiManager::getPlugins() const {
-	return (const MidiPlugin::List &)PluginManager::instance().getPlugins(PLUGIN_TYPE_MIDI);
+const MusicPlugin::List &MusicManager::getPlugins() const {
+	return (const MusicPlugin::List &)PluginManager::instance().getPlugins(PLUGIN_TYPE_MUSIC);
 }

Modified: scummvm/branches/gsoc2008-rtl/base/plugins.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/base/plugins.h	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/base/plugins.h	2008-06-16 19:06:48 UTC (rev 32720)
@@ -62,7 +62,7 @@
 
 enum PluginType {
 	PLUGIN_TYPE_ENGINE = 0,
-	PLUGIN_TYPE_MIDI,
+	PLUGIN_TYPE_MUSIC,
 	/* PLUGIN_TYPE_SCALER, */	// TODO: Add graphics scaler plugins
 
 	PLUGIN_TYPE_MAX
@@ -71,7 +71,7 @@
 // TODO: Make the engine API version depend on ScummVM's version
 // because of the backlinking (posibly from the SVN revision)
 #define PLUGIN_TYPE_ENGINE_VERSION 1
-#define PLUGIN_TYPE_MIDI_VERSION 1
+#define PLUGIN_TYPE_MUSIC_VERSION 1
 
 extern int pluginTypeVersions[PLUGIN_TYPE_MAX];
 

Modified: scummvm/branches/gsoc2008-rtl/dists/msvc7/scummvm.vcproj
===================================================================
--- scummvm/branches/gsoc2008-rtl/dists/msvc7/scummvm.vcproj	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/dists/msvc7/scummvm.vcproj	2008-06-16 19:06:48 UTC (rev 32720)
@@ -396,9 +396,12 @@
 				RelativePath="..\..\sound\midiparser_xmidi.cpp">
 			</File>
 			<File
-				RelativePath="..\..\sound\midiplugin.h">
+				RelativePath="..\..\sound\musicplugin.cpp">
 			</File>
 			<File
+				RelativePath="..\..\sound\musicplugin.h">
+			</File>
+			<File
 				RelativePath="..\..\sound\mixer.cpp">
 			</File>
 			<File

Modified: scummvm/branches/gsoc2008-rtl/dists/msvc71/scummvm.vcproj
===================================================================
--- scummvm/branches/gsoc2008-rtl/dists/msvc71/scummvm.vcproj	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/dists/msvc71/scummvm.vcproj	2008-06-16 19:06:48 UTC (rev 32720)
@@ -410,9 +410,12 @@
 				RelativePath="..\..\sound\midiparser_xmidi.cpp">
 			</File>
 			<File
-				RelativePath="..\..\sound\midiplugin.h">
+				RelativePath="..\..\sound\musicplugin.cpp">
 			</File>
 			<File
+				RelativePath="..\..\sound\musicplugin.h">
+			</File>
+			<File
 				RelativePath="..\..\sound\mixer.cpp">
 			</File>
 			<File

Modified: scummvm/branches/gsoc2008-rtl/dists/msvc8/scummvm.vcproj
===================================================================
--- scummvm/branches/gsoc2008-rtl/dists/msvc8/scummvm.vcproj	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/dists/msvc8/scummvm.vcproj	2008-06-16 19:06:48 UTC (rev 32720)
@@ -565,10 +565,14 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\sound\midiplugin.h"
+				RelativePath="..\..\sound\musicplugin.cpp"
 				>
 			</File>
 			<File
+				RelativePath="..\..\sound\musicplugin.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\sound\mixer.cpp"
 				>
 			</File>

Modified: scummvm/branches/gsoc2008-rtl/dists/msvc9/scummvm.vcproj
===================================================================
--- scummvm/branches/gsoc2008-rtl/dists/msvc9/scummvm.vcproj	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/dists/msvc9/scummvm.vcproj	2008-06-16 19:06:48 UTC (rev 32720)
@@ -570,10 +570,14 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\sound\midiplugin.h"
+				RelativePath="..\..\sound\musicplugin.cpp"
 				>
 			</File>
 			<File
+				RelativePath="..\..\sound\musicplugin.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\sound\mixer.cpp"
 				>
 			</File>

Modified: scummvm/branches/gsoc2008-rtl/engines/cine/part.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/cine/part.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/engines/cine/part.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -128,7 +128,7 @@
 	f.read(buf, packedSize);
 	if (packedSize != unpackedSize) {
 		CineUnpacker cineUnpacker;
-		if (!cineUnpacker.unpack(buf, buf, packedSize)) {
+		if (!cineUnpacker.unpack(buf, packedSize, buf, unpackedSize)) {
 			error("Error while unpacking 'vol.cnf' data");
 		}
 	}
@@ -226,7 +226,9 @@
 		byte *unpackBuffer = (byte *)malloc(partBuffer[foundFileIdx].packedSize);
 		readFromPart(foundFileIdx, unpackBuffer);
 		CineUnpacker cineUnpacker;
-		cineUnpacker.unpack(dataPtr, unpackBuffer, partBuffer[foundFileIdx].packedSize);
+		if (!cineUnpacker.unpack(unpackBuffer, partBuffer[foundFileIdx].packedSize, dataPtr, partBuffer[foundFileIdx].unpackedSize)) {
+			warning("Error unpacking '%s' from bundle file '%s'", partBuffer[foundFileIdx].partName, currentPartName);
+		}
 		free(unpackBuffer);
 	} else {
 		readFromPart(foundFileIdx, dataPtr);

Modified: scummvm/branches/gsoc2008-rtl/engines/cine/unpack.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/cine/unpack.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/engines/cine/unpack.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -31,13 +31,17 @@
 namespace Cine {
 
 uint32 CineUnpacker::readSource() {
+	if (_src < _srcBegin || _src + 4 > _srcEnd) {
+		_error = true;
+		return 0; // The source pointer is out of bounds, returning a default value
+	}
 	uint32 value = READ_BE_UINT32(_src);
 	_src -= 4;
 	return value;
 }
 
-int CineUnpacker::rcr(int inputCarry) {
-	int outputCarry = (_chunk32b & 1);
+uint CineUnpacker::rcr(bool inputCarry) {
+	uint outputCarry = (_chunk32b & 1);
 	_chunk32b >>= 1;
 	if (inputCarry) {
 		_chunk32b |= 0x80000000;
@@ -45,20 +49,20 @@
 	return outputCarry;
 }
 
-int CineUnpacker::nextBit() {
-	int carry = rcr(0);
+uint CineUnpacker::nextBit() {
+	uint carry = rcr(false);
 	// Normally if the chunk becomes zero then the carry is one as
 	// the end of chunk marker is always the last to be shifted out.
 	if (_chunk32b == 0) {
 		_chunk32b = readSource();
 		_crc ^= _chunk32b;
-		carry = rcr(1); // Put the end of chunk marker in the most significant bit
+		carry = rcr(true); // Put the end of chunk marker in the most significant bit
 	}
 	return carry;
 }
 
-uint16 CineUnpacker::getBits(byte numBits) {
-	uint16 c = 0;
+uint CineUnpacker::getBits(uint numBits) {
+	uint c = 0;
 	while (numBits--) {
 		c <<= 1;
 		c |= nextBit();
@@ -66,30 +70,45 @@
 	return c;
 }
 
-void CineUnpacker::unpackRawBytes(uint16 numBytes) {
-	_datasize -= numBytes;
+void CineUnpacker::unpackRawBytes(uint numBytes) {
+	if (_dst >= _dstEnd || _dst - numBytes + 1 < _dstBegin) {
+		_error = true;
+		return; // Destination pointer is out of bounds for this operation
+	}
 	while (numBytes--) {
 		*_dst = (byte)getBits(8);
 		--_dst;
 	}
 }
 
-void CineUnpacker::copyRelocatedBytes(uint16 offset, uint16 numBytes) {
-	_datasize -= numBytes;
+void CineUnpacker::copyRelocatedBytes(uint offset, uint numBytes) {
+	if (_dst + offset >= _dstEnd || _dst - numBytes + 1 < _dstBegin) {
+		_error = true;
+		return; // Destination pointer is out of bounds for this operation
+	}
 	while (numBytes--) {
 		*_dst = *(_dst + offset);
 		--_dst;
 	}
 }
 
-bool CineUnpacker::unpack(byte *dst, const byte *src, int srcLen) {
-	_src = src + srcLen - 4;
-	_datasize = readSource(); // Unpacked length in bytes
-	_dst = dst + _datasize - 1;
+bool CineUnpacker::unpack(const byte *src, uint srcLen, byte *dst, uint dstLen) {
+	// Initialize variables used for detecting errors during unpacking
+	_error    = false;
+	_srcBegin = src;
+	_srcEnd   = src + srcLen;
+	_dstBegin = dst;
+	_dstEnd   = dst + dstLen;
+
+	// Initialize other variables
+	_src = _srcBegin + srcLen - 4;
+	uint32 unpackedLength = readSource(); // Unpacked length in bytes
+	_dst = _dstBegin + unpackedLength - 1;
 	_crc = readSource();
 	_chunk32b = readSource();
 	_crc ^= _chunk32b;
-	do {
+
+	while (_dst >= _dstBegin && !_error) {
 		/*
 		Bits  => Action:
 		0 0   => unpackRawBytes(3 bits + 1)              i.e. unpackRawBytes(1..9)
@@ -101,30 +120,30 @@
 		*/
 		if (!nextBit()) { // 0...
 			if (!nextBit()) { // 0 0
-				uint16 numBytes = getBits(3) + 1;
+				uint numBytes = getBits(3) + 1;
 				unpackRawBytes(numBytes);
 			} else { // 0 1
-				uint16 numBytes = 2;
-				uint16 offset   = getBits(8);
+				uint numBytes = 2;
+				uint offset   = getBits(8);
 				copyRelocatedBytes(offset, numBytes);
 			}
 		} else { // 1...
-			uint16 c = getBits(2);
+			uint c = getBits(2);
 			if (c == 3) { // 1 1 1
-				uint16 numBytes = getBits(8) + 9;
+				uint numBytes = getBits(8) + 9;
 				unpackRawBytes(numBytes);
 			} else if (c < 2) { // 1 0 x
-				uint16 numBytes = c + 3;
-				uint16 offset   = getBits(c + 9);
+				uint numBytes = c + 3;
+				uint offset   = getBits(c + 9);
 				copyRelocatedBytes(offset, numBytes);
 			} else { // 1 1 0
-				uint16 numBytes = getBits(8) + 1;
-				uint16 offset   = getBits(12);
+				uint numBytes = getBits(8) + 1;
+				uint offset   = getBits(12);
 				copyRelocatedBytes(offset, numBytes);
 			}
 		}
-	} while (_datasize > 0 && _src >= src - 4);
-	return _crc == 0;
+	}
+	return !_error && (_crc == 0);
 }
 
 } // End of namespace Cine

Modified: scummvm/branches/gsoc2008-rtl/engines/cine/unpack.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/cine/unpack.h	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/engines/cine/unpack.h	2008-06-16 19:06:48 UTC (rev 32720)
@@ -39,41 +39,77 @@
  */
 class CineUnpacker {
 public:
-	/** Returns true if unpacking was successful, otherwise false. */
-	bool unpack(byte *dst, const byte *src, int srcLen);
+	/**
+	 * Unpacks packed data from the source buffer to the destination buffer.
+	 * @warning Do NOT call this on data that is not packed.
+	 * @note Source and destination buffer pointers can be the same as long as there's space for the unpacked data.
+	 * @param src Pointer to the source buffer.
+	 * @param srcLen Length of the source buffer.
+	 * @param dst Pointer to the destination buffer.
+	 * @param dstLen Length of the destination buffer.
+	 * @return True if no errors were detected in the source data and unpacking was successful, otherwise false.
+	 */
+	bool unpack(const byte *src, uint srcLen, byte *dst, uint dstLen);
 private:
-	/** Reads a single big endian 32-bit integer from the source and goes backwards 4 bytes. */
+	/**
+	 * Reads an unsigned big endian 32-bit integer from the source stream and goes backwards 4 bytes.
+	 * @return If the operation is valid, an unsigned big endian 32-bit integer read from the source stream.
+	 * @return If the operation is invalid, zero.
+	 * @note Sets internal error state if the read operation would be out of source bounds.
+	 */
 	uint32 readSource();
 
 	/**
 	 * Shifts the current internal 32-bit chunk to the right by one.
 	 * Puts input carry into internal chunk's topmost (i.e. leftmost) bit.
-	 * Returns the least significant bit that was shifted out.
+	 * @return The least significant bit that was shifted out from the chunk.
 	 */
-	int rcr(int inputCarry);
-	int nextBit();
-	uint16 getBits(byte numBits);
+	uint rcr(bool inputCarry);
 
 	/**
+	 * Get the next bit from the source stream.
+	 * @note Changes the bit position in the source stream.
+	 * @return The next bit from the source stream.
+	 */
+	uint nextBit();
+
+	/**
+	 * Get bits from the source stream.
+	 * @note Changes the bit position in the source stream.
+	 * @param numBits Number of bits to read from the source stream.	 
+	 * @return Integer value consisting of the bits read from the source stream (In range [0, (2 ** numBits) - 1]).
+	 * @return Later the bit was read from the source, the less significant it is in the return value.
+	 */
+	uint getBits(uint numBits);
+
+	/**
 	 * Copy raw bytes from the input stream and write them to the destination stream.
 	 * This is used when no adequately long match is found in the sliding window.
+	 * @note Sets internal error state if the operation would be out of bounds.
 	 * @param numBytes Amount of bytes to copy from the input stream
 	 */
-	void unpackRawBytes(uint16 numBytes);
+	void unpackRawBytes(uint numBytes);
 
 	/**
 	 * Copy bytes from the sliding window in the destination buffer.
 	 * This is used when a match of two bytes or longer is found.
+	 * @note Sets internal error state if the operation would be out of bounds.
 	 * @param offset Offset in the sliding window
 	 * @param numBytes Amount of bytes to copy
 	 */
-	void copyRelocatedBytes(uint16 offset, uint16 numBytes);
+	void copyRelocatedBytes(uint offset, uint numBytes);
 private:
-	int _datasize;    //!< Bytes left to write into the unpacked data stream
-	uint32 _crc;      //!< Error-detecting code
-	uint32 _chunk32b; //!< The current internal 32-bit chunk
-	byte *_dst;       //!< Destination buffer pointer
-	const byte *_src; //!< Source buffer pointer
+	uint32 _crc;      //!< Error-detecting code (This should be zero after successful unpacking)
+	uint32 _chunk32b; //!< The current internal 32-bit chunk of source data
+	byte *_dst;       //!< Pointer to the current position in the destination buffer
+	const byte *_src; //!< Pointer to the current position in the source buffer
+
+	// These are used for detecting errors (e.g. out of bounds issues) during unpacking
+	bool _error;           //!< Did an error occur during unpacking?
+	const byte *_srcBegin; //!< Source buffer's beginning
+	const byte *_srcEnd;   //!< Source buffer's end
+	byte *_dstBegin;       //!< Destination buffer's beginning
+	byte *_dstEnd;         //!< Destination buffer's end
 };
 
 } // End of namespace Cine

Modified: scummvm/branches/gsoc2008-rtl/engines/made/database.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/made/database.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/engines/made/database.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -301,7 +301,7 @@
 		return 0;
 
 	int16 propertyFlag;
-	int16 *property = getObjectPropertyPtr(objectIndex, propertyId, propertyFlag);
+	int16 *property = findObjectProperty(objectIndex, propertyId, propertyFlag);
 
 	if (property) {
 		return (int16)READ_LE_UINT16(property);
@@ -317,7 +317,7 @@
 		return 0;
 
 	int16 propertyFlag;
-	int16 *property = getObjectPropertyPtr(objectIndex, propertyId, propertyFlag);
+	int16 *property = findObjectProperty(objectIndex, propertyId, propertyFlag);
 
 	if (property) {
 		if (propertyFlag == 1) {
@@ -430,7 +430,7 @@
 	return result;
 }
 
-int16 *GameDatabaseV2::getObjectPropertyPtr(int16 objectIndex, int16 propertyId, int16 &propertyFlag) {
+int16 *GameDatabaseV2::findObjectProperty(int16 objectIndex, int16 propertyId, int16 &propertyFlag) {
 	Object *obj = getObject(objectIndex);
 
 	int16 *prop = (int16*)obj->getData();
@@ -489,6 +489,7 @@
 
 	}
 
+	debug(1, "findObjectProperty(%04X, %04X) Property not found", objectIndex, propertyId);
 	return NULL;
 
 }
@@ -597,7 +598,7 @@
 	return result;
 }
 
-int16 *GameDatabaseV3::getObjectPropertyPtr(int16 objectIndex, int16 propertyId, int16 &propertyFlag) {
+int16 *GameDatabaseV3::findObjectProperty(int16 objectIndex, int16 propertyId, int16 &propertyFlag) {
 	Object *obj = getObject(objectIndex);
 
 	int16 *prop = (int16*)obj->getData();

Modified: scummvm/branches/gsoc2008-rtl/engines/made/database.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/made/database.h	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/engines/made/database.h	2008-06-16 19:06:48 UTC (rev 32720)
@@ -133,7 +133,7 @@
 	const char *getObjectString(int16 index);
 	void setObjectString(int16 index, const char *str);
 
-	virtual int16 *getObjectPropertyPtr(int16 objectIndex, int16 propertyId, int16 &propertyFlag) = 0;
+	virtual int16 *findObjectProperty(int16 objectIndex, int16 propertyId, int16 &propertyFlag) = 0;
 	virtual const char *getString(uint16 offset) = 0;
 	virtual bool getSavegameDescription(const char *filename, Common::String &description) = 0;
 	virtual int16 savegame(const char *filename, const char *description, int16 version) = 0;
@@ -157,7 +157,7 @@
 public:
 	GameDatabaseV2(MadeEngine *vm);
 	~GameDatabaseV2();
-	int16 *getObjectPropertyPtr(int16 objectIndex, int16 propertyId, int16 &propertyFlag);
+	int16 *findObjectProperty(int16 objectIndex, int16 propertyId, int16 &propertyFlag);
 	const char *getString(uint16 offset);
 	bool getSavegameDescription(const char *filename, Common::String &description);
 	int16 savegame(const char *filename, const char *description, int16 version);
@@ -170,7 +170,7 @@
 class GameDatabaseV3 : public GameDatabase {
 public:
 	GameDatabaseV3(MadeEngine *vm);
-	int16 *getObjectPropertyPtr(int16 objectIndex, int16 propertyId, int16 &propertyFlag);
+	int16 *findObjectProperty(int16 objectIndex, int16 propertyId, int16 &propertyFlag);
 	const char *getString(uint16 offset);
 	bool getSavegameDescription(const char *filename, Common::String &description);
 	int16 savegame(const char *filename, const char *description, int16 version);

Modified: scummvm/branches/gsoc2008-rtl/engines/made/detection.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/made/detection.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/engines/made/detection.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -65,6 +65,7 @@
 	{"manhole", "The Manhole"},
 	{"rtz", "Return to Zork"},
 	{"lgop2", "Leather Goddesses of Phobos 2"},
+	{"rodney", "Rodney's Fun Screen"},
 	{0, 0}
 };
 
@@ -276,6 +277,22 @@
 		0,
 	},
 
+	{
+		// Rodney's Fun Screen
+		{
+			"rodney",
+			"",
+			AD_ENTRY1("rodneys.dat", "a79887dbaa47689facd7c6f09258ba5a"),
+			Common::EN_ANY,
+			Common::kPlatformPC,
+			Common::ADGF_NO_FLAGS
+		},
+		GID_RODNEY,
+		0,
+		GF_FLOPPY,
+		0,
+	},
+
 	{ AD_TABLE_END_MARKER, 0, 0, 0, 0 }
 };
 

Modified: scummvm/branches/gsoc2008-rtl/engines/made/made.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/made/made.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/engines/made/made.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -35,6 +35,7 @@
 #include "base/plugins.h"
 #include "base/version.h"
 
+#include "sound/audiocd.h"
 #include "sound/mixer.h"
 
 #include "made/made.h"
@@ -87,7 +88,7 @@
 	_res = new ProjectReader();
 	_screen = new Screen(this);
 
-	if (getGameID() == GID_LGOP2 || getGameID() == GID_MANHOLE) {
+	if (getGameID() == GID_LGOP2 || getGameID() == GID_MANHOLE || getGameID() == GID_RODNEY) {
 		_dat = new GameDatabaseV2(this);
 	} else if (getGameID() == GID_RTZ) {
 		_dat = new GameDatabaseV3(this);
@@ -119,7 +120,7 @@
 
 	// Set default sound frequency
 	// Return to Zork sets it itself via a script funtion
-	if (getGameID() == GID_MANHOLE) {
+	if (getGameID() == GID_MANHOLE || getGameID() == GID_RODNEY) {
 		_soundRate = 11025;
 	} else {
 		_soundRate = 8000;
@@ -238,6 +239,8 @@
 
 		}
 	}
+	
+	AudioCD.updateCD();
 
 }
 
@@ -245,7 +248,7 @@
 
 	for (int i = 0; i < ARRAYSIZE(_timers); i++)
 		_timers[i] = -1;
-	
+
 	if (getGameID() == GID_RTZ) {
 		_engineVersion = 3;
 		if (getFeatures() & GF_DEMO) {
@@ -271,6 +274,10 @@
 		_engineVersion = 2;
 		_dat->open("lgop2.dat");
 		_res->open("lgop2.prj");
+	} else if (getGameID() == GID_RODNEY) {
+		_engineVersion = 2;
+		_dat->open("rodneys.dat");
+		_res->open("rodneys.prj");
 	} else {
 		error ("Unknown MADE game");
 	}

Modified: scummvm/branches/gsoc2008-rtl/engines/made/made.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/made/made.h	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/engines/made/made.h	2008-06-16 19:06:48 UTC (rev 32720)
@@ -48,16 +48,17 @@
 namespace Made {
 
 enum MadeGameID {
-	GID_RTZ = 0,
-	GID_MANHOLE = 1,
-	GID_LGOP2 = 2
+	GID_RTZ		= 0,
+	GID_MANHOLE	= 1,
+	GID_LGOP2	= 2,
+	GID_RODNEY	= 3
 };
 
 enum MadeGameFeatures {
-	GF_DEMO = 1 << 0,
-	GF_CD = 1 << 1,
-	GF_CD_COMPRESSED = 1 << 2,
-	GF_FLOPPY = 1 << 3
+	GF_DEMO				= 1 << 0,
+	GF_CD				= 1 << 1,
+	GF_CD_COMPRESSED	= 1 << 2,
+	GF_FLOPPY			= 1 << 3
 };
 
 const uint32 kTimerResolution = 40;

Modified: scummvm/branches/gsoc2008-rtl/engines/made/screen.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/made/screen.h	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/engines/made/screen.h	2008-06-16 19:06:48 UTC (rev 32720)
@@ -95,6 +95,7 @@
 	void setRGBPalette(byte *palRGB, int start = 0, int count = 256);
 	bool isPaletteLocked() { return _paletteLock; }
 	void setPaletteLock(bool lock) { _paletteLock = lock; }
+	bool isScreenLocked() { return _screenLock; }
 	void setScreenLock(bool lock) { _screenLock = lock; }
 	void setVisualEffectNum(int visualEffectNum) { _visualEffectNum = visualEffectNum; }
 

Modified: scummvm/branches/gsoc2008-rtl/engines/made/script.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/made/script.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/engines/made/script.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -363,8 +363,7 @@
 
 void ScriptInterpreter::cmd_print() {
 	// TODO: This opcode was used for printing debug messages
-	Object *obj = _vm->_dat->getObject(_stack.top());
-	const char *text = obj->getString();
+	const char *text = _vm->_dat->getObjectString(_stack.top());
 	debug(4, "%s", text);
 	_stack.setTop(0);
 }
@@ -672,7 +671,7 @@
 	debug(1, "Dumping code for object %04X", objectIndex);
 
 	Object *obj = _vm->_dat->getObject(objectIndex);
-	byte *code = obj->getData(), *codeEnd = code + obj->getSize();
+	byte *code = obj->getData(), *codeStart = code, *codeEnd = code + obj->getSize();
 	
 	while (code < codeEnd) {
 		byte opcode = *code++;
@@ -684,6 +683,8 @@
 			int16 value;
 			char tempStr[32];
 			opcodeStats[opcode - 1]++;
+			snprintf(tempStr, 32, "[%04X] ", (uint16)(code - codeStart - 1));
+			codeLine += tempStr;
 			codeLine += desc;
 			for (; *sig != '\0'; sig++) {
 				codeLine += " ";

Modified: scummvm/branches/gsoc2008-rtl/engines/made/scriptfuncs.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/made/scriptfuncs.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/engines/made/scriptfuncs.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -26,8 +26,8 @@
 #include "common/endian.h"
 #include "common/util.h"
 #include "common/events.h"
-
 #include "graphics/cursorman.h"
+#include "sound/audiocd.h"
 
 #include "made/made.h"
 #include "made/resource.h"
@@ -94,7 +94,7 @@
 	External(sfSetSpriteGround);
 	External(sfLoadResText);
 	
-	if (_vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_LGOP2) {
+	if (_vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_RODNEY) {
 		External(sfAddScreenMask);
 		External(sfSetSpriteMask);
 	} else if (_vm->getGameID() == GID_RTZ) {
@@ -183,6 +183,8 @@
 }
 
 int16 ScriptFunctions::sfClearScreen(int16 argc, int16 *argv) {
+	if (_vm->_screen->isScreenLocked())
+		return 0;
 	if (_vm->_autoStopSound) {
 		_vm->_mixer->stopHandle(_audioStreamHandle);
 		_vm->_autoStopSound = false;
@@ -548,25 +550,27 @@
 }
 
 int16 ScriptFunctions::sfPlayCd(int16 argc, int16 *argv) {
-	// This one is called loads of times, so it has been commented out to reduce spam
-	//warning("Unimplemented opcode: sfPlayCd");
+	AudioCD.play(argv[0], -1, 0, 0);
 	return 0;
 }
 
 int16 ScriptFunctions::sfStopCd(int16 argc, int16 *argv) {
-	warning("Unimplemented opcode: sfStopCd");
-	return 0;
+	if (AudioCD.isPlaying()) {
+		AudioCD.stop();
+		return 1;
+	} else {
+		return 0;
+	}
 }
 
 int16 ScriptFunctions::sfGetCdStatus(int16 argc, int16 *argv) {
-	// This one is called loads of times, so it has been commented out to reduce spam
-	//warning("Unimplemented opcode: sfGetCdStatus");
-	return 0;
+	return AudioCD.isPlaying() ? 1 : 0;
 }
 
 int16 ScriptFunctions::sfGetCdTime(int16 argc, int16 *argv) {
 	// This one is called loads of times, so it has been commented out to reduce spam
 	//warning("Unimplemented opcode: sfGetCdTime");
+	// TODO
 	return 0;
 }
 

Deleted: scummvm/branches/gsoc2008-rtl/sound/midiplugin.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/sound/midiplugin.h	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/sound/midiplugin.h	2008-06-16 19:06:48 UTC (rev 32720)
@@ -1,93 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- */
-
-#ifndef BACKENDS_MIDI_MIDIPLUGIN_H
-#define BACKENDS_MIDI_MIDIPLUGIN_H
-
-#include "base/plugins.h"
-#include "sound/mididrv.h"
-
-/**
- * A MidiPluginObject is essentially a factory for MidiDriver instances with
- * the added ability of listing the available devices and their capabilities.
- */
-class MidiPluginObject : public PluginObject {
-public:
-	virtual ~MidiPluginObject() {}
-
-	/**
-	 * Returns a unique string identifier which will be used to save the
-	 * selected MIDI driver to the config file.
-	 */
-	virtual const char *getId() const = 0;
-
-	/**
-	 * Returns the type kind of music supported by this driver, as specified
-	 * by the MidiDriverFlags enum.
-	 */
-	virtual int getCapabilities() const = 0;
-
-	/**
-	 * Returns a list of the available devices. The empty string means the
-	 * default device.
-	 */
-	virtual Common::StringList getDevices() const {
-		Common::StringList dev;
-		dev.push_back("");
-		return dev;
-	}
-
-	/**
-	 * Tries to instantiate a MIDI Driver instance based on the settings of
-	 * the currently active ConfMan target. That is, the MidiPluginObject
-	 * should query the ConfMan singleton for the device name, port, etc.
-	 *
-	 * @param mixer			Pointer to the global Mixer object
-	 * @param mididriver	Pointer to a pointer which the MidiPluginObject sets
-	 *				to the newly create MidiDriver, or 0 in case of an error
-	 * @return		a PluginError describing the error which occurred, or kNoError
-	 */
-	virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const = 0;
-};
-
-
-// MIDI plugins
-
-typedef PluginSubclass<MidiPluginObject> MidiPlugin;
-
-/**
- * Singleton class which manages all MIDI plugins.
- */
-class MidiManager : public Common::Singleton<MidiManager> {
-private:
-	friend class Common::Singleton<SingletonBaseType>;
-
-public:
-	const MidiPlugin::List &getPlugins() const;
-};
-
-/** Convenience shortcut for accessing the MIDI manager. */
-#define MidiMan MidiManager::instance()
-
-#endif

Modified: scummvm/branches/gsoc2008-rtl/sound/module.mk
===================================================================
--- scummvm/branches/gsoc2008-rtl/sound/module.mk	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/sound/module.mk	2008-06-16 19:06:48 UTC (rev 32720)
@@ -15,6 +15,7 @@
 	mixer.o \
 	mp3.o \
 	mpu401.o \
+	musicplugin.o \
 	null.o \
 	voc.o \
 	vorbis.o \

Copied: scummvm/branches/gsoc2008-rtl/sound/musicplugin.cpp (from rev 32705, scummvm/trunk/sound/musicplugin.cpp)
===================================================================
--- scummvm/branches/gsoc2008-rtl/sound/musicplugin.cpp	                        (rev 0)
+++ scummvm/branches/gsoc2008-rtl/sound/musicplugin.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "sound/musicplugin.h"
+
+MusicDevice::MusicDevice(MusicPluginObject const *musicPlugin, Common::String name, MusicType mt) :
+	_musicDriverName(musicPlugin->getName()), _musicDriverId(musicPlugin->getId()),
+	_name(name), _type(mt) {
+}
+
+Common::String MusicDevice::getCompleteName() {
+	Common::String name;
+
+	if (_name.empty()) {
+		// Default device, just show the driver name
+		name = _musicDriverName;
+	} else {
+		// Show both device and driver names
+		name = _name;
+		name += " [";
+		name += _musicDriverName;
+		name += "]";
+	}
+
+	return name;
+}

Copied: scummvm/branches/gsoc2008-rtl/sound/musicplugin.h (from rev 32705, scummvm/trunk/sound/musicplugin.h)
===================================================================
--- scummvm/branches/gsoc2008-rtl/sound/musicplugin.h	                        (rev 0)
+++ scummvm/branches/gsoc2008-rtl/sound/musicplugin.h	2008-06-16 19:06:48 UTC (rev 32720)
@@ -0,0 +1,127 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#ifndef SOUND_MUSICPLUGIN_H
+#define SOUND_MUSICPLUGIN_H
+
+#include "base/plugins.h"
+#include "sound/mididrv.h"
+
+/**
+ * Music types that music drivers can implement and engines can rely on.
+ */
+enum MusicType {
+	MT_PCSPK = 1,  // PC Speaker
+	MT_PCJR  = 2,  // PCjr
+	MT_ADLIB = 3,  // AdLib
+	MT_TOWNS = 4,  // FM-TOWNS
+	MT_GM    = 5,  // General MIDI
+	MT_MT32  = 6,  // MT-32
+	MT_GS    = 7   // Roland GS
+};
+
+class MusicPluginObject;
+
+/**
+ * Description of a Music device. Used to list the devices a Music driver
+ * can manage and their capabilities.
+ * A device with an empty name means the default device.
+ */
+class MusicDevice {
+public:
+	MusicDevice(MusicPluginObject const *musicPlugin, Common::String name, MusicType mt);
+
+	Common::String &getName() { return _name; }
+	Common::String &getMusicDriverName() { return _musicDriverName; }
+	Common::String &getMusicDriverId() { return _musicDriverId; }
+	MusicType getMusicType() { return _type; }
+
+	/**
+	 * Returns a user readable string that contains the name of the current
+	 * device name (if it isn't the default one) and the name of the driver.
+	 */
+	Common::String getCompleteName();
+
+private:
+	Common::String _name;
+	Common::String _musicDriverName;
+	Common::String _musicDriverId;
+	MusicType _type;
+};
+
+/** List of music devices. */
+typedef Common::List<MusicDevice> MusicDevices;
+
+/**
+ * A MusicPluginObject is essentially a factory for MidiDriver instances with
+ * the added ability of listing the available devices and their capabilities.
+ */
+class MusicPluginObject : public PluginObject {
+public:
+	virtual ~MusicPluginObject() {}
+
+	/**
+	 * Returns a unique string identifier which will be used to save the
+	 * selected MIDI driver to the config file.
+	 */
+	virtual const char *getId() const = 0;
+
+	/**
+	 * Returns a list of the available devices.
+	 */
+	virtual MusicDevices getDevices() const = 0;
+
+	/**
+	 * Tries to instantiate a MIDI Driver instance based on the settings of
+	 * the currently active ConfMan target. That is, the MusicPluginObject
+	 * should query the ConfMan singleton for the device name, port, etc.
+	 *
+	 * @param mixer			Pointer to the global Mixer object
+	 * @param mididriver	Pointer to a pointer which the MusicPluginObject sets
+	 *				to the newly create MidiDriver, or 0 in case of an error
+	 * @return		a PluginError describing the error which occurred, or kNoError
+	 */
+	virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const = 0;
+};
+
+
+// Music plugins
+
+typedef PluginSubclass<MusicPluginObject> MusicPlugin;
+
+/**
+ * Singleton class which manages all Music plugins.
+ */
+class MusicManager : public Common::Singleton<MusicManager> {
+private:
+	friend class Common::Singleton<SingletonBaseType>;
+
+public:
+	const MusicPlugin::List &getPlugins() const;
+};
+
+/** Convenience shortcut for accessing the Music manager. */
+#define MusicMan MusicManager::instance()
+
+#endif

Modified: scummvm/branches/gsoc2008-rtl/sound/null.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/sound/null.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/sound/null.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -22,7 +22,7 @@
  * $Id$
  */
 
-#include "sound/midiplugin.h"
+#include "sound/musicplugin.h"
 #include "sound/mpu401.h"
 
 /* NULL driver */
@@ -35,33 +35,37 @@
 
 // Plugin interface
 
-class NullMidiPlugin : public MidiPluginObject {
+class NullMusicPlugin : public MusicPluginObject {
 public:
-	virtual const char *getName() const {
+	const char *getName() const {
 		return "No music";
 	}
 
-	virtual const char *getId() const {
+	const char *getId() const {
 		return "null";
 	}
 
-	virtual int getCapabilities() const {
-		return MDT_MIDI | MDT_PCSPK | MDT_ADLIB | MDT_TOWNS;
-	}
-
-	virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+	MusicDevices getDevices() const;
+	PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
 };
 
-PluginError NullMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+PluginError NullMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
 	*mididriver = new MidiDriver_NULL();
 
 	return kNoError;
 }
 
+MusicDevices NullMusicPlugin::getDevices() const {
+	MusicDevices devices;
+	// TODO: return a different music type?
+	devices.push_back(MusicDevice(this, "", MT_GM));
+	return devices;
+}
+
 MidiDriver *MidiDriver_NULL_create(Audio::Mixer *mixer) {
 	MidiDriver *mididriver;
 
-	NullMidiPlugin p;
+	NullMusicPlugin p;
 	p.createInstance(mixer, &mididriver);
 
 	return mididriver;
@@ -74,7 +78,7 @@
 #endif
 
 //#if PLUGIN_ENABLED_DYNAMIC(NULL)
-	//REGISTER_PLUGIN_DYNAMIC(NULL, PLUGIN_TYPE_MIDI, NullMidiPlugin);
+	//REGISTER_PLUGIN_DYNAMIC(NULL, PLUGIN_TYPE_MUSIC, NullMusicPlugin);
 //#else
-	REGISTER_PLUGIN_STATIC(NULL, PLUGIN_TYPE_MIDI, NullMidiPlugin);
+	REGISTER_PLUGIN_STATIC(NULL, PLUGIN_TYPE_MUSIC, NullMusicPlugin);
 //#endif

Modified: scummvm/branches/gsoc2008-rtl/sound/softsynth/adlib.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/sound/softsynth/adlib.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/sound/softsynth/adlib.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -25,7 +25,7 @@
 #include "sound/softsynth/emumidi.h"
 #include "common/util.h"
 #include "sound/fmopl.h"
-#include "sound/midiplugin.h"
+#include "sound/musicplugin.h"
 
 #ifdef DEBUG_ADLIB
 static int tick;
@@ -1518,24 +1518,27 @@
 
 // Plugin interface
 
-class AdlibMidiPlugin : public MidiPluginObject {
+class AdlibEmuMusicPlugin : public MusicPluginObject {
 public:
-	virtual const char *getName() const {
+	const char *getName() const {
 		return "AdLib Emulator";
 	}
 
-	virtual const char *getId() const {
+	const char *getId() const {
 		return "adlib";
 	}
 
-	virtual int getCapabilities() const {
-		return MDT_ADLIB;
-	}
-
-	virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+	MusicDevices getDevices() const;
+	PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
 };
 
-PluginError AdlibMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+MusicDevices AdlibEmuMusicPlugin::getDevices() const {
+	MusicDevices devices;
+	devices.push_back(MusicDevice(this, "", MT_ADLIB));
+	return devices;
+}
+
+PluginError AdlibEmuMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
 	*mididriver = new MidiDriver_ADLIB(mixer);
 
 	return kNoError;
@@ -1544,14 +1547,14 @@
 MidiDriver *MidiDriver_ADLIB_create(Audio::Mixer *mixer) {
 	MidiDriver *mididriver;
 
-	AdlibMidiPlugin p;
+	AdlibEmuMusicPlugin p;
 	p.createInstance(mixer, &mididriver);
 
 	return mididriver;
 }
 
 //#if PLUGIN_ENABLED_DYNAMIC(ADLIB)
-	//REGISTER_PLUGIN_DYNAMIC(ADLIB, PLUGIN_TYPE_MIDI, AdlibMidiPlugin);
+	//REGISTER_PLUGIN_DYNAMIC(ADLIB, PLUGIN_TYPE_MUSIC, AdlibEmuMusicPlugin);
 //#else
-	REGISTER_PLUGIN_STATIC(ADLIB, PLUGIN_TYPE_MIDI, AdlibMidiPlugin);
+	REGISTER_PLUGIN_STATIC(ADLIB, PLUGIN_TYPE_MUSIC, AdlibEmuMusicPlugin);
 //#endif

Modified: scummvm/branches/gsoc2008-rtl/sound/softsynth/fluidsynth.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/sound/softsynth/fluidsynth.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/sound/softsynth/fluidsynth.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -27,7 +27,7 @@
 #ifdef USE_FLUIDSYNTH
 
 #include "common/config-manager.h"
-#include "sound/midiplugin.h"
+#include "sound/musicplugin.h"
 #include "sound/mpu401.h"
 #include "sound/softsynth/emumidi.h"
 
@@ -219,24 +219,27 @@
 
 // Plugin interface
 
-class FluidSynthMidiPlugin : public MidiPluginObject {
+class FluidSynthMusicPlugin : public MusicPluginObject {
 public:
-	virtual const char *getName() const {
+	const char *getName() const {
 		return "FluidSynth";
 	}
 
-	virtual const char *getId() const {
+	const char *getId() const {
 		return "fluidsynth";
 	}
 
-	virtual int getCapabilities() const {
-		return MDT_MIDI;
-	}
-
-	virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+	MusicDevices getDevices() const;
+	PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
 };
 
-PluginError FluidSynthMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+MusicDevices FluidSynthMusicPlugin::getDevices() const {
+	MusicDevices devices;
+	devices.push_back(MusicDevice(this, "", MT_GM));
+	return devices;
+}
+
+PluginError FluidSynthMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
 	*mididriver = new MidiDriver_FluidSynth(mixer);
 
 	return kNoError;
@@ -245,16 +248,16 @@
 MidiDriver *MidiDriver_FluidSynth_create(Audio::Mixer *mixer) {
 	MidiDriver *mididriver;
 
-	FluidSynthMidiPlugin p;
+	FluidSynthMusicPlugin p;
 	p.createInstance(mixer, &mididriver);
 
 	return mididriver;
 }
 
 //#if PLUGIN_ENABLED_DYNAMIC(FLUIDSYNTH)
-	//REGISTER_PLUGIN_DYNAMIC(FLUIDSYNTH, PLUGIN_TYPE_MIDI, FluidSynthMidiPlugin);
+	//REGISTER_PLUGIN_DYNAMIC(FLUIDSYNTH, PLUGIN_TYPE_MUSIC, FluidSynthMusicPlugin);
 //#else
-	REGISTER_PLUGIN_STATIC(FLUIDSYNTH, PLUGIN_TYPE_MIDI, FluidSynthMidiPlugin);
+	REGISTER_PLUGIN_STATIC(FLUIDSYNTH, PLUGIN_TYPE_MUSIC, FluidSynthMusicPlugin);
 //#endif
 
 #endif

Modified: scummvm/branches/gsoc2008-rtl/sound/softsynth/mt32.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/sound/softsynth/mt32.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/sound/softsynth/mt32.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -29,7 +29,7 @@
 #include "sound/softsynth/mt32/mt32emu.h"
 
 #include "sound/softsynth/emumidi.h"
-#include "sound/midiplugin.h"
+#include "sound/musicplugin.h"
 #include "sound/mpu401.h"
 
 #include "common/config-manager.h"
@@ -483,24 +483,27 @@
 
 // Plugin interface
 
-class MT32MidiPlugin : public MidiPluginObject {
+class MT32EmuMusicPlugin : public MusicPluginObject {
 public:
-	virtual const char *getName() const {
+	const char *getName() const {
 		return "MT-32 Emulator";
 	}
 
-	virtual const char *getId() const {
+	const char *getId() const {
 		return "mt32";
 	}
 
-	virtual int getCapabilities() const {
-		return MDT_MIDI;
-	}
-
-	virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+	MusicDevices getDevices() const;
+	PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
 };
 
-PluginError MT32MidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+MusicDevices MT32EmuMusicPlugin::getDevices() const {
+	MusicDevices devices;
+	devices.push_back(MusicDevice(this, "", MT_MT32));
+	return devices;
+}
+
+PluginError MT32EmuMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
 	*mididriver = new MidiDriver_MT32(mixer);
 
 	return kNoError;
@@ -513,16 +516,16 @@
 
 	MidiDriver *mididriver;
 
-	MT32MidiPlugin p;
+	MT32EmuMusicPlugin p;
 	p.createInstance(mixer, &mididriver);
 
 	return mididriver;
 }
 
 //#if PLUGIN_ENABLED_DYNAMIC(MT32)
-	//REGISTER_PLUGIN_DYNAMIC(MT32, PLUGIN_TYPE_MIDI, MT32MidiPlugin);
+	//REGISTER_PLUGIN_DYNAMIC(MT32, PLUGIN_TYPE_MUSIC, MT32EmuMusicPlugin);
 //#else
-	REGISTER_PLUGIN_STATIC(MT32, PLUGIN_TYPE_MIDI, MT32MidiPlugin);
+	REGISTER_PLUGIN_STATIC(MT32, PLUGIN_TYPE_MUSIC, MT32EmuMusicPlugin);
 //#endif
 
 #endif

Modified: scummvm/branches/gsoc2008-rtl/sound/softsynth/ym2612.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/sound/softsynth/ym2612.cpp	2008-06-16 18:47:32 UTC (rev 32719)
+++ scummvm/branches/gsoc2008-rtl/sound/softsynth/ym2612.cpp	2008-06-16 19:06:48 UTC (rev 32720)
@@ -26,7 +26,7 @@
 
 #include "sound/softsynth/ym2612.h"
 #include "common/util.h"
-#include "sound/midiplugin.h"
+#include "sound/musicplugin.h"
 
 ////////////////////////////////////////
 //
@@ -755,24 +755,27 @@
 
 // Plugin interface
 
-class TownsMidiPlugin : public MidiPluginObject {
+class TownsEmuMusicPlugin : public MusicPluginObject {
 public:
-	virtual const char *getName() const {
+	const char *getName() const {
 		return "FM Towns Emulator";
 	}
 
-	virtual const char *getId() const {
+	const char *getId() const {
 		return "towns";
 	}
 
-	virtual int getCapabilities() const {
-		return MDT_TOWNS;
-	}
-
-	virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
+	MusicDevices getDevices() const;
+	PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const;
 };
 
-PluginError TownsMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
+MusicDevices TownsEmuMusicPlugin::getDevices() const {
+	MusicDevices devices;
+	devices.push_back(MusicDevice(this, "", MT_TOWNS));
+	return devices;
+}
+
+PluginError TownsEmuMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
 	*mididriver = new MidiDriver_YM2612(mixer);
 
 	return kNoError;
@@ -781,14 +784,14 @@
 MidiDriver *MidiDriver_YM2612_create(Audio::Mixer *mixer) {
 	MidiDriver *mididriver;
 
-	TownsMidiPlugin p;
+	TownsEmuMusicPlugin p;
 	p.createInstance(mixer, &mididriver);
 
 	return mididriver;
 }
 
 //#if PLUGIN_ENABLED_DYNAMIC(TOWNS)
-	//REGISTER_PLUGIN_DYNAMIC(TOWNS, PLUGIN_TYPE_MIDI, TownsMidiPlugin);
+	//REGISTER_PLUGIN_DYNAMIC(TOWNS, PLUGIN_TYPE_MUSIC, TownsEmuMusicPlugin);
 //#else
-	REGISTER_PLUGIN_STATIC(TOWNS, PLUGIN_TYPE_MIDI, TownsMidiPlugin);
+	REGISTER_PLUGIN_STATIC(TOWNS, PLUGIN_TYPE_MUSIC, TownsEmuMusicPlugin);
 //#endif


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