From c38f467d6d9fefdfb2aacffa6d3d83306d5b11da Mon Sep 17 00:00:00 2001 From: inspectredc Date: Fri, 5 May 2023 17:39:53 +0100 Subject: [PATCH 1/3] clear custcene pointer button --- soh/soh/Enhancements/mods.cpp | 13 +++++++++++++ soh/soh/GameMenuBar.cpp | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index 15232c1daf9..75c55cb0aaf 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -157,6 +157,18 @@ void RegisterFreezeTime() { }); } +/// Clears the cutscene pointer to a value safe for wrong warps. +void RegisterClearCutscenePointer() { + GameInteractor::Instance->RegisterGameHook([]() { + if (!gPlayState) return; + if (CVarGetInteger("gClearCutscenePointer", 0)) { + static uint32_t null_cs[] = {0, 0}; + gPlayState->csCtx.segment = &null_cs; + CVarSetInteger("gClearCutscenePointer", 0); + } + }); +} + /// Switches Link's age and respawns him at the last entrance he entered. void RegisterSwitchAge() { GameInteractor::Instance->RegisterGameHook([]() { @@ -495,6 +507,7 @@ void InitMods() { RegisterInfiniteISG(); RegisterUnrestrictedItems(); RegisterFreezeTime(); + RegisterClearCutscenePointer(); RegisterSwitchAge(); RegisterOcarinaTimeTravel(); RegisterAutoSave(); diff --git a/soh/soh/GameMenuBar.cpp b/soh/soh/GameMenuBar.cpp index 01dfd388e47..92b6bfe1b0e 100644 --- a/soh/soh/GameMenuBar.cpp +++ b/soh/soh/GameMenuBar.cpp @@ -1139,6 +1139,11 @@ namespace GameMenuBar { } UIWidgets::Tooltip("Switches Link's age and reloads the area."); + if (ImGui::Button("Clear Cutscene Pointer")) { + CVarSetInteger("gClearCutscenePointer", 1); + } + UIWidgets::Tooltip("Clears the cutscene pointer to a value safe for wrong warps."); + ImGui::EndMenu(); } From 0cc4bc5469313853db1f17c5886e9312b861c4c6 Mon Sep 17 00:00:00 2001 From: inspectredc Date: Sat, 6 May 2023 05:44:56 +0100 Subject: [PATCH 2/3] fix warps --- soh/soh/Enhancements/mods.cpp | 11 +++++++++++ soh/soh/GameMenuBar.cpp | 2 ++ 2 files changed, 13 insertions(+) diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index 75c55cb0aaf..bfd84203bb0 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -169,6 +169,16 @@ void RegisterClearCutscenePointer() { }); } +void RegisterSafeWrongWarp() { + GameInteractor::Instance->RegisterGameHook([](int32_t sceneNum) { + if (!gPlayState) return; + if (CVarGetInteger("gSafeWrongWarps", 0) && (sceneNum == 17 || sceneNum == 18 || sceneNum == 19 || sceneNum == 21)) { + static uint32_t null_cs[] = {0, 0}; + gPlayState->csCtx.segment = &null_cs; + } + }); +} + /// Switches Link's age and respawns him at the last entrance he entered. void RegisterSwitchAge() { GameInteractor::Instance->RegisterGameHook([]() { @@ -508,6 +518,7 @@ void InitMods() { RegisterUnrestrictedItems(); RegisterFreezeTime(); RegisterClearCutscenePointer(); + RegisterSafeWrongWarp(); RegisterSwitchAge(); RegisterOcarinaTimeTravel(); RegisterAutoSave(); diff --git a/soh/soh/GameMenuBar.cpp b/soh/soh/GameMenuBar.cpp index 92b6bfe1b0e..c17c04c5555 100644 --- a/soh/soh/GameMenuBar.cpp +++ b/soh/soh/GameMenuBar.cpp @@ -1069,6 +1069,8 @@ namespace GameMenuBar { UIWidgets::Tooltip("This syncs the ingame time with the real world time"); UIWidgets::PaddedEnhancementCheckbox("No ReDead/Gibdo Freeze", "gNoRedeadFreeze", true, false); UIWidgets::Tooltip("Prevents ReDeads and Gibdos from being able to freeze you with their scream"); + UIWidgets::PaddedEnhancementCheckbox("Safe Wrong Warps", "gSafeWrongWarps", true, false); + UIWidgets::Tooltip("Wrong Warps using blue warps will never softlock"); { static int32_t betaQuestEnabled = CVarGetInteger("gEnableBetaQuest", 0); From 9fbbfbf3a666d0c39a5fbdf315ca9bdd50a3771b Mon Sep 17 00:00:00 2001 From: inspectredc Date: Thu, 8 Jun 2023 20:45:31 +0100 Subject: [PATCH 3/3] resolve menubar merge --- soh/soh/SohMenuBar.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index d028ec79f53..3d5aea87144 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -1139,6 +1139,8 @@ void DrawCheatsMenu() { UIWidgets::Tooltip("This syncs the ingame time with the real world time"); UIWidgets::PaddedEnhancementCheckbox("No ReDead/Gibdo Freeze", "gNoRedeadFreeze", true, false); UIWidgets::Tooltip("Prevents ReDeads and Gibdos from being able to freeze you with their scream"); + UIWidgets::PaddedEnhancementCheckbox("Safe Wrong Warps", "gSafeWrongWarps", true, false); + UIWidgets::Tooltip("Wrong Warps using blue warps will never softlock"); { static int32_t betaQuestEnabled = CVarGetInteger("gEnableBetaQuest", 0);