diff --git a/src/hooking.cpp b/src/hooking.cpp index ceada7ca..914143c6 100644 --- a/src/hooking.cpp +++ b/src/hooking.cpp @@ -101,6 +101,9 @@ namespace big detour_hook_helper::add("QD", g_pointers->m_queue_dependency); detour_hook_helper::add("PMFS", g_pointers->m_prepare_metric_for_sending); + detour_hook_helper::add("FPC", g_pointers->m_fragment_physics_crash); + detour_hook_helper::add("FPC2", g_pointers->m_fragment_physics_crash_2); + g_hooking = this; } diff --git a/src/hooking.hpp b/src/hooking.hpp index 45c778ba..163b17ed 100644 --- a/src/hooking.hpp +++ b/src/hooking.hpp @@ -66,6 +66,9 @@ namespace big static void network_player_mgr_init(CNetworkPlayerMgr* _this, std::uint64_t a2, std::uint32_t a3, std::uint32_t a4[4]); static void network_player_mgr_shutdown(CNetworkPlayerMgr* _this); + static bool fragment_physics_crash(uintptr_t a1, uint32_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5); + static bool fragment_physics_crash_2(float* a1, float* a2); + static void received_event( rage::netEventMgr* event_manager, CNetGamePlayer* source_player, diff --git a/src/hooks/protections/fragment_physics_crash.cpp b/src/hooks/protections/fragment_physics_crash.cpp new file mode 100644 index 00000000..6a727984 --- /dev/null +++ b/src/hooks/protections/fragment_physics_crash.cpp @@ -0,0 +1,21 @@ +#include "hooking.hpp" + +namespace big +{ + bool hooks::fragment_physics_crash(uintptr_t a1, uint32_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5) + { + if (auto ptr = *reinterpret_cast(a5 + 0x70); ptr) + if (auto ptr2 = *reinterpret_cast(ptr + 8 * a2); !ptr2) + return false; + + return g_hooking->get_original()(a1, a2, a3, a4, a5); + } + + bool hooks::fragment_physics_crash_2(float* a1, float* a2) + { + if (!a1 || !a2) + return false; + + return g_hooking->get_original()(a1, a2); + } +} \ No newline at end of file diff --git a/src/pointers.cpp b/src/pointers.cpp index dea6090a..c7847147 100644 --- a/src/pointers.cpp +++ b/src/pointers.cpp @@ -780,6 +780,18 @@ namespace big m_prepare_metric_for_sending = ptr.as(); }); + // Fragment Physics Crash + main_batch.add("FPC", "E8 ? ? ? ? 44 8B 4D 1C", [this](memory::handle ptr) + { + m_fragment_physics_crash = ptr.add(1).rip().as(); + }); + + // Fragment Physics Crash 2 + main_batch.add("FPC2", "E8 ? ? ? ? 84 C0 75 0B 41 FF CF", [this](memory::handle ptr) + { + m_fragment_physics_crash_2 = ptr.add(1).rip().as(); + }); + auto mem_region = memory::module("GTA5.exe"); main_batch.run(mem_region); diff --git a/src/pointers.hpp b/src/pointers.hpp index 2b98ce74..a5206cde 100644 --- a/src/pointers.hpp +++ b/src/pointers.hpp @@ -227,6 +227,10 @@ namespace big functions::sync_network_time m_sync_network_time; rage::rlGamerInfo* m_chat_gamer_info; + + PVOID m_fragment_physics_crash; + PVOID m_fragment_physics_crash_2; + }; inline pointers* g_pointers{};