From 6edc483502c2cff6fd278072a5dc32ca57d29e40 Mon Sep 17 00:00:00 2001 From: Mr-X-GTA <110748953+Mr-X-GTA@users.noreply.github.com> Date: Fri, 29 Nov 2024 21:20:40 +0100 Subject: [PATCH] Fix early injection (#45) --- src/byte_patch_manager.cpp | 3 +++ src/gta_pointers.hpp | 2 ++ src/pointers.cpp | 9 +++++++++ 3 files changed, 14 insertions(+) diff --git a/src/byte_patch_manager.cpp b/src/byte_patch_manager.cpp index 6c53e629..d3200ffd 100644 --- a/src/byte_patch_manager.cpp +++ b/src/byte_patch_manager.cpp @@ -86,6 +86,9 @@ namespace big weapons::m_no_sway_patch = memory::byte_patch::make(g_pointers->m_gta.m_scope_sway_function, std::vector{0xEB}).get(); memory::byte_patch::make(g_pointers->m_gta.m_report_myself_sender, std::vector{0xC3})->apply(); + + // Patch BattlEye network bail + memory::byte_patch::make(g_pointers->m_gta.m_be_network_bail_patch, std::to_array({0xC3}))->apply(); } byte_patch_manager::byte_patch_manager() diff --git a/src/gta_pointers.hpp b/src/gta_pointers.hpp index 9fda7522..0f03da97 100644 --- a/src/gta_pointers.hpp +++ b/src/gta_pointers.hpp @@ -419,6 +419,8 @@ namespace big functions::get_last_keyboard_state m_get_last_keyboard_state; PVOID m_network_can_access_multiplayer; + + PVOID m_be_network_bail_patch; }; #pragma pack(pop) static_assert(sizeof(gta_pointers) % 8 == 0, "Pointers are not properly aligned"); diff --git a/src/pointers.cpp b/src/pointers.cpp index 29306d3c..b61a90da 100644 --- a/src/pointers.cpp +++ b/src/pointers.cpp @@ -1988,6 +1988,15 @@ namespace big { g_pointers->m_gta.m_network_can_access_multiplayer = ptr.add(10).rip().as(); } + }, + // BattlEye Network Bail Patch + { + "BENBP", + "83 25 ? ? ? ? 00 89 0D ? ? ? ? 85 C9", + [](memory::handle ptr) + { + g_pointers->m_gta.m_be_network_bail_patch = ptr.add(17).rip().add(1).rip().as(); + } } >(); // don't leave a trailing comma at the end