diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor.h b/soh/soh/Enhancements/game-interactor/GameInteractor.h index 193adb6c4bd..f0f02264678 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor.h @@ -179,6 +179,8 @@ class GameInteractor { DEFINE_HOOK(OnSetGameLanguage, void()); + DEFINE_HOOK(OnPauseMenu, void()); + // Helpers static bool IsSaveLoaded(); static bool IsGameplayPaused(); diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp index 7277d765f7b..dec1f22e79c 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp @@ -137,3 +137,8 @@ void GameInteractor_ExecuteOnUpdateFileNameSelection(int16_t charCode) { void GameInteractor_ExecuteOnSetGameLanguage() { GameInteractor::Instance->ExecuteHooks(); } + +// MARK: - Pause Menu +void GameInteractor_ExecuteOnPauseMenu() { + GameInteractor::Instance->ExecuteHooks(); +} \ No newline at end of file diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h index edff2f84b48..336d84200f1 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h @@ -45,6 +45,10 @@ void GameInteractor_ExecuteOnUpdateFileNameSelection(int16_t charCode); // MARK: - Game void GameInteractor_ExecuteOnSetGameLanguage(); + +//MARK: - Pause Menu +void GameInteractor_ExecuteOnPauseMenu(); + #ifdef __cplusplus } #endif diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index 2048ead3168..66334c9de66 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -16,6 +16,8 @@ extern "C" { extern SaveContext gSaveContext; extern PlayState* gPlayState; +void PauseWarp_Main(); + uint32_t ResourceMgr_IsSceneMasterQuest(s16 sceneNum); } bool performDelayedSave = false; @@ -599,6 +601,12 @@ void RegisterMirrorModeHandler() { }); } +void RegisterPauseWarp() { + GameInteractor::Instance->RegisterGameHook([]() { + PauseWarp_Main(); + }); +} + void InitMods() { RegisterTTS(); RegisterInfiniteMoney(); @@ -621,4 +629,5 @@ void InitMods() { RegisterBonkDamage(); RegisterMenuPathFix(); RegisterMirrorModeHandler(); + RegisterPauseWarp(); } diff --git a/soh/soh/Enhancements/randomizer/pausewarp.c b/soh/soh/Enhancements/pausewarp.c similarity index 97% rename from soh/soh/Enhancements/randomizer/pausewarp.c rename to soh/soh/Enhancements/pausewarp.c index 537016c1075..cbd8552c8fd 100644 --- a/soh/soh/Enhancements/randomizer/pausewarp.c +++ b/soh/soh/Enhancements/pausewarp.c @@ -3,7 +3,9 @@ #include #include "soh/Enhancements/gameconsole.h" #include "global.h" -#include "../custom-message/CustomMessageTypes.h" +#include + +#include "luslog.h" // Defining the structure for the pause warp state, which holds different flags and cooldowns typedef struct { @@ -67,6 +69,7 @@ void HandleCooldowns(PauseWarpState* state) { // The main function that gets called every frame void PauseWarp_Main() { + LUSLOG_CRITICAL("PauseWarp_Main Called"); static PauseWarpState state; // The state is static so it retains its value between function calls // Checking if the pause warp feature is enabled diff --git a/soh/src/code/graph.c b/soh/src/code/graph.c index 8ebb0b7794f..21d4526f351 100644 --- a/soh/src/code/graph.c +++ b/soh/src/code/graph.c @@ -486,7 +486,6 @@ static void RunFrame() PadMgr_ThreadEntry(&gPadMgr); Graph_Update(&runFrameContext.gfxCtx, runFrameContext.gameState); - PauseWarp_Main(); ticksB = GetPerfCounter(); Graph_ProcessGfxCommands(runFrameContext.gfxCtx.workBuffer); diff --git a/soh/src/code/z_kaleido_scope_call.c b/soh/src/code/z_kaleido_scope_call.c index 6f0648e082e..c85a3e80d55 100644 --- a/soh/src/code/z_kaleido_scope_call.c +++ b/soh/src/code/z_kaleido_scope_call.c @@ -56,6 +56,8 @@ void KaleidoScopeCall_Update(PlayState* play) { KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]; PauseContext* pauseCtx = &play->pauseCtx; + GameInteractor_ExecuteOnPauseMenu(); + if (!gSaveContext.sohStats.gameComplete && (!gSaveContext.isBossRush || !gSaveContext.isBossRushPaused)) { gSaveContext.sohStats.pauseTimer++;