From 683820632ad651746690ef9cfbf5f0781b04edd6 Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Tue, 27 Feb 2024 21:52:49 +0000 Subject: [PATCH] Fix owl save crash by adjusting save buffer size (#141) --- mm/include/z64save.h | 2 +- mm/src/code/z_sram_NES.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/include/z64save.h b/mm/include/z64save.h index 865b0650a..42c9fd320 100644 --- a/mm/include/z64save.h +++ b/mm/include/z64save.h @@ -32,7 +32,7 @@ typedef enum RespawnMode { /* 8 */ RESPAWN_MODE_MAX } RespawnMode; -#define SAVE_BUFFER_SIZE 0x4000 +#define SAVE_BUFFER_SIZE 0x8000 // 2S2H [Port] Double the original size of 0x4000 for 64 bit support typedef enum { /* 0 */ MAGIC_STATE_IDLE, // Regular gameplay diff --git a/mm/src/code/z_sram_NES.c b/mm/src/code/z_sram_NES.c index ca35153e0..5dab05072 100644 --- a/mm/src/code/z_sram_NES.c +++ b/mm/src/code/z_sram_NES.c @@ -1937,7 +1937,7 @@ void Sram_UpdateWriteToFlashDefault(SramContext* sramCtx) { sramCtx->status = 4; } } - } else if (OSTIME_TO_TIMER(osGetTime() - sramCtx->startWriteOsTime) >= SECONDS_TO_TIMER(2)) { + } else if (OSTIME_TO_TIMER(osGetTime() - sramCtx->startWriteOsTime) >= SECONDS_TO_TIMER(0 /*2*/)) { // 2S2H [Port] Remove arbitrary 2 second delay // Finished status is hardcoded to 2 seconds instead of when the task finishes sramCtx->status = 0; } @@ -1975,7 +1975,7 @@ void Sram_UpdateWriteToFlashOwlSave(SramContext* sramCtx) { sramCtx->status = 4; } } - } else if (OSTIME_TO_TIMER(osGetTime() - sramCtx->startWriteOsTime) >= SECONDS_TO_TIMER(2)) { + } else if (OSTIME_TO_TIMER(osGetTime() - sramCtx->startWriteOsTime) >= SECONDS_TO_TIMER(0 /*2*/)) { // 2S2H [Port] Remove arbitrary 2 second delay // Finished status is hardcoded to 2 seconds instead of when the task finishes sramCtx->status = 0; memset(sramCtx->saveBuf, 0, SAVE_BUFFER_SIZE);