From a5fea429b660354f3c5be972a077da98b002d78a Mon Sep 17 00:00:00 2001 From: Diavolo Date: Mon, 15 Aug 2022 17:25:20 +0200 Subject: [PATCH] [Console] Remove duplicate code --- src/Components/Modules/Console.cpp | 17 +++-------------- src/Components/Modules/Console.hpp | 1 - 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/Components/Modules/Console.cpp b/src/Components/Modules/Console.cpp index 4b02bcb9..9fc90446 100644 --- a/src/Components/Modules/Console.cpp +++ b/src/Components/Modules/Console.cpp @@ -30,18 +30,6 @@ namespace Components return Game::FS_GetFileList(path, extension, behavior, numfiles, allocTrackType); } - void Console::ToggleConsole() - { - // possibly cls.keyCatchers? - Utils::Hook::Xor(0xB2C538, 1); - - // g_consoleField - Game::Field_Clear(reinterpret_cast(0xA1B6B0)); - - // show console output? - Utils::Hook::Set(0xA15F38, 0); - } - void Console::RefreshStatus() { const std::string mapname = (*Game::sv_mapname)->current.string; @@ -569,6 +557,7 @@ namespace Components Console::Console() { AssertOffset(Game::clientUIActive_t, connectionState, 0x9B8); + AssertOffset(Game::clientUIActive_t, keyCatchers, 0x9B0); // Console '%s: %s> ' string Utils::Hook::Set(0x5A44B4, "IW4x MP: " VERSION "> "); @@ -582,8 +571,8 @@ namespace Components Utils::Hook::Set(0x431565, 0xEB); // Internal console - Utils::Hook(0x4F690C, Console::ToggleConsole, HOOK_CALL).install()->quick(); - Utils::Hook(0x4F65A5, Console::ToggleConsole, HOOK_JUMP).install()->quick(); + Utils::Hook(0x4F690C, Console::Con_ToggleConsole, HOOK_CALL).install()->quick(); + Utils::Hook(0x4F65A5, Console::Con_ToggleConsole, HOOK_JUMP).install()->quick(); // Patch safearea for ingame-console Utils::Hook(0x5A50EF, Console::DrawSolidConsoleStub, HOOK_CALL).install()->quick(); diff --git a/src/Components/Modules/Console.hpp b/src/Components/Modules/Console.hpp index baee794c..774631bd 100644 --- a/src/Components/Modules/Console.hpp +++ b/src/Components/Modules/Console.hpp @@ -63,7 +63,6 @@ namespace Components static void StoreSafeArea(); static void RestoreSafeArea(); - static void ToggleConsole(); static char** GetAutoCompleteFileList(const char *path, const char *extension, Game::FsListBehavior_e behavior, int *numfiles, int allocTrackType); static void Con_ToggleConsole();