From 9a76e88987ca38cbc9509e6ce0b1498bfa8fcd50 Mon Sep 17 00:00:00 2001 From: Yauhen Pahrabniak Date: Mon, 7 Oct 2024 11:30:09 +0200 Subject: [PATCH] Revert "Merge Verify pickup weapon component is valid on creation (pr-2797)" This reverts commit a737e50cf92aa90b8fb616270310605ce86a92cd, reversing changes made to 9f4ea0e43cbc87e4ad4e1c889ca3d4b55106c071. --- .../src/CrashFixes.InvalidPickupCreation.cpp | 53 ------------------- 1 file changed, 53 deletions(-) diff --git a/code/components/gta-core-five/src/CrashFixes.InvalidPickupCreation.cpp b/code/components/gta-core-five/src/CrashFixes.InvalidPickupCreation.cpp index 06ab6bafaa..fee38eed92 100644 --- a/code/components/gta-core-five/src/CrashFixes.InvalidPickupCreation.cpp +++ b/code/components/gta-core-five/src/CrashFixes.InvalidPickupCreation.cpp @@ -3,7 +3,6 @@ #include #include #include -#include static void (*origCPedModelInfo__SetupPedBuoyancyInfo)(void* BuoyancyInfo, const void* pCapsuleInfo, const void* FragType, bool bIsWeightless); @@ -68,56 +67,4 @@ static HookFunction hookFunction([] // CPedModelInfo::SetupPedBuoyancyInfo doesn't check that FragType isn't null. origCPedModelInfo__SetupPedBuoyancyInfo = hook::trampoline(hook::get_call(hook::get_pattern("45 33 C9 4C 8B C0 48 8B D3 E8", 0x9)), &CPedModelInfo__SetupPedBuoyancyInfo); } - - // Not present on 1604 and we don't care about builds between 1604 and 2060 - if (xbr::IsGameBuildOrGreater<2060>()) - { - // Test for a valid weapon component info pointer before de-referencing it. - static struct : jitasm::Frontend - { - intptr_t retFail; - intptr_t retSuccess; - - void Init(intptr_t location) - { - retFail = location + 14; - retSuccess = location + 6; - } - - void InternalMain() override - { - test(rbx, rbx); // if ( rbx ) - jz("fail"); // { - // - // * original code // - mov(rax, qword_ptr[rbx]); // - // [run original code] - mov(rcx, rbx); // - // * original code END // - // - mov(rax, retSuccess); // - jmp(rax); // - // } - L("fail"); // - mov(rax, retFail); // - jmp(rax); // - } - - } patchStub; - - // mov rax, [rbx] - auto location = hook::get_pattern("7E ? 33 DB 48 8B 03", 4); - - patchStub.Init(reinterpret_cast(location)); - - /* - * nop: - * - * mov rax, [rbx] - * mov rcx, rbx - */ - hook::nop(location, 6); - - hook::jump_rcx(location, patchStub.GetCode()); - } });