Add save_file_erase because it's already possible at this point

This commit is contained in:
Agent X 2024-06-13 16:57:42 -04:00
parent 653d7a3c1c
commit 7026a2862f
5 changed files with 45 additions and 1 deletions

View file

@ -70,7 +70,7 @@ override_allowed_functions = {
"src/audio/external.h": [ " play_", "fade", "current_background", "stop_", "sound_banks", "drop_queued_background_music", "sound_get_level_intensity" ],
"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", "save_file_reload", "save_file_erase_current_backup_save", "save_file_set_star_flags", "save_file_is_cannon_unlocked", "touch_coin_score_age", "save_file_set_course_coin_score", "save_file_do_save", "save_file_remove_star_flags" ],
"src/game/save_file.h": [ "save_file_get_", "save_file_set_flags", "save_file_clear_flags", "save_file_reload", "save_file_erase_current_backup_save", "save_file_set_star_flags", "save_file_is_cannon_unlocked", "touch_coin_score_age", "save_file_set_course_coin_score", "save_file_do_save", "save_file_remove_star_flags", "save_file_erase" ],
"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.*" ],

View file

@ -7357,6 +7357,11 @@ function save_file_do_save(fileIndex, forceSave)
-- ...
end
--- @param fileIndex integer
function save_file_erase(fileIndex)
-- ...
end
function save_file_erase_current_backup_save()
-- ...
end

View file

@ -8068,6 +8068,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_erase_current_backup_save](#save_file_erase_current_backup_save)
### Lua Example

View file

@ -1541,6 +1541,7 @@
- save_file.h
- [save_file_clear_flags](functions-4.md#save_file_clear_flags)
- [save_file_do_save](functions-4.md#save_file_do_save)
- [save_file_erase](functions-4.md#save_file_erase)
- [save_file_erase_current_backup_save](functions-4.md#save_file_erase_current_backup_save)
- [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)

View file

@ -27592,6 +27592,23 @@ int smlua_func_save_file_do_save(lua_State* L) {
return 1;
}
int smlua_func_save_file_erase(lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 1) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "save_file_erase", 1, top);
return 0;
}
s32 fileIndex = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "save_file_erase"); return 0; }
save_file_erase(fileIndex);
return 1;
}
int smlua_func_save_file_erase_current_backup_save(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
@ -34078,6 +34095,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_do_save", smlua_func_save_file_do_save);
smlua_bind_function(L, "save_file_erase", smlua_func_save_file_erase);
smlua_bind_function(L, "save_file_erase_current_backup_save", smlua_func_save_file_erase_current_backup_save);
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);