CUtlVector<SAddOnMetaData,CUtlMemory<SAddOnMetaData,int>>::InsertBefore
0x00160080 · 388 bytes · __thiscall
_ZN10CUtlVectorI14SAddOnMetaData10CUtlMemoryIS0_iEE12InsertBeforeEiRKS0_
Decompiled
undefined (3 params)
/* CUtlVector<SAddOnMetaData, CUtlMemory<SAddOnMetaData, int> >::InsertBefore(int, SAddOnMetaData
const&) */
int __thiscall
CUtlVector<SAddOnMetaData,CUtlMemory<SAddOnMetaData,int>>::InsertBefore
(CUtlVector<SAddOnMetaData,CUtlMemory<SAddOnMetaData,int>> *this,int param_1,
SAddOnMetaData *param_2)
{
void *pvVar1;
int iVar2;
int iVar3;
int iVar4;
char *pcVar5;
iVar3 = *(int *)(this + 4);
iVar4 = *(int *)(this + 0xc) + 1;
if (iVar3 < iVar4) {
iVar2 = *(int *)(this + 8);
if (iVar2 < 0) goto LAB_001600a0;
if (iVar2 == 0) {
if (iVar3 == 0) {
if (iVar4 < 2) {
iVar2 = 1;
goto LAB_0016014f;
}
iVar3 = 1;
}
do {
iVar2 = iVar3 * 2;
if (iVar4 <= iVar2) break;
iVar2 = iVar3 * 4;
iVar3 = iVar2;
} while (iVar2 < iVar4);
}
else {
for (iVar2 = iVar2 * (*(int *)(this + 0xc) / iVar2 + 1); iVar2 < iVar4;
iVar2 = (iVar2 + iVar4) / 2) {
}
}
LAB_0016014f:
*(int *)(this + 4) = iVar2;
if (*(void **)this != (void *)0x0) {
pvVar1 = realloc(*(void **)this,iVar2 * 0x108);
iVar4 = *(int *)(this + 0xc);
*(void **)this = pvVar1;
*(void **)(this + 0x10) = pvVar1;
*(int *)(this + 0xc) = iVar4 + 1;
iVar4 = (iVar4 + 1) - param_1;
goto joined_r0x00160186;
}
pvVar1 = malloc(iVar2 * 0x108);
*(void **)this = pvVar1;
}
else {
LAB_001600a0:
pvVar1 = *(void **)this;
}
*(int *)(this + 0xc) = iVar4;
iVar4 = iVar4 - param_1;
*(void **)(this + 0x10) = pvVar1;
joined_r0x00160186:
if (0 < iVar4 + -1) {
_V_memmove((void *)((int)pvVar1 + param_1 * 0x108 + 0x108),
(void *)((int)pvVar1 + param_1 * 0x108),(iVar4 + -1) * 0x108);
pvVar1 = *(void **)this;
}
pcVar5 = (char *)(param_1 * 0x108 + (int)pvVar1);
if (pcVar5 != (char *)0x0) {
V_strncpy(pcVar5,(char *)param_2,0x80);
V_strncpy(pcVar5 + 0x80,(char *)(param_2 + 0x80),0x80);
*(undefined4 *)(pcVar5 + 0x100) = *(undefined4 *)(param_2 + 0x100);
*(undefined4 *)(pcVar5 + 0x104) = *(undefined4 *)(param_2 + 0x104);
}
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.