diff options
author | Christopher Page | 2008-05-14 20:37:18 +0000 |
---|---|---|
committer | Christopher Page | 2008-05-14 20:37:18 +0000 |
commit | cbe03226a4e3e658a3832eec233e1630c4515474 (patch) | |
tree | 12ed6dde0fe22c977f96b66b0c87a7af2fb75fa5 /backends | |
parent | 7d98ed714be064b75308db21ce6d5191fd040c94 (diff) | |
parent | e279d9693a1541f4595e73a5b646869890634922 (diff) | |
download | scummvm-rg350-cbe03226a4e3e658a3832eec233e1630c4515474.tar.gz scummvm-rg350-cbe03226a4e3e658a3832eec233e1630c4515474.tar.bz2 scummvm-rg350-cbe03226a4e3e658a3832eec233e1630c4515474.zip |
Merged revisions 31972-31973,31975-31981,31984-31989,31993-31994,31996-32014,32016-32020,32022-32025,32027-32028,32030,32034,32037-32038,32040-32058,32060-32087,32089-32093,32095-32123 via svnmerge from
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk
svn-id: r32125
Diffstat (limited to 'backends')
-rw-r--r-- | backends/midi/alsa.cpp | 91 | ||||
-rw-r--r-- | backends/midi/camd.cpp | 48 | ||||
-rw-r--r-- | backends/midi/coreaudio.cpp | 42 | ||||
-rw-r--r-- | backends/midi/coremidi.cpp | 42 | ||||
-rw-r--r-- | backends/midi/dmedia.cpp | 44 | ||||
-rw-r--r-- | backends/midi/quicktime.cpp | 45 | ||||
-rw-r--r-- | backends/midi/seq.cpp | 44 | ||||
-rw-r--r-- | backends/midi/timidity.cpp | 44 | ||||
-rw-r--r-- | backends/midi/windows.cpp | 50 | ||||
-rw-r--r-- | backends/midi/ypa1.cpp | 44 | ||||
-rw-r--r-- | backends/midi/zodiac.cpp | 44 | ||||
-rw-r--r-- | backends/platform/dc/selector.cpp | 4 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/gbampsave.cpp | 5 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/osystem_ds.cpp | 89 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/osystem_ds.h | 1 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/ramsave.cpp | 12 | ||||
-rw-r--r-- | backends/platform/wince/CELauncherDialog.cpp | 2 | ||||
-rw-r--r-- | backends/plugins/dc/dc-provider.cpp | 10 | ||||
-rw-r--r-- | backends/plugins/dc/dc-provider.h | 3 | ||||
-rw-r--r-- | backends/plugins/win32/win32-provider.cpp | 8 | ||||
-rw-r--r-- | backends/plugins/win32/win32-provider.h | 3 |
21 files changed, 569 insertions, 106 deletions
diff --git a/backends/midi/alsa.cpp b/backends/midi/alsa.cpp index 174bb73f65..6b0e424d68 100644 --- a/backends/midi/alsa.cpp +++ b/backends/midi/alsa.cpp @@ -26,10 +26,10 @@ #if defined(UNIX) && defined(USE_ALSA) -#include "sound/mpu401.h" - -#include "common/util.h" #include "common/config-manager.h" +#include "common/util.h" +#include "sound/midiplugin.h" +#include "sound/mpu401.h" #include <alsa/asoundlib.h> @@ -238,8 +238,89 @@ void MidiDriver_ALSA::send_event(int do_flush) { snd_seq_flush_output(seq_handle); } -MidiDriver *MidiDriver_ALSA_create() { - return new MidiDriver_ALSA(); + +// Plugin interface + +class AlsaMidiPlugin : public MidiPluginObject { +public: + virtual const char *getName() const { + return "ALSA"; + } + + virtual 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; +}; + +#define perm_ok(pinfo,bits) ((snd_seq_port_info_get_capability(pinfo) & (bits)) == (bits)) + +static int check_permission(snd_seq_port_info_t *pinfo) +{ + if (perm_ok(pinfo, SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE)) { + if (!(snd_seq_port_info_get_capability(pinfo) & SND_SEQ_PORT_CAP_NO_EXPORT)) + return 1; + } + return 0; +} + +Common::StringList AlsaMidiPlugin::getDevices() const { + Common::StringList devices; + + snd_seq_t *seq; + if (snd_seq_open(&seq, "default", SND_SEQ_OPEN_DUPLEX, 0) < 0) + return devices; // can't open sequencer + + snd_seq_client_info_t *cinfo; + snd_seq_client_info_alloca(&cinfo); + snd_seq_port_info_t *pinfo; + snd_seq_port_info_alloca(&pinfo); + snd_seq_client_info_set_client(cinfo, -1); + while (snd_seq_query_next_client(seq, cinfo) >= 0) { + bool found_valid_port = false; + + /* reset query info */ + snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo)); + snd_seq_port_info_set_port(pinfo, -1); + 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)); + //snd_seq_client_info_get_client(cinfo) : snd_seq_port_info_get_port(pinfo) + } + } + } + snd_seq_close(seq); + + return devices; } +PluginError AlsaMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { + *mididriver = new MidiDriver_ALSA(); + + return kNoError; +} + +MidiDriver *MidiDriver_ALSA_create(Audio::Mixer *mixer) { + MidiDriver *mididriver; + + AlsaMidiPlugin p; + p.createInstance(mixer, &mididriver); + + return mididriver; +} + +//#if PLUGIN_ENABLED_DYNAMIC(ALSA) + //REGISTER_PLUGIN_DYNAMIC(ALSA, PLUGIN_TYPE_MIDI, AlsaMidiPlugin); +//#else + REGISTER_PLUGIN_STATIC(ALSA, PLUGIN_TYPE_MIDI, AlsaMidiPlugin); +//#endif + #endif diff --git a/backends/midi/camd.cpp b/backends/midi/camd.cpp index 25dc00bf63..6aa79eb260 100644 --- a/backends/midi/camd.cpp +++ b/backends/midi/camd.cpp @@ -26,9 +26,10 @@ #if defined(__amigaos4__) -#include "sound/mpu401.h" -#include "common/util.h" #include "common/endian.h" +#include "common/util.h" +#include "sound/midiplugin.h" +#include "sound/mpu401.h" #include <proto/camd.h> #include <proto/exec.h> @@ -162,8 +163,47 @@ void MidiDriver_CAMD::closeAll() { _isOpen = false; } -MidiDriver *MidiDriver_CAMD_create() { - return new MidiDriver_CAMD(); + +// Plugin interface + +class CamdMidiPlugin : public MidiPluginObject { +public: + virtual const char *getName() const { + return "CAMD"; + } + + virtual const char *getId() const { + return "camd"; + } + + virtual int getCapabilities() const { + return MDT_MIDI; + } + + //virtual Common::StringList getDevices() const; + + virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; +}; + +PluginError CamdMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { + *mididriver = new MidiDriver_CAMD(); + + return kNoError; +} + +MidiDriver *MidiDriver_CAMD_create(Audio::Mixer *mixer) { + MidiDriver *mididriver; + + CamdMidiPlugin p; + p.createInstance(mixer, &mididriver); + + return mididriver; } +//#if PLUGIN_ENABLED_DYNAMIC(CAMD) + //REGISTER_PLUGIN_DYNAMIC(CAMD, PLUGIN_TYPE_MIDI, CamdMidiPlugin); +//#else + REGISTER_PLUGIN_STATIC(CAMD, PLUGIN_TYPE_MIDI, CamdMidiPlugin); +//#endif + #endif diff --git a/backends/midi/coreaudio.cpp b/backends/midi/coreaudio.cpp index c338678036..8e00c24a1f 100644 --- a/backends/midi/coreaudio.cpp +++ b/backends/midi/coreaudio.cpp @@ -26,6 +26,7 @@ #include "common/config-manager.h" #include "common/util.h" +#include "sound/midiplugin.h" #include "sound/mpu401.h" #include <AudioToolbox/AUGraph.h> @@ -192,8 +193,45 @@ void MidiDriver_CORE::sysEx(const byte *msg, uint16 length) { MusicDeviceSysEx(_synth, buf, length+2); } -MidiDriver *MidiDriver_CORE_create() { - return new MidiDriver_CORE(); + +// Plugin interface + +class CoreAudioMidiPlugin : public MidiPluginObject { +public: + virtual const char *getName() const { + return "CoreAudio"; + } + + virtual const char *getId() const { + return "core"; + } + + virtual int getCapabilities() const { + return MDT_MIDI; + } + + virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; +}; + +PluginError CoreAudioMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { + *mididriver = new MidiDriver_CORE(); + + return kNoError; +} + +MidiDriver *MidiDriver_CORE_create(Audio::Mixer *mixer) { + MidiDriver *mididriver; + + CoreAudioMidiPlugin p; + p.createInstance(mixer, &mididriver); + + return mididriver; } +//#if PLUGIN_ENABLED_DYNAMIC(COREAUDIO) + //REGISTER_PLUGIN_DYNAMIC(COREAUDIO, PLUGIN_TYPE_MIDI, CoreAudioMidiPlugin); +//#else + REGISTER_PLUGIN_STATIC(COREAUDIO, PLUGIN_TYPE_MIDI, CoreAudioMidiPlugin); +//#endif + #endif // MACOSX diff --git a/backends/midi/coremidi.cpp b/backends/midi/coremidi.cpp index 251b41a986..efbdaad4e4 100644 --- a/backends/midi/coremidi.cpp +++ b/backends/midi/coremidi.cpp @@ -26,6 +26,7 @@ #include "common/config-manager.h" #include "common/util.h" +#include "sound/midiplugin.h" #include "sound/mpu401.h" #include <CoreMIDI/CoreMIDI.h> @@ -175,8 +176,45 @@ void MidiDriver_CoreMIDI::sysEx(const byte *msg, uint16 length) { MIDISend(mOutPort, mDest, packetList); } -MidiDriver *MidiDriver_CoreMIDI_create() { - return new MidiDriver_CoreMIDI(); + +// Plugin interface + +class CoreMIDIMidiPlugin : public MidiPluginObject { +public: + virtual const char *getName() const { + return "CoreMIDI"; + } + + virtual const char *getId() const { + return "coremidi"; + } + + virtual int getCapabilities() const { + return MDT_MIDI; + } + + virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; +}; + +PluginError CoreMIDIMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { + *mididriver = new MidiDriver_CoreMIDI(); + + return kNoError; +} + +MidiDriver *MidiDriver_CoreMIDI_create(Audio::Mixer *mixer) { + MidiDriver *mididriver; + + CoreMIDIMidiPlugin p; + p.createInstance(mixer, &mididriver); + + return mididriver; } +//#if PLUGIN_ENABLED_DYNAMIC(COREMIDI) + //REGISTER_PLUGIN_DYNAMIC(COREMIDI, PLUGIN_TYPE_MIDI, CoreMIDIMidiPlugin); +//#else + REGISTER_PLUGIN_STATIC(COREMIDI, PLUGIN_TYPE_MIDI, CoreMIDIMidiPlugin); +//#endif + #endif // MACOSX diff --git a/backends/midi/dmedia.cpp b/backends/midi/dmedia.cpp index 1904eaf647..885081e3e0 100644 --- a/backends/midi/dmedia.cpp +++ b/backends/midi/dmedia.cpp @@ -30,8 +30,9 @@ #if defined(IRIX) #include "common/scummsys.h" -#include "sound/mpu401.h" #include "common/util.h" +#include "sound/midiplugin.h" +#include "sound/mpu401.h" #include <dmedia/midi.h> #include <sys/types.h> @@ -174,8 +175,45 @@ void MidiDriver_DMEDIA::sysEx (const byte *msg, uint16 length) { } } -MidiDriver *MidiDriver_DMEDIA_create() { - return new MidiDriver_DMEDIA(); + +// Plugin interface + +class DMediaMidiPlugin : public MidiPluginObject { +public: + virtual const char *getName() const { + return "DMedia"; + } + + virtual const char *getId() const { + return "dmedia"; + } + + virtual int getCapabilities() const { + return MDT_MIDI; + } + + virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; +}; + +PluginError DMediaMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { + *mididriver = new MidiDriver_DMEDIA(); + + return kNoError; } +MidiDriver *MidiDriver_DMEDIA_create(Audio::Mixer *mixer) { + MidiDriver *mididriver; + + DMediaMidiPlugin p; + p.createInstance(mixer, &mididriver); + + return mididriver; +} + +//#if PLUGIN_ENABLED_DYNAMIC(DMEDIA) + //REGISTER_PLUGIN_DYNAMIC(DMEDIA, PLUGIN_TYPE_MIDI, DMediaMidiPlugin); +//#else + REGISTER_PLUGIN_STATIC(DMEDIA, PLUGIN_TYPE_MIDI, DMediaMidiPlugin); +//#endif + #endif diff --git a/backends/midi/quicktime.cpp b/backends/midi/quicktime.cpp index 3267bb3415..950dfa632c 100644 --- a/backends/midi/quicktime.cpp +++ b/backends/midi/quicktime.cpp @@ -24,10 +24,10 @@ #if defined(MACOSX) || defined(macintosh) - -#include "sound/mpu401.h" #include "common/endian.h" #include "common/util.h" +#include "sound/midiplugin.h" +#include "sound/mpu401.h" #if defined(MACOSX) #include <QuickTime/QuickTimeComponents.h> @@ -250,8 +250,45 @@ void MidiDriver_QT::dispose() } } -MidiDriver *MidiDriver_QT_create() { - return new MidiDriver_QT(); + +// Plugin interface + +class QuickTimeMidiPlugin : public MidiPluginObject { +public: + virtual const char *getName() const { + return "QuickTime"; + } + + virtual const char *getId() const { + return "qt"; + } + + virtual int getCapabilities() const { + return MDT_MIDI; + } + + virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; +}; + +PluginError QuickTimeMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { + *mididriver = new MidiDriver_QT(); + + return kNoError; +} + +MidiDriver *MidiDriver_QT_create(Audio::Mixer *mixer) { + MidiDriver *mididriver; + + QuickTimeMidiPlugin p; + p.createInstance(mixer, &mididriver); + + return mididriver; } +//#if PLUGIN_ENABLED_DYNAMIC(QT) + //REGISTER_PLUGIN_DYNAMIC(QT, PLUGIN_TYPE_MIDI, QuickTimeMidiPlugin); +//#else + REGISTER_PLUGIN_STATIC(QT, PLUGIN_TYPE_MIDI, QuickTimeMidiPlugin); +//#endif + #endif // MACOSX || macintosh diff --git a/backends/midi/seq.cpp b/backends/midi/seq.cpp index 39c61dd85b..07dfc25142 100644 --- a/backends/midi/seq.cpp +++ b/backends/midi/seq.cpp @@ -30,8 +30,9 @@ #if defined(UNIX) && !defined(__BEOS__) && !defined(__MAEMO__) -#include "sound/mpu401.h" #include "common/util.h" +#include "sound/midiplugin.h" +#include "sound/mpu401.h" #include <fcntl.h> #include <unistd.h> @@ -169,8 +170,45 @@ void MidiDriver_SEQ::sysEx (const byte *msg, uint16 length) { write (device, buf, position); } -MidiDriver *MidiDriver_SEQ_create() { - return new MidiDriver_SEQ(); + +// Plugin interface + +class SeqMidiPlugin : public MidiPluginObject { +public: + virtual const char *getName() const { + return "SEQ"; + } + + virtual const char *getId() const { + return "seq"; + } + + virtual int getCapabilities() const { + return MDT_MIDI; + } + + virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; +}; + +PluginError SeqMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { + *mididriver = new MidiDriver_SEQ(); + + return kNoError; } +MidiDriver *MidiDriver_SEQ_create(Audio::Mixer *mixer) { + MidiDriver *mididriver; + + SeqMidiPlugin p; + p.createInstance(mixer, &mididriver); + + return mididriver; +} + +//#if PLUGIN_ENABLED_DYNAMIC(SEQ) + //REGISTER_PLUGIN_DYNAMIC(SEQ, PLUGIN_TYPE_MIDI, SeqMidiPlugin); +//#else + REGISTER_PLUGIN_STATIC(SEQ, PLUGIN_TYPE_MIDI, SeqMidiPlugin); +//#endif + #endif diff --git a/backends/midi/timidity.cpp b/backends/midi/timidity.cpp index 8b10cf07a4..842fb358bf 100644 --- a/backends/midi/timidity.cpp +++ b/backends/midi/timidity.cpp @@ -36,8 +36,9 @@ #if defined (UNIX) -#include "sound/mpu401.h" #include "common/util.h" +#include "sound/midiplugin.h" +#include "sound/mpu401.h" #include <fcntl.h> #include <unistd.h> @@ -510,8 +511,45 @@ void MidiDriver_TIMIDITY::sysEx(const byte *msg, uint16 length) { timidity_write_data(buf, position); } -MidiDriver *MidiDriver_TIMIDITY_create() { - return new MidiDriver_TIMIDITY(); + +// Plugin interface + +class TimidityMidiPlugin : public MidiPluginObject { +public: + virtual const char *getName() const { + return "TiMidity"; + } + + virtual const char *getId() const { + return "timidity"; + } + + virtual int getCapabilities() const { + return MDT_MIDI; + } + + virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; +}; + +PluginError TimidityMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { + *mididriver = new MidiDriver_TIMIDITY(); + + return kNoError; } +MidiDriver *MidiDriver_TIMIDITY_create(Audio::Mixer *mixer) { + MidiDriver *mididriver; + + TimidityMidiPlugin p; + p.createInstance(mixer, &mididriver); + + return mididriver; +} + +//#if PLUGIN_ENABLED_DYNAMIC(TIMIDITY) + //REGISTER_PLUGIN_DYNAMIC(TIMIDITY, PLUGIN_TYPE_MIDI, TimidityMidiPlugin); +//#else + REGISTER_PLUGIN_STATIC(TIMIDITY, PLUGIN_TYPE_MIDI, TimidityMidiPlugin); +//#endif + #endif // defined (UNIX) diff --git a/backends/midi/windows.cpp b/backends/midi/windows.cpp index db3ed50165..083f0eaf96 100644 --- a/backends/midi/windows.cpp +++ b/backends/midi/windows.cpp @@ -24,11 +24,14 @@ #if defined(WIN32) && !defined(_WIN32_WCE) - #include <windows.h> -#include <mmsystem.h> +// winnt.h defines ARRAYSIZE, but we want our own one... +#undef ARRAYSIZE + +#include "sound/midiplugin.h" #include "sound/mpu401.h" -#include "common/util.h" + +#include <mmsystem.h> //////////////////////////////////////// // @@ -141,8 +144,45 @@ void MidiDriver_WIN::check_error(MMRESULT result) { } } -MidiDriver *MidiDriver_WIN_create() { - return new MidiDriver_WIN(); + +// Plugin interface + +class WindowsMidiPlugin : public MidiPluginObject { +public: + virtual const char *getName() const { + return "Windows MIDI"; + } + + virtual const char *getId() const { + return "windows"; + } + + virtual int getCapabilities() const { + return MDT_MIDI; + } + + virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; +}; + +PluginError WindowsMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { + *mididriver = new MidiDriver_WIN(); + + return kNoError; +} + +MidiDriver *MidiDriver_WIN_create(Audio::Mixer *mixer) { + MidiDriver *mididriver; + + WindowsMidiPlugin p; + p.createInstance(mixer, &mididriver); + + return mididriver; } +//#if PLUGIN_ENABLED_DYNAMIC(WINDOWS) + //REGISTER_PLUGIN_DYNAMIC(WINDOWS, PLUGIN_TYPE_MIDI, WindowsMidiPlugin); +//#else + REGISTER_PLUGIN_STATIC(WINDOWS, PLUGIN_TYPE_MIDI, WindowsMidiPlugin); +//#endif + #endif diff --git a/backends/midi/ypa1.cpp b/backends/midi/ypa1.cpp index ca77de7300..37d90d45b0 100644 --- a/backends/midi/ypa1.cpp +++ b/backends/midi/ypa1.cpp @@ -22,8 +22,9 @@ * $Id$ */ -#include "sound/mpu401.h" #include "common/util.h" +#include "sound/midiplugin.h" +#include "sound/mpu401.h" #include "Pa1Lib.h" @@ -102,6 +103,43 @@ void MidiDriver_YamahaPa1::send(uint32 b) { } } -MidiDriver *MidiDriver_YamahaPa1_create() { - return new MidiDriver_YamahaPa1(); + +// Plugin interface + +class YamahaPa1MidiPlugin : public MidiPluginObject { +public: + virtual const char *getName() const { + return "Yamaha Pa1"; + } + + virtual const char *getId() const { + return "ypa1"; + } + + virtual int getCapabilities() const { + return MDT_MIDI; + } + + virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; +}; + +PluginError YamahaPa1MidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { + *mididriver = new MidiDriver_YamahaPa1(); + + return kNoError; +} + +MidiDriver *MidiDriver_YamahaPa1_create(Audio::Mixer *mixer) { + MidiDriver *mididriver; + + YamahaPa1MidiPlugin p; + p.createInstance(mixer, &mididriver); + + return mididriver; } + +//#if PLUGIN_ENABLED_DYNAMIC(YPA1) + //REGISTER_PLUGIN_DYNAMIC(YPA1, PLUGIN_TYPE_MIDI, YamahaPa1MidiPlugin); +//#else + REGISTER_PLUGIN_STATIC(YPA1, PLUGIN_TYPE_MIDI, YamahaPa1MidiPlugin); +//#endif diff --git a/backends/midi/zodiac.cpp b/backends/midi/zodiac.cpp index b1c2aa61c7..f27c042de8 100644 --- a/backends/midi/zodiac.cpp +++ b/backends/midi/zodiac.cpp @@ -22,8 +22,9 @@ * $Id$ */ -#include "sound/mpu401.h" #include "common/util.h" +#include "sound/midiplugin.h" +#include "sound/mpu401.h" #ifndef DISABLE_TAPWAVE @@ -120,8 +121,45 @@ void MidiDriver_Zodiac::sysEx(const byte *msg, uint16 length) { TwMidiSysEx(_midiHandle, 0, (byte *)buf, length + 2); } -MidiDriver *MidiDriver_Zodiac_create() { - return new MidiDriver_Zodiac(); + +// Plugin interface + +class ZodiacMidiPlugin : public MidiPluginObject { +public: + virtual const char *getName() const { + return "Tapwave Zodiac"; + } + + virtual const char *getId() const { + return "zodiac"; + } + + virtual int getCapabilities() const { + return MDT_MIDI; + } + + virtual PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const; +}; + +PluginError ZodiacMidiPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const { + *mididriver = new MidiDriver_Zodiac(); + + return kNoError; +} + +MidiDriver *MidiDriver_Zodiac_create(Audio::Mixer *mixer) { + MidiDriver *mididriver; + + ZodiacMidiPlugin p; + p.createInstance(mixer, &mididriver); + + return mididriver; } +//#if PLUGIN_ENABLED_DYNAMIC(ZODIAC) + //REGISTER_PLUGIN_DYNAMIC(ZODIAC, PLUGIN_TYPE_MIDI, ZodiacMidiPlugin); +//#else + REGISTER_PLUGIN_STATIC(ZODIAC, PLUGIN_TYPE_MIDI, ZodiacMidiPlugin); +//#endif + #endif diff --git a/backends/platform/dc/selector.cpp b/backends/platform/dc/selector.cpp index 4bca47afb2..880fbc400f 100644 --- a/backends/platform/dc/selector.cpp +++ b/backends/platform/dc/selector.cpp @@ -151,8 +151,8 @@ static Game the_game; static void detectGames(FSList &files, GameList &candidates) { - const PluginList &plugins = PluginManager::instance().getPlugins(); - PluginList::const_iterator iter = plugins.begin(); + const EnginePluginList &plugins = EngineMan.getPlugins(); + EnginePluginList::const_iterator iter = plugins.begin(); for (iter = plugins.begin(); iter != plugins.end(); ++iter) { candidates.push_back((*iter)->detectGames(files)); } diff --git a/backends/platform/ds/arm9/source/gbampsave.cpp b/backends/platform/ds/arm9/source/gbampsave.cpp index fbe0c69944..3ee572f0f7 100644 --- a/backends/platform/ds/arm9/source/gbampsave.cpp +++ b/backends/platform/ds/arm9/source/gbampsave.cpp @@ -146,7 +146,7 @@ GBAMPSaveFileManager::~GBAMPSaveFileManager() { GBAMPSaveFile* GBAMPSaveFileManager::openSavefile(char const* name, bool saveOrLoad) { char fileSpec[128]; - strcpy(fileSpec, getSavePath()); + strcpy(fileSpec, getSavePath().c_str()); if (fileSpec[strlen(fileSpec) - 1] == '/') { sprintf(fileSpec, "%s%s", getSavePath(), name); @@ -169,7 +169,7 @@ Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) { enum { TYPE_NO_MORE = 0, TYPE_FILE = 1, TYPE_DIR = 2 }; char name[256]; - DS::std_cwd((char *) getSavePath()); + DS::std_cwd((char*)getSavePath().c_str()); //TODO : Check this suspicious const-cast // consolePrintf("Save path: '%s', pattern: '%s'\n", getSavePath(),pattern); @@ -177,7 +177,6 @@ Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) { Common::StringList list; - do { if (fileType == TYPE_FILE) { diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index 2044448923..f9b0b768c0 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -57,8 +57,7 @@ OSystem_DS::~OSystem_DS() { delete _timer; } -int OSystem_DS::timerHandler(int t) -{ +int OSystem_DS::timerHandler(int t) { DSTimerManager *tm = (DSTimerManager *)g_system->getTimerManager(); tm->handler(); return t; @@ -183,8 +182,7 @@ void OSystem_DS::grabPalette(unsigned char *colors, uint start, uint num) { } -void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) -{ +void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { // consolePrintf("Copy rect %d, %d %d, %d ", x, y, w, h); if (w <= 1) return; @@ -229,8 +227,7 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int } -void OSystem_DS::updateScreen() -{ +void OSystem_DS::updateScreen() { if (_frameBufferExists) { @@ -253,30 +250,25 @@ void OSystem_DS::setShakePos(int shakeOffset) { DS::setShakePos(shakeOffset); } -void OSystem_DS::showOverlay () -{ +void OSystem_DS::showOverlay () { // consolePrintf("showovl\n"); DS::displayMode16Bit(); } -void OSystem_DS::hideOverlay () -{ +void OSystem_DS::hideOverlay () { DS::displayMode8Bit(); } -void OSystem_DS::clearOverlay () -{ +void OSystem_DS::clearOverlay () { memset((u16 *) DS::get16BitBackBuffer(), 0, 512 * 256 * 2); // consolePrintf("clearovl\n"); } -void OSystem_DS::grabOverlay (OverlayColor *buf, int pitch) -{ +void OSystem_DS::grabOverlay (OverlayColor *buf, int pitch) { // consolePrintf("grabovl\n"); } -void OSystem_DS::copyRectToOverlay (const OverlayColor *buf, int pitch, int x, int y, int w, int h) -{ +void OSystem_DS::copyRectToOverlay (const OverlayColor *buf, int pitch, int x, int y, int w, int h) { u16* bg = (u16 *) DS::get16BitBackBuffer(); u16* src = (u16 *) buf; @@ -313,27 +305,23 @@ void OSystem_DS::copyRectToOverlay (const OverlayColor *buf, int pitch, int x, i } -int16 OSystem_DS::getOverlayHeight() -{ +int16 OSystem_DS::getOverlayHeight() { // consolePrintf("getovlheight\n"); return getHeight(); } -int16 OSystem_DS::getOverlayWidth() -{ +int16 OSystem_DS::getOverlayWidth() { // consolePrintf("getovlwid\n"); return getWidth(); } -bool OSystem_DS::showMouse(bool visible) -{ +bool OSystem_DS::showMouse(bool visible) { DS::setShowCursor(visible); return true; } -void OSystem_DS::warpMouse(int x, int y) -{ +void OSystem_DS::warpMouse(int x, int y) { } void OSystem_DS::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor, int targetCursorScale) { @@ -344,8 +332,7 @@ void OSystem_DS::addEvent(Common::Event& e) { eventQueue[queuePos++] = e; } -bool OSystem_DS::pollEvent(Common::Event &event) -{ +bool OSystem_DS::pollEvent(Common::Event &event) { if (lastPenFrame != DS::getMillis()) { @@ -398,13 +385,11 @@ bool OSystem_DS::pollEvent(Common::Event &event) return false; } -uint32 OSystem_DS::getMillis() -{ +uint32 OSystem_DS::getMillis() { return DS::getMillis(); } -void OSystem_DS::delayMillis(uint msecs) -{ +void OSystem_DS::delayMillis(uint msecs) { int st = getMillis(); DS::addEventsToQueue(); DS::CD::update(); @@ -419,25 +404,25 @@ void OSystem_DS::delayMillis(uint msecs) DS::addEventsToQueue(); } -OSystem::MutexRef OSystem_DS::createMutex(void) -{ +void OSystem_DS::getTimeAndDate(struct tm &t) const { + time_t curTime = time(0); + t = *localtime(&curTime); +} + +OSystem::MutexRef OSystem_DS::createMutex(void) { return NULL; } -void OSystem_DS::lockMutex(MutexRef mutex) -{ +void OSystem_DS::lockMutex(MutexRef mutex) { } -void OSystem_DS::unlockMutex(MutexRef mutex) -{ +void OSystem_DS::unlockMutex(MutexRef mutex) { } -void OSystem_DS::deleteMutex(MutexRef mutex) -{ +void OSystem_DS::deleteMutex(MutexRef mutex) { } -void OSystem_DS::clearSoundCallback() -{ +void OSystem_DS::clearSoundCallback() { consolePrintf("Clearing sound callback"); // DS::setSoundProc(NULL, NULL); } @@ -447,23 +432,19 @@ int OSystem_DS::getOutputSampleRate() const return DS::getSoundFrequency(); } -bool OSystem_DS::openCD(int drive) -{ +bool OSystem_DS::openCD(int drive) { return DS::CD::checkCD(); } -bool OSystem_DS::pollCD() -{ +bool OSystem_DS::pollCD() { return DS::CD::isPlaying(); } -void OSystem_DS::playCD(int track, int num_loops, int start_frame, int duration) -{ +void OSystem_DS::playCD(int track, int num_loops, int start_frame, int duration) { DS::CD::playTrack(track, num_loops, start_frame, duration); } -void OSystem_DS::stopCD() -{ +void OSystem_DS::stopCD() { DS::CD::stopTrack(); } @@ -471,8 +452,7 @@ void OSystem_DS::updateCD() { } -void OSystem_DS::quit() -{ +void OSystem_DS::quit() { /* consolePrintf("Soft resetting..."); IPC->reset = 1; REG_IE = 0; @@ -481,16 +461,13 @@ void OSystem_DS::quit() swiSoftReset();*/ } -void OSystem_DS::setWindowCaption(const char *caption) -{ +void OSystem_DS::setWindowCaption(const char *caption) { } -void OSystem_DS::displayMessageOnOSD(const char *msg) -{ +void OSystem_DS::displayMessageOnOSD(const char *msg) { } -Common::SaveFileManager* OSystem_DS::getSavefileManager() -{ +Common::SaveFileManager* OSystem_DS::getSavefileManager() { bool forceSram; if (ConfMan.hasKey("forcesramsave", "ds")) { diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index 9d6454d02d..2bbd82bcf7 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -107,6 +107,7 @@ public: virtual bool pollEvent(Common::Event &event); virtual uint32 getMillis(); virtual void delayMillis(uint msecs); + virtual void getTimeAndDate(struct tm &t) const; virtual MutexRef createMutex(void); virtual void lockMutex(MutexRef mutex); diff --git a/backends/platform/ds/arm9/source/ramsave.cpp b/backends/platform/ds/arm9/source/ramsave.cpp index 8bcc34f9af..a9ac773dd2 100644 --- a/backends/platform/ds/arm9/source/ramsave.cpp +++ b/backends/platform/ds/arm9/source/ramsave.cpp @@ -383,16 +383,24 @@ void DSSaveFileManager::deleteFile(char* name) { flushToSaveRAM(); } -void DSSaveFileManager::removeSavefile(const char *filename) { - TODO: Implement this. Most likely, you just have to use the code of deleteFile? +bool DSSaveFileManager::removeSavefile(const char *filename) { + consolePrintf("DSSaveFileManager::removeSavefile : Not implemented yet.\n"); + assert(false); + //TODO: Implement this. Most likely, you just have to use the code of deleteFile? + return false; } Common::StringList DSSaveFileManager::listSavefiles(const char *pattern) { + consolePrintf("DSSaveFileManager::listSavefiles : Not implemented yet.\n"); + assert(false); + return Common::StringList(); + /* TODO: Implement this. If you don't understand what it should do, just ask (e.g. on scummvm-devel or Fingolfin). It should be pretty simple if you use Common::matchString from common/util.h and read the Doxygen docs, then combine this with the old code below... + */ /* void DSSaveFileManager::listSavefiles(const char *prefix, bool *marks, int num) { diff --git a/backends/platform/wince/CELauncherDialog.cpp b/backends/platform/wince/CELauncherDialog.cpp index 45e41e5e93..d474110f26 100644 --- a/backends/platform/wince/CELauncherDialog.cpp +++ b/backends/platform/wince/CELauncherDialog.cpp @@ -77,7 +77,7 @@ void CELauncherDialog::automaticScanDirectory(const FilesystemNode &node) { FSList files; node.getChildren(files, FilesystemNode::kListFilesOnly); // detect - GameList candidates(PluginManager::instance().detectGames(files)); + GameList candidates(EngineMan.detectGames(files)); // insert if (candidates.size() >= 1) { GameDescriptor result = candidates[0]; diff --git a/backends/plugins/dc/dc-provider.cpp b/backends/plugins/dc/dc-provider.cpp index 1cae4bbd32..9b150c8db4 100644 --- a/backends/plugins/dc/dc-provider.cpp +++ b/backends/plugins/dc/dc-provider.cpp @@ -83,9 +83,17 @@ public: }; -Plugin* SDLPluginProvider::createPlugin(const Common::String &filename) const { +Plugin* DCPluginProvider::createPlugin(const Common::String &filename) const { return new DCPlugin(filename); } +bool DCPluginProvider::isPluginFilename(const Common::String &filename) const { + // Check the plugin suffix + if (!filename.hasSuffix(".PLG")) + return false; + + return true; +} + #endif // defined(DYNAMIC_MODULES) && defined(__DC__) diff --git a/backends/plugins/dc/dc-provider.h b/backends/plugins/dc/dc-provider.h index 1b96f55d4d..f413061828 100644 --- a/backends/plugins/dc/dc-provider.h +++ b/backends/plugins/dc/dc-provider.h @@ -34,8 +34,7 @@ class DCPluginProvider : public FilePluginProvider { protected: Plugin* createPlugin(const Common::String &filename) const; - virtual const char* getPrefix() const { return ""; } - virtual const char* getSuffix() const { return ".PLG"; } + bool isPluginFilename(const Common::String &filename) const; virtual void addCustomDirectories(Common::StringList &dirs) const { dirs.push_back("/"); diff --git a/backends/plugins/win32/win32-provider.cpp b/backends/plugins/win32/win32-provider.cpp index 0592638140..64636d8096 100644 --- a/backends/plugins/win32/win32-provider.cpp +++ b/backends/plugins/win32/win32-provider.cpp @@ -107,5 +107,13 @@ Plugin* Win32PluginProvider::createPlugin(const Common::String &filename) const return new Win32Plugin(filename); } +bool Win32PluginProvider::isPluginFilename(const Common::String &filename) const { + // Check the plugin suffix + if (!filename.hasSuffix(".dll")) + return false; + + return true; +} + #endif // defined(DYNAMIC_MODULES) && defined(_WIN32) diff --git a/backends/plugins/win32/win32-provider.h b/backends/plugins/win32/win32-provider.h index e4b0be7395..4ddc8b7500 100644 --- a/backends/plugins/win32/win32-provider.h +++ b/backends/plugins/win32/win32-provider.h @@ -34,8 +34,7 @@ class Win32PluginProvider : public FilePluginProvider { protected: Plugin* createPlugin(const Common::String &filename) const; - virtual const char* getPrefix() const { return ""; } - virtual const char* getSuffix() const { return ".dll"; } + bool isPluginFilename(const Common::String &filename) const; virtual void addCustomDirectories(Common::StringList &dirs) const {} }; |