From 4a6cd17750bfec2714af6773523828b1f690863c Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Tue, 2 Jun 2026 20:45:52 -0400 Subject: [PATCH 1/9] usage message + localization support --- src/desktop/main.c | 116 ++++++++++++++++++++++++++++++++++++++++++++- src/localization.c | 40 ++++++++++++++++ src/localization.h | 21 ++++++++ 3 files changed, 175 insertions(+), 2 deletions(-) create mode 100644 src/localization.c create mode 100644 src/localization.h diff --git a/src/desktop/main.c b/src/desktop/main.c index da00922b..d5a92704 100644 --- a/src/desktop/main.c +++ b/src/desktop/main.c @@ -24,7 +24,7 @@ #include "runner.h" #include "input_recording.h" #include "debug_overlay.h" -#if defined(ENABLE_LEGACY_GL) || defined(ENABLE_MODERN_GL) || ((defined(USE_GLFW3) || defined(USE_GLFW2)) && defined(ENABLE_SW_RENDERER) ) +#if defined(ENABLE_LEGACY_GL) || defined(ENABLE_MODERN_GL) || ((defined(USE_GLFW3) || defined(USE_GLFW2)) && defined(ENABLE_SW_RENDERER)) #include #endif #if defined(ENABLE_LEGACY_GL) || defined(ENABLE_MODERN_GL) @@ -48,6 +48,7 @@ #include "utils.h" #include "profiler.h" +#include "localization.h" enum GraphicsAPI gfx; @@ -276,10 +277,118 @@ static char** extractRunnerArguments(char* rawArguments) { return array; } +static void printUsage(const char *argv0) { + fprintf( + stderr, + "Usage: %s \n" + " --help - %s\n" + //" --screenshot - %s\n" + " --screenshot-at-frame - %s\n" + //" --screenshot-surfaces - %s\n" + //" --screenshot-surfaces-at-frame - %s\n" +#ifndef USE_GLFW2 + " --headless - %s\n" +#endif + //" --print-rooms - %s\n" + //" --print-objects - %s\n" + //" --print-declared-functions - %s\n" + //" --print-unknown-functions - %s\n" + //" --trace-variable-reads - %s\n" + //" --trace-variable-writes - %s\n" + //" --trace-function-calls - %s\n" + //" --trace-alarms - %s\n" + //" --trace-instance-lifecycles - %s\n" + //" --trace-events - %s\n" + //" --trace-collisions - %s\n" + //" --trace-event-inherited - %s\n" + //" --trace-tiles - %s\n" + //" --trace-opcodes - %s\n" + //" --trace-stack - %s\n" + //" --trace-frames - %s\n" + //" --always-log-unknown-functions - %s\n" + //" --always-log-stubbed-functions - %s\n" + " --exit-at-frame - %s\n" + //" --trace-bytecode-after-frame - %s\n" + //" --dump-frame - %s\n" + //" --dump-frame-json - %s\n" + //" --dump-frame-json-file - %s\n" + " --speed - %s\n" + " --fast-forward-speed - %s\n" + " --seed - %s\n" + //" --debug - %s\n" + //" --disassemble - %s\n" + //" --record-inputs - %s\n" + //" --playback-inputs - %s\n" + " --renderer - %s\n" + " --lazy-rooms - %s\n" + //" --eager-room - %s\n" + " --os-type - %s\n" + " --window-size - %s\n" + //" --profile-gml-scripts - %s\n" + " --save-folder - %s\n" + //" --game-args - %s\n" +#ifdef EABLE_VM_OPCODE_PROFILER + //" --profile-opcodes - %s\n" +#endif + , + argv0, + getLocStr("Shows this message", "help.help"), + //getLocStr("", "help.screenshot"), + getLocStr("Take a screenshot frames after startup", "help.screenshot-at-frame"), + //getLocStr("", "help.screenshot-surfaces"), + //getLocStr("", "help.screenshot-surfaces-at-frame"), +#ifndef USE_GLFW2 + getLocStr("Launch without a window", "help.headless"), +#endif + //getLocStr("", "help.print-rooms"), + //getLocStr("", "help.print-objects"), + //getLocStr("", "help.print-declared-functions"), + //getLocStr("", "help.print-unknown-functions"), + //getLocStr("", "help.trace-variable-reads"), + //getLocStr("", "help.trace-variable-writes"), + //getLocStr("", "help.trace-function-calls"), + //getLocStr("", "help.trace-alarms"), + //getLocStr("", "help.trace-instance-lifecycles"), + //getLocStr("", "help.trace-events"), + //getLocStr("", "help.trace-collisions"), + //getLocStr("", "help.trace-event-inherited"), + //getLocStr("", "help.trace-tiles"), + //getLocStr("", "help.trace-opcodes"), + //getLocStr("", "help.trace-stack"), + //getLocStr("", "help.trace-frames"), + //getLocStr("", "help.always-log-unknown-functions"), + //getLocStr("", "help.always-log-stubbed-functions"), + getLocStr("Exits at the specified frame", "help.exit-at-frame"), + //getLocStr("", "help.trace-bytecode-after-frame"), + //getLocStr("", "help.dump-frame"), + //getLocStr("", "help.dump-frame-json"), + //getLocStr("", "help.dump-frame-json-file"), + getLocStr("Set a normal speed multiplier", "help.speed"), + getLocStr("Set a fast-forward speed multiplier", "help.fast-forward-speed"), + getLocStr("Seed for the random number generator", "help.seed"), + //getLocStr("", "help.debug"), + //getLocStr("", "help.disassemble"), + //getLocStr("", "help.record-inputs"), + //getLocStr("", "help.playback-inputs"), + getLocStr("Sets the rendering API", "help.renderer"), + getLocStr("Lazily load rooms, increases load times but reduces memory usage", "help.lazy-rooms"), + //getLocStr("", "help.eager-room"), + getLocStr("Sets the reported OS type", "help.os-type"), + getLocStr("Sets the target window size", "help.window-size"), + //getLocStr("", "help.profile-gml-scripts"), + getLocStr("Sets the directory will save files will be stored", "help.save-folder") + //getLocStr("", "help.game-args") +#ifdef EABLE_VM_OPCODE_PROFILER + //, getLocStr("", "help.profile-opcodes") +#endif + ); +} + static void parseCommandLineArgs(CommandLineArgs* args, int argc, char* argv[]) { memset(args, 0, sizeof(CommandLineArgs)); static struct option longOptions[] = { + {"help", no_argument, nullptr, 'H'}, {"screenshot", required_argument, nullptr, 's'}, {"screenshot-at-frame", required_argument, nullptr, 'f'}, {"screenshot-surfaces", required_argument, nullptr, 'U'}, @@ -351,6 +460,9 @@ static void parseCommandLineArgs(CommandLineArgs* args, int argc, char* argv[]) int opt; while ((opt = getopt_long(argc, argv, "", longOptions, nullptr)) != -1) { switch (opt) { + case 'H': + printUsage(argv[0]); + exit(0); case 's': args->screenshotPattern = optarg; break; @@ -596,7 +708,7 @@ static void parseCommandLineArgs(CommandLineArgs* args, int argc, char* argv[]) break; } default: - fprintf(stderr, "Usage: %s \n", argv[0]); + printUsage(argv[0]); exit(1); } } diff --git a/src/localization.c b/src/localization.c new file mode 100644 index 00000000..14f788bd --- /dev/null +++ b/src/localization.c @@ -0,0 +1,40 @@ +#include "localization.h" + +#include + +const struct localized_string help_strings_sillylang[] = { + { "help", "im silly :3" }, + { NULL, NULL } +}; + +const struct string_category string_categories_sillylang[] = { + { "help", help_strings_sillylang }, + { NULL, NULL } +}; + +enum language getLanguage(void) { + return LANG_ENGLISH; +} + +const char *getLocStr(const char *fallback, const char *id) { + if (!id) + return fallback; + const struct string_category *categories; + switch (getLanguage()) { + case LANG_SILLY: + categories = string_categories_sillylang; + break; + default: + return fallback; + } + size_t id_dot = 0; + while (id[id_dot] != '.') + ++id_dot; + for (size_t category = 0; categories[category].name; ++category) + if (strncmp(categories[category].name, id, id_dot) == 0) + for (size_t i = 0; categories[category].strings[i].name; ++i) + if (strcmp(categories[category].strings[i].name, id + id_dot + 1) == 0) + return categories[category].strings[i].string; + + return fallback; +} diff --git a/src/localization.h b/src/localization.h new file mode 100644 index 00000000..8934e848 --- /dev/null +++ b/src/localization.h @@ -0,0 +1,21 @@ +#pragma once + +#include + +enum language { + LANG_ENGLISH, + LANG_SILLY, +}; + +struct localized_string { + const char *name; + const char *string; +}; + +struct string_category { + const char *name; + const struct localized_string *strings; +}; + +const char *getLocStr(const char *fallback, const char *id); +void locLog(const char *fallback, const char *id); From c909358922dc91ff84cd12c3ae6322e6e1acfa58 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Tue, 2 Jun 2026 20:49:49 -0400 Subject: [PATCH 2/9] printf wrapper --- src/localization.c | 8 ++++++++ src/localization.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/localization.c b/src/localization.c index 14f788bd..ef447ad0 100644 --- a/src/localization.c +++ b/src/localization.c @@ -1,6 +1,7 @@ #include "localization.h" #include +#include const struct localized_string help_strings_sillylang[] = { { "help", "im silly :3" }, @@ -38,3 +39,10 @@ const char *getLocStr(const char *fallback, const char *id) { return fallback; } + +void locLog(const char *fallback, const char *id, ...) { + va_list ap; + va_start(ap, id); + vfprintf(stderr, getLocStr(fallback, id), ap); + va_end(ap); +} diff --git a/src/localization.h b/src/localization.h index 8934e848..3a06458a 100644 --- a/src/localization.h +++ b/src/localization.h @@ -18,4 +18,4 @@ struct string_category { }; const char *getLocStr(const char *fallback, const char *id); -void locLog(const char *fallback, const char *id); +void locLog(const char *fallback, const char *id, ...); From 17fdaea3fe0f8b0b915b08c0d3170ecd73684a17 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Tue, 2 Jun 2026 23:34:49 -0400 Subject: [PATCH 3/9] fix --- src/localization.c | 4 ++-- src/localization.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/localization.c b/src/localization.c index ef447ad0..1c58dfd8 100644 --- a/src/localization.c +++ b/src/localization.c @@ -14,7 +14,7 @@ const struct string_category string_categories_sillylang[] = { }; enum language getLanguage(void) { - return LANG_ENGLISH; + return BS_LANG_ENGLISH; } const char *getLocStr(const char *fallback, const char *id) { @@ -22,7 +22,7 @@ const char *getLocStr(const char *fallback, const char *id) { return fallback; const struct string_category *categories; switch (getLanguage()) { - case LANG_SILLY: + case BS_LANG_SILLY: categories = string_categories_sillylang; break; default: diff --git a/src/localization.h b/src/localization.h index 3a06458a..b6fd29ad 100644 --- a/src/localization.h +++ b/src/localization.h @@ -3,8 +3,8 @@ #include enum language { - LANG_ENGLISH, - LANG_SILLY, + BS_LANG_ENGLISH, + BS_LANG_SILLY, }; struct localized_string { From 6dd06696b5c0069c63c1361ad162db76e3deda30 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Wed, 3 Jun 2026 01:55:49 -0400 Subject: [PATCH 4/9] add widescreen-hack --- src/desktop/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/desktop/main.c b/src/desktop/main.c index d5a92704..01a4066f 100644 --- a/src/desktop/main.c +++ b/src/desktop/main.c @@ -324,6 +324,7 @@ static void printUsage(const char *argv0) { //" --eager-room - %s\n" " --os-type - %s\n" " --window-size - %s\n" + " --widescreen-hack - %s\n" //" --profile-gml-scripts - %s\n" " --save-folder - %s\n" //" --game-args - %s\n" @@ -374,7 +375,8 @@ static void printUsage(const char *argv0) { getLocStr("Lazily load rooms, increases load times but reduces memory usage", "help.lazy-rooms"), //getLocStr("", "help.eager-room"), getLocStr("Sets the reported OS type", "help.os-type"), - getLocStr("Sets the target window size", "help.window-size"), + getLocStr("Sets a custom window size", "help.window-size"), + getLocStr("Sets a custom aspect ratio", "help.widescreen-hack"), //getLocStr("", "help.profile-gml-scripts"), getLocStr("Sets the directory will save files will be stored", "help.save-folder") //getLocStr("", "help.game-args") From b95f1320d186be5248c3183c217ee80b2d38cfa3 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Wed, 3 Jun 2026 02:09:31 -0400 Subject: [PATCH 5/9] add descriptions of stuf --- src/desktop/main.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/desktop/main.c b/src/desktop/main.c index 01a4066f..a1d61bf7 100644 --- a/src/desktop/main.c +++ b/src/desktop/main.c @@ -282,16 +282,16 @@ static void printUsage(const char *argv0) { stderr, "Usage: %s \n" " --help - %s\n" - //" --screenshot - %s\n" + " --screenshot - %s\n" " --screenshot-at-frame - %s\n" - //" --screenshot-surfaces - %s\n" - //" --screenshot-surfaces-at-frame - %s\n" + " --screenshot-surfaces - %s\n" + " --screenshot-surfaces-at-frame - %s\n" #ifndef USE_GLFW2 " --headless - %s\n" #endif - //" --print-rooms - %s\n" + " --print-rooms - %s\n" //" --print-objects - %s\n" - //" --print-declared-functions - %s\n" + " --print-declared-functions - %s\n" //" --print-unknown-functions - %s\n" //" --trace-variable-reads - %s\n" //" --trace-variable-writes - %s\n" @@ -315,7 +315,7 @@ static void printUsage(const char *argv0) { " --speed - %s\n" " --fast-forward-speed - %s\n" " --seed - %s\n" - //" --debug - %s\n" + " --debug - %s\n" //" --disassemble - %s\n" //" --record-inputs - %s\n" //" --playback-inputs - %s\n" @@ -334,16 +334,16 @@ static void printUsage(const char *argv0) { , argv0, getLocStr("Shows this message", "help.help"), - //getLocStr("", "help.screenshot"), + getLocStr("Specifies the filename for screenshots", "help.screenshot"), getLocStr("Take a screenshot frames after startup", "help.screenshot-at-frame"), - //getLocStr("", "help.screenshot-surfaces"), - //getLocStr("", "help.screenshot-surfaces-at-frame"), + getLocStr("Take a screenshot of all surfaces frames after startup", "help.screenshot-surfaces"), + getLocStr("Specifies the filename for surface screenshots", "help.screenshot-surfaces-at-frame"), #ifndef USE_GLFW2 getLocStr("Launch without a window", "help.headless"), #endif - //getLocStr("", "help.print-rooms"), + getLocStr("Print all the rooms in the game and exit", "help.print-rooms"), //getLocStr("", "help.print-objects"), - //getLocStr("", "help.print-declared-functions"), + getLocStr("Print all declared functions in the game and exit", "help.print-declared-functions"), //getLocStr("", "help.print-unknown-functions"), //getLocStr("", "help.trace-variable-reads"), //getLocStr("", "help.trace-variable-writes"), @@ -367,7 +367,7 @@ static void printUsage(const char *argv0) { getLocStr("Set a normal speed multiplier", "help.speed"), getLocStr("Set a fast-forward speed multiplier", "help.fast-forward-speed"), getLocStr("Seed for the random number generator", "help.seed"), - //getLocStr("", "help.debug"), + getLocStr("Enable debug mode", "help.debug"), //getLocStr("", "help.disassemble"), //getLocStr("", "help.record-inputs"), //getLocStr("", "help.playback-inputs"), From 8f24ef74424eab940b15c633278ab96f278d2081 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Wed, 3 Jun 2026 02:19:37 -0400 Subject: [PATCH 6/9] more stuf --- src/desktop/main.c | 82 +++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/src/desktop/main.c b/src/desktop/main.c index a1d61bf7..e1746aeb 100644 --- a/src/desktop/main.c +++ b/src/desktop/main.c @@ -293,20 +293,20 @@ static void printUsage(const char *argv0) { //" --print-objects - %s\n" " --print-declared-functions - %s\n" //" --print-unknown-functions - %s\n" - //" --trace-variable-reads - %s\n" - //" --trace-variable-writes - %s\n" - //" --trace-function-calls - %s\n" - //" --trace-alarms - %s\n" - //" --trace-instance-lifecycles - %s\n" - //" --trace-events - %s\n" - //" --trace-collisions - %s\n" - //" --trace-event-inherited - %s\n" - //" --trace-tiles - %s\n" - //" --trace-opcodes - %s\n" - //" --trace-stack - %s\n" - //" --trace-frames - %s\n" - //" --always-log-unknown-functions - %s\n" - //" --always-log-stubbed-functions - %s\n" + " --trace-variable-reads - %s\n" + " --trace-variable-writes - %s\n" + " --trace-function-calls - %s\n" + " --trace-alarms - %s\n" + " --trace-instance-lifecycles - %s\n" + " --trace-events - %s\n" + " --trace-collisions - %s\n" + " --trace-event-inherited - %s\n" + " --trace-tiles - %s\n" + " --trace-opcodes - %s\n" + " --trace-stack - %s\n" + " --trace-frames - %s\n" + " --always-log-unknown-functions - %s\n" + " --always-log-stubbed-functions - %s\n" " --exit-at-frame - %s\n" //" --trace-bytecode-after-frame - %s\n" //" --dump-frame - %s\n" @@ -325,19 +325,19 @@ static void printUsage(const char *argv0) { " --os-type - %s\n" " --window-size - %s\n" " --widescreen-hack - %s\n" - //" --profile-gml-scripts - %s\n" + " --profile-gml-scripts - %s\n" " --save-folder - %s\n" //" --game-args - %s\n" #ifdef EABLE_VM_OPCODE_PROFILER - //" --profile-opcodes - %s\n" + " --profile-opcodes - %s\n" #endif , argv0, - getLocStr("Shows this message", "help.help"), - getLocStr("Specifies the filename for screenshots", "help.screenshot"), + getLocStr("Show this message", "help.help"), + getLocStr("Specify the filename for screenshots", "help.screenshot"), getLocStr("Take a screenshot frames after startup", "help.screenshot-at-frame"), getLocStr("Take a screenshot of all surfaces frames after startup", "help.screenshot-surfaces"), - getLocStr("Specifies the filename for surface screenshots", "help.screenshot-surfaces-at-frame"), + getLocStr("Specify the filename for surface screenshots", "help.screenshot-surfaces-at-frame"), #ifndef USE_GLFW2 getLocStr("Launch without a window", "help.headless"), #endif @@ -345,21 +345,21 @@ static void printUsage(const char *argv0) { //getLocStr("", "help.print-objects"), getLocStr("Print all declared functions in the game and exit", "help.print-declared-functions"), //getLocStr("", "help.print-unknown-functions"), - //getLocStr("", "help.trace-variable-reads"), - //getLocStr("", "help.trace-variable-writes"), - //getLocStr("", "help.trace-function-calls"), - //getLocStr("", "help.trace-alarms"), - //getLocStr("", "help.trace-instance-lifecycles"), - //getLocStr("", "help.trace-events"), - //getLocStr("", "help.trace-collisions"), - //getLocStr("", "help.trace-event-inherited"), - //getLocStr("", "help.trace-tiles"), - //getLocStr("", "help.trace-opcodes"), - //getLocStr("", "help.trace-stack"), - //getLocStr("", "help.trace-frames"), - //getLocStr("", "help.always-log-unknown-functions"), - //getLocStr("", "help.always-log-stubbed-functions"), - getLocStr("Exits at the specified frame", "help.exit-at-frame"), + getLocStr("Trace variable reads", "help.trace-variable-reads"), + getLocStr("Trace variable writes", "help.trace-variable-writes"), + getLocStr("Trace function calls", "help.trace-function-calls"), + getLocStr("Trace alarms", "help.trace-alarms"), + getLocStr("Trace instance creations and deletions", "help.trace-instance-lifecycles"), + getLocStr("Trace events", "help.trace-events"), + getLocStr("Trace collisions between instances", "help.trace-collisions"), + getLocStr("Trace event inherited calls", "help.trace-event-inherited"), + getLocStr("Trace drawn tiles", "help.trace-tiles"), + getLocStr("Trace opcodes", "help.trace-opcodes"), + getLocStr("Trace stack", "help.trace-stack"), + getLocStr("Log frametimes", "help.trace-frames"), + getLocStr("Always log unknown function calls instead of once per script", "help.always-log-unknown-functions"), + getLocStr("Always log stubbed function calls instead of once per script", "help.always-log-stubbed-functions"), + getLocStr("Exit at the specified frame", "help.exit-at-frame"), //getLocStr("", "help.trace-bytecode-after-frame"), //getLocStr("", "help.dump-frame"), //getLocStr("", "help.dump-frame-json"), @@ -371,17 +371,17 @@ static void printUsage(const char *argv0) { //getLocStr("", "help.disassemble"), //getLocStr("", "help.record-inputs"), //getLocStr("", "help.playback-inputs"), - getLocStr("Sets the rendering API", "help.renderer"), + getLocStr("Set the rendering API", "help.renderer"), getLocStr("Lazily load rooms, increases load times but reduces memory usage", "help.lazy-rooms"), //getLocStr("", "help.eager-room"), - getLocStr("Sets the reported OS type", "help.os-type"), - getLocStr("Sets a custom window size", "help.window-size"), - getLocStr("Sets a custom aspect ratio", "help.widescreen-hack"), - //getLocStr("", "help.profile-gml-scripts"), - getLocStr("Sets the directory will save files will be stored", "help.save-folder") + getLocStr("Set the reported OS type", "help.os-type"), + getLocStr("Set a custom window size", "help.window-size"), + getLocStr("Set a custom aspect ratio", "help.widescreen-hack"), + getLocStr("Log which GML scripts are the heaviest in terms of time and executed instructions", "help.profile-gml-scripts"), + getLocStr("Set the directory will save files will be stored", "help.save-folder") //getLocStr("", "help.game-args") #ifdef EABLE_VM_OPCODE_PROFILER - //, getLocStr("", "help.profile-opcodes") + , getLocStr("Rank which GML opcodes were executed the most", "help.profile-opcodes") #endif ); } From 085aa4730d336b4aeee8ee4973e65d850e45df82 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Wed, 3 Jun 2026 02:22:24 -0400 Subject: [PATCH 7/9] more message --- src/desktop/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/desktop/main.c b/src/desktop/main.c index e1746aeb..2cc1025e 100644 --- a/src/desktop/main.c +++ b/src/desktop/main.c @@ -292,7 +292,7 @@ static void printUsage(const char *argv0) { " --print-rooms - %s\n" //" --print-objects - %s\n" " --print-declared-functions - %s\n" - //" --print-unknown-functions - %s\n" + " --print-unknown-functions - %s\n" " --trace-variable-reads - %s\n" " --trace-variable-writes - %s\n" " --trace-function-calls - %s\n" @@ -344,7 +344,7 @@ static void printUsage(const char *argv0) { getLocStr("Print all the rooms in the game and exit", "help.print-rooms"), //getLocStr("", "help.print-objects"), getLocStr("Print all declared functions in the game and exit", "help.print-declared-functions"), - //getLocStr("", "help.print-unknown-functions"), + getLocStr("Print all unknown functions used by the game and exit", "help.print-unknown-functions"), getLocStr("Trace variable reads", "help.trace-variable-reads"), getLocStr("Trace variable writes", "help.trace-variable-writes"), getLocStr("Trace function calls", "help.trace-function-calls"), From c613d1dc386c136a9ec962e7821c835207f62dc4 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Wed, 3 Jun 2026 03:21:18 -0400 Subject: [PATCH 8/9] comments --- src/localization.c | 30 +++++++++++++++++++++++++++++- src/localization.h | 3 +-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/localization.c b/src/localization.c index 1c58dfd8..879f238d 100644 --- a/src/localization.c +++ b/src/localization.c @@ -3,6 +3,24 @@ #include #include +/* + * To add a language, create a category array and one or more string arrays. + * Then, add your language to the switch statement in getLocStr(). + * + * Below is a language called 'sillylang' that exists to act as an example + * of how you would add a language. It should be removed once at least one + * real language is added to this file. + * + * The only string sillylang translates is the description for the --help + * option in the --help usage message, it translates 'Show this message' + * to 'im silly :3'. + * + * If a string is unhandled by your translation, it will show up as the + * fallback string passed to getLocStr(). This will be an English version + * of the text. + */ + +/* const struct localized_string help_strings_sillylang[] = { { "help", "im silly :3" }, { NULL, NULL } @@ -12,8 +30,16 @@ const struct string_category string_categories_sillylang[] = { { "help", help_strings_sillylang }, { NULL, NULL } }; +*/ -enum language getLanguage(void) { +static enum language getLanguage(void) { + /* + * TODO: add more languages + * Also prolly don't fetch it again every time cuz this + * function might get called frequently, so have a static + * variable that gets inited once and subsequent calls + * can return the cached value. + */ return BS_LANG_ENGLISH; } @@ -22,9 +48,11 @@ const char *getLocStr(const char *fallback, const char *id) { return fallback; const struct string_category *categories; switch (getLanguage()) { + /* case BS_LANG_SILLY: categories = string_categories_sillylang; break; + */ default: return fallback; } diff --git a/src/localization.h b/src/localization.h index b6fd29ad..3160bfc5 100644 --- a/src/localization.h +++ b/src/localization.h @@ -3,8 +3,7 @@ #include enum language { - BS_LANG_ENGLISH, - BS_LANG_SILLY, + BS_LANG_ENGLISH }; struct localized_string { From aa7b53d0f509f6464726a8adeedf53dad80fc682 Mon Sep 17 00:00:00 2001 From: Un1q32 Date: Wed, 3 Jun 2026 03:24:22 -0400 Subject: [PATCH 9/9] message tweaking --- src/desktop/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/desktop/main.c b/src/desktop/main.c index 2cc1025e..80811207 100644 --- a/src/desktop/main.c +++ b/src/desktop/main.c @@ -308,7 +308,7 @@ static void printUsage(const char *argv0) { " --always-log-unknown-functions - %s\n" " --always-log-stubbed-functions - %s\n" " --exit-at-frame - %s\n" - //" --trace-bytecode-after-frame - %s\n" + " --trace-bytecode-after-frame - %s\n" //" --dump-frame - %s\n" //" --dump-frame-json - %s\n" //" --dump-frame-json-file - %s\n" @@ -335,8 +335,8 @@ static void printUsage(const char *argv0) { argv0, getLocStr("Show this message", "help.help"), getLocStr("Specify the filename for screenshots", "help.screenshot"), - getLocStr("Take a screenshot frames after startup", "help.screenshot-at-frame"), - getLocStr("Take a screenshot of all surfaces frames after startup", "help.screenshot-surfaces"), + getLocStr("Take a screenshot at the specified frame", "help.screenshot-at-frame"), + getLocStr("Take a screenshot of all surfaces at the specified frame", "help.screenshot-surfaces"), getLocStr("Specify the filename for surface screenshots", "help.screenshot-surfaces-at-frame"), #ifndef USE_GLFW2 getLocStr("Launch without a window", "help.headless"), @@ -360,7 +360,7 @@ static void printUsage(const char *argv0) { getLocStr("Always log unknown function calls instead of once per script", "help.always-log-unknown-functions"), getLocStr("Always log stubbed function calls instead of once per script", "help.always-log-stubbed-functions"), getLocStr("Exit at the specified frame", "help.exit-at-frame"), - //getLocStr("", "help.trace-bytecode-after-frame"), + getLocStr("Delay stack and opcode tracing until the specified frame", "help.trace-bytecode-after-frame"), //getLocStr("", "help.dump-frame"), //getLocStr("", "help.dump-frame-json"), //getLocStr("", "help.dump-frame-json-file"),