[Scummvm-cvs-logs] SF.net SVN: scummvm:[50158] scummvm/trunk
athrxx at users.sourceforge.net
athrxx at users.sourceforge.net
Tue Jun 22 20:27:00 CEST 2010
Revision: 50158
http://scummvm.svn.sourceforge.net/scummvm/?rev=50158&view=rev
Author: athrxx
Date: 2010-06-22 18:27:00 +0000 (Tue, 22 Jun 2010)
Log Message:
-----------
LAUNCHER: hopefully fixed music driver selection via command line
Modified Paths:
--------------
scummvm/trunk/base/commandLine.cpp
scummvm/trunk/base/main.cpp
scummvm/trunk/sound/mididrv.cpp
Modified: scummvm/trunk/base/commandLine.cpp
===================================================================
--- scummvm/trunk/base/commandLine.cpp 2010-06-22 18:25:15 UTC (rev 50157)
+++ scummvm/trunk/base/commandLine.cpp 2010-06-22 18:27:00 UTC (rev 50158)
@@ -32,8 +32,6 @@
#include "common/system.h"
#include "common/fs.h"
-#include "sound/mididrv.h"
-
#include "gui/ThemeEngine.h"
#define DETECTOR_TESTING_HACK
@@ -364,8 +362,6 @@
END_OPTION
DO_OPTION('e', "music-driver")
- if (MidiDriver::getMusicType(MidiDriver::getDeviceHandle(option)) == MT_NULL)
- usage("Unrecognized music driver '%s'", option);
END_OPTION
DO_LONG_OPTION_INT("output-rate")
Modified: scummvm/trunk/base/main.cpp
===================================================================
--- scummvm/trunk/base/main.cpp 2010-06-22 18:25:15 UTC (rev 50157)
+++ scummvm/trunk/base/main.cpp 2010-06-22 18:27:00 UTC (rev 50158)
@@ -54,6 +54,7 @@
#include "gui/error.h"
#include "sound/audiocd.h"
+#include "sound/mididrv.h"
#include "backends/keymapper/keymapper.h"
@@ -341,6 +342,16 @@
// Load the plugins.
PluginManager::instance().loadPlugins();
+ // If we received an invalid music parameter via command line we check this here.
+ // We can't check this before loading the music plugins.
+ // On the other hand we cannot load the plugins before we know the file paths (in case of external plugins).
+ if (!settings["music-driver"].empty()) {
+ if (MidiDriver::getMusicType(MidiDriver::getDeviceHandle(settings["music-driver"])) == MT_NULL) {
+ warning("Unrecognized music driver '%s'\nSwitching to default device.", settings["music-driver"].c_str());
+ settings["music-driver"] = "auto";
+ }
+ }
+
// Process the remaining command line settings. Must be done after the
// config file and the plugins have been loaded.
Common::Error res;
Modified: scummvm/trunk/sound/mididrv.cpp
===================================================================
--- scummvm/trunk/sound/mididrv.cpp 2010-06-22 18:25:15 UTC (rev 50157)
+++ scummvm/trunk/sound/mididrv.cpp 2010-06-22 18:27:00 UTC (rev 50158)
@@ -238,6 +238,10 @@
MidiDriver::DeviceHandle MidiDriver::getDeviceHandle(const Common::String &identifier) {
const MusicPlugin::List p = MusicMan.getPlugins();
+
+ if (p.begin() == p.end())
+ error("Music plugins must be loaded prior to calling this method.");
+
for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end(); m++) {
MusicDevices i = (**m)->getDevices();
for (MusicDevices::iterator d = i.begin(); d != i.end(); d++) {
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