CMaster::AddServer
0x00201da0 · 417 bytes · __thiscall
_ZN7CMaster9AddServerEP8netadr_s
Decompiled
undefined (2 params)
/* CMaster::AddServer(netadr_s*) */
undefined4 __thiscall CMaster::AddServer(CMaster *this,netadr_s *param_1)
{
int iVar1;
char cVar2;
netadr_s *this_00;
int iVar3;
void *pvVar4;
int iVar5;
undefined4 *puVar6;
int iVar7;
cVar2 = (**(code **)(*(int *)this + 0x2c))(this,param_1);
if (cVar2 != '\0') {
return 0;
}
iVar5 = *(int *)(this + 0x10);
iVar3 = *(int *)(this + 8);
iVar7 = iVar5 + 1;
if (iVar3 < iVar7) {
iVar1 = *(int *)(this + 0xc);
if (-1 < iVar1) {
if (iVar1 == 0) {
if (iVar3 == 0) {
if (iVar7 < 2) {
iVar3 = 1;
goto LAB_00201ee7;
}
iVar3 = 1;
}
do {
iVar3 = iVar3 * 2;
} while (iVar3 < iVar7);
}
else {
for (iVar3 = (iVar5 / iVar1 + 1) * iVar1; iVar3 < iVar7; iVar3 = (iVar3 + iVar7) / 2) {
}
}
LAB_00201ee7:
*(int *)(this + 8) = iVar3;
if (*(void **)(this + 4) == (void *)0x0) {
pvVar4 = malloc(iVar3 * 0x24);
*(void **)(this + 4) = pvVar4;
}
else {
pvVar4 = realloc(*(void **)(this + 4),iVar3 * 0x24);
*(void **)(this + 4) = pvVar4;
iVar7 = *(int *)(this + 0x10) + 1;
}
goto LAB_00201de4;
}
}
pvVar4 = *(void **)(this + 4);
LAB_00201de4:
*(int *)(this + 0x10) = iVar7;
iVar7 = (iVar7 - iVar5) + -1;
*(void **)(this + 0x14) = pvVar4;
iVar5 = iVar5 * 0x24;
if (0 < iVar7) {
_V_memmove((void *)((int)pvVar4 + iVar5 + 0x24),(void *)((int)pvVar4 + iVar5),iVar7 * 0x24);
pvVar4 = *(void **)(this + 4);
}
puVar6 = (undefined4 *)0x0;
this_00 = (netadr_s *)((int)pvVar4 + iVar5);
if (this_00 != (netadr_s *)0x0) {
netadr_s::SetIP(this_00,0);
netadr_s::SetPort(this_00,0);
netadr_s::SetType(this_00,3);
*(undefined4 *)(this_00 + 0x10) = 0;
*(undefined4 *)(this_00 + 0x14) = 0;
*(undefined4 *)(this_00 + 0x18) = 0;
*(undefined4 *)(this_00 + 0x1c) = 0;
*(undefined4 *)(this_00 + 0x20) = 0;
*(undefined4 *)(this_00 + 0xc) = 0;
puVar6 = (undefined4 *)(iVar5 + *(int *)(this + 4));
}
*puVar6 = *(undefined4 *)param_1;
puVar6[1] = *(undefined4 *)(param_1 + 4);
*(undefined2 *)(puVar6 + 2) = *(undefined2 *)(param_1 + 8);
return 1;
}
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.