CGameServer::InitMaxClients
0x001fbe80 · 440 bytes · __thiscall
_ZN11CGameServer14InitMaxClientsEv
Decompiled
undefined (1 param)
/* CGameServer::InitMaxClients() */
void __thiscall CGameServer::InitMaxClients(CGameServer *this)
{
char cVar1;
int *piVar2;
undefined4 ****ppppuVar3;
undefined4 ****ppppuVar4;
int local_18;
undefined4 ***local_14;
undefined4 ***local_10;
local_18 = 1;
local_14 = (undefined4 ****)0x20;
local_10 = (undefined4 ***)&DAT_00000001;
if (serverGameClients != (undefined4 *)0x0) {
ppppuVar3 = &local_14;
(**(code **)*serverGameClients)(serverGameClients,&local_18,ppppuVar3,&local_10);
if (local_18 < 1) {
Sys_Error("GetPlayerLimits: min maxplayers must be >= 1 (%i)",local_18);
}
else if ((int)local_10 < 1) {
Sys_Error("GetPlayerLimits: default maxplayers must be >= 1 (%i)",local_18);
}
if (((int)local_14 < local_18) || ((int)local_14 < (int)local_10)) {
ppppuVar3 = (undefined4 ****)local_14;
Sys_Error("GetPlayerLimits: min maxplayers %i > max %i",local_18,local_14);
}
if (0x20 < (int)local_14) {
Sys_Error("GetPlayerLimits: max players limited to %i",0x20,ppppuVar3);
}
}
*(int *)(this + 0x21c) = local_18;
*(undefined4 ****)(this + 0x220) = local_14;
piVar2 = (int *)CommandLine_Tier0();
ppppuVar3 = (undefined4 ****)(**(code **)(*piVar2 + 0x1c))(piVar2,"-maxplayers",0xffffffff);
if (*(int *)(tv_enable._28_4_ + 0x30) != 0) {
*(int *)(this + 0x220) = *(int *)(this + 0x220) + 1;
ppppuVar3 = (undefined4 ****)((int)ppppuVar3 + 1);
}
if ((int)ppppuVar3 < 1) {
ppppuVar4 = *(undefined4 *****)(this + 0x220);
ppppuVar3 = (undefined4 ****)local_10;
}
else {
if ((int)local_14 < (int)ppppuVar3) {
ppppuVar3 = (undefined4 ****)local_14;
}
ppppuVar4 = *(undefined4 *****)(this + 0x21c);
if ((int)*(undefined4 *****)(this + 0x21c) <= (int)ppppuVar3) {
ppppuVar4 = ppppuVar3;
}
*(undefined4 *****)(this + 0x220) = ppppuVar4;
}
if (((int)ppppuVar3 <= (int)ppppuVar4) &&
(ppppuVar4 = *(undefined4 *****)(this + 0x21c),
(int)*(undefined4 *****)(this + 0x21c) <= (int)ppppuVar3)) {
ppppuVar4 = ppppuVar3;
}
cVar1 = CL_IsHL2Demo();
if (((cVar1 != '\0') || (cVar1 = CL_IsPortalDemo(), cVar1 != '\0')) &&
(cVar1 = (**(code **)(*(int *)this + 0x60))(this), cVar1 == '\0')) {
*(undefined4 *)(this + 0x21c) = 1;
ppppuVar4 = (undefined4 ****)&DAT_00000001;
*(undefined4 *)(this + 0x220) = 1;
}
(**(code **)(*(int *)this + 0x98))(this,ppppuVar4);
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.