Skip to content

Commit

Permalink
ChaosMod: Various fixes for recent game builds (#3697)
Browse files Browse the repository at this point in the history
- #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
  • Loading branch information
holysnipz authored Jan 21, 2025
1 parent 7a88b7d commit 37ba7f5
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
18 changes: 14 additions & 4 deletions ChaosMod/ChaosMod.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion ChaosMod/Memory/Drawing.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ namespace Memory
}

AllocateDrawRect = handle.At(0x56).Into().Get<char *(void *)>();
SetDrawRectCoords = handle.At(0x92).Into().Get<void(void *, float, float, float, float)>();

auto offsetSDC = getGameVersion() < eGameVersion::VER_1_0_3407_0 ? 0x92 : 0x97;
SetDrawRectCoords = handle.At(offsetSDC).Into().Get<void(void *, float, float, float, float)>();

drawRects = handle.At(0x32).Into().Get<char>();
drawRectsSize = handle.At(0x2C).Value<int>();
Expand Down
2 changes: 1 addition & 1 deletion ChaosMod/Memory/Hooks/MiscHooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions vendor/scripthookv/inc/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down

0 comments on commit 37ba7f5

Please sign in to comment.