From e3ad41792ad8a83f522f67b3fc7488fe5db6fa2b Mon Sep 17 00:00:00 2001 From: MelonSpeedruns Date: Sat, 2 May 2026 10:42:20 -0400 Subject: [PATCH] fix respawn stageinfo when autosaving --- src/d/d_s_play.cpp | 8 ++++---- src/dusk/autosave.cpp | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/d/d_s_play.cpp b/src/d/d_s_play.cpp index 1bc02029ec..f0e2330a15 100644 --- a/src/d/d_s_play.cpp +++ b/src/d/d_s_play.cpp @@ -702,7 +702,7 @@ static u32 l_sceneChangeStartTick; #endif #if TARGET_PC -static BOOL shouldAutoSave; +static BOOL autoSaved; #endif static int dScnPly_Execute(dScnPly_c* i_this) { @@ -749,10 +749,10 @@ static int dScnPly_Execute(dScnPly_c* i_this) { #if TARGET_PC if (!dComIfGp_event_runCheck() && !fopOvlpM_IsPeek() && !dComIfG_resetToOpening(i_this) && - !dComIfGp_isEnableNextStage() && shouldAutoSave == FALSE) + !dComIfGp_isEnableNextStage() && autoSaved == FALSE) { triggerAutoSave(); - shouldAutoSave = TRUE; + autoSaved = TRUE; } #endif @@ -1609,7 +1609,7 @@ static int dScnPly_Create(scene_class* i_this) { int phase_state = dComLbG_PhaseHandler(&a_this->field_0x1c4, l_method, a_this); #if TARGET_PC - shouldAutoSave = FALSE; + autoSaved = FALSE; #endif return phase_state; diff --git a/src/dusk/autosave.cpp b/src/dusk/autosave.cpp index 23cef619a0..f9b76f4c67 100644 --- a/src/dusk/autosave.cpp +++ b/src/dusk/autosave.cpp @@ -14,7 +14,7 @@ void noAutoSave() {} void triggerAutoSave() { if (dusk::getSettings().game.autoSave && mAutoSaveProc == 0 && - strcmp(dComIfGp_getStartStageName(), "F_SP102") != 0 && dComIfGp_getStartStageLayer() != 0) + strcmp(dComIfGp_getStartStageName(), "F_SP102") != 0) { mAutoSaveProc = 1; } @@ -25,6 +25,9 @@ void updateAutoSave() { } void writeAutoSave() { + int stageNo = dStage_stagInfo_GetSaveTbl(dComIfGp_getStageStagInfo()); + + dComIfGs_putSave(stageNo); dComIfGs_setMemoryToCard(mSaveBuffer, dComIfGs_getDataNum()); mDoMemCdRWm_SetCheckSumGameData(mSaveBuffer, dComIfGs_getDataNum());