feat(Protection): fragment physics crash (#806)

Patch made by @SkiddyToast
This commit is contained in:
TheGreenBandit 2023-01-03 05:52:07 -05:00 committed by GitHub
parent b77e09065c
commit 858b4d6b9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 43 additions and 0 deletions

View File

@ -101,6 +101,9 @@ namespace big
detour_hook_helper::add<hooks::queue_dependency>("QD", g_pointers->m_queue_dependency);
detour_hook_helper::add<hooks::prepare_metric_for_sending>("PMFS", g_pointers->m_prepare_metric_for_sending);
detour_hook_helper::add<hooks::fragment_physics_crash>("FPC", g_pointers->m_fragment_physics_crash);
detour_hook_helper::add<hooks::fragment_physics_crash_2>("FPC2", g_pointers->m_fragment_physics_crash_2);
g_hooking = this;
}

View File

@ -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,

View File

@ -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<uintptr_t*>(a5 + 0x70); ptr)
if (auto ptr2 = *reinterpret_cast<uintptr_t*>(ptr + 8 * a2); !ptr2)
return false;
return g_hooking->get_original<hooks::fragment_physics_crash>()(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<hooks::fragment_physics_crash_2>()(a1, a2);
}
}

View File

@ -780,6 +780,18 @@ namespace big
m_prepare_metric_for_sending = ptr.as<PVOID>();
});
// 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<PVOID>();
});
// 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<PVOID>();
});
auto mem_region = memory::module("GTA5.exe");
main_batch.run(mem_region);

View File

@ -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{};