Unserialize<Vector>
0x00be5df0 · 494 bytes · __cdecl
_Z11UnserializeI6VectorEbR10CUtlBufferR10CUtlVectorIT_10CUtlMemoryIS4_iEE
Decompiled
bool (2 params)
/* bool Unserialize<Vector>(CUtlBuffer&, CUtlVector<Vector, CUtlMemory<Vector, int> >&) */
bool Unserialize<Vector>(CUtlBuffer *param_1,CUtlVector *param_2)
{
int iVar1;
char cVar2;
int *piVar3;
void *pvVar4;
int iVar5;
int local_34;
int local_24;
undefined4 local_20;
*(undefined4 *)(param_2 + 0xc) = 0;
if (((byte)param_1[0x15] & 1) == 0) {
cVar2 = CUtlBuffer::CheckGet(param_1,4);
if (cVar2 != '\0') {
if (((byte)param_1[0x34] & 1) == 0) {
iVar5 = *(int *)(param_1 + 0xc);
local_34 = *(int *)(*(int *)param_1 + (iVar5 - *(int *)(param_1 + 0x20)));
}
else {
piVar3 = (int *)((*(int *)(param_1 + 0xc) - *(int *)(param_1 + 0x20)) + *(int *)param_1);
if (piVar3 == (int *)0x0) {
piVar3 = &local_24;
}
local_20 = local_24;
local_20 = CONCAT31((int3)((uint)local_24 >> 8),*(undefined1 *)((int)piVar3 + 3));
local_20._2_2_ = (undefined2)((uint)local_24 >> 0x10);
local_20._0_2_ = CONCAT11(*(undefined1 *)((int)piVar3 + 2),*(undefined1 *)((int)piVar3 + 3))
;
local_20._3_1_ = (undefined1)((uint)local_24 >> 0x18);
local_20._0_3_ = CONCAT12(*(undefined1 *)((int)piVar3 + 1),(undefined2)local_20);
local_20 = CONCAT13((char)*piVar3,(undefined3)local_20);
_V_memcpy(&local_24,&local_20,4);
local_34 = local_24;
iVar5 = *(int *)(param_1 + 0xc);
}
*(int *)(param_1 + 0xc) = iVar5 + 4;
if (local_34 != 0) {
if ((*(int *)(param_2 + 4) < local_34) && (-1 < *(int *)(param_2 + 8))) {
*(int *)(param_2 + 4) = local_34;
if (*(void **)param_2 == (void *)0x0) {
pvVar4 = malloc(local_34 * 0xc);
*(void **)param_2 = pvVar4;
}
else {
pvVar4 = realloc(*(void **)param_2,local_34 * 0xc);
*(void **)param_2 = pvVar4;
}
}
else {
pvVar4 = *(void **)param_2;
}
*(void **)(param_2 + 0x10) = pvVar4;
if (0 < local_34) {
iVar5 = 0;
do {
iVar1 = *(int *)(param_2 + 0xc);
CUtlVector<Vector,CUtlMemory<Vector,int>>::GrowVector
((CUtlVector<Vector,CUtlMemory<Vector,int>> *)param_2,1);
CUtlVector<Vector,CUtlMemory<Vector,int>>::ShiftElementsRight
((CUtlVector<Vector,CUtlMemory<Vector,int>> *)param_2,iVar1,1);
cVar2 = Unserialize(param_1,(Vector *)(*(int *)param_2 + iVar5 * 0xc));
if (cVar2 == '\0') {
return false;
}
iVar5 = iVar5 + 1;
} while (iVar5 != local_34);
}
}
}
return param_1[0x14] == (CUtlBuffer)0x0;
}
do {
CUtlBuffer::EatWhiteSpace(param_1);
if (param_1[0x14] != (CUtlBuffer)0x0) {
return true;
}
iVar5 = *(int *)(param_2 + 0xc);
CUtlVector<Vector,CUtlMemory<Vector,int>>::GrowVector
((CUtlVector<Vector,CUtlMemory<Vector,int>> *)param_2,1);
CUtlVector<Vector,CUtlMemory<Vector,int>>::ShiftElementsRight
((CUtlVector<Vector,CUtlMemory<Vector,int>> *)param_2,iVar5,1);
cVar2 = Unserialize(param_1,(Vector *)(*(int *)param_2 + iVar5 * 0xc));
} while (cVar2 != '\0');
return false;
}
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.