From b3cf4d9057c8ddf588f2a9543a11ed3b7d79ec42 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Tue, 11 Aug 2026 09:03:27 -0400 Subject: long to nint Signed-off-by: Andrew Opalach --- Plugin.cs | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/Plugin.cs b/Plugin.cs index c1d7baf..c2ee00d 100755 --- a/Plugin.cs +++ b/Plugin.cs @@ -48,7 +48,6 @@ using SharpPluginLoader.Core.Configuration; // - Open Poses Menu // @TODO: -// - Unchecked nint overflow ntol. // - Cleanup math. // - pCamera refactor. // - Attempt to document all test cases I can think of. @@ -185,6 +184,8 @@ namespace NewCamera #endif } + private static nint lton(long l) { unchecked { return (nint)l; } } + private static byte ByteFlag(bool f) { return f ? (byte)0x1 : (byte)0x0; } private bool disableMod = false; @@ -743,16 +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(new nint(0x140256A3F) + 0x6, [0x1]); - zoneStateForcePassive2 = new Patch(new nint(0x141AC2865) + 0x6, [0x1]); - zoneStateForceCombat1 = new Patch(new nint(0x141AC2938) + 0x6, [0x0]); - zoneStateForceCombat2 = new Patch(new nint(0x141AC28EC) + 0x6, [0x0]); + 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 procEnvironmentCollision = new NativeAction(0x141F737D0); @@ -766,7 +768,7 @@ namespace NewCamera // @TODO: Pick camera functions out of the upper function (they happen in immediate succession). // Place where we can check camera state early. - IntPtr addr = PatternScanner.FindFirst(Pattern.FromString("40 53 48 81 EC 80 00 00 00 8B 81 B0 17 00 00 48 8B D9 85 C0 ?? ??")); + nint addr = PatternScanner.FindFirst(Pattern.FromString("40 53 48 81 EC 80 00 00 00 8B 81 B0 17 00 00 48 8B D9 85 C0 ?? ??")); Assert(addr == 0x141FA11A0); // nint setCameraHook = Hook.Create(addr, SetCameraHook); @@ -862,18 +864,18 @@ namespace NewCamera noopCharacterFade.Enable(); } - underwaterCamera1 = new Patch(new nint(0x1412AD54D), [0x90, 0x90, 0x90, 0x90, 0x90, 0x90]); // Nop "Is diving" check. - underwaterCamera2 = new Patch(new nint(0x1412AD571), [0xB1, 0x01, 0x28, 0xC1, 0x90, 0x90, 0x90]); // Make cl the inverse of al. - underwaterCamera3 = new Patch(new nint(0x141FA5A7E), [0x90, 0x90]); // Nop check. - underwaterCamera4 = new Patch(new nint(0x141FA5BA0), [0x40, 0x84, 0xF6, 0x90, 0x74]); // jae -> je. - underwaterCamera5 = new Patch(new nint(0x141FA5A74), [0x0F, 0x57, 0xF6, 0x31, 0xD2, 0x48, 0x8D, 0x4D, 0x80, 0xE8, 0x9E, 0x41, 0x38, 0xFE, 0xC1, 0xE8, 0x14, 0x66, 0x25, 0xD8, 0x03, 0xFF, 0xC8, 0x66, 0x3D, 0x48, 0x00, 0x77]); - nullifyDofCoc = new Patch(new nint(0x1424236DD), [0x0F, 0x57, 0xF6, 0x90, 0x90, 0x90, 0x90]); + underwaterCamera1 = new Patch(lton(0x1412AD54D), [0x90, 0x90, 0x90, 0x90, 0x90, 0x90]); // Nop "Is diving" check. + underwaterCamera2 = new Patch(lton(0x1412AD571), [0xB1, 0x01, 0x28, 0xC1, 0x90, 0x90, 0x90]); // Make cl the inverse of al. + underwaterCamera3 = new Patch(lton(0x141FA5A7E), [0x90, 0x90]); // Nop check. + underwaterCamera4 = new Patch(lton(0x141FA5BA0), [0x40, 0x84, 0xF6, 0x90, 0x74]); // jae -> je. + underwaterCamera5 = new Patch(lton(0x141FA5A74), [0x0F, 0x57, 0xF6, 0x31, 0xD2, 0x48, 0x8D, 0x4D, 0x80, 0xE8, 0x9E, 0x41, 0x38, 0xFE, 0xC1, 0xE8, 0x14, 0x66, 0x25, 0xD8, 0x03, 0xFF, 0xC8, 0x66, 0x3D, 0x48, 0x00, 0x77]); + nullifyDofCoc = new Patch(lton(0x1424236DD), [0x0F, 0x57, 0xF6, 0x90, 0x90, 0x90, 0x90]); underwaterCheckHook = Hook.Create(0x1412AD500, UnderwaterCheckHook); // nint getSaveSlotGuiAddr = new NativeFunction(0x141AC0B60); getPlayerSettingsAddr = new NativeFunction(0x141B8DBB0); - forceDisableIK = new Patch(new nint(0x14031FD40), [0xC6, 0x81, 0x81, 0x01, 0x00, 0x00, 0x00, 0xC3]); + forceDisableIK = new Patch(lton(0x14031FD40), [0xC6, 0x81, 0x81, 0x01, 0x00, 0x00, 0x00, 0xC3]); // Alt: 0x141FBC7A0 (model - 0x958) updateJointsHook = Hook.Create(0x14223BA30, UpdateJointsHook); @@ -888,14 +890,14 @@ namespace NewCamera */ // Player + ECCC = How far underwater is the player. - jmpOverHotSpringsEval = new Patch(new nint(0x1417C1B03), [0xEB]); - jmpOverHotSpringsSteam = new Patch(new nint(0x14203A494), [0xE9, 0x8D, 0x00, 0x00, 0x00, 0x90]); + jmpOverHotSpringsEval = new Patch(lton(0x1417C1B03), [0xEB]); + jmpOverHotSpringsSteam = new Patch(lton(0x14203A494), [0xE9, 0x8D, 0x00, 0x00, 0x00, 0x90]); refreshEntityParamsHook = Hook.Create(0x141F605F0, RefreshEntityParamsHook); // nint, nint - noopPlayerWetnessUpdate = new Patch(new nint(0x14203E893), [0x90, 0x90, 0x90, 0x90, 0x90]); - jmpOverChangeEquipmentWetnessUpdate_1 = new Patch(new nint(0x14203E310), [0xEB]); // je -> jmp. - jmpOverChangeEquipmentWetnessUpdate_2 = new Patch(new nint(0x14203E397), [0xE9, 0xB9, 0x00, 0x00, 0x00, 0x90]); // je -> jmp. + noopPlayerWetnessUpdate = new Patch(lton(0x14203E893), [0x90, 0x90, 0x90, 0x90, 0x90]); + jmpOverChangeEquipmentWetnessUpdate_1 = new Patch(lton(0x14203E310), [0xEB]); // je -> jmp. + jmpOverChangeEquipmentWetnessUpdate_2 = new Patch(lton(0x14203E397), [0xE9, 0xB9, 0x00, 0x00, 0x00, 0x90]); // je -> jmp. // Noop collision checks. addr = PatternScanner.FindFirst(Pattern.FromString("F3 0F 11 06 F3 0F 10 48 04 F3 0F 58 4E 04 F3 0F 11 4E 04 F3 0F 10 40 08 F3 0F 58 46 08 F3 0F 11 46 08 44 8B AF E0 0B 00 00")); -- cgit v1.2.3-101-g0448