diff --git a/soh/soh/Enhancements/TimeSavers/SkipCutscene/SkipLogoTitle.cpp b/soh/soh/Enhancements/TimeSavers/SkipCutscene/SkipLogoTitle.cpp new file mode 100644 index 000000000..4142286b5 --- /dev/null +++ b/soh/soh/Enhancements/TimeSavers/SkipCutscene/SkipLogoTitle.cpp @@ -0,0 +1,19 @@ +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" + +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; + + 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; + } + }); +} diff --git a/soh/soh/Enhancements/TimeSavers/TimeSavers.cpp b/soh/soh/Enhancements/TimeSavers/TimeSavers.cpp index a198f8289..e9e21064d 100644 --- a/soh/soh/Enhancements/TimeSavers/TimeSavers.cpp +++ b/soh/soh/Enhancements/TimeSavers/TimeSavers.cpp @@ -9,6 +9,7 @@ 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 ad521c6c2..6ce14111b 100644 --- a/soh/soh/Enhancements/TimeSavers/TimeSavers.h +++ b/soh/soh/Enhancements/TimeSavers/TimeSavers.h @@ -11,6 +11,7 @@ void TimeSavers_Register(); void SkipToGivingZeldasLetter_Register(); void SkipZeldaFleeingCastle_Register(); void SkipIntro_Register(); + void SkipLogoTitle_Register(); // SkipMiscInteractions void MoveJabuJabuElevator_Register(); void MoveMidoInKokiriForest_Register(); diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h b/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h index a2d5c56ec..0ed761716 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h @@ -5,6 +5,7 @@ * - Argument 1: Name of the hook * - Argument 2: Function type that the hook uses */ +DEFINE_HOOK(OnZTitleUpdate, (void* gameState)); DEFINE_HOOK(OnLoadGame, (int32_t fileNum)); DEFINE_HOOK(OnExitGame, (int32_t fileNum)); DEFINE_HOOK(OnGameFrameUpdate, ()); diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp index 39fc298a8..bd2baef98 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp @@ -2,6 +2,10 @@ // MARK: - Gameplay +void GameInteractor_ExecuteOnZTitleUpdate(void* gameState) { + GameInteractor::Instance->ExecuteHooks(gameState); +} + void GameInteractor_ExecuteOnLoadGame(int32_t fileNum) { GameInteractor::Instance->ExecuteHooks(fileNum); } diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h index cb238539f..0808bd844 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h @@ -7,6 +7,7 @@ extern "C" { #endif // MARK: - Gameplay +void GameInteractor_ExecuteOnZTitleUpdate(void* gameState); void GameInteractor_ExecuteOnLoadGame(int32_t fileNum); void GameInteractor_ExecuteOnExitGame(int32_t fileNum); void GameInteractor_ExecuteOnGameFrameUpdate(); diff --git a/soh/src/overlays/gamestates/ovl_title/z_title.c b/soh/src/overlays/gamestates/ovl_title/z_title.c index f8561166f..b0455bf7e 100644 --- a/soh/src/overlays/gamestates/ovl_title/z_title.c +++ b/soh/src/overlays/gamestates/ovl_title/z_title.c @@ -14,6 +14,7 @@ #include #include #include "soh/ResourceManagerHelpers.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include #include "time.h" @@ -275,6 +276,8 @@ void Title_Main(GameState* thisx) { SET_NEXT_GAMESTATE(&this->state, Opening_Init, OpeningContext); } + GameInteractor_ExecuteOnZTitleUpdate(this); + CLOSE_DISPS(this->state.gfxCtx); }