aboutsummaryrefslogtreecommitdiff
path: root/base/commandLine.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2013-04-18 23:35:23 +0200
committerWillem Jan Palenstijn2013-05-08 20:40:58 +0200
commit9c2341678ef4984bf92b3878295250faf980b066 (patch)
tree2fb4805e05e16b9924e80c9947e6bad723b28c4b /base/commandLine.cpp
parent8172d679df5148a4a32f46074b20cb6caf91844f (diff)
parenta5f4ff36ffc386d48f2da49387a9655ce9295a4d (diff)
downloadscummvm-rg350-9c2341678ef4984bf92b3878295250faf980b066.tar.gz
scummvm-rg350-9c2341678ef4984bf92b3878295250faf980b066.tar.bz2
scummvm-rg350-9c2341678ef4984bf92b3878295250faf980b066.zip
Merge branch 'master'
Diffstat (limited to 'base/commandLine.cpp')
-rw-r--r--base/commandLine.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 6550f60670..08838167e9 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -33,12 +33,15 @@
#include "base/version.h"
#include "common/config-manager.h"
+#include "common/fs.h"
+#include "common/rendermode.h"
#include "common/system.h"
#include "common/textconsole.h"
-#include "common/fs.h"
#include "gui/ThemeEngine.h"
+#include "audio/musicplugin.h"
+
#define DETECTOR_TESTING_HACK
#define UPGRADE_ALL_TARGETS_HACK
@@ -81,6 +84,7 @@ static const char HELP_STRING[] =
" --themepath=PATH Path to where GUI themes are stored\n"
" --list-themes Display list of all usable GUI themes\n"
" -e, --music-driver=MODE Select music driver (see README for details)\n"
+ " --list-audio-devices List all available audio devices\n"
" -q, --language=LANG Select language (en,de,fr,it,pt,es,jp,zh,kr,se,gb,\n"
" hb,ru,cz)\n"
" -m, --music-volume=NUM Set the music volume, 0-255 (default: 192)\n"
@@ -274,7 +278,7 @@ void registerDefaults() {
// resp. between "--some-option" and "--no-some-option".
#define DO_OPTION_BOOL(shortCmd, longCmd) \
if (isLongCmd ? (!strcmp(s+2, longCmd) || !strcmp(s+2, "no-"longCmd)) : (tolower(s[1]) == shortCmd)) { \
- bool boolValue = (islower(static_cast<unsigned char>(s[1])) != 0); \
+ bool boolValue = (Common::isLower(s[1]) != 0); \
s += 2; \
if (isLongCmd) { \
boolValue = !strcmp(s, longCmd); \
@@ -381,6 +385,9 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha
DO_OPTION('e', "music-driver")
END_OPTION
+ DO_LONG_COMMAND("list-audio-devices")
+ END_OPTION
+
DO_LONG_OPTION_INT("output-rate")
END_OPTION
@@ -689,6 +696,21 @@ static void listThemes() {
printf("%-14s %s\n", i->id.c_str(), i->name.c_str());
}
+/** Lists all output devices */
+static void listAudioDevices() {
+ MusicPlugin::List pluginList = MusicMan.getPlugins();
+
+ printf("ID Description\n");
+ printf("------------------------------ ------------------------------------------------\n");
+
+ for (MusicPlugin::List::const_iterator i = pluginList.begin(), iend = pluginList.end(); i != iend; ++i) {
+ MusicDevices deviceList = (**i)->getDevices();
+ for (MusicDevices::iterator j = deviceList.begin(), jend = deviceList.end(); j != jend; ++j) {
+ printf("%-30s %s\n", Common::String::format("\"%s\"", j->getCompleteId().c_str()).c_str(), j->getCompleteName().c_str());
+ }
+ }
+}
+
#ifdef DETECTOR_TESTING_HACK
static void runDetectorTest() {
@@ -906,6 +928,9 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
} else if (command == "list-themes") {
listThemes();
return true;
+ } else if (command == "list-audio-devices") {
+ listAudioDevices();
+ return true;
} else if (command == "version") {
printf("%s\n", gScummVMFullVersion);
printf("Features compiled in: %s\n", gScummVMFeatures);