diff --git a/src/Components/Modules/QuickPatch.cpp b/src/Components/Modules/QuickPatch.cpp index da2b9e1e..08b41fcf 100644 --- a/src/Components/Modules/QuickPatch.cpp +++ b/src/Components/Modules/QuickPatch.cpp @@ -163,6 +163,34 @@ namespace Components } } + Game::dvar_t* QuickPatch::sv_enableBounces; + __declspec(naked) void QuickPatch::BounceStub() + { + __asm + { + // check the value of sv_enableBounces + push eax; + mov eax, sv_enableBounces; + cmp byte ptr[eax + 16], 1; + pop eax; + + // always bounce if sv_enableBounces is set to 1 + je bounce; + + // original code + cmp dword ptr[esp + 24h], 0; + jnz dontBounce; + + bounce: + push 0x004B1B34; + retn; + + dontBounce: + push 0x004B1B48; + retn; + } + } + QuickPatch::QuickPatch() { QuickPatch::FrameTime = 0; @@ -171,6 +199,10 @@ namespace Components QuickPatch::FrameTime = Game::Sys_Milliseconds(); }); + // bounce dvar + sv_enableBounces = Game::Dvar_RegisterBool("sv_enableBounces", false, Game::DVAR_FLAG_REPLICATED, "Dasfonia is a meme"); + Utils::Hook(0x4B1B2D, QuickPatch::BounceStub, 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 3f7abd3e..7b07d545 100644 --- a/src/Components/Modules/QuickPatch.hpp +++ b/src/Components/Modules/QuickPatch.hpp @@ -27,7 +27,10 @@ namespace Components static void JavelinResetHookStub(); - static bool QuickPatch::InvalidNameCheck(char *dest, char *source, int size); - static void QuickPatch::InvalidNameStub(); + static bool InvalidNameCheck(char *dest, char *source, int size); + static void InvalidNameStub(); + + static Game::dvar_t* sv_enableBounces; + static void BounceStub(); }; }