CUtlVector<SoundInfo_t,CUtlMemory<SoundInfo_t,int>>::InsertBefore
0x001eccf0 · 241 bytes · __thiscall
_ZN10CUtlVectorI11SoundInfo_t10CUtlMemoryIS0_iEE12InsertBeforeEiRKS0_
Decompiled
undefined (3 params)
/* CUtlVector<SoundInfo_t, CUtlMemory<SoundInfo_t, int> >::InsertBefore(int, SoundInfo_t const&) */
int __thiscall
CUtlVector<SoundInfo_t,CUtlMemory<SoundInfo_t,int>>::InsertBefore
(CUtlVector<SoundInfo_t,CUtlMemory<SoundInfo_t,int>> *this,int param_1,
SoundInfo_t *param_2)
{
int iVar1;
void *pvVar2;
int iVar3;
int iVar4;
undefined4 *puVar5;
byte bVar6;
bVar6 = 0;
iVar4 = *(int *)(this + 4);
iVar3 = *(int *)(this + 0xc) + 1;
if (iVar4 < iVar3) {
iVar1 = *(int *)(this + 8);
if (-1 < iVar1) {
if (iVar1 == 0) {
if (iVar4 == 0) {
if (iVar3 < 2) {
iVar4 = 1;
goto LAB_001ecd86;
}
iVar4 = 1;
}
do {
iVar4 = iVar4 * 2;
} while (iVar4 < iVar3);
}
else {
for (iVar4 = iVar1 * (*(int *)(this + 0xc) / iVar1 + 1); iVar4 < iVar3;
iVar4 = (iVar4 + iVar3) / 2) {
}
}
LAB_001ecd86:
*(int *)(this + 4) = iVar4;
if (*(void **)this == (void *)0x0) {
pvVar2 = malloc(iVar4 * 0x58);
*(void **)this = pvVar2;
}
else {
pvVar2 = realloc(*(void **)this,iVar4 * 0x58);
*(void **)this = pvVar2;
iVar3 = *(int *)(this + 0xc) + 1;
}
goto LAB_001ecd0e;
}
}
pvVar2 = *(void **)this;
LAB_001ecd0e:
*(int *)(this + 0xc) = iVar3;
iVar3 = (iVar3 - param_1) + -1;
*(void **)(this + 0x10) = pvVar2;
iVar4 = param_1 * 0x58;
if (0 < iVar3) {
_V_memmove((void *)((int)pvVar2 + iVar4 + 0x58),(void *)((int)pvVar2 + iVar4),iVar3 * 0x58);
pvVar2 = *(void **)this;
}
if ((undefined4 *)((int)pvVar2 + iVar4) != (undefined4 *)0x0) {
puVar5 = (undefined4 *)((int)pvVar2 + iVar4);
for (iVar3 = 0x16; iVar3 != 0; iVar3 = iVar3 + -1) {
*puVar5 = *(undefined4 *)param_2;
param_2 = param_2 + (uint)bVar6 * -8 + 4;
puVar5 = puVar5 + (uint)bVar6 * -2 + 1;
}
}
return param_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.