From 6fc711e440063c935f7b67d16e1061e7bb2135e9 Mon Sep 17 00:00:00 2001 From: MysterD Date: Sat, 1 Apr 2023 00:04:45 -0700 Subject: [PATCH] Added smlua_text_utils_get_language() --- autogen/convert_functions.py | 2 +- autogen/lua_definitions/constants.lua | 2 +- autogen/lua_definitions/functions.lua | 5 +++++ docs/lua/functions-5.md | 18 ++++++++++++++++++ docs/lua/functions.md | 1 + src/pc/lua/smlua_constants_autogen.c | 2 +- src/pc/lua/smlua_functions_autogen.c | 16 ++++++++++++++++ src/pc/lua/utils/smlua_text_utils.c | 4 ++++ src/pc/lua/utils/smlua_text_utils.h | 1 + 9 files changed, 48 insertions(+), 3 deletions(-) diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py index e7d51fd0..ed277910 100644 --- a/autogen/convert_functions.py +++ b/autogen/convert_functions.py @@ -91,7 +91,7 @@ override_disallowed_functions = { "src/game/interaction.h": [ "process_interactions", "_handle_" ], "src/game/sound_init.h": [ "_loop_", "thread4_", "set_sound_mode" ], "src/pc/network/network_utils.h": [ "network_get_player_text_color[^_]" ], - "src/pc/network/network_player.h": [ "_init", "_connected[^_]", "_shutdown", "_disconnected", "_update" ], + "src/pc/network/network_player.h": [ "_init", "_connected[^_]", "_shutdown", "_disconnected", "_update", "construct_player_popup" ], "src/game/object_helpers.c": [ "spawn_obj", "^bhv_", "abs[fi]", "^bit_shift", "_debug$", "^stub_", "_set_model" ], "src/game/obj_behaviors.c": [ "debug_" ], "src/game/obj_behaviors_2.c": [ "wiggler_jumped_on_attack_handler", "huge_goomba_weakly_attacked" ], diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index 95b32932..469d5893 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -4741,7 +4741,7 @@ PLAYER_INTERACTIONS_PVP = 2 MAX_RX_SEQ_IDS = 64 --- @type integer -NETWORK_PLAYER_PING_TIMEOUT = 3 +NETWORK_PLAYER_PING_TIMEOUT = 1 --- @type integer NETWORK_PLAYER_TIMEOUT = 10 diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index 33280fdb..1465c5c9 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -8768,6 +8768,11 @@ function smlua_text_utils_extra_text_replace(index, text) -- ... end +--- @return string +function smlua_text_utils_get_language() + -- ... +end + --- @return nil function smlua_text_utils_reset_all() -- ... diff --git a/docs/lua/functions-5.md b/docs/lua/functions-5.md index f18e56ea..30a9790b 100644 --- a/docs/lua/functions-5.md +++ b/docs/lua/functions-5.md @@ -788,6 +788,24 @@
+## [smlua_text_utils_get_language](#smlua_text_utils_get_language) + +### Lua Example +`local stringValue = smlua_text_utils_get_language()` + +### Parameters +- None + +### Returns +- `string` + +### C Prototype +`char* smlua_text_utils_get_language(void);` + +[:arrow_up_small:](#) + +
+ ## [smlua_text_utils_reset_all](#smlua_text_utils_reset_all) ### Lua Example diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 9c2891ed..13868490 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -1622,6 +1622,7 @@ - [smlua_text_utils_course_acts_replace](functions-5.md#smlua_text_utils_course_acts_replace) - [smlua_text_utils_dialog_replace](functions-5.md#smlua_text_utils_dialog_replace) - [smlua_text_utils_extra_text_replace](functions-5.md#smlua_text_utils_extra_text_replace) + - [smlua_text_utils_get_language](functions-5.md#smlua_text_utils_get_language) - [smlua_text_utils_reset_all](functions-5.md#smlua_text_utils_reset_all) - [smlua_text_utils_secret_star_replace](functions-5.md#smlua_text_utils_secret_star_replace) diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index 8de1fdc0..f2dd71f4 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -1766,7 +1766,7 @@ char gSmluaConstants[] = "" "UNKNOWN_GLOBAL_INDEX = (-1)\n" "UNKNOWN_NETWORK_INDEX = (-1)\n" "NETWORK_PLAYER_TIMEOUT = 10\n" -"NETWORK_PLAYER_PING_TIMEOUT = 3\n" +"NETWORK_PLAYER_PING_TIMEOUT = 1\n" "MAX_RX_SEQ_IDS = 64\n" "USE_REAL_PALETTE_VAR = 0xFF\n" "NPT_UNKNOWN = 0\n" diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 4558cf29..97f445e8 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -28373,6 +28373,21 @@ int smlua_func_smlua_text_utils_extra_text_replace(lua_State* L) { return 1; } +int smlua_func_smlua_text_utils_get_language(UNUSED lua_State* L) { + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "smlua_text_utils_get_language", 0, top); + return 0; + } + + + lua_pushstring(L, smlua_text_utils_get_language()); + + return 1; +} + int smlua_func_smlua_text_utils_reset_all(UNUSED lua_State* L) { if (L == NULL) { return 0; } @@ -30643,6 +30658,7 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "smlua_text_utils_course_acts_replace", smlua_func_smlua_text_utils_course_acts_replace); smlua_bind_function(L, "smlua_text_utils_dialog_replace", smlua_func_smlua_text_utils_dialog_replace); smlua_bind_function(L, "smlua_text_utils_extra_text_replace", smlua_func_smlua_text_utils_extra_text_replace); + smlua_bind_function(L, "smlua_text_utils_get_language", smlua_func_smlua_text_utils_get_language); smlua_bind_function(L, "smlua_text_utils_reset_all", smlua_func_smlua_text_utils_reset_all); smlua_bind_function(L, "smlua_text_utils_secret_star_replace", smlua_func_smlua_text_utils_secret_star_replace); diff --git a/src/pc/lua/utils/smlua_text_utils.c b/src/pc/lua/utils/smlua_text_utils.c index e6ec49c3..a95e3c7e 100644 --- a/src/pc/lua/utils/smlua_text_utils.c +++ b/src/pc/lua/utils/smlua_text_utils.c @@ -118,4 +118,8 @@ void smlua_text_utils_extra_text_replace(s16 index, const char* text) { seg2_act_name_table[index] = smlua_text_utils_convert(text); sReplacedActName[index] = true; +} + +char* smlua_text_utils_get_language(void) { + return configLanguage; } \ No newline at end of file diff --git a/src/pc/lua/utils/smlua_text_utils.h b/src/pc/lua/utils/smlua_text_utils.h index a50a41bb..08f7beb7 100644 --- a/src/pc/lua/utils/smlua_text_utils.h +++ b/src/pc/lua/utils/smlua_text_utils.h @@ -10,5 +10,6 @@ void smlua_text_utils_course_acts_replace(s16 courseNum, const char* courseName, void smlua_text_utils_secret_star_replace(s16 courseNum, const char* courseName); void smlua_text_utils_castle_secret_stars_replace(const char* name); void smlua_text_utils_extra_text_replace(s16 index, const char* text); +char* smlua_text_utils_get_language(void); #endif