CUtlVector<netpacket_s,CUtlMemory<netpacket_s,int>>::EnsureCount
0x001c94e0 · 401 bytes · __thiscall
_ZN10CUtlVectorI11netpacket_s10CUtlMemoryIS0_iEE11EnsureCountEi
Decompiled
undefined (2 params)
/* CUtlVector<netpacket_s, CUtlMemory<netpacket_s, int> >::EnsureCount(int) */
void __thiscall
CUtlVector<netpacket_s,CUtlMemory<netpacket_s,int>>::EnsureCount
(CUtlVector<netpacket_s,CUtlMemory<netpacket_s,int>> *this,int param_1)
{
int iVar1;
int iVar2;
void *pvVar3;
int iVar4;
int iVar5;
int iVar6;
netadr_s *this_00;
iVar6 = *(int *)(this + 0xc);
if (param_1 <= iVar6) {
return;
}
iVar2 = param_1 - iVar6;
if (iVar2 == 0) {
return;
}
iVar5 = *(int *)(this + 4);
iVar4 = iVar6;
if (iVar5 < param_1) {
iVar1 = *(int *)(this + 8);
if (iVar1 < 0) goto LAB_001c9517;
if (iVar1 == 0) {
if (iVar5 == 0) {
if (param_1 < 2) {
iVar5 = 1;
goto LAB_001c961f;
}
iVar5 = 1;
}
do {
iVar5 = iVar5 * 2;
} while (iVar5 < param_1);
}
else {
for (iVar5 = ((param_1 + -1) / iVar1 + 1) * iVar1; iVar5 < param_1;
iVar5 = (iVar5 + param_1) / 2) {
}
}
LAB_001c961f:
*(int *)(this + 4) = iVar5;
if (*(void **)this == (void *)0x0) {
pvVar3 = malloc(iVar5 * 0x50);
*(void **)this = pvVar3;
}
else {
pvVar3 = realloc(*(void **)this,iVar5 * 0x50);
*(void **)this = pvVar3;
iVar4 = *(int *)(this + 0xc);
}
}
else {
LAB_001c9517:
pvVar3 = *(void **)this;
}
*(int *)(this + 0xc) = iVar4 + iVar2;
iVar5 = ((iVar4 + iVar2) - iVar6) - iVar2;
*(void **)(this + 0x10) = pvVar3;
if (iVar5 < 1) {
if (0 < iVar2) {
LAB_001c953d:
iVar5 = 0;
iVar6 = iVar6 * 0x50;
do {
this_00 = (netadr_s *)(iVar6 + *(int *)this);
if (this_00 != (netadr_s *)0x0) {
netadr_s::SetIP(this_00,0);
netadr_s::SetPort(this_00,0);
netadr_s::SetType(this_00,3);
this_00[0x20] = (netadr_s)0x0;
*(undefined4 *)(this_00 + 0x1c) = 0;
*(undefined4 *)(this_00 + 0x24) = 0xffffffff;
*(undefined4 *)(this_00 + 0x28) = 0;
}
iVar5 = iVar5 + 1;
iVar6 = iVar6 + 0x50;
} while (iVar5 < iVar2);
return;
}
}
else if (0 < iVar2) {
_V_memmove((void *)((int)pvVar3 + param_1 * 0x50),(void *)(iVar6 * 0x50 + (int)pvVar3),
iVar5 * 0x50);
goto LAB_001c953d;
}
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.