Merge pull request #437 from diamante0018/abcdefg

[Console] Remove duped code
This commit is contained in:
Dss0 2022-08-15 17:36:32 +02:00 committed by GitHub
commit 6cba16b95a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 15 deletions

View File

@ -30,18 +30,6 @@ namespace Components
return Game::FS_GetFileList(path, extension, behavior, numfiles, allocTrackType); return Game::FS_GetFileList(path, extension, behavior, numfiles, allocTrackType);
} }
void Console::ToggleConsole()
{
// possibly cls.keyCatchers?
Utils::Hook::Xor<DWORD>(0xB2C538, 1);
// g_consoleField
Game::Field_Clear(reinterpret_cast<void*>(0xA1B6B0));
// show console output?
Utils::Hook::Set<BYTE>(0xA15F38, 0);
}
void Console::RefreshStatus() void Console::RefreshStatus()
{ {
const std::string mapname = (*Game::sv_mapname)->current.string; const std::string mapname = (*Game::sv_mapname)->current.string;
@ -569,6 +557,7 @@ namespace Components
Console::Console() Console::Console()
{ {
AssertOffset(Game::clientUIActive_t, connectionState, 0x9B8); AssertOffset(Game::clientUIActive_t, connectionState, 0x9B8);
AssertOffset(Game::clientUIActive_t, keyCatchers, 0x9B0);
// Console '%s: %s> ' string // Console '%s: %s> ' string
Utils::Hook::Set<const char*>(0x5A44B4, "IW4x MP: " VERSION "> "); Utils::Hook::Set<const char*>(0x5A44B4, "IW4x MP: " VERSION "> ");
@ -582,8 +571,8 @@ namespace Components
Utils::Hook::Set<BYTE>(0x431565, 0xEB); Utils::Hook::Set<BYTE>(0x431565, 0xEB);
// Internal console // Internal console
Utils::Hook(0x4F690C, Console::ToggleConsole, HOOK_CALL).install()->quick(); Utils::Hook(0x4F690C, Console::Con_ToggleConsole, HOOK_CALL).install()->quick();
Utils::Hook(0x4F65A5, Console::ToggleConsole, HOOK_JUMP).install()->quick(); Utils::Hook(0x4F65A5, Console::Con_ToggleConsole, HOOK_JUMP).install()->quick();
// Patch safearea for ingame-console // Patch safearea for ingame-console
Utils::Hook(0x5A50EF, Console::DrawSolidConsoleStub, HOOK_CALL).install()->quick(); Utils::Hook(0x5A50EF, Console::DrawSolidConsoleStub, HOOK_CALL).install()->quick();

View File

@ -63,7 +63,6 @@ namespace Components
static void StoreSafeArea(); static void StoreSafeArea();
static void RestoreSafeArea(); static void RestoreSafeArea();
static void ToggleConsole();
static char** GetAutoCompleteFileList(const char *path, const char *extension, Game::FsListBehavior_e behavior, int *numfiles, int allocTrackType); static char** GetAutoCompleteFileList(const char *path, const char *extension, Game::FsListBehavior_e behavior, int *numfiles, int allocTrackType);
static void Con_ToggleConsole(); static void Con_ToggleConsole();