Merge branch 'main' into main

This commit is contained in:
ASillyNeko 2026-08-06 00:24:19 -07:00 committed by GitHub
commit 8e5e1f1a02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 40 additions and 0 deletions

View file

@ -139,6 +139,7 @@ add_library(
"server/servernethooks.cpp"
"server/serverpresence.cpp"
"server/serverpresence.h"
"server/idlekick.cpp"
"shared/exploit_fixes/exploitfixes.cpp"
"shared/exploit_fixes/exploitfixes_lzss.cpp"
"shared/exploit_fixes/exploitfixes_utf8parser.cpp"

View file

@ -0,0 +1,39 @@
#include "core/convar/convar.h"
#include "dedicated/dedicated.h"
#include "silver-bun/module.h"
ConVar* Cvar_idleKickLocal_enable;
ON_DLL_LOAD("server.dll", IdleKick, (CModule module))
{
// Jump over the check for match_useMatchmaking in the function that handles idling
module.Offset(0x157e68).Patch("EB 17 90 90 90 90 90 90 90 90");
// Skip the first player (local player) in the idle kick function
if (!IsDedicatedServer())
CModule("server.dll").Offset(0x157ea6).Patch("BF 02");
Cvar_idleKickLocal_enable = new ConVar(
"idleKickLocal_enable",
"0",
FCVAR_GAMEDLL,
"Enables/disables whether the local player would get kicked or not; doesn't work on dedicated servers",
false,
0,
false,
0,
[](ConVar* cvar, const char* pOldValue, float flOldValue)
{
NOTE_UNUSED(cvar);
NOTE_UNUSED(pOldValue);
NOTE_UNUSED(flOldValue);
if (IsDedicatedServer())
return;
// Toggles if the first player would get skipped in the idle kick function
if (Cvar_idleKickLocal_enable->GetBool())
CModule("server.dll").Offset(0x157ea6).Patch("BF 01");
else
CModule("server.dll").Offset(0x157ea6).Patch("BF 02");
});
}