Exposed save_file_erase and save_file_reload to lua (#137)

This commit is contained in:
Emerald Lockdown 2022-08-07 22:52:51 -05:00 committed by GitHub
parent 1ac7032606
commit 670acc638e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 75 additions and 2 deletions

View File

@ -58,7 +58,7 @@ override_allowed_functions = {
"src/audio/external.h": [ " play_", "fade", "current_background" ],
"src/game/rumble_init.c": [ "queue_rumble_", "reset_rumble_timers" ],
"src/pc/djui/djui_popup.h" : [ "create" ],
"src/game/save_file.h": [ "save_file_get_", "save_file_set_flags", "save_file_clear_flags" ],
"src/game/save_file.h": [ "save_file_get_", "save_file_set_flags", "save_file_clear_flags", "save_file_erase", "save_file_reload" ],
"src/pc/lua/utils/smlua_model_utils.h": [ "smlua_model_util_get_id" ],
"src/game/object_list_processor.h": [ "set_object_respawn_info_bits" ],
"src/game/mario_misc.h": [ "bhv_toad.*", "bhv_unlock_door.*" ],
@ -878,4 +878,4 @@ def main():
print('Total functions: ' + str(total_functions))
if __name__ == '__main__':
main()
main()

View File

@ -7203,6 +7203,12 @@ function save_file_clear_flags(flags)
-- ...
end
--- @param fileIndex integer
--- @return nil
function save_file_erase(fileIndex)
-- ...
end
--- @param capPos Vec3s
--- @return integer
function save_file_get_cap_pos(capPos)
@ -7254,6 +7260,11 @@ function save_file_get_total_star_count(fileIndex, minCourse, maxCourse)
-- ...
end
--- @return nil
function save_file_reload()
-- ...
end
--- @param flags integer
--- @return nil
function save_file_set_flags(flags)

View File

@ -5364,6 +5364,26 @@
<br />
## [save_file_erase](#save_file_erase)
### Lua Example
`save_file_erase(fileIndex)`
### Parameters
| Field | Type |
| ----- | ---- |
| fileIndex | `integer` |
### Returns
- None
### C Prototype
`void save_file_erase(s32 fileIndex);`
[:arrow_up_small:](#)
<br />
## [save_file_get_cap_pos](#save_file_get_cap_pos)
### Lua Example
@ -5525,6 +5545,24 @@
<br />
## [save_file_reload](#save_file_reload)
### Lua Example
`save_file_reload()`
### Parameters
- None
### Returns
- None
### C Prototype
`void save_file_reload(void);`
[:arrow_up_small:](#)
<br />
## [save_file_set_flags](#save_file_set_flags)
### Lua Example

View File

@ -1339,6 +1339,7 @@
- save_file.h
- [save_file_clear_flags](functions-4.md#save_file_clear_flags)
- [save_file_erase](functions-4.md#save_file_erase)
- [save_file_get_cap_pos](functions-4.md#save_file_get_cap_pos)
- [save_file_get_course_coin_score](functions-4.md#save_file_get_course_coin_score)
- [save_file_get_course_star_count](functions-4.md#save_file_get_course_star_count)
@ -1347,6 +1348,7 @@
- [save_file_get_sound_mode](functions-4.md#save_file_get_sound_mode)
- [save_file_get_star_flags](functions-4.md#save_file_get_star_flags)
- [save_file_get_total_star_count](functions-4.md#save_file_get_total_star_count)
- [save_file_reload](functions-4.md#save_file_reload)
- [save_file_set_flags](functions-4.md#save_file_set_flags)
<br />

View File

@ -15992,6 +15992,17 @@ int smlua_func_save_file_clear_flags(lua_State* L) {
return 1;
}
int smlua_func_save_file_erase(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
s32 fileIndex = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1"); return 0; }
save_file_erase(fileIndex);
return 1;
}
int smlua_func_save_file_get_cap_pos(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
@ -16094,6 +16105,15 @@ int smlua_func_save_file_get_total_star_count(lua_State* L) {
return 1;
}
int smlua_func_save_file_reload(UNUSED lua_State* L) {
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
save_file_reload();
return 1;
}
int smlua_func_save_file_set_flags(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
@ -19256,6 +19276,7 @@ void smlua_bind_functions_autogen(void) {
// save_file.h
smlua_bind_function(L, "save_file_clear_flags", smlua_func_save_file_clear_flags);
smlua_bind_function(L, "save_file_erase", smlua_func_save_file_erase);
smlua_bind_function(L, "save_file_get_cap_pos", smlua_func_save_file_get_cap_pos);
smlua_bind_function(L, "save_file_get_course_coin_score", smlua_func_save_file_get_course_coin_score);
smlua_bind_function(L, "save_file_get_course_star_count", smlua_func_save_file_get_course_star_count);
@ -19264,6 +19285,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "save_file_get_sound_mode", smlua_func_save_file_get_sound_mode);
smlua_bind_function(L, "save_file_get_star_flags", smlua_func_save_file_get_star_flags);
smlua_bind_function(L, "save_file_get_total_star_count", smlua_func_save_file_get_total_star_count);
smlua_bind_function(L, "save_file_reload", smlua_func_save_file_reload);
smlua_bind_function(L, "save_file_set_flags", smlua_func_save_file_set_flags);
// smlua_audio_utils.h