From 97032e9d464425ff49da3f367c419eea1dc7deae Mon Sep 17 00:00:00 2001 From: Diavolo Date: Sun, 18 Jul 2021 20:51:33 +0200 Subject: [PATCH] Quit f --- src/Components/Modules/ZoneBuilder.cpp | 11 +---------- src/Components/Modules/ZoneBuilder.hpp | 1 - src/Game/Functions.cpp | 1 + src/Game/Functions.hpp | 3 +++ 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/Components/Modules/ZoneBuilder.cpp b/src/Components/Modules/ZoneBuilder.cpp index 1031d654..be9004f5 100644 --- a/src/Components/Modules/ZoneBuilder.cpp +++ b/src/Components/Modules/ZoneBuilder.cpp @@ -844,7 +844,7 @@ namespace Components Command::Add("quit", [](Command::Params*) { - ZoneBuilder::Quit(); + Game::Com_Quitf_t(); }); Command::Add("error", [](Command::Params*) @@ -921,12 +921,6 @@ namespace Components return 0; } - void ZoneBuilder::Quit() - { - //TerminateProcess(GetCurrentProcess(), 0); - ExitProcess(0); - } - void ZoneBuilder::HandleError(int level, const char* format, ...) { char buffer[256] = { 0 }; @@ -1088,9 +1082,6 @@ namespace Components // set new entry point Utils::Hook(0x4513DA, ZoneBuilder::EntryPoint, HOOK_JUMP).install()->quick(); - // set quit handler - Utils::Hook(0x4D4000, ZoneBuilder::Quit, HOOK_JUMP).install()->quick(); - // handle com_error calls Utils::Hook(0x4B22D0, ZoneBuilder::HandleError, HOOK_JUMP).install()->quick(); diff --git a/src/Components/Modules/ZoneBuilder.hpp b/src/Components/Modules/ZoneBuilder.hpp index d35ec63e..8b0c12f0 100644 --- a/src/Components/Modules/ZoneBuilder.hpp +++ b/src/Components/Modules/ZoneBuilder.hpp @@ -138,7 +138,6 @@ namespace Components static std::string FindMaterialByTechnique(const std::string& name); static int __stdcall EntryPoint(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int /*nShowCmd*/); - static void Quit(); static void HandleError(int level, const char* format, ...); static void SoftErrorAssetOverflow(); diff --git a/src/Game/Functions.cpp b/src/Game/Functions.cpp index 14af16f0..cb4a819f 100644 --- a/src/Game/Functions.cpp +++ b/src/Game/Functions.cpp @@ -65,6 +65,7 @@ namespace Game Com_Parse_t Com_Parse = Com_Parse_t(0x474D60); Com_MatchToken_t Com_MatchToken = Com_MatchToken_t(0x447130); Com_SetSlowMotion_t Com_SetSlowMotion = Com_SetSlowMotion_t(0x446E20); + Com_Quitf_t Com_Quit_f = Com_Quitf_t(0x4D4000); Con_DrawMiniConsole_t Con_DrawMiniConsole = Con_DrawMiniConsole_t(0x464F30); Con_DrawSolidConsole_t Con_DrawSolidConsole = Con_DrawSolidConsole_t(0x5A5040); diff --git a/src/Game/Functions.hpp b/src/Game/Functions.hpp index 53d5b1f6..eaf3d6d1 100644 --- a/src/Game/Functions.hpp +++ b/src/Game/Functions.hpp @@ -130,6 +130,9 @@ namespace Game typedef void(__cdecl * Com_SetSlowMotion_t)(float start, float end, int duration); extern Com_SetSlowMotion_t Com_SetSlowMotion; + typedef void(__cdecl * Com_Quitf_t)(); + extern Com_Quitf_t Com_Quit_f; + typedef char* (__cdecl * Con_DrawMiniConsole_t)(int localClientNum, int xPos, int yPos, float alpha); extern Con_DrawMiniConsole_t Con_DrawMiniConsole;