From 28df9b651a4faf1c1ea57ac89d79a79b86c1fc2a Mon Sep 17 00:00:00 2001 From: INeedBots Date: Tue, 22 Dec 2020 22:15:48 -0600 Subject: [PATCH 1/2] [QuickPatch] Added G_Antilag dvar --- src/Components/Modules/QuickPatch.cpp | 61 +++++++++++++++++++++++++++ src/Components/Modules/QuickPatch.hpp | 4 ++ 2 files changed, 65 insertions(+) diff --git a/src/Components/Modules/QuickPatch.cpp b/src/Components/Modules/QuickPatch.cpp index 58b9bf64..b79bcdd0 100644 --- a/src/Components/Modules/QuickPatch.cpp +++ b/src/Components/Modules/QuickPatch.cpp @@ -183,6 +183,63 @@ namespace Components } } + Game::dvar_t* QuickPatch::g_antilag; + + __declspec(naked) void QuickPatch::ClientEventsFireWeaponStub() + { + __asm + { + // check g_antilag dvar value + mov eax, g_antilag; + cmp byte ptr[eax + 16], 1; + + // do antilag if 1 + je fireWeapon + + // do not do antilag if 0 + mov eax, 0x1A83554 // level.time + mov ecx, [eax] + + fireWeapon: + push edx + push ecx + push edi + mov eax, 0x4A4D50 // FireWeapon + call eax + add esp, 0Ch + pop edi + pop ecx + retn + } + } + + __declspec(naked) void QuickPatch::ClientEventsFireWeaponMeleeStub() + { + __asm + { + // check g_antilag dvar value + mov eax, g_antilag; + cmp byte ptr[eax + 16], 1; + + // do antilag if 1 + je fireWeaponMelee + + // do not do antilag if 0 + mov eax, 0x1A83554 // level.time + mov edx, [eax] + + fireWeaponMelee: + push edx + push edi + mov eax, 0x4F2470 // FireWeaponMelee + call eax + add esp, 8 + pop edi + pop ecx + retn + } + } + Game::dvar_t* QuickPatch::sv_enableBounces; __declspec(naked) void QuickPatch::BounceStub() { @@ -397,6 +454,10 @@ namespace Components g_playerEjection = Game::Dvar_RegisterBool("g_playerEjection", true, Game::DVAR_FLAG_REPLICATED, "Flag whether player ejection is on or off"); Utils::Hook(0x5D814A, QuickPatch::PlayerEjectionStub, HOOK_JUMP).install()->quick(); + g_antilag = Game::Dvar_RegisterBool("g_antilag", true, Game::DVAR_FLAG_REPLICATED, "Perform antilag"); + Utils::Hook(0x5D6D56, QuickPatch::ClientEventsFireWeaponStub, HOOK_JUMP).install()->quick(); + Utils::Hook(0x5D6D6A, QuickPatch::ClientEventsFireWeaponMeleeStub, HOOK_JUMP).install()->quick(); + // Disallow invalid player names Utils::Hook(0x401983, QuickPatch::InvalidNameStub, HOOK_JUMP).install()->quick(); diff --git a/src/Components/Modules/QuickPatch.hpp b/src/Components/Modules/QuickPatch.hpp index 9a9ef6e4..37402355 100644 --- a/src/Components/Modules/QuickPatch.hpp +++ b/src/Components/Modules/QuickPatch.hpp @@ -39,6 +39,10 @@ namespace Components static void SetAspectRatioStub(); static void SetAspectRatio(); + static Game::dvar_t* g_antilag; + static void ClientEventsFireWeaponStub(); + static void ClientEventsFireWeaponMeleeStub(); + static Game::dvar_t* g_playerCollision; static void PlayerCollisionStub(); static Game::dvar_t* g_playerEjection; From 7257245ad3cd202c851be852e6305763fc2731d7 Mon Sep 17 00:00:00 2001 From: INeedGames Date: Wed, 23 Dec 2020 16:08:02 -0600 Subject: [PATCH 2/2] Updated changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3dd8f68..3d47ae04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog v0.3.0](http://keepachangelog.com/en/0.3.0/) and this project adheres to [Semantic Versioning](http://semver.org/). -## [0.6.1] - 2020-12-22 +## [0.6.1] - 2020-12-23 ### Added @@ -30,6 +30,7 @@ The format is based on [Keep a Changelog v0.3.0](http://keepachangelog.com/en/0. - Add r_specularCustomMaps Dvar (#36) - Unlock safeArea_horizontal and safeArea_vertical Dvars (#42) - Unlock cg_fovscale Dvar (#47) +- Added g_antilag Dvar (#61) ### Changed