diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor.h b/soh/soh/Enhancements/game-interactor/GameInteractor.h index 036483f2e..cfb4483ac 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor.h @@ -184,6 +184,8 @@ public: 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 dfd90c084..190302fc8 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp @@ -161,3 +161,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 a1d2cbb31..31d998a5d 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h @@ -51,6 +51,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 6fc3b35b2..aadcfe790 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -32,6 +32,7 @@ extern SaveContext gSaveContext; extern PlayState* gPlayState; extern void Overlay_DisplayText(float duration, const char* text); uint32_t ResourceMgr_IsSceneMasterQuest(s16 sceneNum); +void PauseWarp_Main(); } bool performDelayedSave = false; bool performSave = false; @@ -974,6 +975,12 @@ void RegisterRandomizerSheikSpawn() { }); } +void RegisterPauseWarp() { + GameInteractor::Instance->RegisterGameHook([]() { + PauseWarp_Main(); + }); +} + void InitMods() { RegisterTTS(); RegisterInfiniteMoney(); @@ -1000,4 +1007,5 @@ void InitMods() { RegisterAltTrapTypes(); RegisterRandomizerSheikSpawn(); NameTag_RegisterHooks(); + 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 537016c10..cbd8552c8 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/z_kaleido_scope_call.c b/soh/src/code/z_kaleido_scope_call.c index 6f0648e08..c85a3e80d 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++;