Fix Outside ToT crash when using din's or dying (#6731)

This commit is contained in:
aMannus
2026-06-12 13:55:38 +02:00
committed by GitHub
parent 2da8cf50c9
commit e9268c4467
3 changed files with 18 additions and 17 deletions
+18
View File
@@ -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, { "" });
@@ -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 });
@@ -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") });