From a2566fbb188c47a7a70874e95de757ca4a5f9a34 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Tue, 11 Aug 2026 10:12:33 -0400 Subject: Always use SetZoneStateHook() Signed-off-by: Andrew Opalach --- Config.cs | 6 +++--- Plugin.cs | 13 ++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Config.cs b/Config.cs index 07e3cf4..28031b0 100755 --- a/Config.cs +++ b/Config.cs @@ -1,4 +1,4 @@ -#define SIMPLE_KEYBOARD_LAYER +#define MOUSE_AND_KEYBOARD_LAYER using SharpPluginLoader.Core.Configuration; using SharpPluginLoader.Core.IO; @@ -50,7 +50,7 @@ namespace NewCamera EnableCombo = true; FreeCameraCombo = "RStick,LT"; DisableComboButton1UnlessButton2Held = false; -#if SIMPLE_KEYBOARD_LAYER +#if MOUSE_AND_KEYBOARD_LAYER EnableMouse = true; MouseSensitivity = 0.0225f; EnableKeyboard = true; @@ -61,7 +61,7 @@ namespace NewCamera public bool EnableCombo { get; set; } public String FreeCameraCombo { get; set; } public bool DisableComboButton1UnlessButton2Held { get; set; } -#if SIMPLE_KEYBOARD_LAYER +#if MOUSE_AND_KEYBOARD_LAYER public bool EnableMouse { get; set; } public float MouseSensitivity { get; set; } public bool EnableKeyboard { get; set; } diff --git a/Plugin.cs b/Plugin.cs index c2ee00d..2070add 100755 --- a/Plugin.cs +++ b/Plugin.cs @@ -146,7 +146,7 @@ namespace NewCamera public static bool InitFromLoadedInstance() { #if QUARANTINED_FEATURES - Instance = IPlugin.GetInstance(PluginName); + //Instance = IPlugin.GetInstance(PluginName); #endif return Instance != null; } @@ -620,8 +620,6 @@ namespace NewCamera private NativeAction setZoneState; private NativeAction setPlayerController1; private NativeAction setPlayerController5; - private delegate void ZoneStateDelegate(nint player, int flags); - private Hook? setZoneStateHook; private bool zoneStateManualInvoke = false; private bool forcePassiveInCombatZone = false; private Patch zoneStateForcePassive1; @@ -630,6 +628,8 @@ namespace NewCamera private Patch zoneStateForceCombat1; private Patch zoneStateForceCombat2; #endif + private delegate void ZoneStateDelegate(nint player, int flags); + private Hook? setZoneStateHook; private bool allowHotSpringsAnywhere = false; private Patch jmpOverHotSpringsEval; @@ -744,18 +744,17 @@ namespace NewCamera getViewParamOffset = new NativeFunction(0x14136E6C0); - // @TODO: This doesn't preserve wetness if QUARANTINED_FEATURES is off. #if QUARANTINED_FEATURES // MonsterHunterWorld.exe+20354F7 - call MonsterHunterWorld.exe+1F73850 setZoneState = new NativeAction(0x142035020); setPlayerController1 = new NativeAction(0x141F73850); setPlayerController5 = new NativeAction(0x14118DDC0); - setZoneStateHook = Hook.Create(0x142035020, SetZoneStateHook); // nint, int zoneStateForcePassive1 = new Patch(lton(0x140256A3F) + 0x6, [0x1]); zoneStateForcePassive2 = new Patch(lton(0x141AC2865) + 0x6, [0x1]); zoneStateForceCombat1 = new Patch(lton(0x141AC2938) + 0x6, [0x0]); zoneStateForceCombat2 = new Patch(lton(0x141AC28EC) + 0x6, [0x0]); #endif + setZoneStateHook = Hook.Create(0x142035020, SetZoneStateHook); // nint, int procEnvironmentCollision = new NativeAction(0x141F737D0); psuedoObject1 = (nint)NativeMemory.AllocZeroed(0x7C); @@ -2525,7 +2524,6 @@ namespace NewCamera collisionCheckHook!.Original(unknownPtr, unknownPtr2); } -#if QUARANTINED_FEATURES private void SetZoneStateHook(nint player, int flags) { if (disableMod) @@ -2538,6 +2536,7 @@ namespace NewCamera debugLog($"SetZoneStateHook(0x{player:X}, 0x{flags:X}) @ {frameTick}"); #endif +#if QUARANTINED_FEATURES nint zoneStateAddr = MemoryUtil.Read(0x1451C42B8); ref byte zoneState = ref MemoryUtil.GetRef(zoneStateAddr + 0xD2EA); if (!zoneStateManualInvoke) @@ -2554,6 +2553,7 @@ namespace NewCamera { zoneState = ByteFlag(overrideZoneState == ZoneState.Hub); } +#endif float headWet = 0.0f, bodyWet = 0.0f, waistWet = 0.0f, legsWet = 0.0f; nint wetnessAddr = player + 0x13BD0; @@ -2575,7 +2575,6 @@ namespace NewCamera MemoryUtil.GetRef(wetnessAddr + 0x78) = legsWet; } } -#endif private void RefreshEntityParamsHook(nint entity, nint unknownPtr2) { -- cgit v1.2.3-101-g0448