Skip to content

Commit

Permalink
tweak(gta-streaming-five): change patch location & assert
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniGP17 committed Feb 24, 2025
1 parent d00226b commit bea5663
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions code/components/gta-streaming-five/src/PatchSkeletonCrash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,10 @@ static HookFunction hookFunction([]()

virtual void InternalMain() override
{
mov(rax, qword_ptr[rdx+0x118]); // Original code
movsxd(r13, dword_ptr[rax+rcx*4]); // Original code
cmp(r13, -1); // Check if the index of the bone map is -1 that represents a invalid position
je("fail");
mov(rdx, qword_ptr[rcx+0xA0]); // Original code
mov(rax, this->retSuccess);
jmp(rax);
L("fail");
Expand All @@ -205,10 +206,11 @@ static HookFunction hookFunction([]()
}
} patchStub;

auto location = hook::get_pattern("48 8B 91 ? ? ? ? 48 8D 8D");
hook::nop(location, 7);
const auto successPtr = reinterpret_cast<intptr_t>(location) + 7;
const auto failPtr = successPtr + 19;
auto location = hook::get_pattern("48 8B 82 ? ? ? ? 4C 63 2C 88");
hook::nop(location, 11);
const auto successPtr = reinterpret_cast<intptr_t>(location) + 11;
const auto failPtr = reinterpret_cast<intptr_t>(hook::get_pattern("4C 8D 85 ? ? ? ? E8 ? ? ? ? 4C 8D 9C 24 ? ? ? ? 49 8B 5B ? 41 0F 28 73", 12));
assert((failPtr - reinterpret_cast<intptr_t>(location)) < 3000);
patchStub.Init(successPtr, failPtr);
hook::jump(location, patchStub.GetCode());
}
Expand Down

0 comments on commit bea5663

Please sign in to comment.