feat(protection): vehicle parachute crashes (#1022)

CTaskParachuteObject_0x270 crash
This commit is contained in:
Aure7138 2023-02-24 00:14:44 +08:00 committed by GitHub
parent 6b6dabfeba
commit 9056f5aba1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 0 deletions

View File

@ -59,6 +59,7 @@ namespace big
detour_hook_helper::add<hooks::invalid_mods_crash_detour>("IMCD", g_pointers->m_invalid_mods_crash_detour);
detour_hook_helper::add<hooks::constraint_attachment_crash>("CAC", g_pointers->m_constraint_attachment_crash);
detour_hook_helper::add<hooks::invalid_decal>("IDC", g_pointers->m_invalid_decal_crash);
detour_hook_helper::add<hooks::task_parachute_object_0x270>("TPO270", g_pointers->m_task_parachute_object_0x270);
detour_hook_helper::add<hooks::update_presence_attribute_int>("UPAI", g_pointers->m_update_presence_attribute_int);
detour_hook_helper::add<hooks::update_presence_attribute_string>("UPAS", g_pointers->m_update_presence_attribute_string);

View File

@ -102,6 +102,7 @@ namespace big
static void invalid_mods_crash_detour(int64_t a1, int64_t a2, int a3, char a4);
static std::int64_t constraint_attachment_crash(std::uintptr_t a1);
static uint64_t invalid_decal(uintptr_t a1, int a2);
static uint64_t task_parachute_object_0x270(uint64_t _this, int a2, int a3);
static bool update_presence_attribute_int(void* presence_data, int profile_index, char* attr, std::uint64_t value);
static bool update_presence_attribute_string(void* presence_data, int profile_index, char* attr, char* value);

View File

@ -0,0 +1,17 @@
#include "hooking.hpp"
namespace big
{
uint64_t hooks::task_parachute_object_0x270(uint64_t _this, int a2, int a3)
{
if (a2 == 1 && a3 == 1) // enter crash func
{
if (auto ptr = *(uint64_t*)(_this + 16))
if (auto ptr2 = *(uint64_t*)(ptr + 80))
if (auto ptr3 = *(uint64_t*)(ptr2 + 64))
return g_hooking->get_original<hooks::task_parachute_object_0x270>()(_this, a2, a3);
return 0;
}
return g_hooking->get_original<hooks::task_parachute_object_0x270>()(_this, a2, a3);
}
}

View File

@ -665,6 +665,12 @@ namespace big
m_invalid_decal_crash = ptr.add(1).rip().as<PVOID>();
});
// Task Parachute Object 0x270
main_batch.add("TPO270", "0F 88 ? ? ? ? 75 34", [this](memory::handle ptr)
{
m_task_parachute_object_0x270 = ptr.sub(6).as<PVOID>();
});
// Encode Session Info
main_batch.add("ESI", "E8 ? ? ? ? C6 83 94 01 00 00 01", [this](memory::handle ptr)
{

View File

@ -150,6 +150,7 @@ namespace big
PVOID m_invalid_mods_crash_detour{};
PVOID m_constraint_attachment_crash{};
PVOID m_invalid_decal_crash{};
PVOID m_task_parachute_object_0x270{};
int64_t** m_send_chat_ptr{};
functions::send_chat_message m_send_chat_message{};