From dd6e9450fc0d81317553f23ad95ec140b23fed2f Mon Sep 17 00:00:00 2001 From: FireFox101889 <87771170+FireFox101889@users.noreply.github.com> Date: Wed, 26 Oct 2022 15:38:01 -0400 Subject: [PATCH] feat(session): disable sent chat messages being filtered (#525) --- BigBaseV2/src/core/globals.hpp | 1 + BigBaseV2/src/function_types.hpp | 2 ++ BigBaseV2/src/hooking.cpp | 5 +++++ BigBaseV2/src/hooking.hpp | 2 ++ .../src/hooks/misc/multiplayer_chat_filter.cpp | 13 +++++++++++++ BigBaseV2/src/pointers.cpp | 6 ++++++ BigBaseV2/src/pointers.hpp | 1 + BigBaseV2/src/views/network/view_session.cpp | 6 ++++++ 8 files changed, 36 insertions(+) create mode 100644 BigBaseV2/src/hooks/misc/multiplayer_chat_filter.cpp diff --git a/BigBaseV2/src/core/globals.hpp b/BigBaseV2/src/core/globals.hpp index 8bb7ec70..210fd7ec 100644 --- a/BigBaseV2/src/core/globals.hpp +++ b/BigBaseV2/src/core/globals.hpp @@ -175,6 +175,7 @@ namespace big } custom_time; bool join_queued = false; rage::rlSessionInfo info; + bool disable_chat_filter = false; }; struct settings { diff --git a/BigBaseV2/src/function_types.hpp b/BigBaseV2/src/function_types.hpp index 71f762b3..33fb5371 100644 --- a/BigBaseV2/src/function_types.hpp +++ b/BigBaseV2/src/function_types.hpp @@ -14,6 +14,8 @@ namespace big::functions using ptr_to_handle = Entity(*)(void* entity); using get_script_handle_t = uint64_t(*)(int64_t); + + using multiplayer_chat_filter = int(__int64 chat_type, const char* input, const char** output); using get_gameplay_cam_coords = Vector3(*)(); diff --git a/BigBaseV2/src/hooking.cpp b/BigBaseV2/src/hooking.cpp index bb11178a..e9768db1 100644 --- a/BigBaseV2/src/hooking.cpp +++ b/BigBaseV2/src/hooking.cpp @@ -25,6 +25,9 @@ namespace big // Get Label Text m_get_label_text("GLT", g_pointers->m_get_label_text, &hooks::get_label_text), + + // Multiplayer chat filter + m_multiplayer_chat_filter("MCF", g_pointers->m_multiplayer_chat_filter, &hooks::multiplayer_chat_filter), // GTA Thead Start m_gta_thread_start_hook("GTS", g_pointers->m_gta_thread_start, &hooks::gta_thread_start), @@ -79,6 +82,7 @@ namespace big m_run_script_threads_hook.enable(); m_get_label_text.enable(); + m_multiplayer_chat_filter.enable(); m_gta_thread_start_hook.enable(); m_gta_thread_kill_hook.enable(); m_network_group_override.enable(); @@ -115,6 +119,7 @@ namespace big m_network_group_override.disable(); m_gta_thread_kill_hook.disable(); m_gta_thread_start_hook.disable(); + m_multiplayer_chat_filter.disable(); m_get_label_text.disable(); m_run_script_threads_hook.disable(); diff --git a/BigBaseV2/src/hooking.hpp b/BigBaseV2/src/hooking.hpp index ca447957..0c415f56 100644 --- a/BigBaseV2/src/hooking.hpp +++ b/BigBaseV2/src/hooking.hpp @@ -26,6 +26,7 @@ namespace big static LRESULT wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); static const char* get_label_text(void* unk, const char* label); + static int multiplayer_chat_filter(__int64 chat_type, const char* input, const char** output); static GtaThread* gta_thread_start(unsigned int** a1, unsigned int a2); static rage::eThreadState gta_thread_kill(GtaThread* thread); @@ -98,6 +99,7 @@ namespace big detour_hook m_run_script_threads_hook; detour_hook m_get_label_text; + detour_hook m_multiplayer_chat_filter; detour_hook m_gta_thread_start_hook; detour_hook m_gta_thread_kill_hook; diff --git a/BigBaseV2/src/hooks/misc/multiplayer_chat_filter.cpp b/BigBaseV2/src/hooks/misc/multiplayer_chat_filter.cpp new file mode 100644 index 00000000..5924625b --- /dev/null +++ b/BigBaseV2/src/hooks/misc/multiplayer_chat_filter.cpp @@ -0,0 +1,13 @@ +#include "hooking.hpp" + +namespace big +{ + int hooks::multiplayer_chat_filter(__int64 chat_type, const char* input, const char** output) + { + if (g->session.disable_chat_filter) + { + return -1; + } + return g_hooking->m_multiplayer_chat_filter.get_original()(chat_type, input, output); + } +} diff --git a/BigBaseV2/src/pointers.cpp b/BigBaseV2/src/pointers.cpp index 6c3301ef..77a9d005 100644 --- a/BigBaseV2/src/pointers.cpp +++ b/BigBaseV2/src/pointers.cpp @@ -328,6 +328,12 @@ namespace big { m_get_label_text = ptr.sub(19).as(); }); + + // Multiplayer chat filter + main_batch.add("MCF", "E8 ? ? ? ? 83 F8 FF 75 B9", [this](memory::handle ptr) + { + m_multiplayer_chat_filter = ptr.add(1).rip().as(); + }); // Network main_batch.add("N", "48 8B 0D ? ? ? ? 48 8B D7 E8 ? ? ? ? 84 C0 75 17 48 8B 0D ? ? ? ? 48 8B D7", [this](memory::handle ptr) diff --git a/BigBaseV2/src/pointers.hpp b/BigBaseV2/src/pointers.hpp index 47798a96..c6d8f0b8 100644 --- a/BigBaseV2/src/pointers.hpp +++ b/BigBaseV2/src/pointers.hpp @@ -50,6 +50,7 @@ namespace big PVOID m_native_return; PVOID m_network_group_override; PVOID m_get_label_text; + functions::multiplayer_chat_filter* m_multiplayer_chat_filter{}; FriendRegistry* m_friend_registry{}; diff --git a/BigBaseV2/src/views/network/view_session.cpp b/BigBaseV2/src/views/network/view_session.cpp index 9765a3a7..4ccc5a30 100644 --- a/BigBaseV2/src/views/network/view_session.cpp +++ b/BigBaseV2/src/views/network/view_session.cpp @@ -25,5 +25,11 @@ namespace big } ImGui::EndListBox(); } + if (ImGui::TreeNode("Chat")) + { + ImGui::Checkbox("Disable Filter", &g->session.disable_chat_filter); + + ImGui::TreePop(); + } } }