From 21b47530cf90dbf6e30107df8ed87be95d864299 Mon Sep 17 00:00:00 2001 From: Diavolo Date: Thu, 7 Apr 2022 22:39:38 +0200 Subject: [PATCH] Small fix --- src/module/patches.cpp | 4 ++++ src/module/test_clients.cpp | 13 ++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/module/patches.cpp b/src/module/patches.cpp index 0318517..f9b0e49 100644 --- a/src/module/patches.cpp +++ b/src/module/patches.cpp @@ -49,6 +49,10 @@ private: { // Skip call to queryserverinfo handler in SV_ConnectionlessPacket utils::hook::nop(0x4FE051, 5); + + // Disable callvote/vote exploit + utils::hook::nop(0x47EB9D, 5); + utils::hook::nop(0x47EBC9, 5); } static __declspec(noreturn) void long_jump_stub(jmp_buf buf, const int value) noexcept(false) diff --git a/src/module/test_clients.cpp b/src/module/test_clients.cpp index dc05d3d..092b07a 100644 --- a/src/module/test_clients.cpp +++ b/src/module/test_clients.cpp @@ -93,12 +93,12 @@ game::native::gentity_s* test_clients::sv_add_test_client() void test_clients::spawn() { - auto* ent = test_clients::sv_add_test_client(); + const auto* ent = test_clients::sv_add_test_client(); - if (ent == nullptr) - return; - - game::native::Scr_AddEntityNum(ent->s.number, 0); + if (ent != nullptr) + { + game::native::Scr_AddEntityNum(ent->s.number, 0); + } } void test_clients::scr_shutdown_system_mp_stub(unsigned char sys) @@ -178,6 +178,9 @@ void test_clients::patch_mp() utils::hook(0x50C147, &test_clients::scr_shutdown_system_mp_stub, HOOK_CALL).install()->quick(); // G_ShutdownGame utils::hook(0x57BBF9, &test_clients::reset_reliable_mp, HOOK_CALL).install()->quick(); // SV_SendMessageToClient utils::hook(0x576DCC, &test_clients::check_timeouts_stub_mp, HOOK_JUMP).install()->quick(); // SV_CheckTimeouts + + // Replace nullsubbed gsc func "GScr_AddTestClient" with our spawn + utils::hook::set(0x8AC8DC, test_clients::spawn); } REGISTER_MODULE(test_clients);