Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

feat(gameengine): -language picks the text language for one run

Olcay Seygan92ede3df35f0
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
index f75c1d15b..d4c94fbd6 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
@@ -1475,6 +1475,31 @@ Int parseDirect3D9(char *args[], int num)
return 1;
}
+/* -language <english|turkish>: the language the game's words are in for this run, over whatever
+ * the Options menu saved. The string table is built once, while the game starts and after this
+ * line is read, so this is how the launcher lets a player pick a language before the first menu.
+ * The names follow TextLanguageType. A name this build does not know leaves the saved one. */
+Int parseTextLanguage(char *args[], int num)
+{
+ static const char *const TheTextLanguageNames[ TEXT_LANGUAGE_COUNT ] = { "english", "turkish" };
+
+ if (TheWritableGlobalData && num > 1)
+ {
+ for (Int language = 0; language < TEXT_LANGUAGE_COUNT; ++language)
+ {
+ if (stricmp(args[1], TheTextLanguageNames[language]) == 0)
+ {
+ TheWritableGlobalData->m_textLanguage = language;
+ DEBUG_LOG(("-language: %s\n", TheTextLanguageNames[language]));
+ return 2;
+ }
+ }
+ DEBUG_LOG(("-language: '%s' is not a language this build knows, keeping the saved one\n", args[1]));
+ return 2;
+ }
+ return 1;
+}
+
/* -dx11dump <directory>: write every program the Direct3D 11 backend generates into that
* directory as it is built, named by the order it was built in with the state it came from on
* its first line. A generated program that draws the wrong thing cannot be read any other way:
@@ -2210,6 +2235,7 @@ static CommandLineParam params[] =
{ "-video", parseVideo },
{ "-msaa", parseMSAA },
{ "-d3d9", parseDirect3D9 },
+ { "-language", parseTextLanguage },
{ "-dx11dump", parseDirect3D11Dump },
{ "-dx11post", parseDirect3D11Post },
{ "-autocamera", parseAutoCamera },