skip z_title with button press

This commit is contained in:
briaguya 2025-01-21 14:47:28 -05:00
parent 63046a89ec
commit 2bc46bfa68
7 changed files with 30 additions and 0 deletions

View File

@ -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;
}
});
}

View File

@ -9,6 +9,7 @@ void TimeSavers_Register() {
SkipToGivingZeldasLetter_Register(); SkipToGivingZeldasLetter_Register();
SkipZeldaFleeingCastle_Register(); SkipZeldaFleeingCastle_Register();
SkipIntro_Register(); SkipIntro_Register();
SkipLogoTitle_Register();
// SkipMiscInteractions // SkipMiscInteractions
MoveJabuJabuElevator_Register(); MoveJabuJabuElevator_Register();
MoveMidoInKokiriForest_Register(); MoveMidoInKokiriForest_Register();

View File

@ -11,6 +11,7 @@ void TimeSavers_Register();
void SkipToGivingZeldasLetter_Register(); void SkipToGivingZeldasLetter_Register();
void SkipZeldaFleeingCastle_Register(); void SkipZeldaFleeingCastle_Register();
void SkipIntro_Register(); void SkipIntro_Register();
void SkipLogoTitle_Register();
// SkipMiscInteractions // SkipMiscInteractions
void MoveJabuJabuElevator_Register(); void MoveJabuJabuElevator_Register();
void MoveMidoInKokiriForest_Register(); void MoveMidoInKokiriForest_Register();

View File

@ -5,6 +5,7 @@
* - Argument 1: Name of the hook * - Argument 1: Name of the hook
* - Argument 2: Function type that the hook uses * - Argument 2: Function type that the hook uses
*/ */
DEFINE_HOOK(OnZTitleUpdate, (void* gameState));
DEFINE_HOOK(OnLoadGame, (int32_t fileNum)); DEFINE_HOOK(OnLoadGame, (int32_t fileNum));
DEFINE_HOOK(OnExitGame, (int32_t fileNum)); DEFINE_HOOK(OnExitGame, (int32_t fileNum));
DEFINE_HOOK(OnGameFrameUpdate, ()); DEFINE_HOOK(OnGameFrameUpdate, ());

View File

@ -2,6 +2,10 @@
// MARK: - Gameplay // MARK: - Gameplay
void GameInteractor_ExecuteOnZTitleUpdate(void* gameState) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnZTitleUpdate>(gameState);
}
void GameInteractor_ExecuteOnLoadGame(int32_t fileNum) { void GameInteractor_ExecuteOnLoadGame(int32_t fileNum) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnLoadGame>(fileNum); GameInteractor::Instance->ExecuteHooks<GameInteractor::OnLoadGame>(fileNum);
} }

View File

@ -7,6 +7,7 @@
extern "C" { extern "C" {
#endif #endif
// MARK: - Gameplay // MARK: - Gameplay
void GameInteractor_ExecuteOnZTitleUpdate(void* gameState);
void GameInteractor_ExecuteOnLoadGame(int32_t fileNum); void GameInteractor_ExecuteOnLoadGame(int32_t fileNum);
void GameInteractor_ExecuteOnExitGame(int32_t fileNum); void GameInteractor_ExecuteOnExitGame(int32_t fileNum);
void GameInteractor_ExecuteOnGameFrameUpdate(); void GameInteractor_ExecuteOnGameFrameUpdate();

View File

@ -14,6 +14,7 @@
#include <soh/GameVersions.h> #include <soh/GameVersions.h>
#include <soh/SaveManager.h> #include <soh/SaveManager.h>
#include "soh/ResourceManagerHelpers.h" #include "soh/ResourceManagerHelpers.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include <string.h> #include <string.h>
#include "time.h" #include "time.h"
@ -275,6 +276,8 @@ void Title_Main(GameState* thisx) {
SET_NEXT_GAMESTATE(&this->state, Opening_Init, OpeningContext); SET_NEXT_GAMESTATE(&this->state, Opening_Init, OpeningContext);
} }
GameInteractor_ExecuteOnZTitleUpdate(this);
CLOSE_DISPS(this->state.gfxCtx); CLOSE_DISPS(this->state.gfxCtx);
} }