diff --git a/src/Components/Modules/QuickPatch.cpp b/src/Components/Modules/QuickPatch.cpp index d0c8a103..df633790 100644 --- a/src/Components/Modules/QuickPatch.cpp +++ b/src/Components/Modules/QuickPatch.cpp @@ -380,14 +380,6 @@ namespace Components } } - template std::function < T > ImportFunction(const std::string& dll, const std::string& function) - { - auto dllHandle = GetModuleHandleA(&dll[0]); - auto procAddr = GetProcAddress(dllHandle, &function[0]); - - return std::function < T >(reinterpret_cast(procAddr)); - } - QuickPatch::QuickPatch() { QuickPatch::FrameTime = 0; @@ -399,10 +391,10 @@ namespace Components // quit_hard Command::Add("quit_hard", [](Command::Params*) { - int data = false; - const Utils::Library ntdll("ntdll.dll"); - ntdll.invoke_pascal("RtlAdjustPrivilege", 19, true, false, &data); - ntdll.invoke_pascal("NtRaiseHardError", 0xC000007B, 0, nullptr, nullptr, 6, &data); + int data = false; + const Utils::Library ntdll("ntdll.dll"); + ntdll.invoke_pascal("RtlAdjustPrivilege", 19, true, false, &data); + ntdll.invoke_pascal("NtRaiseHardError", 0xC000007B, 0, nullptr, nullptr, 6, &data); }); // bounce dvar 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;