CUtlVector<int,CUtlMemory<int,int>>::EnsureCount
0x00062f10 · 232 bytes · __thiscall
_ZN10CUtlVectorIi10CUtlMemoryIiiEE11EnsureCountEi
Decompiled
undefined (2 params)
/* CUtlVector<int, CUtlMemory<int, int> >::EnsureCount(int) */
void __thiscall
CUtlVector<int,CUtlMemory<int,int>>::EnsureCount
(CUtlVector<int,CUtlMemory<int,int>> *this,int param_1)
{
int iVar1;
int iVar2;
void *pvVar3;
int iVar4;
int iVar5;
int iVar6;
iVar1 = *(int *)(this + 0xc);
if (param_1 <= iVar1) {
return;
}
iVar4 = param_1 - iVar1;
if (iVar4 == 0) {
return;
}
iVar6 = *(int *)(this + 4);
iVar5 = iVar1;
if (iVar6 < param_1) {
iVar2 = *(int *)(this + 8);
if (-1 < iVar2) {
if (iVar2 == 0) {
if (iVar6 == 0) {
if (param_1 < 9) {
iVar6 = 8;
goto LAB_00062f9f;
}
iVar6 = 8;
}
do {
iVar6 = iVar6 * 2;
} while (iVar6 < param_1);
}
else {
for (iVar6 = ((param_1 + -1) / iVar2 + 1) * iVar2; iVar6 < param_1;
iVar6 = (iVar6 + param_1) / 2) {
}
}
LAB_00062f9f:
*(int *)(this + 4) = iVar6;
if (*(void **)this == (void *)0x0) {
pvVar3 = malloc(iVar6 << 2);
*(void **)this = pvVar3;
}
else {
pvVar3 = realloc(*(void **)this,iVar6 << 2);
*(void **)this = pvVar3;
iVar5 = *(int *)(this + 0xc);
}
goto LAB_00062f41;
}
}
pvVar3 = *(void **)this;
LAB_00062f41:
*(void **)(this + 0x10) = pvVar3;
*(int *)(this + 0xc) = iVar5 + iVar4;
iVar6 = ((iVar5 + iVar4) - iVar1) - iVar4;
if ((0 < iVar6) && (0 < iVar4)) {
_V_memmove((void *)((int)pvVar3 + param_1 * 4),(void *)((int)pvVar3 + iVar1 * 4),iVar6 * 4);
}
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.