From 9056f5aba1c8f045801db7b27c7b4dab44eba30e Mon Sep 17 00:00:00 2001 From: Aure7138 <100095051+Aure7138@users.noreply.github.com> Date: Fri, 24 Feb 2023 00:14:44 +0800 Subject: [PATCH] feat(protection): vehicle parachute crashes (#1022) CTaskParachuteObject_0x270 crash --- src/hooking.cpp | 1 + src/hooking.hpp | 1 + .../protections/task_parachute_object_0x270.cpp | 17 +++++++++++++++++ src/pointers.cpp | 6 ++++++ src/pointers.hpp | 1 + 5 files changed, 26 insertions(+) create mode 100644 src/hooks/protections/task_parachute_object_0x270.cpp diff --git a/src/hooking.cpp b/src/hooking.cpp index 5b736667..756bae11 100644 --- a/src/hooking.cpp +++ b/src/hooking.cpp @@ -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); diff --git a/src/hooking.hpp b/src/hooking.hpp index a91d5938..00646b97 100644 --- a/src/hooking.hpp +++ b/src/hooking.hpp @@ -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); diff --git a/src/hooks/protections/task_parachute_object_0x270.cpp b/src/hooks/protections/task_parachute_object_0x270.cpp new file mode 100644 index 00000000..9faa8fd2 --- /dev/null +++ b/src/hooks/protections/task_parachute_object_0x270.cpp @@ -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); + } +} \ No newline at end of file diff --git a/src/pointers.cpp b/src/pointers.cpp index 8192a76d..21d07f9e 100644 --- a/src/pointers.cpp +++ b/src/pointers.cpp @@ -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) { diff --git a/src/pointers.hpp b/src/pointers.hpp index e0ce455e..8775e7f8 100644 --- a/src/pointers.hpp +++ b/src/pointers.hpp @@ -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{};