CUtlVector<AsyncCaption_t,CUtlMemory<AsyncCaption_t,int>>::InsertBefore
0x004b6b50 · 400 bytes · __thiscall
_ZN10CUtlVectorI14AsyncCaption_t10CUtlMemoryIS0_iEE12InsertBeforeEi
Decompiled
undefined (2 params)
/* CUtlVector<AsyncCaption_t, CUtlMemory<AsyncCaption_t, int> >::InsertBefore(int) */
int __thiscall
CUtlVector<AsyncCaption_t,CUtlMemory<AsyncCaption_t,int>>::InsertBefore
(CUtlVector<AsyncCaption_t,CUtlMemory<AsyncCaption_t,int>> *this,int param_1)
{
void *pvVar1;
int iVar2;
int iVar3;
int iVar4;
undefined4 *puVar5;
iVar4 = *(int *)(this + 4);
iVar3 = *(int *)(this + 0xc) + 1;
if (iVar4 < iVar3) {
iVar2 = *(int *)(this + 8);
if (-1 < iVar2) {
if (iVar2 == 0) {
if (iVar4 == 0) {
if (iVar3 < 2) {
iVar2 = 1;
goto LAB_004b6c87;
}
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_004b6c87:
*(int *)(this + 4) = iVar2;
if (*(void **)this == (void *)0x0) {
pvVar1 = malloc(iVar2 * 0x54);
*(void **)this = pvVar1;
}
else {
pvVar1 = realloc(*(void **)this,iVar2 * 0x54);
*(void **)this = pvVar1;
iVar3 = *(int *)(this + 0xc) + 1;
}
goto LAB_004b6b72;
}
}
pvVar1 = *(void **)this;
LAB_004b6b72:
*(int *)(this + 0xc) = iVar3;
iVar3 = (iVar3 - param_1) + -1;
*(void **)(this + 0x10) = pvVar1;
iVar4 = param_1 * 0x54;
if (0 < iVar3) {
_V_memmove((void *)((int)pvVar1 + iVar4 + 0x54),(void *)((int)pvVar1 + iVar4),iVar3 * 0x54);
pvVar1 = *(void **)this;
}
puVar5 = (undefined4 *)(iVar4 + (int)pvVar1);
if (puVar5 != (undefined4 *)0x0) {
*(undefined2 *)(puVar5 + 4) = 0xffff;
*(undefined2 *)(puVar5 + 0x14) = 0xffff;
*puVar5 = AsyncCaption_t::BlockInfo_t::Less;
puVar5[1] = 0;
puVar5[2] = 0;
puVar5[3] = 0;
*(undefined2 *)((int)puVar5 + 0x12) = 0;
*(undefined2 *)(puVar5 + 5) = 0xffff;
*(undefined2 *)((int)puVar5 + 0x16) = 0xffff;
puVar5[6] = 0;
puVar5[7] = 0;
puVar5[8] = 0;
puVar5[9] = 0;
puVar5[10] = 0;
puVar5[0xb] = 0;
puVar5[0xc] = 0;
*(undefined1 *)(puVar5 + 0xd) = 0;
/* try { // try from 004b6c44 to 004b6c48 has its CatchHandler @ 004b6cf6 */
_V_memset(puVar5 + 0xe,0,0x18);
}
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.