From 774e61e74a17b295ff62d8a0c088aec4566b8f2d Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Fri, 24 Jan 2025 14:42:16 -0500 Subject: [PATCH] Add Script Cmd for Forcing Save Game (#6090) Co-authored-by: ghoulslash --- asm/macros/event.inc | 5 +++++ src/start_menu.c | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/asm/macros/event.inc b/asm/macros/event.inc index b3c7ce050a..efc30cabae 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -2471,6 +2471,11 @@ callnative Script_SetDifficulty, requests_effects=1 .byte \difficulty .endm + + .macro forcesave + callnative Script_ForceSaveGame + waitstate + .endm @ Makes the trainer unable to see the player if executed. @ This is a no-op if the player interacts with the trainer. diff --git a/src/start_menu.c b/src/start_menu.c index fcd8f7b42b..a49b7c6d8a 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -1497,3 +1497,11 @@ static bool8 StartMenuDexNavCallback(void) CreateTask(Task_OpenDexNavFromStartMenu, 0); return TRUE; } + +void Script_ForceSaveGame(struct ScriptContext *ctx) +{ + SaveGame(); + ShowSaveInfoWindow(); + gMenuCallback = SaveCallback; + sSaveDialogCallback = SaveSavingMessageCallback; +}