CUtlVector<GCSDK::FieldSet_t,CUtlMemory<GCSDK::FieldSet_t,int>>::InsertBefore
0x0008ff70 · 576 bytes · __thiscall
_ZN10CUtlVectorIN5GCSDK10FieldSet_tE10CUtlMemoryIS1_iEE12InsertBeforeEiRKS1_
Decompiled
undefined (3 params)
/* CUtlVector<GCSDK::FieldSet_t, CUtlMemory<GCSDK::FieldSet_t, int> >::InsertBefore(int,
GCSDK::FieldSet_t const&) */
int __thiscall
CUtlVector<GCSDK::FieldSet_t,CUtlMemory<GCSDK::FieldSet_t,int>>::InsertBefore
(CUtlVector<GCSDK::FieldSet_t,CUtlMemory<GCSDK::FieldSet_t,int>> *this,int param_1,
FieldSet_t *param_2)
{
void *pvVar1;
int iVar2;
int iVar3;
int iVar4;
CUtlVector<int,CUtlMemory<int,int>> *this_00;
iVar4 = *(int *)(this + 4);
iVar3 = *(int *)(this + 0xc) + 1;
if (iVar4 < iVar3) {
iVar2 = *(int *)(this + 8);
if (iVar2 < 0) goto LAB_0008ff90;
if (iVar2 == 0) {
if (iVar4 == 0) {
if (iVar3 < 2) {
iVar2 = 1;
goto LAB_000900af;
}
iVar4 = 1;
}
do {
iVar2 = iVar4 * 2;
if (iVar3 <= iVar2) break;
iVar2 = iVar4 * 4;
iVar4 = iVar2;
} while (iVar2 < iVar3);
}
else {
for (iVar2 = iVar2 * (*(int *)(this + 0xc) / iVar2 + 1); iVar2 < iVar3;
iVar2 = (iVar2 + iVar3) / 2) {
}
}
LAB_000900af:
*(int *)(this + 4) = iVar2;
if (*(void **)this == (void *)0x0) {
pvVar1 = malloc(iVar2 * 0xb0);
*(void **)this = pvVar1;
}
else {
pvVar1 = realloc(*(void **)this,iVar2 * 0xb0);
*(void **)this = pvVar1;
iVar3 = *(int *)(this + 0xc) + 1;
}
}
else {
LAB_0008ff90:
pvVar1 = *(void **)this;
}
*(int *)(this + 0xc) = iVar3;
*(void **)(this + 0x10) = pvVar1;
iVar3 = (iVar3 - param_1) + -1;
iVar4 = param_1 * 0xb0;
if (0 < iVar3) {
_V_memmove((void *)((int)pvVar1 + iVar4 + 0xb0),(void *)((int)pvVar1 + iVar4),iVar3 * 0xb0);
pvVar1 = *(void **)this;
}
this_00 = (CUtlVector<int,CUtlMemory<int,int>> *)(iVar4 + (int)pvVar1);
if (this_00 == (CUtlVector<int,CUtlMemory<int,int>> *)0x0) {
return param_1;
}
*(undefined4 *)this_00 = 0;
*(undefined4 *)(this_00 + 4) = 0;
*(undefined4 *)(this_00 + 8) = 0;
*(undefined4 *)(this_00 + 0xc) = 0;
*(undefined4 *)(this_00 + 0x10) = 0;
*(undefined4 *)(this_00 + 0x14) = 0;
*(undefined4 *)(this_00 + 0x18) = 0;
*(undefined4 *)(this_00 + 0x1c) = 0;
*(undefined4 *)(this_00 + 0x20) = 0;
*(undefined4 *)(this_00 + 0x24) = 0;
iVar3 = *(int *)(param_2 + 0xc);
if (iVar3 != 0) {
CUtlVector<int,CUtlMemory<int,int>>::GrowVector(this_00,iVar3);
CUtlVector<int,CUtlMemory<int,int>>::ShiftElementsRight(this_00,0,iVar3);
if (0 < iVar3) {
iVar4 = 0;
do {
*(undefined4 *)(*(int *)this_00 + iVar4 * 4) = *(undefined4 *)(*(int *)param_2 + iVar4 * 4);
iVar4 = iVar4 + 1;
} while (iVar4 != iVar3);
iVar3 = *(int *)(param_2 + 0x20);
*(undefined4 *)(this_00 + 0x20) = 0;
goto joined_r0x0009012d;
}
}
iVar3 = *(int *)(param_2 + 0x20);
*(undefined4 *)(this_00 + 0x20) = 0;
joined_r0x0009012d:
if (iVar3 != 0) {
CUtlVector<int,CUtlMemory<int,int>>::GrowVector(this_00 + 0x14,iVar3);
CUtlVector<int,CUtlMemory<int,int>>::ShiftElementsRight(this_00 + 0x14,0,iVar3);
if (0 < iVar3) {
iVar4 = 0;
do {
*(undefined4 *)(*(int *)(this_00 + 0x14) + iVar4 * 4) =
*(undefined4 *)(*(int *)(param_2 + 0x14) + iVar4 * 4);
iVar4 = iVar4 + 1;
} while (iVar4 != iVar3);
}
}
this_00[0x28] = *(CUtlVector<int,CUtlMemory<int,int>> *)(param_2 + 0x28);
this_00[0x29] = *(CUtlVector<int,CUtlMemory<int,int>> *)(param_2 + 0x29);
*(undefined4 *)(this_00 + 0x2c) = *(undefined4 *)(param_2 + 0x2c);
/* try { // try from 00090066 to 00090158 has its CatchHandler @ 000901bf */
V_strncpy((char *)(this_00 + 0x30),(char *)(param_2 + 0x30),0x80);
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.