diff options
| author | aMannus <mannusmenting@gmail.com> | 2026-06-12 13:55:38 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-06-12 11:55:38 +0000 |
| commit | e9268c4467d6ba2b63308084f1ef3b8bca4c5683 (patch) | |
| tree | 9d5ed74dcf974a9191e25046e5b8ff70269b97c1 | |
| parent | 2da8cf50c928ad3534d3b3c9ccea670133b47ce6 (diff) | |
Fix Outside ToT crash when using din's or dying (#6731)
| -rw-r--r-- | soh/soh/Enhancements/AlwaysOnFixes.cpp | 18 | ||||
| -rw-r--r-- | soh/soh/Enhancements/Cheats/UnrestrictedItems.cpp | 6 | ||||
| -rw-r--r-- | soh/soh/Network/CrowdControl/CrowdControl.cpp | 11 |
3 files changed, 18 insertions, 17 deletions
diff --git a/soh/soh/Enhancements/AlwaysOnFixes.cpp b/soh/soh/Enhancements/AlwaysOnFixes.cpp new file mode 100644 index 000000000..c2746a2c7 --- /dev/null +++ b/soh/soh/Enhancements/AlwaysOnFixes.cpp @@ -0,0 +1,18 @@ +#include <libultraship/bridge.h> +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/ShipInit.hpp" + +// Dying or using Din's Fire in the Outside Temple of Time area crashes the game. +// In vanilla this can never happen, but with CrowdControl, Sail, Unrestricted Items +// and others this *can* happen. Because it checks for a camId of -1, this code path +// shouldn't ever influence vanilla play regardless. +void RegisterFixOutsideTotCrash() { + COND_VB_SHOULD(VB_SHOULD_LOAD_BG_IMAGE, true, { + int32_t* camId = va_arg(args, int*); + if (*camId == -1) { + *should = false; + } + }); +} + +static RegisterShipInitFunc initFunc(RegisterFixOutsideTotCrash, { "" }); diff --git a/soh/soh/Enhancements/Cheats/UnrestrictedItems.cpp b/soh/soh/Enhancements/Cheats/UnrestrictedItems.cpp index d6f92fea8..0b5aaebbc 100644 --- a/soh/soh/Enhancements/Cheats/UnrestrictedItems.cpp +++ b/soh/soh/Enhancements/Cheats/UnrestrictedItems.cpp @@ -21,12 +21,6 @@ void OnGameFrameUpdateUnrestrictedItems() { void RegisterUnrestrictedItems() { COND_HOOK(OnGameFrameUpdate, CVAR_UNRESTRICTED_ITEMS_VALUE, OnGameFrameUpdateUnrestrictedItems); - COND_VB_SHOULD(VB_SHOULD_LOAD_BG_IMAGE, CVAR_UNRESTRICTED_ITEMS_VALUE, { - int32_t* camId = va_arg(args, int*); - if (*camId == -1) { - *should = false; - } - }); } static RegisterShipInitFunc initFunc(RegisterUnrestrictedItems, { CVAR_UNRESTRICTED_ITEMS_NAME }); diff --git a/soh/soh/Network/CrowdControl/CrowdControl.cpp b/soh/soh/Network/CrowdControl/CrowdControl.cpp index a0621a4ea..9eeeef7db 100644 --- a/soh/soh/Network/CrowdControl/CrowdControl.cpp +++ b/soh/soh/Network/CrowdControl/CrowdControl.cpp @@ -681,14 +681,3 @@ std::unique_ptr<CrowdControl::Effect> CrowdControl::ParseMessage(nlohmann::json return effect; } - -void RegisterCrowdControlHooks() { - COND_VB_SHOULD(VB_SHOULD_LOAD_BG_IMAGE, CVarGetInteger(CVAR_REMOTE_CROWD_CONTROL("Enabled"), 0), { - int32_t* camId = va_arg(args, int*); - if (*camId == -1) { - *should = false; - } - }); -} - -static RegisterShipInitFunc initFunc(RegisterCrowdControlHooks, { CVAR_REMOTE_CROWD_CONTROL("Enabled") }); |
