Better minicon patch

This commit is contained in:
Diavolo 2022-06-04 19:07:45 +02:00
parent db51c06a12
commit d2f72b465c
No known key found for this signature in database
GPG Key ID: FA77F074E98D98A5
2 changed files with 14 additions and 11 deletions

View File

@ -229,6 +229,16 @@ namespace Components
}
}
Game::dvar_t* QuickPatch::Dvar_RegisterConMinicon(const char* dvarName, [[maybe_unused]] bool value, unsigned __int16 flags, const char* description)
{
#ifdef _DEBUG
constexpr auto value_ = true;
#else
constexpr auto value_ = false;
#endif
return Game::Dvar_RegisterBool(dvarName, value_, flags, description);
}
QuickPatch::QuickPatch()
{
// Filtering any mapents that is intended for Spec:Ops gamemode (CODO) and prevent them from spawning
@ -251,6 +261,8 @@ namespace Components
Utils::Hook(0x51B13B, QuickPatch::Dvar_RegisterAspectRatioDvar, HOOK_CALL).install()->quick();
Utils::Hook(0x5063F3, QuickPatch::SetAspectRatioStub, HOOK_JUMP).install()->quick();
Utils::Hook(0x4FA448, QuickPatch::Dvar_RegisterConMinicon, HOOK_CALL).install()->quick();
// Make sure preDestroy is called when the game shuts down
Scheduler::OnShutdown(Loader::PreDestroy);
@ -705,17 +717,6 @@ namespace Components
// Disable cheat protection for dvars
Utils::Hook::Set<BYTE>(0x647682, 0xEB);
// Constantly draw the mini console
Utils::Hook::Set<BYTE>(0x412A45, 0xEB);
Scheduler::OnFrame([]()
{
if (*reinterpret_cast<Game::Font_s**>(0x62E4BAC))
{
Game::Con_DrawMiniConsole(0, 2, 4, (Game::CL_IsCgameInitialized() ? 1.0f : 0.4f));
}
}, true);
#else
// Remove missing tag message
Utils::Hook::Nop(0x4EBF1A, 5);

View File

@ -27,5 +27,7 @@ namespace Components
static void CL_KeyEvent_OnEscape();
static void CL_KeyEvent_ConsoleEscape_Stub();
static Game::dvar_t* Dvar_RegisterConMinicon(const char* dvarName, bool value, unsigned __int16 flags, const char* description);
};
}