From fefb222198e86e2b45c086756810085f0246646d Mon Sep 17 00:00:00 2001 From: Agent X <44549182+AgentXLP@users.noreply.github.com> Date: Fri, 10 Jan 2025 19:04:55 -0500 Subject: [PATCH] Re-expose function --- autogen/convert_functions.py | 2 +- autogen/lua_definitions/functions.lua | 5 +++++ docs/lua/functions-6.md | 21 +++++++++++++++++++++ docs/lua/functions.md | 1 + src/pc/lua/smlua_functions_autogen.c | 16 ++++++++++++++++ src/pc/lua/utils/smlua_text_utils.h | 1 + 6 files changed, 45 insertions(+), 1 deletion(-) diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py index a8c738930..c7cd44689 100644 --- a/autogen/convert_functions.py +++ b/autogen/convert_functions.py @@ -121,7 +121,7 @@ override_disallowed_functions = { "src/pc/lua/utils/smlua_audio_utils.h": [ "smlua_audio_utils_override", "audio_custom_shutdown", "smlua_audio_custom_deinit", "audio_sample_destroy_pending_copies", "audio_custom_update_volume" ], "src/pc/djui/djui_hud_utils.h": [ "djui_hud_render_texture", "djui_hud_render_texture_raw", "djui_hud_render_texture_tile", "djui_hud_render_texture_tile_raw" ], "src/pc/lua/utils/smlua_level_utils.h": [ "smlua_level_util_reset" ], - "src/pc/lua/utils/smlua_text_utils.h": [ "smlua_text_utils_init", "smlua_text_utils_shutdown", "smlua_text_utils_reset_all" ], + "src/pc/lua/utils/smlua_text_utils.h": [ "smlua_text_utils_init", "smlua_text_utils_shutdown" ], "src/pc/lua/utils/smlua_anim_utils.h": [ "smlua_anim_util_reset", "smlua_anim_util_register_animation" ], "src/pc/network/lag_compensation.h": [ "lag_compensation_clear" ], "src/game/first_person_cam.h": [ "first_person_update" ], diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index 8819eb365..218c25c4d 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -10376,6 +10376,11 @@ function smlua_text_utils_get_language() -- ... end +--- Resets every modified dialog back to vanilla +function smlua_text_utils_reset_all() + -- ... +end + --- @param courseNum integer --- @param courseName string --- Replaces the secret star course name of `courseNum` with `courseName` diff --git a/docs/lua/functions-6.md b/docs/lua/functions-6.md index ffb769811..f1fb51bb5 100644 --- a/docs/lua/functions-6.md +++ b/docs/lua/functions-6.md @@ -3242,6 +3242,27 @@ Gets the current language
+## [smlua_text_utils_reset_all](#smlua_text_utils_reset_all) + +### Description +Resets every modified dialog back to vanilla + +### Lua Example +`smlua_text_utils_reset_all()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void smlua_text_utils_reset_all(void);` + +[:arrow_up_small:](#) + +
+ ## [smlua_text_utils_secret_star_replace](#smlua_text_utils_secret_star_replace) ### Description diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 66daa9e4c..2a5fef61b 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -1890,6 +1890,7 @@ - [smlua_text_utils_dialog_replace](functions-6.md#smlua_text_utils_dialog_replace) - [smlua_text_utils_extra_text_replace](functions-6.md#smlua_text_utils_extra_text_replace) - [smlua_text_utils_get_language](functions-6.md#smlua_text_utils_get_language) + - [smlua_text_utils_reset_all](functions-6.md#smlua_text_utils_reset_all) - [smlua_text_utils_secret_star_replace](functions-6.md#smlua_text_utils_secret_star_replace)
diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 3bf19c24d..bae6512b1 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -31271,6 +31271,21 @@ int smlua_func_smlua_text_utils_get_language(UNUSED lua_State* L) { return 1; } +int smlua_func_smlua_text_utils_reset_all(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_reset_all", 0, top); + return 0; + } + + + smlua_text_utils_reset_all(); + + return 1; +} + int smlua_func_smlua_text_utils_secret_star_replace(lua_State* L) { if (L == NULL) { return 0; } @@ -33785,6 +33800,7 @@ void smlua_bind_functions_autogen(void) { 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); // sound_init.h diff --git a/src/pc/lua/utils/smlua_text_utils.h b/src/pc/lua/utils/smlua_text_utils.h index dc80a4e4f..b2a61e0f1 100644 --- a/src/pc/lua/utils/smlua_text_utils.h +++ b/src/pc/lua/utils/smlua_text_utils.h @@ -24,6 +24,7 @@ extern struct CourseName *gReplacedActNameTable[]; void smlua_text_utils_init(void); void smlua_text_utils_shutdown(void); +/* |description|Resets every modified dialog back to vanilla|descriptionEnd|*/ void smlua_text_utils_reset_all(void); /* |description|Replaces `dialogId` with a custom one|descriptionEnd| */ void smlua_text_utils_dialog_replace(enum DialogId dialogId, u32 unused, s8 linesPerBox, s16 leftOffset, s16 width, const char* str);