From ef02f8649de42af3e10e2ce004d00b2a96445581 Mon Sep 17 00:00:00 2001 From: Eblo <7004497+Eblo@users.noreply.github.com> Date: Wed, 25 Jun 2025 14:29:34 -0400 Subject: [PATCH] Add enhancement to speed up pause menu animation --- .../Enhancements/TimeSavers/FasterKaleido.cpp | 35 +++++++++++++++++++ soh/soh/SohGui/SohMenuEnhancements.cpp | 3 ++ 2 files changed, 38 insertions(+) create mode 100644 soh/soh/Enhancements/TimeSavers/FasterKaleido.cpp diff --git a/soh/soh/Enhancements/TimeSavers/FasterKaleido.cpp b/soh/soh/Enhancements/TimeSavers/FasterKaleido.cpp new file mode 100644 index 000000000..fccbafb94 --- /dev/null +++ b/soh/soh/Enhancements/TimeSavers/FasterKaleido.cpp @@ -0,0 +1,35 @@ +#include "soh/Enhancements/game-interactor/GameInteractor.h" +#include "soh/ShipInit.hpp" + +extern "C" { +#include "variables.h" +extern PlayState* gPlayState; +extern void func_808237B4(PlayState* play, Input* input); +} + +#define CVAR_FASTER_KALEIDO_NAME CVAR_ENHANCEMENT("FasterKaleido") +#define CVAR_FASTER_KALEIDO_VALUE CVarGetInteger(CVAR_FASTER_KALEIDO_NAME, 0) + +void OnKaleidoUpdateFaster() { + ZREG(46) = 2; // pauseCtx->eye and pauseCtx->unk_1EA multiply by this for animation. Double the default value. + WREG(6) = 4; // Numerous kaleido animations divide by this for movement and alpha. Half the default value. + + // Page turn animation is governed by func_808237B4. Those values don't use registers to modify the speed, so we + // just directly call it twice to effectively double the speed. + if (gPlayState->pauseCtx.state == 6 && gPlayState->pauseCtx.unk_1E4 == 1) { // In page turning mode + func_808237B4(gPlayState, gPlayState->state.input); + } +} + +void RegisterFasterKaleido() { + COND_HOOK(GameInteractor::OnKaleidoUpdate, CVAR_FASTER_KALEIDO_VALUE, OnKaleidoUpdateFaster); + + // Reset register values on close. These values are only used by z_kaleido_scope_PAL.c + COND_VB_SHOULD(VB_KALEIDO_UNPAUSE_CLOSE, CVAR_FASTER_KALEIDO_VALUE, { + // Default values, as defined in Regs_InitDataImpl + ZREG(46) = 1; + WREG(6) = 8; + }); +} + +static RegisterShipInitFunc initFunc(RegisterFasterKaleido, { CVAR_FASTER_KALEIDO_NAME }); diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp index 953a4c331..a054e7734 100644 --- a/soh/soh/SohGui/SohMenuEnhancements.cpp +++ b/soh/soh/SohGui/SohMenuEnhancements.cpp @@ -351,6 +351,9 @@ void SohMenu::AddMenuEnhancements() { AddWidget(path, "King Zora Speed: %.2fx", WIDGET_CVAR_SLIDER_FLOAT) .CVar(CVAR_ENHANCEMENT("MweepSpeed")) .Options(FloatSliderOptions().Min(0.1f).Max(5.0f).DefaultValue(1.0f).Format("%.2fx")); + AddWidget(path, "Faster Pause Menu", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR_ENHANCEMENT("FasterKaleido")) + .Options(CheckboxOptions().Tooltip("Speeds up animation of the pause menu, similar to Majora's Mask")); path.column = SECTION_COLUMN_3; AddWidget(path, "Misc", WIDGET_SEPARATOR_TEXT);