CUtlVector<CDirectorJournalTask,CUtlMemory<CDirectorJournalTask,int>>::InsertBefore
0x008913d0 · 391 bytes · __thiscall
_ZN10CUtlVectorI20CDirectorJournalTask10CUtlMemoryIS0_iEE12InsertBeforeEiRKS0_
Decompiled
undefined (3 params)
/* CUtlVector<CDirectorJournalTask, CUtlMemory<CDirectorJournalTask, int> >::InsertBefore(int,
CDirectorJournalTask const&) */
int __thiscall
CUtlVector<CDirectorJournalTask,CUtlMemory<CDirectorJournalTask,int>>::InsertBefore
(CUtlVector<CDirectorJournalTask,CUtlMemory<CDirectorJournalTask,int>> *this,int param_1,
CDirectorJournalTask *param_2)
{
undefined4 uVar1;
undefined4 *puVar2;
void *pvVar3;
int iVar4;
int iVar5;
CDirectorJournalTask *pCVar6;
int iVar7;
undefined4 *puVar8;
byte bVar9;
bVar9 = 0;
iVar7 = *(int *)(this + 4);
iVar4 = *(int *)(this + 0xc) + 1;
if (iVar7 < iVar4) {
iVar5 = *(int *)(this + 8);
if (-1 < iVar5) {
if (iVar5 == 0) {
if (iVar7 == 0) {
if (iVar4 < 2) {
iVar5 = 1;
goto LAB_008914ff;
}
iVar7 = 1;
}
do {
iVar5 = iVar7 * 2;
if (iVar4 <= iVar5) break;
iVar5 = iVar7 * 4;
iVar7 = iVar5;
} while (iVar5 < iVar4);
}
else {
for (iVar5 = iVar5 * (*(int *)(this + 0xc) / iVar5 + 1); iVar5 < iVar4;
iVar5 = (iVar5 + iVar4) / 2) {
}
}
LAB_008914ff:
*(int *)(this + 4) = iVar5;
if (*(void **)this == (void *)0x0) {
pvVar3 = malloc(iVar5 * 0x324);
*(void **)this = pvVar3;
}
else {
pvVar3 = realloc(*(void **)this,iVar5 * 0x324);
*(void **)this = pvVar3;
iVar4 = *(int *)(this + 0xc) + 1;
}
goto LAB_008913f2;
}
}
pvVar3 = *(void **)this;
LAB_008913f2:
*(int *)(this + 0xc) = iVar4;
*(void **)(this + 0x10) = pvVar3;
iVar4 = (iVar4 - param_1) + -1;
iVar7 = param_1 * 0x324;
if (0 < iVar4) {
_V_memmove((void *)((int)pvVar3 + iVar7 + 0x324),(void *)((int)pvVar3 + iVar7),iVar4 * 0x324);
pvVar3 = *(void **)this;
}
puVar2 = (undefined4 *)((int)pvVar3 + iVar7);
if (puVar2 != (undefined4 *)0x0) {
*puVar2 = &PTR_InitQuietTruncation_00c08ee8;
*(CDirectorJournalTask *)(puVar2 + 1) = param_2[4];
pCVar6 = param_2 + 5;
puVar8 = (undefined4 *)((int)puVar2 + 5);
for (iVar4 = 0x40; iVar4 != 0; iVar4 = iVar4 + -1) {
*puVar8 = *(undefined4 *)pCVar6;
pCVar6 = pCVar6 + (uint)bVar9 * -8 + 4;
puVar8 = puVar8 + (uint)bVar9 * -2 + 1;
}
uVar1 = *(undefined4 *)(param_2 + 0x108);
puVar2[0x43] = &PTR_InitQuietTruncation_00c08ee8;
puVar2[0x42] = uVar1;
*(CDirectorJournalTask *)(puVar2 + 0x44) = param_2[0x110];
pCVar6 = param_2 + 0x111;
puVar8 = (undefined4 *)((int)puVar2 + 0x111);
for (iVar4 = 0x40; iVar4 != 0; iVar4 = iVar4 + -1) {
*puVar8 = *(undefined4 *)pCVar6;
pCVar6 = pCVar6 + (uint)bVar9 * -8 + 4;
puVar8 = puVar8 + (uint)bVar9 * -2 + 1;
}
uVar1 = *(undefined4 *)(param_2 + 0x214);
puVar2[0x86] = &PTR_InitQuietTruncation_00c08ee8;
puVar2[0x85] = uVar1;
*(CDirectorJournalTask *)(puVar2 + 0x87) = param_2[0x21c];
pCVar6 = param_2 + 0x21d;
puVar8 = (undefined4 *)((int)puVar2 + 0x21d);
for (iVar4 = 0x40; iVar4 != 0; iVar4 = iVar4 + -1) {
*puVar8 = *(undefined4 *)pCVar6;
pCVar6 = pCVar6 + (uint)bVar9 * -8 + 4;
puVar8 = puVar8 + (uint)bVar9 * -2 + 1;
}
puVar2[200] = *(undefined4 *)(param_2 + 800);
}
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.