CMaster::GetHeartbeat
0x00202920 · 340 bytes · __thiscall
_ZN7CMaster12GetHeartbeatEP13CMasterserverP11CBaseServer
Decompiled
undefined (3 params)
/* CMaster::GetHeartbeat(CMasterserver*, CBaseServer*) */
undefined4 * __thiscall
CMaster::GetHeartbeat(CMaster *this,CMasterserver *param_1,CBaseServer *param_2)
{
int *piVar1;
int iVar2;
int iVar3;
undefined4 *puVar4;
int iVar5;
int iVar6;
undefined4 *puVar7;
undefined4 *puVar8;
iVar2 = *(int *)(param_1 + 0x1c);
if (iVar2 < 1) {
puVar7 = *(undefined4 **)(param_1 + 0x10);
}
else {
puVar7 = *(undefined4 **)(param_1 + 0x10);
if ((CBaseServer *)puVar7[3] == param_2) {
return puVar7;
}
iVar5 = 0;
puVar4 = puVar7;
while( true ) {
puVar8 = puVar4 + 4;
iVar5 = iVar5 + 1;
if (iVar5 == iVar2) break;
piVar1 = puVar4 + 7;
puVar4 = puVar8;
if ((CBaseServer *)*piVar1 == param_2) {
return puVar8;
}
}
}
iVar5 = iVar2 + 1;
iVar6 = *(int *)(param_1 + 0x14);
if (iVar5 <= iVar6) goto LAB_0020296e;
iVar3 = *(int *)(param_1 + 0x18);
if (iVar3 < 0) goto LAB_0020296e;
if (iVar3 == 0) {
if (iVar6 == 0) {
if (iVar5 < 3) {
iVar6 = 2;
goto LAB_00202a1f;
}
iVar6 = 2;
}
do {
iVar6 = iVar6 * 2;
} while (iVar6 < iVar5);
}
else {
for (iVar6 = (iVar2 / iVar3 + 1) * iVar3; iVar6 < iVar5; iVar6 = (iVar6 + iVar5) / 2) {
}
}
LAB_00202a1f:
*(int *)(param_1 + 0x14) = iVar6;
if (puVar7 == (undefined4 *)0x0) {
puVar7 = malloc(iVar6 << 4);
*(undefined4 **)(param_1 + 0x10) = puVar7;
}
else {
puVar7 = realloc(puVar7,iVar6 << 4);
*(undefined4 **)(param_1 + 0x10) = puVar7;
iVar5 = *(int *)(param_1 + 0x1c) + 1;
}
LAB_0020296e:
*(int *)(param_1 + 0x1c) = iVar5;
iVar5 = (iVar5 - iVar2) + -1;
*(undefined4 **)(param_1 + 0x20) = puVar7;
if (0 < iVar5) {
_V_memmove(puVar7 + iVar2 * 4 + 4,puVar7 + iVar2 * 4,iVar5 * 0x10);
puVar7 = *(undefined4 **)(param_1 + 0x10);
}
puVar7 = puVar7 + iVar2 * 4;
puVar7[3] = param_2;
puVar7[1] = 0xffffffff;
puVar7[2] = 0xc61c3c00;
*puVar7 = 0;
return puVar7;
}
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.