diff --git a/soh/soh/Enhancements/AlwaysOnFixes.cpp b/soh/soh/Enhancements/AlwaysOnFixes.cpp new file mode 100644 index 0000000000..c2746a2c7e --- /dev/null +++ b/soh/soh/Enhancements/AlwaysOnFixes.cpp @@ -0,0 +1,18 @@ +#include +#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 d6f92fea81..0b5aaebbc4 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 a0621a4eac..9eeeef7dbc 100644 --- a/soh/soh/Network/CrowdControl/CrowdControl.cpp +++ b/soh/soh/Network/CrowdControl/CrowdControl.cpp @@ -681,14 +681,3 @@ std::unique_ptr 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") });