CUtlVector<unsigned_char,CUtlMemory<unsigned_char,int>>::EnsureCount
0x000f4680 · 221 bytes · __thiscall
_ZN10CUtlVectorIh10CUtlMemoryIhiEE11EnsureCountEi
Decompiled
undefined (2 params)
/* CUtlVector<unsigned char, CUtlMemory<unsigned char, int> >::EnsureCount(int) */
void __thiscall
CUtlVector<unsigned_char,CUtlMemory<unsigned_char,int>>::EnsureCount
(CUtlVector<unsigned_char,CUtlMemory<unsigned_char,int>> *this,int param_1)
{
int iVar1;
int iVar2;
size_t __size;
void *pvVar3;
int iVar4;
int iVar5;
iVar1 = *(int *)(this + 0xc);
if (param_1 <= iVar1) {
return;
}
iVar4 = param_1 - iVar1;
if (iVar4 == 0) {
return;
}
__size = *(size_t *)(this + 4);
iVar5 = iVar1;
if ((int)__size < param_1) {
iVar2 = *(int *)(this + 8);
if (-1 < iVar2) {
if (iVar2 == 0) {
if (__size == 0) {
if (param_1 < 0x21) {
__size = 0x20;
goto LAB_000f470f;
}
__size = 0x20;
}
do {
__size = __size * 2;
} while ((int)__size < param_1);
}
else {
for (__size = ((param_1 + -1) / iVar2 + 1) * iVar2; (int)__size < param_1;
__size = (int)(__size + param_1) / 2) {
}
}
LAB_000f470f:
*(size_t *)(this + 4) = __size;
if (*(void **)this == (void *)0x0) {
pvVar3 = malloc(__size);
*(void **)this = pvVar3;
}
else {
pvVar3 = realloc(*(void **)this,__size);
*(void **)this = pvVar3;
iVar5 = *(int *)(this + 0xc);
}
goto LAB_000f46b1;
}
}
pvVar3 = *(void **)this;
LAB_000f46b1:
*(void **)(this + 0x10) = pvVar3;
*(int *)(this + 0xc) = iVar5 + iVar4;
iVar5 = ((iVar5 + iVar4) - iVar1) - iVar4;
if ((0 < iVar5) && (0 < iVar4)) {
_V_memmove((void *)((int)pvVar3 + param_1),(void *)(iVar1 + (int)pvVar3),iVar5);
}
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.