From a6b7a11af1b0fe23aec8f1ef023b1f128889f420 Mon Sep 17 00:00:00 2001 From: Federico Cecchetto Date: Fri, 20 May 2022 00:05:51 +0200 Subject: [PATCH] Console changes + colors --- src/client/component/auth.cpp | 6 ------ src/client/component/colors.cpp | 23 ++++++++++++++++++----- src/client/component/console.cpp | 6 +++--- src/client/component/fastfiles.cpp | 2 +- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/client/component/auth.cpp b/src/client/component/auth.cpp index 6b19fb87..a337cacd 100644 --- a/src/client/component/auth.cpp +++ b/src/client/component/auth.cpp @@ -243,12 +243,6 @@ namespace auth // kill "disconnected from steam" error utils::hook::nop(0x1D61DF_b, 0x11); - /*utils::hook::nop(0x1D6193_b, 103); // STEAM - utils::hook::nop(0x60153_b, 0x60426 - 0x60153); // STEAM - utils::hook::nop(0x603E1_b, 0x60426 - 0x603E1); // STEAM - utils::hook::nop(0x1D7553_b, 0x1D7587 - 0x1D7553); // STEAM MAYBE `1401D7553` ON FIRST - utils::hook::nop(0x1D7A82_b, 0x1D7AC8 - 0x1D7A82); // STEAM*/ - utils::hook::jump(0x1CAE70_b, get_direct_connect_stub(), true); utils::hook::jump(0x12D426_b, get_send_connect_data_stub(), true); diff --git a/src/client/component/colors.cpp b/src/client/component/colors.cpp index 1487675b..84e2025f 100644 --- a/src/client/component/colors.cpp +++ b/src/client/component/colors.cpp @@ -147,17 +147,30 @@ namespace colors if (!game::environment::is_sp()) { // allows colored name in-game - utils::hook::jump(0x5AEDF0_b, com_clean_name_stub); // 1.15 + utils::hook::jump(0x5AEDF0_b, com_clean_name_stub, true); // don't apply colors to overhead names - utils::hook::call(0xF7B85_b, get_client_name_stub); // 1.15 + utils::hook::jump(0xF7B6A_b, utils::hook::assemble([](utils::hook::assembler& a) + { + a.lea(rax, qword_ptr(rbp, -0x10)); + a.mov(dword_ptr(rsp, 0x28), 0xB); + a.mov(r9d, 0x20); + a.mov(qword_ptr(rsp, 0x20), rax); + a.lea(r8, qword_ptr(rbp)); + + a.pushad64(); + a.call_aligned(get_client_name_stub); + a.popad64(); + + a.jmp(0xF7B8A_b); + }), true); // patch I_CleanStr - utils::hook::jump(0x5AF2E0_b, i_clean_str_stub); // 1.15 + utils::hook::jump(0x5AF2E0_b, i_clean_str_stub, true); } // force new colors - utils::hook::jump(SELECT_VALUE(0x0, 0x6C9460_b), rb_lookup_color_stub); // 1.15 + utils::hook::jump(SELECT_VALUE(0x0, 0x6C9460_b), rb_lookup_color_stub, true); // add colors add(0, 0, 0); // 0 - Black @@ -179,4 +192,4 @@ namespace colors }; } -//REGISTER_COMPONENT(colors::component) +REGISTER_COMPONENT(colors::component) diff --git a/src/client/component/console.cpp b/src/client/component/console.cpp index b0430888..a54b60ee 100644 --- a/src/client/component/console.cpp +++ b/src/client/component/console.cpp @@ -6,6 +6,7 @@ #include "command.hpp" #include +#include namespace game_console { @@ -32,9 +33,8 @@ namespace console void dispatch_message(const int type, const std::string& message) { - printf("%s\n", message.data()); - - //game_console::print(type, message); + printf(message.data()); + game_console::print(type, message); } void print(const int type, const char* fmt, ...) diff --git a/src/client/component/fastfiles.cpp b/src/client/component/fastfiles.cpp index f7fb38c5..bfb64af9 100644 --- a/src/client/component/fastfiles.cpp +++ b/src/client/component/fastfiles.cpp @@ -18,7 +18,7 @@ namespace fastfiles void db_try_load_x_file_internal(const char* zone_name, const int flags) { - printf("Loading fastfile %s\n", zone_name); + console::info("Loading fastfile %s\n", zone_name); current_fastfile.access([&](std::string& fastfile) { fastfile = zone_name;