From e3a257c734afba73f0182405f2566cf6f4f06be7 Mon Sep 17 00:00:00 2001 From: louist103 <35883445+louist103@users.noreply.github.com> Date: Sun, 19 May 2024 12:23:08 -0400 Subject: [PATCH] Fix a few issues related to tricks (#426) * Fix missing DList * Add variable save delay. --- mm/2s2h/BenGui/BenMenuBar.cpp | 5 ++++- mm/src/code/z_player_lib.c | 6 ++++-- mm/src/code/z_sram_NES.c | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/mm/2s2h/BenGui/BenMenuBar.cpp b/mm/2s2h/BenGui/BenMenuBar.cpp index e1a486287..e75209c10 100644 --- a/mm/2s2h/BenGui/BenMenuBar.cpp +++ b/mm/2s2h/BenGui/BenMenuBar.cpp @@ -381,7 +381,10 @@ void DrawEnhancementsMenu() { UIWidgets::CVarCheckbox("Do not reset Rupees", "gEnhancements.Cycle.DoNotResetRupees", { .tooltip = "Playing the Song Of Time will not reset the your rupees." }); - + UIWidgets::CVarSliderInt("Save Delay", "gEnhancements.Save.SaveDelay", 0, 5, 0, { + .tooltip = "Sets the delay between pressing save and the save being marked as complete. Original game was 2." + }); + ImGui::EndMenu(); } diff --git a/mm/src/code/z_player_lib.c b/mm/src/code/z_player_lib.c index 1c09f407c..7941fb883 100644 --- a/mm/src/code/z_player_lib.c +++ b/mm/src/code/z_player_lib.c @@ -1082,7 +1082,8 @@ Gfx* sPlayerFirstPersonRightShoulderDLs[PLAYER_FORM_MAX] = { Gfx* sPlayerFirstPersonRightHandDLs[PLAYER_FORM_MAX] = { gLinkFierceDeityRightHandDL, //! @bug This is in the middle of a texture in the link_goron object. It has the same offset as a link_nuts dlist - (Gfx*)0x060038C0, + // 2S2H [Port] Put the DList that makes the most sense here. In reality nothing makes sense since goron has no first person items, but we need something here to prevent a crash. + gLinkGoronRightHandOpenDL, gLinkZoraRightHandOpenDL, gLinkDekuRightHandDL, object_link_child_DL_018490, @@ -1091,7 +1092,8 @@ Gfx* sPlayerFirstPersonRightHandDLs[PLAYER_FORM_MAX] = { Gfx* sPlayerFirstPersonRightHandHookshotDLs[PLAYER_FORM_MAX] = { gLinkFierceDeityRightHandDL, //! @bug This is in the middle of a texture in the link_goron object. It has the same offset as a link_nuts dlist - (Gfx*)0x060038C0, + // 2S2H [Port] Put the DList that makes the most sense here. In reality nothing makes sense since goron has no first person items, but we need something here to prevent a crash. + gLinkGoronRightHandOpenDL, gLinkZoraRightHandOpenDL, gLinkDekuRightHandDL, object_link_child_DL_017B40, diff --git a/mm/src/code/z_sram_NES.c b/mm/src/code/z_sram_NES.c index a59c6c06e..94e8c73bc 100644 --- a/mm/src/code/z_sram_NES.c +++ b/mm/src/code/z_sram_NES.c @@ -1994,7 +1994,7 @@ void Sram_UpdateWriteToFlashDefault(SramContext* sramCtx) { sramCtx->status = 4; } } - } else if (OSTIME_TO_TIMER(osGetTime() - sramCtx->startWriteOsTime) >= SECONDS_TO_TIMER(0 /*2*/)) { // 2S2H [Port] Remove arbitrary 2 second delay + } else if (OSTIME_TO_TIMER(osGetTime() - sramCtx->startWriteOsTime) >= SECONDS_TO_TIMER(CVarGetInteger("gEnhancements.Save.SaveDelay", 0))) { // 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 sramCtx->status = 0; } @@ -2032,7 +2032,7 @@ void Sram_UpdateWriteToFlashOwlSave(SramContext* sramCtx) { sramCtx->status = 4; } } - } else if (OSTIME_TO_TIMER(osGetTime() - sramCtx->startWriteOsTime) >= SECONDS_TO_TIMER(0 /*2*/)) { // 2S2H [Port] Remove arbitrary 2 second delay + } else if (OSTIME_TO_TIMER(osGetTime() - sramCtx->startWriteOsTime) >= SECONDS_TO_TIMER(CVarGetInteger("gEnhancements.Save.SaveDelay", 0))) { // 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 sramCtx->status = 0; memset(sramCtx->saveBuf, 0, SAVE_BUFFER_SIZE);