feat(Hooking/Pointers/TabOnline): Added disable chat censoring option

This commit is contained in:
Yimura 2020-12-31 02:22:12 +01:00
parent 0b312ecd1c
commit fe9d985d9e
No known key found for this signature in database
GPG Key ID: 3D8FF4397E768682
8 changed files with 26 additions and 3 deletions

View File

@ -9,6 +9,7 @@ namespace big::functions
using get_native_handler_t = rage::scrNativeHandler(*)(rage::scrNativeRegistrationTable*, rage::scrNativeHash); using get_native_handler_t = rage::scrNativeHandler(*)(rage::scrNativeRegistrationTable*, rage::scrNativeHash);
using fix_vectors_t = void(*)(rage::scrNativeCallContext*); using fix_vectors_t = void(*)(rage::scrNativeCallContext*);
using censor_chat = int(int64_t chat_menu, const char* user_text, const char** output_text);
using error_screen = void(char* entryHeader, char* entryLine1, int instructionalKey, char* entryLine2, BOOL p4, Any p5, Any* p6, Any* p7, BOOL background); using error_screen = void(char* entryHeader, char* entryLine1, int instructionalKey, char* entryLine2, BOOL p4, Any p5, Any* p6, Any* p7, BOOL background);
using increment_stat_event = bool(uint64_t net_event_struct, int64_t sender, int64_t a3); using increment_stat_event = bool(uint64_t net_event_struct, int64_t sender, int64_t a3);
using get_player_name = char*(Player player); using get_player_name = char*(Player player);

View File

@ -28,10 +28,11 @@ namespace big
{ {
if (ImGui::TreeNode("Self")) if (ImGui::TreeNode("Self"))
{ {
if (ImGui::Checkbox("Off-Radar", g_settings.options["off_radar"].get<bool*>())) if (ImGui::Checkbox("Disable Chat Censoring", g_settings.options["disable_chat_censoring"].get<bool*>()))
g_settings.save(); g_settings.save();
ImGui::SameLine(); if (ImGui::Checkbox("Off-Radar", g_settings.options["off_radar"].get<bool*>()))
g_settings.save();
if (ImGui::Checkbox("Reveal Players", g_settings.options["reveal_players"].get<bool*>())) if (ImGui::Checkbox("Reveal Players", g_settings.options["reveal_players"].get<bool*>()))
g_settings.save(); g_settings.save();

View File

@ -39,9 +39,10 @@ namespace big
m_run_script_threads_hook("Script hook", g_pointers->m_run_script_threads, &hooks::run_script_threads), m_run_script_threads_hook("Script hook", g_pointers->m_run_script_threads, &hooks::run_script_threads),
m_convert_thread_to_fiber_hook("ConvertThreadToFiber", memory::module("kernel32.dll").get_export("ConvertThreadToFiber").as<void*>(), &hooks::convert_thread_to_fiber), m_convert_thread_to_fiber_hook("ConvertThreadToFiber", memory::module("kernel32.dll").get_export("ConvertThreadToFiber").as<void*>(), &hooks::convert_thread_to_fiber),
m_censor_chat("Censor Chat", g_pointers->m_censor_chat, &hooks::censor_chat),
m_error_screen_hook("Disable Warning/Error Screen", g_pointers->m_error_screen, &hooks::error_screen), 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_increment_stat_hook("Increment Stat Event", g_pointers->m_increment_stat_event, &hooks::increment_stat_event),
m_script_event_hook("Script Event Handler hook", 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_swapchain_hook.hook(hooks::swapchain_present_index, &hooks::swapchain_present); m_swapchain_hook.hook(hooks::swapchain_present_index, &hooks::swapchain_present);
m_swapchain_hook.hook(hooks::swapchain_resizebuffers_index, &hooks::swapchain_resizebuffers); m_swapchain_hook.hook(hooks::swapchain_resizebuffers_index, &hooks::swapchain_resizebuffers);

View File

@ -22,6 +22,7 @@ namespace big
static BOOL set_cursor_pos(int x, int y); static BOOL set_cursor_pos(int x, int y);
// New Hook Definitions // New Hook Definitions
static int censor_chat(int64_t chat_menu, const char* user_text, const char** output_text);
static void error_screen(char* entryHeader, char* entryLine1, int instructionalKey, char* entryLine2, BOOL p4, Any p5, Any* p6, Any* p7, BOOL background); 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, int64_t sender, int64_t a3);
static bool script_event_handler(std::int64_t NetEventStruct, std::int64_t CNetGamePlayer); static bool script_event_handler(std::int64_t NetEventStruct, std::int64_t CNetGamePlayer);
@ -55,6 +56,7 @@ namespace big
detour_hook m_convert_thread_to_fiber_hook; detour_hook m_convert_thread_to_fiber_hook;
// New Detour Hook Definitions // New Detour Hook Definitions
detour_hook m_censor_chat;
detour_hook m_error_screen_hook; detour_hook m_error_screen_hook;
detour_hook m_increment_stat_hook; detour_hook m_increment_stat_hook;
detour_hook m_script_event_hook; detour_hook m_script_event_hook;

View File

@ -0,0 +1,11 @@
#include "hooking.hpp"
namespace big
{
int hooks::censor_chat(int64_t chat_menu, const char* user_text, const char** output_text)
{
if (g_settings.options["disable_chat_censoring"].get<bool>()) return -1;
return g_hooking->m_censor_chat.get_original<decltype(&hooks::censor_chat)>()(chat_menu, user_text, output_text);
}
}

View File

@ -112,6 +112,11 @@ namespace big
{ {
m_spectate_player = ptr.as<decltype(m_spectate_player)>(); m_spectate_player = ptr.as<decltype(m_spectate_player)>();
}); });
main_batch.add("Censor Chat", "E8 ? ? ? ? 83 F8 FF 75 B9", [this](memory::handle ptr)
{
m_censor_chat = ptr.as<decltype(m_censor_chat)>();
});
main_batch.run(memory::module(nullptr)); main_batch.run(memory::module(nullptr));

View File

@ -35,6 +35,7 @@ namespace big
PVOID m_model_spawn_bypass; PVOID m_model_spawn_bypass;
functions::censor_chat* m_censor_chat{};
functions::error_screen* m_error_screen{}; functions::error_screen* m_error_screen{};
functions::get_player_name* m_get_player_name{}; functions::get_player_name* m_get_player_name{};
functions::increment_stat_event* m_increment_stat_event{}; functions::increment_stat_event* m_increment_stat_event{};

View File

@ -13,6 +13,7 @@ namespace big
nlohmann::json options; nlohmann::json options;
nlohmann::json default_options = nlohmann::json default_options =
R"({ R"({
"disable_chat_censoring": false,
"god_mode": false, "god_mode": false,
"join_message": false, "join_message": false,
"never_wanted": false, "never_wanted": false,