From ae742543be954a80b1bd532b9be3e69716586069 Mon Sep 17 00:00:00 2001 From: Yimura Date: Fri, 29 Jan 2021 18:56:17 +0100 Subject: [PATCH] feat(Hooks): Added snend net info to lobby hook --- BigBaseV2/src/hooking.cpp | 3 ++- BigBaseV2/src/hooking.hpp | 4 +++- BigBaseV2/src/hooks/send_net_info_to_lobby.cpp | 12 ++++++++++++ BigBaseV2/src/pointers.cpp | 5 +++++ BigBaseV2/src/pointers.hpp | 1 + 5 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 BigBaseV2/src/hooks/send_net_info_to_lobby.cpp diff --git a/BigBaseV2/src/hooking.cpp b/BigBaseV2/src/hooking.cpp index 54fff776..53985a07 100644 --- a/BigBaseV2/src/hooking.cpp +++ b/BigBaseV2/src/hooking.cpp @@ -42,7 +42,8 @@ namespace big m_get_event_data("Get Event Data", g_pointers->m_get_event_data, &hooks::get_event_data), m_error_screen_hook("Disable Warning/Error Screen", g_pointers->m_error_screen, &hooks::error_screen), m_increment_stat_hook("Increment Stat Event", g_pointers->m_increment_stat_event, &hooks::increment_stat_event), - m_script_event_hook("Script Event Handler", g_pointers->m_script_event_handler, &hooks::script_event_handler) + m_script_event_hook("Script Event Handler", g_pointers->m_script_event_handler, &hooks::script_event_handler), + m_send_net_info_to_lobby_hook("Send Net Info to Lobby", g_pointers->m_send_net_info_to_lobby, &hooks::send_net_info_to_lobby) { m_swapchain_hook.hook(hooks::swapchain_present_index, &hooks::swapchain_present); m_swapchain_hook.hook(hooks::swapchain_resizebuffers_index, &hooks::swapchain_resizebuffers); diff --git a/BigBaseV2/src/hooking.hpp b/BigBaseV2/src/hooking.hpp index 233c51d8..5975892d 100644 --- a/BigBaseV2/src/hooking.hpp +++ b/BigBaseV2/src/hooking.hpp @@ -24,8 +24,9 @@ namespace big // New Hook Definitions static bool get_event_data(int32_t eventGroup, int32_t eventIndex, int64_t* args, uint32_t argCount); static void error_screen(char* entryHeader, char* entryLine1, int instructionalKey, char* entryLine2, BOOL p4, Any p5, Any* p6, Any* p7, BOOL background); - static bool increment_stat_event(uint64_t net_event_struct, int64_t sender, int64_t a3); + static bool increment_stat_event(uint64_t net_event_struct, CNetGamePlayer* sender, int64_t a3); static bool script_event_handler(std::int64_t NetEventStruct, std::int64_t CNetGamePlayer); + static bool send_net_info_to_lobby(rage::netPlayerData* local_player, int64_t a2, int64_t a3, DWORD* a4); }; struct minhook_keepalive @@ -60,6 +61,7 @@ namespace big detour_hook m_error_screen_hook; detour_hook m_increment_stat_hook; detour_hook m_script_event_hook; + detour_hook m_send_net_info_to_lobby_hook; }; inline hooking *g_hooking{}; diff --git a/BigBaseV2/src/hooks/send_net_info_to_lobby.cpp b/BigBaseV2/src/hooks/send_net_info_to_lobby.cpp new file mode 100644 index 00000000..646c0378 --- /dev/null +++ b/BigBaseV2/src/hooks/send_net_info_to_lobby.cpp @@ -0,0 +1,12 @@ +#include "hooking.hpp" + +namespace big +{ + bool hooks::send_net_info_to_lobby(rage::netPlayerData* local_player, int64_t a2, int64_t a3, DWORD* a4) + { + const char name[20] = "How dare you!"; + memcpy(local_player->m_name, name, sizeof(name)); + + return g_hooking->m_send_net_info_to_lobby_hook.get_original()(local_player, a2, a3, a4); + } +} \ No newline at end of file diff --git a/BigBaseV2/src/pointers.cpp b/BigBaseV2/src/pointers.cpp index 90a39d42..cc46d14f 100644 --- a/BigBaseV2/src/pointers.cpp +++ b/BigBaseV2/src/pointers.cpp @@ -132,6 +132,11 @@ namespace big { m_ptr_to_handle = ptr.as(); }); + + main_batch.add("Send Info To Lobby", "44 8D 47 78 48 8D 54 24 ? 48 8B CB E8", [this](memory::handle ptr) + { + m_send_net_info_to_lobby = ptr.add(13).rip().as(); + }); main_batch.run(memory::module(nullptr)); diff --git a/BigBaseV2/src/pointers.hpp b/BigBaseV2/src/pointers.hpp index 03489f9b..bb789359 100644 --- a/BigBaseV2/src/pointers.hpp +++ b/BigBaseV2/src/pointers.hpp @@ -36,6 +36,7 @@ namespace big IDXGISwapChain **m_swapchain{}; PVOID m_model_spawn_bypass; + PVOID m_send_net_info_to_lobby; functions::error_screen* m_error_screen{}; functions::get_event_data* m_get_event_data{};