From b8c42f308f4bb4241fa99e25359b873e9b4ce98f Mon Sep 17 00:00:00 2001 From: Agent X <44549182+Agent-11@users.noreply.github.com> Date: Tue, 9 Apr 2024 17:40:52 -0400 Subject: [PATCH] Disallow function that shouldn't be in Lua --- autogen/convert_functions.py | 2 +- autogen/lua_definitions/functions.lua | 5 - docs/lua/functions-3.md | 185 +++++++++++++++++++++++--- docs/lua/functions-4.md | 167 ----------------------- docs/lua/functions.md | 17 ++- src/pc/lua/smlua_functions_autogen.c | 17 --- 6 files changed, 176 insertions(+), 217 deletions(-) diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py index d06f945c..5689b38d 100644 --- a/autogen/convert_functions.py +++ b/autogen/convert_functions.py @@ -88,7 +88,7 @@ override_disallowed_functions = { "src/engine/surface_collision.h": [ " debug_", "f32_find_wall_collision" ], "src/game/mario_actions_airborne.c": [ "^[us]32 act_.*" ], "src/game/mario_actions_automatic.c": [ "^[us]32 act_.*" ], - "src/game/mario_actions_cutscene.c": [ "^[us]32 act_.*", " geo_", "spawn_obj" ], + "src/game/mario_actions_cutscene.c": [ "^[us]32 act_.*", " geo_", "spawn_obj", "print_displaying_credits_entry" ], "src/game/mario_actions_moving.c": [ "^[us]32 act_.*" ], "src/game/mario_actions_object.c": [ "^[us]32 act_.*" ], "src/game/mario_actions_stationary.c": [ "^[us]32 act_.*" ], diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index e51b0237..67a6501c 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -4923,11 +4923,6 @@ function mario_ready_to_speak(m) -- ... end ---- @return nil -function print_displaying_credits_entry() - -- ... -end - --- @param m MarioState --- @param object Object --- @return integer diff --git a/docs/lua/functions-3.md b/docs/lua/functions-3.md index 07dd8c70..6b3f9207 100644 --- a/docs/lua/functions-3.md +++ b/docs/lua/functions-3.md @@ -6159,24 +6159,6 @@
-## [print_displaying_credits_entry](#print_displaying_credits_entry) - -### Lua Example -`print_displaying_credits_entry()` - -### Parameters -- None - -### Returns -- None - -### C Prototype -`void print_displaying_credits_entry(void);` - -[:arrow_up_small:](#) - -
- ## [should_start_or_continue_dialog](#should_start_or_continue_dialog) ### Lua Example @@ -8702,6 +8684,173 @@ [:arrow_up_small:](#) +
+ +--- +# functions from mod_storage.h + +
+ + +## [mod_storage_clear](#mod_storage_clear) + +### Lua Example +`local booleanValue = mod_storage_clear()` + +### Parameters +- None + +### Returns +- `boolean` + +### C Prototype +`bool mod_storage_clear(void);` + +[:arrow_up_small:](#) + +
+ +## [mod_storage_load](#mod_storage_load) + +### Lua Example +`local stringValue = mod_storage_load(key)` + +### Parameters +| Field | Type | +| ----- | ---- | +| key | `string` | + +### Returns +- `string` + +### C Prototype +`const char *mod_storage_load(const char* key);` + +[:arrow_up_small:](#) + +
+ +## [mod_storage_load_bool](#mod_storage_load_bool) + +### Lua Example +`local booleanValue = mod_storage_load_bool(key)` + +### Parameters +| Field | Type | +| ----- | ---- | +| key | `string` | + +### Returns +- `boolean` + +### C Prototype +`bool mod_storage_load_bool(const char* key);` + +[:arrow_up_small:](#) + +
+ +## [mod_storage_load_number](#mod_storage_load_number) + +### Lua Example +`local numberValue = mod_storage_load_number(key)` + +### Parameters +| Field | Type | +| ----- | ---- | +| key | `string` | + +### Returns +- `number` + +### C Prototype +`double mod_storage_load_number(const char* key);` + +[:arrow_up_small:](#) + +
+ +## [mod_storage_remove](#mod_storage_remove) + +### Lua Example +`local booleanValue = mod_storage_remove(key)` + +### Parameters +| Field | Type | +| ----- | ---- | +| key | `string` | + +### Returns +- `boolean` + +### C Prototype +`bool mod_storage_remove(const char* key);` + +[:arrow_up_small:](#) + +
+ +## [mod_storage_save](#mod_storage_save) + +### Lua Example +`local booleanValue = mod_storage_save(key, value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| key | `string` | +| value | `string` | + +### Returns +- `boolean` + +### C Prototype +`bool mod_storage_save(const char* key, const char* value);` + +[:arrow_up_small:](#) + +
+ +## [mod_storage_save_bool](#mod_storage_save_bool) + +### Lua Example +`local booleanValue = mod_storage_save_bool(key, value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| key | `string` | +| value | `boolean` | + +### Returns +- `boolean` + +### C Prototype +`bool mod_storage_save_bool(const char* key, bool value);` + +[:arrow_up_small:](#) + +
+ +## [mod_storage_save_number](#mod_storage_save_number) + +### Lua Example +`local booleanValue = mod_storage_save_number(key, value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| key | `string` | +| value | `number` | + +### Returns +- `boolean` + +### C Prototype +`bool mod_storage_save_number(const char* key, double value);` + +[:arrow_up_small:](#) +
--- diff --git a/docs/lua/functions-4.md b/docs/lua/functions-4.md index 20c7a3a3..f42ac341 100644 --- a/docs/lua/functions-4.md +++ b/docs/lua/functions-4.md @@ -5,173 +5,6 @@ [< prev](functions-3.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | 4 | [5](functions-5.md) | [next >](functions-5.md)] ---- -# functions from mod_storage.h - -
- - -## [mod_storage_clear](#mod_storage_clear) - -### Lua Example -`local booleanValue = mod_storage_clear()` - -### Parameters -- None - -### Returns -- `boolean` - -### C Prototype -`bool mod_storage_clear(void);` - -[:arrow_up_small:](#) - -
- -## [mod_storage_load](#mod_storage_load) - -### Lua Example -`local stringValue = mod_storage_load(key)` - -### Parameters -| Field | Type | -| ----- | ---- | -| key | `string` | - -### Returns -- `string` - -### C Prototype -`const char *mod_storage_load(const char* key);` - -[:arrow_up_small:](#) - -
- -## [mod_storage_load_bool](#mod_storage_load_bool) - -### Lua Example -`local booleanValue = mod_storage_load_bool(key)` - -### Parameters -| Field | Type | -| ----- | ---- | -| key | `string` | - -### Returns -- `boolean` - -### C Prototype -`bool mod_storage_load_bool(const char* key);` - -[:arrow_up_small:](#) - -
- -## [mod_storage_load_number](#mod_storage_load_number) - -### Lua Example -`local numberValue = mod_storage_load_number(key)` - -### Parameters -| Field | Type | -| ----- | ---- | -| key | `string` | - -### Returns -- `number` - -### C Prototype -`double mod_storage_load_number(const char* key);` - -[:arrow_up_small:](#) - -
- -## [mod_storage_remove](#mod_storage_remove) - -### Lua Example -`local booleanValue = mod_storage_remove(key)` - -### Parameters -| Field | Type | -| ----- | ---- | -| key | `string` | - -### Returns -- `boolean` - -### C Prototype -`bool mod_storage_remove(const char* key);` - -[:arrow_up_small:](#) - -
- -## [mod_storage_save](#mod_storage_save) - -### Lua Example -`local booleanValue = mod_storage_save(key, value)` - -### Parameters -| Field | Type | -| ----- | ---- | -| key | `string` | -| value | `string` | - -### Returns -- `boolean` - -### C Prototype -`bool mod_storage_save(const char* key, const char* value);` - -[:arrow_up_small:](#) - -
- -## [mod_storage_save_bool](#mod_storage_save_bool) - -### Lua Example -`local booleanValue = mod_storage_save_bool(key, value)` - -### Parameters -| Field | Type | -| ----- | ---- | -| key | `string` | -| value | `boolean` | - -### Returns -- `boolean` - -### C Prototype -`bool mod_storage_save_bool(const char* key, bool value);` - -[:arrow_up_small:](#) - -
- -## [mod_storage_save_number](#mod_storage_save_number) - -### Lua Example -`local booleanValue = mod_storage_save_number(key, value)` - -### Parameters -| Field | Type | -| ----- | ---- | -| key | `string` | -| value | `number` | - -### Returns -- `boolean` - -### C Prototype -`bool mod_storage_save_number(const char* key, double value);` - -[:arrow_up_small:](#) - -
- --- # functions from network_player.h diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 118c2c0a..6ec3375a 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -977,7 +977,6 @@ - [launch_mario_until_land](functions-3.md#launch_mario_until_land) - [mario_execute_cutscene_action](functions-3.md#mario_execute_cutscene_action) - [mario_ready_to_speak](functions-3.md#mario_ready_to_speak) - - [print_displaying_credits_entry](functions-3.md#print_displaying_credits_entry) - [should_start_or_continue_dialog](functions-3.md#should_start_or_continue_dialog) - [stuck_in_ground_handler](functions-3.md#stuck_in_ground_handler) @@ -1131,14 +1130,14 @@
- mod_storage.h - - [mod_storage_clear](functions-4.md#mod_storage_clear) - - [mod_storage_load](functions-4.md#mod_storage_load) - - [mod_storage_load_bool](functions-4.md#mod_storage_load_bool) - - [mod_storage_load_number](functions-4.md#mod_storage_load_number) - - [mod_storage_remove](functions-4.md#mod_storage_remove) - - [mod_storage_save](functions-4.md#mod_storage_save) - - [mod_storage_save_bool](functions-4.md#mod_storage_save_bool) - - [mod_storage_save_number](functions-4.md#mod_storage_save_number) + - [mod_storage_clear](functions-3.md#mod_storage_clear) + - [mod_storage_load](functions-3.md#mod_storage_load) + - [mod_storage_load_bool](functions-3.md#mod_storage_load_bool) + - [mod_storage_load_number](functions-3.md#mod_storage_load_number) + - [mod_storage_remove](functions-3.md#mod_storage_remove) + - [mod_storage_save](functions-3.md#mod_storage_save) + - [mod_storage_save_bool](functions-3.md#mod_storage_save_bool) + - [mod_storage_save_number](functions-3.md#mod_storage_save_number)
diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 40cf0d2f..637713a4 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -15896,22 +15896,6 @@ int smlua_func_mario_ready_to_speak(lua_State* L) { return 1; } -int smlua_func_print_displaying_credits_entry(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", "print_displaying_credits_entry", 0, top); - return 0; - } - - - extern void print_displaying_credits_entry(void); - print_displaying_credits_entry(); - - return 1; -} - int smlua_func_should_start_or_continue_dialog(lua_State* L) { if (L == NULL) { return 0; } @@ -32343,7 +32327,6 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "launch_mario_until_land", smlua_func_launch_mario_until_land); smlua_bind_function(L, "mario_execute_cutscene_action", smlua_func_mario_execute_cutscene_action); smlua_bind_function(L, "mario_ready_to_speak", smlua_func_mario_ready_to_speak); - smlua_bind_function(L, "print_displaying_credits_entry", smlua_func_print_displaying_credits_entry); smlua_bind_function(L, "should_start_or_continue_dialog", smlua_func_should_start_or_continue_dialog); smlua_bind_function(L, "stuck_in_ground_handler", smlua_func_stuck_in_ground_handler);