diff --git a/include/dusk/autosave.h b/include/dusk/autosave.h index 248924fcb8..6670a66830 100644 --- a/include/dusk/autosave.h +++ b/include/dusk/autosave.h @@ -13,5 +13,6 @@ void enterAutoSave(); void autoSaving(); void waitingForWrite(); void endAutoSave(); +void toggleAutoSave(bool enabled); #endif \ No newline at end of file diff --git a/src/d/d_bright_check.cpp b/src/d/d_bright_check.cpp index 42ed7845cb..fc6924c9e7 100644 --- a/src/d/d_bright_check.cpp +++ b/src/d/d_bright_check.cpp @@ -13,6 +13,7 @@ #include "dusk/imgui/ImGuiConsole.hpp" #include "dusk/speedrun.h" #include "m_Do/m_Do_controller_pad.h" +#include dBrightCheck_c::dBrightCheck_c(JKRArchive* i_archive) { mArchive = i_archive; @@ -151,6 +152,8 @@ void dBrightCheck_c::modeMove() { dusk::m_speedrunInfo.startRun(); } } + + toggleAutoSave(true); #endif mCompleteCheck = true; mMode = MODE_WAIT_e; diff --git a/src/d/d_s_name.cpp b/src/d/d_s_name.cpp index cfeeb722d6..c3ae12e992 100644 --- a/src/d/d_s_name.cpp +++ b/src/d/d_s_name.cpp @@ -20,6 +20,7 @@ #include "m_Do/m_Do_machine.h" #include "m_Do/m_Do_main.h" #include "m_Do/m_Do_mtx.h" +#include #if TARGET_PC #define SHOW_TV_SETTINGS_SCREEN (this->mShowTvSettingsScreen) @@ -423,6 +424,8 @@ void dScnName_c::changeGameScene() { dusk::m_speedrunInfo.startRun(); } } + + toggleAutoSave(true); #endif } } diff --git a/src/d/d_s_play.cpp b/src/d/d_s_play.cpp index f7ebf6a20d..f2e7d5d926 100644 --- a/src/d/d_s_play.cpp +++ b/src/d/d_s_play.cpp @@ -1042,6 +1042,10 @@ static BOOL heapSizeCheck() { bool dScnPly_c::resetGame() { if (fpcM_GetName(this) == fpcNm_OPENING_SCENE_e) { + #if TARGET_PC + toggleAutoSave(false); + #endif + if (!dStage_roomControl_c::resetArchiveBank(0)) { return false; } diff --git a/src/dusk/autosave.cpp b/src/dusk/autosave.cpp index 779cb19915..6fce913910 100644 --- a/src/dusk/autosave.cpp +++ b/src/dusk/autosave.cpp @@ -2,6 +2,7 @@ #include "dusk/ui/ui.hpp" #include "imgui/ImGuiConsole.hpp" +bool shouldAutoSave = false; u8 mSaveBuffer[QUEST_LOG_SIZE * 3]; u8 mAutoSaveProc = 0; int autoSaveWriteState = 0; @@ -14,7 +15,7 @@ static AutoSaveFuncs AutoSaveFuncsProc[] = { void noAutoSave() {} void triggerAutoSave() { - if (dusk::getSettings().game.autoSave && mAutoSaveProc == 0 && + if (dusk::getSettings().game.autoSave && shouldAutoSave && mAutoSaveProc == 0 && strcmp(dComIfGp_getStartStageName(), "F_SP102") != 0) { mAutoSaveProc = 1; @@ -89,4 +90,8 @@ void endAutoSave() { .duration = std::chrono::milliseconds(1500), }); mAutoSaveProc = 0; +} + +void toggleAutoSave(bool enabled) { + shouldAutoSave = enabled; } \ No newline at end of file diff --git a/src/dusk/imgui/ImGuiStateShare.cpp b/src/dusk/imgui/ImGuiStateShare.cpp index 48849e2bc3..27c6c74517 100644 --- a/src/dusk/imgui/ImGuiStateShare.cpp +++ b/src/dusk/imgui/ImGuiStateShare.cpp @@ -18,6 +18,7 @@ #include #include +#include namespace dusk { @@ -135,6 +136,8 @@ bool ImGuiStateShare::applyEncodedState(const std::string& encoded, const std::s return false; } + toggleAutoSave(false); + StateSharePacket pkt; memcpy(&pkt, raw.data(), sizeof(pkt)); pkt.stageName[7] = '\0';