From debd94fbaa69121e4bf9720dfe354eff2bbf7081 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 23 Nov 2011 17:01:04 +0100 Subject: BASE: Implement a command to list all available audio devices on the shell. --- base/commandLine.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'base/commandLine.cpp') diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 6550f60670..c3059ced2f 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -39,6 +39,8 @@ #include "gui/ThemeEngine.h" +#include "audio/musicplugin.h" + #define DETECTOR_TESTING_HACK #define UPGRADE_ALL_TARGETS_HACK @@ -81,6 +83,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" @@ -381,6 +384,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 +695,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 +927,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); -- cgit v1.2.3 From 658080deeda79d20ea40643569fbcb072573e7cf Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 28 Jan 2012 01:15:49 +0100 Subject: ALL: Avoid using is* macros from ctype.h On some systems, passing signed chars to macros like isspace() etc. lead to a runtime error. Hence, mark these macros as forbidden by default, and introduce otherwise equivalent alternatives for them. --- base/commandLine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'base/commandLine.cpp') diff --git a/base/commandLine.cpp b/base/commandLine.cpp index c3059ced2f..16a2b6f9f0 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -277,7 +277,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(s[1])) != 0); \ + bool boolValue = (isLower(s[1]) != 0); \ s += 2; \ if (isLongCmd) { \ boolValue = !strcmp(s, longCmd); \ -- cgit v1.2.3 From 4f8665fc836898ebf54fc73b1061125b748183bc Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 20 Feb 2012 16:03:39 +0100 Subject: COMMON: Move isFoo functions to namespace Common, add doxygen comments --- base/commandLine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'base/commandLine.cpp') diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 16a2b6f9f0..aa589ed15f 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -277,7 +277,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(s[1]) != 0); \ + bool boolValue = (Common::isLower(s[1]) != 0); \ s += 2; \ if (isLongCmd) { \ boolValue = !strcmp(s, longCmd); \ -- cgit v1.2.3 From 215b41b244e042019f82cb507463d7e13672a6d0 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 22 Feb 2012 15:33:29 +0100 Subject: COMMON: Move RenderMode and GUIOptions functionality into separate files --- base/commandLine.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'base/commandLine.cpp') diff --git a/base/commandLine.cpp b/base/commandLine.cpp index aa589ed15f..08838167e9 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -33,9 +33,10 @@ #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" -- cgit v1.2.3