From 849c4325b962de9fb1279fceeacaa34f97e67af6 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Tue, 21 Jan 2025 16:38:39 -0500 Subject: [PATCH] use `RegisterShipInitFunc` --- .../TimeSavers/SkipCutscene/SkipLogoTitle.cpp | 25 +++++++++++-------- .../Enhancements/TimeSavers/TimeSavers.cpp | 1 - soh/soh/Enhancements/TimeSavers/TimeSavers.h | 1 - 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/soh/soh/Enhancements/TimeSavers/SkipCutscene/SkipLogoTitle.cpp b/soh/soh/Enhancements/TimeSavers/SkipCutscene/SkipLogoTitle.cpp index 4142286b5..7a7beeeb6 100644 --- a/soh/soh/Enhancements/TimeSavers/SkipCutscene/SkipLogoTitle.cpp +++ b/soh/soh/Enhancements/TimeSavers/SkipCutscene/SkipLogoTitle.cpp @@ -1,19 +1,24 @@ #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/ShipInit.hpp" extern "C" { #include "macros.h" #include "z64.h" } -void SkipLogoTitle_Register() { - // Allows pressing A to skip the boot logo and go to the next state (opening or file select) - COND_HOOK(OnZTitleUpdate, true, [](void* gameState) { - TitleContext* titleContext = (TitleContext*)gameState; +// Allows pressing A to skip the boot logo and go to the next state (opening or file select) +void OnZTitleUpdateSkipLogoTitle(void* gameState) { + TitleContext* titleContext = (TitleContext*)gameState; - if (CHECK_BTN_ANY(titleContext->state.input->press.button, BTN_A | BTN_B | BTN_START)) { - // Force the title state to start fading to black and to last roughly 5 frames based on current fade in/out - titleContext->visibleDuration = 0; - titleContext->addAlpha = (255 - titleContext->coverAlpha) / 5; - } - }); + if (CHECK_BTN_ANY(titleContext->state.input->press.button, BTN_A | BTN_B | BTN_START)) { + // Force the title state to start fading to black and to last roughly 5 frames based on current fade in/out + titleContext->visibleDuration = 0; + titleContext->addAlpha = (255 - titleContext->coverAlpha) / 5; + } } + +void RegisterSkipLogoTitle() { + COND_HOOK(OnZTitleUpdate, true, OnZTitleUpdateSkipLogoTitle); +} + +static RegisterShipInitFunc initFunc(RegisterSkipLogoTitle); diff --git a/soh/soh/Enhancements/TimeSavers/TimeSavers.cpp b/soh/soh/Enhancements/TimeSavers/TimeSavers.cpp index e9e21064d..a198f8289 100644 --- a/soh/soh/Enhancements/TimeSavers/TimeSavers.cpp +++ b/soh/soh/Enhancements/TimeSavers/TimeSavers.cpp @@ -9,7 +9,6 @@ void TimeSavers_Register() { SkipToGivingZeldasLetter_Register(); SkipZeldaFleeingCastle_Register(); SkipIntro_Register(); - SkipLogoTitle_Register(); // SkipMiscInteractions MoveJabuJabuElevator_Register(); MoveMidoInKokiriForest_Register(); diff --git a/soh/soh/Enhancements/TimeSavers/TimeSavers.h b/soh/soh/Enhancements/TimeSavers/TimeSavers.h index 6ce14111b..ad521c6c2 100644 --- a/soh/soh/Enhancements/TimeSavers/TimeSavers.h +++ b/soh/soh/Enhancements/TimeSavers/TimeSavers.h @@ -11,7 +11,6 @@ void TimeSavers_Register(); void SkipToGivingZeldasLetter_Register(); void SkipZeldaFleeingCastle_Register(); void SkipIntro_Register(); - void SkipLogoTitle_Register(); // SkipMiscInteractions void MoveJabuJabuElevator_Register(); void MoveMidoInKokiriForest_Register();