CGameServer::SetHibernating
0x001fda40 · 470 bytes · __thiscall
_ZN11CGameServer14SetHibernatingEb
Decompiled
undefined (2 params)
/* CGameServer::SetHibernating(bool) */
void __thiscall CGameServer::SetHibernating(CGameServer *this,bool param_1)
{
int *piVar1;
bool bVar2;
char cVar3;
uint uVar4;
char *pcVar5;
int iVar6;
if (this[0x2d379] == (CGameServer)param_1) {
return;
}
this[0x2d379] = (CGameServer)param_1;
pcVar5 = "Server is hibernating\n";
if (!param_1) {
pcVar5 = "Server waking up from hibernation\n";
}
Msg(pcVar5);
if (this[0x2d379] == (CGameServer)0x0) goto LAB_001fdb82;
iVar6 = 0;
if (0 < *(int *)(this + 0x120)) {
do {
while( true ) {
piVar1 = *(int **)(*(int *)(this + 0x114) + iVar6 * 4);
cVar3 = (**(code **)(*piVar1 + 0x78))(piVar1);
if (((cVar3 != '\0') && (cVar3 = (**(code **)(*piVar1 + 0x6c))(piVar1), cVar3 != '\0')) &&
(cVar3 = (**(code **)(*piVar1 + 0x94))(piVar1), cVar3 == '\0')) break;
iVar6 = iVar6 + 1;
if (*(int *)(this + 0x120) <= iVar6) goto LAB_001fdaf0;
}
iVar6 = iVar6 + 1;
(**(code **)(*piVar1 + 0x3c))(piVar1,"Punting bot, server is hibernating");
} while (iVar6 < *(int *)(this + 0x120));
}
LAB_001fdaf0:
(**(code **)(*(int *)this + 0x78))(this,0);
if (s_bExitWhenEmpty == '\0') {
if (*(int *)(sv_memlimit._28_4_ + 0x30) != 0) {
uVar4 = ApproximateProcessMemoryUsage();
iVar6 = *(int *)(sv_memlimit._28_4_ + 0x30);
if ((uint)(iVar6 << 0x14) < uVar4) {
uVar4 = ApproximateProcessMemoryUsage();
bVar2 = true;
Warning("Server shutting down because of using %dMB with an sv_memory_limit of %dMB\n",
uVar4 >> 0x14,iVar6);
goto LAB_001fdb1f;
}
}
bVar2 = false;
}
else {
bVar2 = true;
Warning("Server shutting down because sv_shutdown was done and a game has ended.\n");
}
LAB_001fdb1f:
if (0 < g_nForkID) {
syscall(0xfc,0);
}
if (bVar2) {
HostState_Shutdown();
}
ResetGameConVarsToDefaults();
ExecGameTypeCfg(this,(char *)(this + 0x10));
CBaseServer::SetReservationCookie(ZEXT48(this),(char *)0x0,"SetHibernating(true)");
*(undefined4 *)(this + 0x174) = 0;
LAB_001fdb82:
CBaseServer::UpdateGameType((CBaseServer *)this);
Heartbeat_f();
/* WARNING: Could not recover jumptable at 0x001fdbb0. Too many branches */
/* WARNING: Treating indirect jump as call */
(**(code **)(*serverGameDLL + 0x9c))();
return;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.