summaryrefslogtreecommitdiff
path: root/mm/src/code
diff options
context:
space:
mode:
authorGarrett Cox <garrettjcox@gmail.com>2026-01-24 17:52:29 -0600
committerGitHub <noreply@github.com>2026-01-24 17:52:29 -0600
commit16ef59baeaf9f6955281b54d2f75ecc7c968a6c3 (patch)
treef12d58ffca6e2212be42be29b2ee2bc16dc0e1e7 /mm/src/code
parent5229a531c2336349e12a4985dc25ebf5e13fc63a (diff)
WIP Tweaks to fix compatibility with 0th/4th day glitches (#1462)
Diffstat (limited to 'mm/src/code')
-rw-r--r--mm/src/code/z_play.c2
-rw-r--r--mm/src/code/z_sram_NES.c21
2 files changed, 13 insertions, 10 deletions
diff --git a/mm/src/code/z_play.c b/mm/src/code/z_play.c
index a0a3b3a99..1b568b522 100644
--- a/mm/src/code/z_play.c
+++ b/mm/src/code/z_play.c
@@ -1101,7 +1101,7 @@ void Play_UpdateMain(PlayState* this) {
this->state.gfxCtx);
if (this->sramCtx.status != 0) {
- if (gSaveContext.save.isOwlSave) {
+ if (GameInteractor_Should(VB_SAVE_USE_OWL_SAVE_TIMING, gSaveContext.save.isOwlSave)) {
Sram_UpdateWriteToFlashOwlSave(&this->sramCtx);
} else {
Sram_UpdateWriteToFlashDefault(&this->sramCtx);
diff --git a/mm/src/code/z_sram_NES.c b/mm/src/code/z_sram_NES.c
index 03c3c301e..bbeb24e70 100644
--- a/mm/src/code/z_sram_NES.c
+++ b/mm/src/code/z_sram_NES.c
@@ -1401,7 +1401,14 @@ void Sram_OpenSave(FileSelectState* fileSelect, SramContext* sramCtx) {
if (gSaveContext.save.shipSaveInfo.pauseSaveEntrance != -1) {
gSaveContext.save.entrance = gSaveContext.save.shipSaveInfo.pauseSaveEntrance;
} else {
- gSaveContext.save.entrance = sOwlWarpEntrances[(void)0, gSaveContext.save.owlWarpId];
+ // @bug When the player saves at the extra Owl statue in west clock town
+ // their owlWarpId is set to 0xF. On hardware this results in the entrance being set to 0
+ // 2S2H [Port] We opt to fix this by hardcoding entrance to 0 when owlWarpId is out of bounds
+ if (gSaveContext.save.owlWarpId > OWL_WARP_MAX) {
+ gSaveContext.save.entrance = 0;
+ } else {
+ gSaveContext.save.entrance = sOwlWarpEntrances[(void)0, gSaveContext.save.owlWarpId];
+ }
}
if ((gSaveContext.save.entrance == ENTRANCE(SOUTHERN_SWAMP_POISONED, 10)) &&
CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE)) {
@@ -2079,10 +2086,8 @@ void Sram_UpdateWriteToFlashDefault(SramContext* sramCtx) {
sramCtx->status = 4;
}
}
- } else if (OSTIME_TO_TIMER(osGetTime() - sramCtx->startWriteOsTime) >=
- SECONDS_TO_TIMER(CVarGetInteger("gEnhancements.Saving.DisableSaveDelay", 0) ? 0 : 2)) {
- // 2S2H [Port] Some tricks require a save delay so we can't just force it to zero
- // Finished status is hardcoded to 2 seconds instead of when the task finishes
+ } else if (GameInteractor_Should(VB_SAVE_DELAY,
+ OSTIME_TO_TIMER(osGetTime() - sramCtx->startWriteOsTime) >= SECONDS_TO_TIMER(2))) {
sramCtx->status = 0;
}
}
@@ -2119,10 +2124,8 @@ void Sram_UpdateWriteToFlashOwlSave(SramContext* sramCtx) {
sramCtx->status = 4;
}
}
- } else if (OSTIME_TO_TIMER(osGetTime() - sramCtx->startWriteOsTime) >=
- SECONDS_TO_TIMER(CVarGetInteger("gEnhancements.Saving.DisableSaveDelay", 0) ? 0 : 2)) {
- // 2S2H [Port] Some tricks require a save delay so we can't just force it to zero
- // Finished status is hardcoded to 2 seconds instead of when the task finishes
+ } else if (GameInteractor_Should(VB_SAVE_DELAY,
+ OSTIME_TO_TIMER(osGetTime() - sramCtx->startWriteOsTime) >= SECONDS_TO_TIMER(2))) {
sramCtx->status = 0;
memset(sramCtx->saveBuf, 0, SAVE_BUFFER_SIZE);
gSaveContext.save.isOwlSave = false;