From aef0bf50ea5dd2bf5f01f644b2de1a507c746278 Mon Sep 17 00:00:00 2001 From: LittleCube Date: Tue, 29 Apr 2025 22:50:20 -0400 Subject: [PATCH] Restore 0th day (#574) --- patches/save_patches.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/patches/save_patches.c b/patches/save_patches.c index 5eeba3a..2ebf234 100644 --- a/patches/save_patches.c +++ b/patches/save_patches.c @@ -11,7 +11,7 @@ void Sleep_Msec(u32 ms); extern u16 D_801F6AF0; extern u8 D_801F6AF2; -// @recomp Patched to not wait a hardcoded amount of time for the save to complete. +// @recomp Patched to wait a much shorter amount of time for the save to complete. RECOMP_PATCH void Sram_UpdateWriteToFlashDefault(SramContext* sramCtx) { if (sramCtx->status == 2) { if (SysFlashrom_IsBusy() != 0) { // if task running @@ -23,13 +23,13 @@ RECOMP_PATCH void Sram_UpdateWriteToFlashDefault(SramContext* sramCtx) { sramCtx->status = 4; } } - } else if (sramCtx->status == 4) { - // @recomp Patched to check status instead of using a hardcoded wait. + } else if (OSTIME_TO_TIMER(osGetTime() - sramCtx->startWriteOsTime) >= SECONDS_TO_TIMER_PRECISE(0, 25)) { + // @recomp Patched to wait a much shorter amount of time. sramCtx->status = 0; } } -// @recomp Patched to not wait a hardcoded amount of time for the save to complete. +// @recomp Patched to wait a much shorter amount of time for the save to complete. RECOMP_PATCH void Sram_UpdateWriteToFlashOwlSave(SramContext* sramCtx) { if (sramCtx->status == 7) { if (SysFlashrom_IsBusy() != 0) { // Is task running @@ -49,8 +49,8 @@ RECOMP_PATCH void Sram_UpdateWriteToFlashOwlSave(SramContext* sramCtx) { sramCtx->status = 4; } } - } else if (sramCtx->status == 4) { - // @recomp Patched to check status instead of using a hardcoded wait. + } else if (OSTIME_TO_TIMER(osGetTime() - sramCtx->startWriteOsTime) >= SECONDS_TO_TIMER_PRECISE(0, 25)) { + // @recomp Patched to wait a much shorter amount of time. sramCtx->status = 0; bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); gSaveContext.save.isOwlSave = false;