From 56bfa2460cfed9620e137b72782f350a9d5b9556 Mon Sep 17 00:00:00 2001 From: Jacob Babor Date: Sat, 20 Jun 2026 15:01:20 -0500 Subject: [PATCH] Disable unstable GPS multiplier hooks --- red4ext/EdgeWeightGPS/src/Main.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/red4ext/EdgeWeightGPS/src/Main.cpp b/red4ext/EdgeWeightGPS/src/Main.cpp index 8d25c37..05e8832 100644 --- a/red4ext/EdgeWeightGPS/src/Main.cpp +++ b/red4ext/EdgeWeightGPS/src/Main.cpp @@ -95,6 +95,7 @@ constexpr uint32_t kGameStateRunning = 2; constexpr bool kEnableVerboseJournalListenerHooks = false; constexpr bool kEnableVerboseRouteObserverHooks = false; constexpr bool kEnableVerboseMappinRouteState = false; +constexpr bool kEnableGpsMultiplierHooks = false; constexpr uintptr_t kGpsSystemTickRva = 0x0E6B62C; constexpr uintptr_t kJournalTrackEntryImplRva = 0x05944FC; constexpr uintptr_t kJournalListenerArrayOffset = 0x210; @@ -3932,12 +3933,15 @@ RED4EXT_C_EXPORT bool RED4EXT_CALL Main(RED4ext::v1::PluginHandle aHandle, RED4e reinterpret_cast(&gOriginalGpsSearch)); AttachProbeHook("GPSEdgeCost 0x44f838", kGpsEdgeCostRva, reinterpret_cast(&DetourGpsEdgeCost), reinterpret_cast(&gOriginalGpsEdgeCost)); - AttachProbeHook("GPSAuxMultiplier 0x40bb00", kGpsAuxMultiplierRva, - reinterpret_cast(&DetourGpsAuxMultiplier), - reinterpret_cast(&gOriginalGpsAuxMultiplier)); - AttachProbeHook("GPSNodeMultiplier 0x40bb40", kGpsNodeMultiplierRva, - reinterpret_cast(&DetourGpsNodeMultiplier), - reinterpret_cast(&gOriginalGpsNodeMultiplier)); + if (kEnableGpsMultiplierHooks) + { + AttachProbeHook("GPSAuxMultiplier 0x40bb00", kGpsAuxMultiplierRva, + reinterpret_cast(&DetourGpsAuxMultiplier), + reinterpret_cast(&gOriginalGpsAuxMultiplier)); + AttachProbeHook("GPSNodeMultiplier 0x40bb40", kGpsNodeMultiplierRva, + reinterpret_cast(&DetourGpsNodeMultiplier), + reinterpret_cast(&gOriginalGpsNodeMultiplier)); + } AttachProbeHook("GPSSystem/Tick", kGpsSystemTickRva, reinterpret_cast(&DetourGpsSystemTick), reinterpret_cast(&gOriginalGpsSystemTick)); AttachProbeHook("JournalManager::TrackEntry impl", kJournalTrackEntryImplRva, @@ -4060,8 +4064,11 @@ RED4EXT_C_EXPORT bool RED4EXT_CALL Main(RED4ext::v1::PluginHandle aHandle, RED4e DetachProbeHook("GPSRouteProducer 0x44cc7c", kGpsRouteProducerRva); DetachProbeHook("GPSSearch 0x44f054", kGpsSearchRva); DetachProbeHook("GPSEdgeCost 0x44f838", kGpsEdgeCostRva); - DetachProbeHook("GPSAuxMultiplier 0x40bb00", kGpsAuxMultiplierRva); - DetachProbeHook("GPSNodeMultiplier 0x40bb40", kGpsNodeMultiplierRva); + if (kEnableGpsMultiplierHooks) + { + DetachProbeHook("GPSAuxMultiplier 0x40bb00", kGpsAuxMultiplierRva); + DetachProbeHook("GPSNodeMultiplier 0x40bb40", kGpsNodeMultiplierRva); + } DetachProbeHook("GPSSystem/Tick", kGpsSystemTickRva); DetachProbeHook("JournalManager::TrackEntry impl", kJournalTrackEntryImplRva); if (kEnableVerboseJournalListenerHooks)