From 37ba7f54850f69a7bc5a57a2517d10e28d12caa9 Mon Sep 17 00:00:00 2001 From: holysnipz <9103583+holysnipz@users.noreply.github.com> Date: Wed, 22 Jan 2025 05:06:57 +0700 Subject: [PATCH] ChaosMod: Various fixes for recent game builds (#3697) - #3687 was caused by pattern in `MiscHooks.cpp` return 2 results since build 3337 (IIRC), so i just added extra byte in to make sure - Fixed crash caused by shifted offset in DrawLine in game builds 3407-3411 - Marked support for newer builds for FiveM --- ChaosMod/ChaosMod.rc | 18 ++++++++++++++---- ChaosMod/Memory/Drawing.h | 4 +++- ChaosMod/Memory/Hooks/MiscHooks.cpp | 2 +- vendor/scripthookv/inc/main.h | 20 ++++++++++++++++++++ 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/ChaosMod/ChaosMod.rc b/ChaosMod/ChaosMod.rc index d1113d89b..4584f314c 100644 --- a/ChaosMod/ChaosMod.rc +++ b/ChaosMod/ChaosMod.rc @@ -20,20 +20,30 @@ END FX_ASI_BUILD 2699 BEGIN -"\0" + "\0" END FX_ASI_BUILD 2802 BEGIN -"\0" + "\0" END FX_ASI_BUILD 2944 BEGIN -"\0" + "\0" END FX_ASI_BUILD 3095 BEGIN -"\0" + "\0" +END + +FX_ASI_BUILD 3258 +BEGIN + "\0" +END + +FX_ASI_BUILD 3407 +BEGIN + "\0" END \ No newline at end of file diff --git a/ChaosMod/Memory/Drawing.h b/ChaosMod/Memory/Drawing.h index 14ae94952..d6b37adba 100644 --- a/ChaosMod/Memory/Drawing.h +++ b/ChaosMod/Memory/Drawing.h @@ -32,7 +32,9 @@ namespace Memory } AllocateDrawRect = handle.At(0x56).Into().Get(); - SetDrawRectCoords = handle.At(0x92).Into().Get(); + + auto offsetSDC = getGameVersion() < eGameVersion::VER_1_0_3407_0 ? 0x92 : 0x97; + SetDrawRectCoords = handle.At(offsetSDC).Into().Get(); drawRects = handle.At(0x32).Into().Get(); drawRectsSize = handle.At(0x2C).Value(); diff --git a/ChaosMod/Memory/Hooks/MiscHooks.cpp b/ChaosMod/Memory/Hooks/MiscHooks.cpp index 5e9f19aba..ef75a8b77 100644 --- a/ChaosMod/Memory/Hooks/MiscHooks.cpp +++ b/ChaosMod/Memory/Hooks/MiscHooks.cpp @@ -20,7 +20,7 @@ static bool OnHook() { Handle handle; - handle = Memory::FindPattern("E8 ? ? ? ? 4D 03 F5"); + handle = Memory::FindPattern("E8 ? ? ? ? 4D 03 F5 48"); if (!handle.IsValid()) LOG("crSkeleton::GetGlobalMtx not found!"); else diff --git a/vendor/scripthookv/inc/main.h b/vendor/scripthookv/inc/main.h index f027de84f..8f7503d4c 100644 --- a/vendor/scripthookv/inc/main.h +++ b/vendor/scripthookv/inc/main.h @@ -242,6 +242,26 @@ enum eGameVersion : int VER_1_0_2944_0, + VER_1_0_3028_0, + + VER_1_0_3095_0, + + VER_1_0_3179_0, + + VER_1_0_3258_0, + + VER_1_0_3274_0, + + VER_1_0_3323_0, + + VER_1_0_3337_0, + + VER_1_0_3351_0, + + VER_1_0_3407_0, + + VER_1_0_3411_0, + VER_SIZE, VER_UNK = -1 };