Added bounce dvar

This commit is contained in:
RektInator 2019-01-21 00:44:49 +01:00
parent a1385f0a33
commit 3130dd37e7
2 changed files with 37 additions and 2 deletions

View File

@ -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();

View File

@ -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();
};
}