mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-04 18:28:45 -04:00
Auto Save Protection (#1102)
* Auto Save Protection * added line behind target_pc define --------- Co-authored-by: MelonSpeedruns <melonspeedruns@stratobox.net> Co-authored-by: TakaRikka <38417346+TakaRikka@users.noreply.github.com>
This commit is contained in:
@@ -13,5 +13,6 @@ void enterAutoSave();
|
||||
void autoSaving();
|
||||
void waitingForWrite();
|
||||
void endAutoSave();
|
||||
void toggleAutoSave(bool enabled);
|
||||
|
||||
#endif
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "dusk/imgui/ImGuiConsole.hpp"
|
||||
#include "dusk/speedrun.h"
|
||||
#include "m_Do/m_Do_controller_pad.h"
|
||||
#include <dusk/autosave.h>
|
||||
|
||||
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;
|
||||
|
||||
@@ -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 <dusk/autosave.h>
|
||||
|
||||
#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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <unordered_set>
|
||||
#include <zstd.h>
|
||||
#include <dusk/autosave.h>
|
||||
|
||||
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';
|
||||
|
||||
Reference in New Issue
Block a user