From 8c5673d9b8dcb87448902183006f791d3cc0f93b Mon Sep 17 00:00:00 2001 From: MelonSpeedruns Date: Fri, 17 Apr 2026 13:12:20 -0400 Subject: [PATCH] autosave when loading scene --- src/d/d_s_play.cpp | 16 ++++++++++++++++ src/f_ap/f_ap_game.cpp | 3 --- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/d/d_s_play.cpp b/src/d/d_s_play.cpp index 3f3cd073b9..9af875b2f5 100644 --- a/src/d/d_s_play.cpp +++ b/src/d/d_s_play.cpp @@ -700,6 +700,10 @@ static u8 lbl_8074CAE4; static u32 l_sceneChangeStartTick; #endif +#if TARGET_PC +static BOOL shouldAutoSave; +#endif + static int dScnPly_Execute(dScnPly_c* i_this) { #if DEBUG fapGm_HIO_c::startCpuTimer(); @@ -742,6 +746,13 @@ static int dScnPly_Execute(dScnPly_c* i_this) { } } + #if TARGET_PC + if (!fopOvlpM_IsPeek() && !dComIfG_resetToOpening(i_this) && !dComIfGp_isEnableNextStage() && shouldAutoSave == FALSE) { + triggerAutoSave(); + shouldAutoSave = TRUE; + } + #endif + dKy_itudemo_se(); #if DEBUG @@ -1598,6 +1609,11 @@ static int dScnPly_Create(scene_class* i_this) { dScnPly_c* a_this = (dScnPly_c*)i_this; int phase_state = dComLbG_PhaseHandler(&a_this->field_0x1c4, l_method, a_this); + + #if TARGET_PC + shouldAutoSave = FALSE; + #endif + return phase_state; } diff --git a/src/f_ap/f_ap_game.cpp b/src/f_ap/f_ap_game.cpp index 9aa1763b8a..3dc192b665 100644 --- a/src/f_ap/f_ap_game.cpp +++ b/src/f_ap/f_ap_game.cpp @@ -766,9 +766,6 @@ void updateAutoSave() { } void writeAutoSave() { - int stageNo = dStage_stagInfo_GetSaveTbl(dComIfGp_getStageStagInfo()); - - dComIfGs_putSave(stageNo); dComIfGs_setMemoryToCard(mSaveBuffer, dComIfGs_getDataNum()); mDoMemCdRWm_SetCheckSumGameData(mSaveBuffer, dComIfGs_getDataNum());