[Scummvm-git-logs] scummvm master -> 1fa331f44a6d0ad1124c6301f478b35b032baa3f

sev- noreply at scummvm.org
Fri Jul 22 13:05:03 UTC 2022


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
30f3e0eceb COMMON: Get accessor methods to the platform and language lists
1fa331f44a BASE: Generate list of languages and platforms instead of hardcoding


Commit: 30f3e0eceb9301ab5d1619cf37bae3ca951cca12
    https://github.com/scummvm/scummvm/commit/30f3e0eceb9301ab5d1619cf37bae3ca951cca12
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-07-22T15:03:48+02:00

Commit Message:
COMMON: Get accessor methods to the platform and language lists

Changed paths:
    common/language.cpp
    common/language.h
    common/platform.cpp
    common/platform.h


diff --git a/common/language.cpp b/common/language.cpp
index b2dd7794f18..c974a09472b 100644
--- a/common/language.cpp
+++ b/common/language.cpp
@@ -22,6 +22,7 @@
 #include "common/language.h"
 #include "common/gui_options.h"
 #include "common/str.h"
+#include "common/algorithm.h"
 
 namespace Common {
 
@@ -178,4 +179,15 @@ const String getGameGUIOptionsDescriptionLanguage(Language lang) {
 	return String("lang_") + getLanguageDescription(lang);
 }
 
+List<String> getLanguageList() {
+	List<String> list;
+
+	for (const LanguageDescription *l = g_languages; l->code; ++l)
+		list.push_back(l->code);
+
+	 Common::sort(list.begin(), list.end());
+
+	 return list;
+}
+
 } // End of namespace Common
diff --git a/common/language.h b/common/language.h
index b2d866bcd9f..eb579c48566 100644
--- a/common/language.h
+++ b/common/language.h
@@ -23,6 +23,7 @@
 #define COMMON_LANGUAGE_H
 
 #include "common/scummsys.h"
+#include "common/list.h"
 
 namespace Common {
 
@@ -105,6 +106,8 @@ const String getGameGUIOptionsDescriptionLanguage(Common::Language lang);
 // TODO: Document this GUIO related function
 bool checkGameGUIOptionLanguage(Common::Language lang, const String &str);
 
+List<String> getLanguageList();
+
 /** @} */
 
 } // End of namespace Common
diff --git a/common/platform.cpp b/common/platform.cpp
index 277bd62fd13..315ade937d1 100644
--- a/common/platform.cpp
+++ b/common/platform.cpp
@@ -21,6 +21,7 @@
 
 #include "common/platform.h"
 #include "common/str.h"
+#include "common/algorithm.h"
 
 namespace Common {
 
@@ -120,4 +121,15 @@ const char *getPlatformDescription(Platform id) {
 	return l->description;
 }
 
+List<String> getPlatformList() {
+	List<String> list;
+
+	for (const PlatformDescription *l = g_platforms; l->code; ++l)
+		list.push_back(l->code2);
+
+	 Common::sort(list.begin(), list.end());
+
+	 return list;
+}
+
 } // End of namespace Common
diff --git a/common/platform.h b/common/platform.h
index 8bd4ebf834b..f4dc4ab96fd 100644
--- a/common/platform.h
+++ b/common/platform.h
@@ -23,6 +23,7 @@
 #define COMMON_PLATFORM_H
 
 #include "common/scummsys.h"
+#include "common/list.h"
 
 namespace Common {
 
@@ -99,6 +100,8 @@ extern const char *getPlatformCode(Platform id);
 extern const char *getPlatformAbbrev(Platform id);
 extern const char *getPlatformDescription(Platform id);
 
+List<String> getPlatformList();
+
 /** @} */
 
 } // End of namespace Common


Commit: 1fa331f44a6d0ad1124c6301f478b35b032baa3f
    https://github.com/scummvm/scummvm/commit/1fa331f44a6d0ad1124c6301f478b35b032baa3f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-07-22T15:04:27+02:00

Commit Message:
BASE: Generate list of languages and platforms instead of hardcoding

Changed paths:
    base/commandLine.cpp


diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 45eae4c1ae0..59be47cd6cd 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -66,9 +66,12 @@ static const char USAGE_STRING[] =
 
 // DONT FIXME: DO NOT ORDER ALPHABETICALLY, THIS IS ORDERED BY IMPORTANCE/CATEGORY! :)
 #if defined(ANDROID) || defined(__DS__) || defined(__3DS__)
-static const char HELP_STRING[] = "NoUsageString"; // save more data segment space
+static const char HELP_STRING1[] = "%s None"; // save more data segment space
+static const char HELP_STRING2[] = "None";
+static const char HELP_STRING3[] = "None";
+static const char HELP_STRING4[] = "None";
 #else
-static const char HELP_STRING[] =
+static const char HELP_STRING1[] =
 	"ScummVM - Graphical Adventure Game Interpreter\n"
 	"Usage: %s [OPTIONS]... [GAME]\n"
 	"  -v, --version            Display ScummVM version information and exit\n"
@@ -125,9 +128,19 @@ 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"
+	"  --list-audio-devices     List all available audio devices\n";
+
+// Make it match the indentation of the main list
+#define kCommandLineIndent \
+	"                           "
+#define kCommandMaxWidth 79
+static const char HELP_STRING2[] =
+	"  -q, --language=LANG      Select language (";
+
+static const char HELP_STRING3[] =
+	"  --platform=WORD          Specify platform of game (allowed values: ";
+
+static const char HELP_STRING4[] =
 	"  -m, --music-volume=NUM   Set the music volume, 0-255 (default: 192)\n"
 	"  -s, --sfx-volume=NUM     Set the sfx volume, 0-255 (default: 192)\n"
 	"  -r, --speech-volume=NUM  Set the speech volume, 0-255 (default: 192)\n"
@@ -146,12 +159,6 @@ static const char HELP_STRING[] =
 	"                           drive, path, or numeric index (default: 0 = best\n"
 	"                           choice drive)\n"
 	"  --joystick[=NUM]         Enable joystick input (default: 0 = first joystick)\n"
-	"  --platform=WORD          Specify platform of game (allowed values: 2gs, 3do,\n"
-	"                           acorn, amiga, android, apple2, atari, atari8, beos,\n"
-	"                           c64, cdi, coco, coco3, fmtowns, genesis, ios, lunux,\n"
-	"                           nes, mac, macintosh2, os2, pc, pc98, pce, pippin, ppc,\n"
-	"                           psx, ps2, saturm, segacd, shockwave, ti994, wii,\n"
-	"                           windows, xbox, zx)\n"
 	"  --savepath=PATH          Path to where saved games are stored\n"
 	"  --extrapath=PATH         Extra path to additional game data\n"
 	"  --iconspath=PATH         Path to additional icons for the launcher grid view\n"
@@ -1740,7 +1747,43 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
 		printf("Features compiled in: %s\n", gScummVMFeatures);
 		return true;
 	} else if (command == "help") {
-		printf(HELP_STRING, s_appName);
+		printf(HELP_STRING1, s_appName);
+
+		Common::String s = HELP_STRING2;
+		Common::List<Common::String> langs = Common::getLanguageList();
+
+		s += langs.front();
+		langs.pop_front();
+
+		for (auto &l : langs) {
+			if (s.size() + l.size() + 2 >= kCommandMaxWidth) {
+				printf("%s,\n", s.c_str());
+				s = kCommandLineIndent + l;
+			} else {
+				s += ", " + l;
+			}
+		}
+
+		printf("%s)\n", s.c_str());
+
+		s = HELP_STRING3;
+		Common::List<Common::String> platforms = Common::getPlatformList();
+		s += platforms.front();
+		langs.pop_front();
+
+		for (auto &p : platforms) {
+			if (s.size() + p.size() + 2 >= kCommandMaxWidth) {
+				printf("%s,\n", s.c_str());
+				s = kCommandLineIndent + p;
+			} else {
+				s += ", " + p;
+			}
+		}
+
+		printf("%s)\n", s.c_str());
+
+		printf(HELP_STRING4);
+
 		return true;
 	} else if (command == "auto-detect") {
 		bool resursive = settings["recursive"] == "true";




More information about the Scummvm-git-logs mailing list