From 912556bb9485fdc6edb8d3f9e5386a94ad73f700 Mon Sep 17 00:00:00 2001 From: PeachyPeachSM64 <72323920+PeachyPeachSM64@users.noreply.github.com> Date: Tue, 29 Jul 2025 15:01:56 +0200 Subject: [PATCH] autogen --- autogen/lua_definitions/functions.lua | 13 ++++++++ docs/lua/functions-3.md | 43 +++++++++++++++++++++++++++ docs/lua/functions.md | 2 ++ src/pc/lua/smlua_constants_autogen.c | 15 +++++----- src/pc/lua/smlua_functions_autogen.c | 42 ++++++++++++++++++++++++++ 5 files changed, 108 insertions(+), 7 deletions(-) diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index 937a787c2..e40b88fc4 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -4876,6 +4876,19 @@ function lag_compensation_get_local_state_index() -- ... end +--- @param str64 Pointer_integer +--- @param strAscii string +--- @param menu boolean +function convert_string_ascii_to_sm64(str64, strAscii, menu) + -- ... +end + +--- @param strAscii Pointer_integer +--- @param str64 Pointer_integer +function convert_string_sm64_to_ascii(strAscii, str64) + -- ... +end + --- @param courseNum integer --- @param levelNum integer --- @param areaIndex integer diff --git a/docs/lua/functions-3.md b/docs/lua/functions-3.md index 1839566f6..a1ea838c5 100644 --- a/docs/lua/functions-3.md +++ b/docs/lua/functions-3.md @@ -6253,6 +6253,49 @@ Gets the local Mario's state index
+## [convert_string_ascii_to_sm64](#convert_string_ascii_to_sm64) + +### Lua Example +`convert_string_ascii_to_sm64(str64, strAscii, menu)` + +### Parameters +| Field | Type | +| ----- | ---- | +| str64 | `Pointer` <`integer`> | +| strAscii | `string` | +| menu | `boolean` | + +### Returns +- None + +### C Prototype +`void convert_string_ascii_to_sm64(u8 *str64, const char *strAscii, bool menu);` + +[:arrow_up_small:](#) + +
+ +## [convert_string_sm64_to_ascii](#convert_string_sm64_to_ascii) + +### Lua Example +`convert_string_sm64_to_ascii(strAscii, str64)` + +### Parameters +| Field | Type | +| ----- | ---- | +| strAscii | `Pointer` <`integer`> | +| str64 | `Pointer` <`integer`> | + +### Returns +- None + +### C Prototype +`void convert_string_sm64_to_ascii(char *strAscii, const u8 *str64);` + +[:arrow_up_small:](#) + +
+ ## [get_level_name_ascii](#get_level_name_ascii) ### Description diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 8656b5289..3ab7c2ae7 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -935,6 +935,8 @@
- level_info.h + - [convert_string_ascii_to_sm64](functions-3.md#convert_string_ascii_to_sm64) + - [convert_string_sm64_to_ascii](functions-3.md#convert_string_sm64_to_ascii) - [get_level_name_ascii](functions-3.md#get_level_name_ascii) - [get_level_name_sm64](functions-3.md#get_level_name_sm64) - [get_level_name](functions-3.md#get_level_name) diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index e594393fe..a318e3b3f 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -3499,13 +3499,14 @@ char gSmluaConstants[] = "" "HUD_DISPLAY_FLAGS_CAMERA=0x0080\n" "HUD_DISPLAY_FLAGS_POWER=0x0100\n" "HUD_DISPLAY_FLAGS_EMPHASIZE_POWER=0x8000\n" -"ACT_SELECT_HUD_ALL=1 << 0\n" -"ACT_SELECT_HUD_SCORE=1 << 1\n" -"ACT_SELECT_HUD_LEVEL_NAME=1 << 2\n" -"ACT_SELECT_HUD_COURSE_NUM=1 << 3\n" -"ACT_SELECT_HUD_ACT_NAME=1 << 4\n" -"ACT_SELECT_HUD_STAR_NUM=1 << 5\n" -"ACT_SELECT_HUD_PLAYERS_IN_LEVEL=1 << 6\n" +"ACT_SELECT_HUD_SCORE=1 << 0\n" +"ACT_SELECT_HUD_LEVEL_NAME=1 << 1\n" +"ACT_SELECT_HUD_COURSE_NUM=1 << 2\n" +"ACT_SELECT_HUD_ACT_NAME=1 << 3\n" +"ACT_SELECT_HUD_STAR_NUM=1 << 4\n" +"ACT_SELECT_HUD_PLAYERS_IN_LEVEL=1 << 5\n" +"ACT_SELECT_HUD_NONE=0\n" +"ACT_SELECT_HUD_ALL=ACT_SELECT_HUD_SCORE | ACT_SELECT_HUD_LEVEL_NAME | ACT_SELECT_HUD_COURSE_NUM | ACT_SELECT_HUD_ACT_NAME |ACT_SELECT_HUD_STAR_NUM | ACT_SELECT_HUD_PLAYERS_IN_LEVEL\n" "E_MODEL_NONE=0\n" "E_MODEL_MARIO=1\n" "E_MODEL_SMOKE=2\n" diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 885815bc9..069586574 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -15155,6 +15155,46 @@ int smlua_func_lag_compensation_get_local_state_index(UNUSED lua_State* L) { // level_info.h // ////////////////// +int smlua_func_convert_string_ascii_to_sm64(lua_State* L) { + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "convert_string_ascii_to_sm64", 3, top); + return 0; + } + + u8 * str64 = (u8 *)smlua_to_cpointer(L, 1, LVT_U8_P); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "convert_string_ascii_to_sm64"); return 0; } + const char* strAscii = smlua_to_string(L, 2); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "convert_string_ascii_to_sm64"); return 0; } + bool menu = smlua_to_boolean(L, 3); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "convert_string_ascii_to_sm64"); return 0; } + + convert_string_ascii_to_sm64(str64, strAscii, menu); + + return 1; +} + +int smlua_func_convert_string_sm64_to_ascii(lua_State* L) { + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "convert_string_sm64_to_ascii", 2, top); + return 0; + } + + char * strAscii = (char *)smlua_to_cpointer(L, 1, LVT_STRING_P); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "convert_string_sm64_to_ascii"); return 0; } + u8 * str64 = (u8 *)smlua_to_cpointer(L, 2, LVT_U8_P); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "convert_string_sm64_to_ascii"); return 0; } + + convert_string_sm64_to_ascii(strAscii, str64); + + return 1; +} + int smlua_func_get_level_name_ascii(lua_State* L) { if (L == NULL) { return 0; } @@ -37264,6 +37304,8 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "lag_compensation_get_local_state_index", smlua_func_lag_compensation_get_local_state_index); // level_info.h + smlua_bind_function(L, "convert_string_ascii_to_sm64", smlua_func_convert_string_ascii_to_sm64); + smlua_bind_function(L, "convert_string_sm64_to_ascii", smlua_func_convert_string_sm64_to_ascii); smlua_bind_function(L, "get_level_name_ascii", smlua_func_get_level_name_ascii); smlua_bind_function(L, "get_level_name_sm64", smlua_func_get_level_name_sm64); smlua_bind_function(L, "get_level_name", smlua_func_get_level_name);