diff --git a/src/hooking.cpp b/src/hooking.cpp index f31e60b7..1eb98b75 100644 --- a/src/hooking.cpp +++ b/src/hooking.cpp @@ -60,6 +60,8 @@ namespace big detour_hook_helper::add("FMFS", g_pointers->m_format_metric_for_sending); + detour_hook_helper::add("IMCD", g_pointers->m_invalid_mods_crash_detour); + g_hooking = this; } diff --git a/src/hooking.hpp b/src/hooking.hpp index 988cf971..5e12759e 100644 --- a/src/hooking.hpp +++ b/src/hooking.hpp @@ -65,6 +65,8 @@ namespace big static void write_player_gamer_data_node(rage::netObject* player, CPlayerGamerDataNode* node); static bool write_player_game_state_data_node(rage::netObject* player, CPlayerGameStateDataNode* node); + + static void invalid_mods_crash_detour(int64_t a1, int64_t a2, int a3, char a4); }; class minhook_keepalive diff --git a/src/hooks/protections/invalid_mods_crash_detour.cpp b/src/hooks/protections/invalid_mods_crash_detour.cpp new file mode 100644 index 00000000..ebfae26d --- /dev/null +++ b/src/hooks/protections/invalid_mods_crash_detour.cpp @@ -0,0 +1,11 @@ +#include "hooking.hpp" + +namespace big +{ + void hooks::invalid_mods_crash_detour(int64_t a1, int64_t a2, int a3, char a4) + { + if(!*(int64_t*)(a1 + 0xD8)) + return; + g_hooking->get_original()(a1, a2, a3, a4); + } +} \ No newline at end of file diff --git a/src/pointers.cpp b/src/pointers.cpp index e260ba87..d66c6748 100644 --- a/src/pointers.cpp +++ b/src/pointers.cpp @@ -398,12 +398,6 @@ namespace big m_fipackfile_unmount = ptr.add(1).rip().as(); }); - // fidevice unmount - main_batch.add("FPFUM", "E8 ? ? ? ? 84 C0 74 37 80 3D", [this](memory::handle ptr) - { - m_fipackfile_unmount = ptr.add(1).rip().as(); - }); - // game version + online version main_batch.add("GVOV", "8B C3 33 D2 C6 44 24 20", [this](memory::handle ptr) { @@ -411,6 +405,12 @@ namespace big m_online_version = ptr.add(0x24).rip().add(0x20).as(); }); + // Invalid Mods Crash Detour + main_batch.add("IMCD", "E8 ? ? ? ? 40 88 7C 24 ? 49 89 9C 24", [this](memory::handle ptr) + { + m_invalid_mods_crash_detour = ptr.add(1).rip().as(); + }); + // Format Metric For Sending main_batch.add("FMFS", "48 8B C4 48 89 58 ? 48 89 70 ? 48 89 78 ? 4C 89 70 ? 55 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 48 83 3D", [this](memory::handle ptr) { diff --git a/src/pointers.hpp b/src/pointers.hpp index 73dca85f..6d3dcb1a 100644 --- a/src/pointers.hpp +++ b/src/pointers.hpp @@ -132,6 +132,8 @@ namespace big const char* m_game_version; const char* m_online_version; + + PVOID m_invalid_mods_crash_detour{}; }; inline pointers* g_pointers{};