diff --git a/src/hooking.cpp b/src/hooking.cpp index c4c918c7..9eea3dfe 100644 --- a/src/hooking.cpp +++ b/src/hooking.cpp @@ -65,6 +65,7 @@ namespace big detour_hook_helper::add("IMCD", g_pointers->m_invalid_mods_crash_detour); detour_hook_helper::add("CAC", g_pointers->m_constraint_attachment_crash); + detour_hook_helper::add("IDC", g_pointers->m_invalid_decal_crash); detour_hook_helper::add("UPAI", g_pointers->m_update_presence_attribute_int); detour_hook_helper::add("UPAS", g_pointers->m_update_presence_attribute_string); diff --git a/src/hooking.hpp b/src/hooking.hpp index 47c1e63d..3631c45e 100644 --- a/src/hooking.hpp +++ b/src/hooking.hpp @@ -99,6 +99,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 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/invalid_decal.cpp b/src/hooks/protections/invalid_decal.cpp new file mode 100644 index 00000000..c75612f1 --- /dev/null +++ b/src/hooks/protections/invalid_decal.cpp @@ -0,0 +1,16 @@ +#include "hooking.hpp" + +namespace big +{ + uint64_t hooks::invalid_decal(uintptr_t a1, int a2) + { + if (a1 && a2 == 2) + //*(*(*(a1 + 0x48) + 0x30) + 0x2C8) + if (const auto ptr = *reinterpret_cast((a1 + 0x48)); ptr) + if (const auto ptr2 = *reinterpret_cast((ptr + 0x30)); ptr2) + if (*reinterpret_cast(ptr2 + 0x2C8) == 0) + return 0; + + return g_hooking->get_original()(a1, a2); + } +} \ No newline at end of file diff --git a/src/pointers.cpp b/src/pointers.cpp index c5c68eeb..4ad258cd 100644 --- a/src/pointers.cpp +++ b/src/pointers.cpp @@ -665,11 +665,18 @@ namespace big m_read_bitbuffer_gamer_handle = ptr.as(); }); + // Constraint Attachment Crash main_batch.add("CAC", "40 53 48 83 EC 20 48 8B D9 48 8B 49 38 48 8B 01", [this](memory::handle ptr) { m_constraint_attachment_crash = ptr.as(); }); + // Invalid Decal Crash + main_batch.add("IDC", "E8 ? ? ? ? 8B 9C 24 B8 00 00 00 4C 8B AC 24 A8 00 00 00", [this](memory::handle ptr) + { + m_invalid_decal_crash = 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 37190b0e..fb9f932e 100644 --- a/src/pointers.hpp +++ b/src/pointers.hpp @@ -149,6 +149,7 @@ namespace big PVOID m_invalid_mods_crash_detour{}; PVOID m_constraint_attachment_crash{}; + PVOID m_invalid_decal_crash{}; int64_t** m_send_chat_ptr{}; functions::send_chat_message m_send_chat_message{};