CUtlVector<CEffectScriptElement,CUtlMemory<CEffectScriptElement,int>>::InsertBefore
0x0068fc00 · 464 bytes · __thiscall
_ZN10CUtlVectorI20CEffectScriptElement10CUtlMemoryIS0_iEE12InsertBeforeEiRKS0_
Decompiled
undefined (3 params)
/* CUtlVector<CEffectScriptElement, CUtlMemory<CEffectScriptElement, int> >::InsertBefore(int,
CEffectScriptElement const&) */
int __thiscall
CUtlVector<CEffectScriptElement,CUtlMemory<CEffectScriptElement,int>>::InsertBefore
(CUtlVector<CEffectScriptElement,CUtlMemory<CEffectScriptElement,int>> *this,int param_1,
CEffectScriptElement *param_2)
{
undefined4 *puVar1;
void *pvVar2;
int iVar3;
int iVar4;
CEffectScriptElement *pCVar5;
int iVar6;
undefined4 *puVar7;
byte bVar8;
bVar8 = 0;
iVar6 = *(int *)(this + 4);
iVar3 = *(int *)(this + 0xc) + 1;
if (iVar6 < iVar3) {
iVar4 = *(int *)(this + 8);
if (-1 < iVar4) {
if (iVar4 == 0) {
if (iVar6 == 0) {
if (iVar3 < 2) {
iVar4 = 1;
goto LAB_0068fd77;
}
iVar6 = 1;
}
do {
iVar4 = iVar6 * 2;
if (iVar3 <= iVar4) break;
iVar4 = iVar6 * 4;
iVar6 = iVar4;
} while (iVar4 < iVar3);
}
else {
for (iVar4 = iVar4 * (*(int *)(this + 0xc) / iVar4 + 1); iVar4 < iVar3;
iVar4 = (iVar4 + iVar3) / 2) {
}
}
LAB_0068fd77:
*(int *)(this + 4) = iVar4;
if (*(void **)this == (void *)0x0) {
pvVar2 = malloc(iVar4 * 0x1b0);
*(void **)this = pvVar2;
}
else {
pvVar2 = realloc(*(void **)this,iVar4 * 0x1b0);
*(void **)this = pvVar2;
iVar3 = *(int *)(this + 0xc) + 1;
}
goto LAB_0068fc22;
}
}
pvVar2 = *(void **)this;
LAB_0068fc22:
*(int *)(this + 0xc) = iVar3;
*(void **)(this + 0x10) = pvVar2;
iVar3 = (iVar3 - param_1) + -1;
iVar6 = param_1 * 0x1b0;
if (0 < iVar3) {
_V_memmove((void *)((int)pvVar2 + iVar6 + 0x1b0),(void *)((int)pvVar2 + iVar6),iVar3 * 0x1b0);
pvVar2 = *(void **)this;
}
puVar1 = (undefined4 *)((int)pvVar2 + iVar6);
if (puVar1 != (undefined4 *)0x0) {
pCVar5 = param_2;
puVar7 = puVar1;
for (iVar3 = 0x20; iVar3 != 0; iVar3 = iVar3 + -1) {
*puVar7 = *(undefined4 *)pCVar5;
pCVar5 = pCVar5 + (uint)bVar8 * -8 + 4;
puVar7 = puVar7 + (uint)bVar8 * -2 + 1;
}
puVar1[0x20] = *(undefined4 *)(param_2 + 0x80);
puVar1[0x21] = *(undefined4 *)(param_2 + 0x84);
puVar1[0x22] = *(undefined4 *)(param_2 + 0x88);
puVar1[0x23] = *(undefined4 *)(param_2 + 0x8c);
puVar1[0x24] = *(undefined4 *)(param_2 + 0x90);
puVar1[0x25] = *(undefined4 *)(param_2 + 0x94);
puVar1[0x26] = *(undefined4 *)(param_2 + 0x98);
puVar1[0x27] = *(undefined4 *)(param_2 + 0x9c);
pCVar5 = param_2 + 0xa0;
puVar7 = puVar1 + 0x28;
for (iVar3 = 0x20; iVar3 != 0; iVar3 = iVar3 + -1) {
*puVar7 = *(undefined4 *)pCVar5;
pCVar5 = pCVar5 + (uint)bVar8 * -8 + 4;
puVar7 = puVar7 + (uint)bVar8 * -2 + 1;
}
pCVar5 = param_2 + 0x120;
puVar7 = puVar1 + 0x48;
for (iVar3 = 0x20; iVar3 != 0; iVar3 = iVar3 + -1) {
*puVar7 = *(undefined4 *)pCVar5;
pCVar5 = pCVar5 + (uint)bVar8 * -8 + 4;
puVar7 = puVar7 + (uint)bVar8 * -2 + 1;
}
puVar1[0x68] = *(undefined4 *)(param_2 + 0x1a0);
puVar1[0x69] = *(undefined4 *)(param_2 + 0x1a4);
puVar1[0x6a] = *(undefined4 *)(param_2 + 0x1a8);
*(CEffectScriptElement *)(puVar1 + 0x6b) = param_2[0x1ac];
*(CEffectScriptElement *)((int)puVar1 + 0x1ad) = param_2[0x1ad];
}
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.