CDmxSerializer::Unserialize
0x00bea420 · 2244 bytes · __thiscall
_ZN14CDmxSerializer11UnserializeER10CUtlBufferiPP11CDmxElement
Decompiled
undefined (4 params)
/* CDmxSerializer::Unserialize(CUtlBuffer&, int, CDmxElement**) */
char __thiscall
CDmxSerializer::Unserialize
(CDmxSerializer *this,CUtlBuffer *param_1,int param_2,CDmxElement **param_3)
{
undefined1 uVar1;
size_t sVar2;
undefined1 *puVar3;
undefined4 *puVar4;
undefined2 uVar5;
size_t *psVar6;
char cVar7;
size_t sVar8;
undefined4 uVar9;
int iVar10;
int iVar11;
short *psVar12;
short sVar13;
int iVar14;
undefined4 *puVar15;
size_t *psVar16;
size_t sVar17;
int in_GS_OFFSET;
undefined4 uStack_9b0;
size_t local_9a0 [7];
CDmxElement **local_984;
undefined4 local_980;
undefined4 *local_97c;
size_t local_978;
undefined1 *local_974;
undefined1 *local_970;
bool local_969;
int local_968;
size_t local_964;
size_t local_960;
short local_94e;
short local_94c;
undefined2 local_94a;
undefined4 local_948;
undefined4 local_944;
size_t local_940;
undefined4 local_93c;
size_t local_938;
undefined4 *local_934;
undefined1 local_930 [16];
undefined1 local_920 [256];
undefined1 local_820 [2048];
int local_20;
psVar16 = (size_t *)&stack0xfffff654;
local_980 = this;
local_984 = param_3;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
psVar6 = (size_t *)&stack0xfffff654;
if ((uint)param_2 < 5) {
do {
if (((byte)param_1[0x15] & 1) == 0) {
uStack_9b0 = 0xbea4a6;
cVar7 = CUtlBuffer::CheckGet(param_1,1);
if (cVar7 != '\0') {
cVar7 = *(char *)(*(int *)param_1 + (*(int *)(param_1 + 0xc) - *(int *)(param_1 + 0x20)));
*(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;
goto LAB_00bea482;
}
LAB_00bea4ae:
if (param_2 < 2) {
local_964 = 0;
sVar17 = 0;
local_960 = 0;
psVar16 = (size_t *)&stack0xfffff654;
}
else {
if (param_2 == 4) {
if (((byte)param_1[0x15] & 1) != 0) {
local_948 = 0;
uStack_9b0 = 0xbea7d8;
CUtlBuffer::Scanf(param_1,"%d");
local_960 = local_948;
goto LAB_00beaa0a;
}
uStack_9b0 = 0xbeabe5;
cVar7 = CUtlBuffer::CheckGet(param_1,4);
if (cVar7 != '\0') {
if (((byte)param_1[0x34] & 1) == 0) {
iVar10 = *(int *)(param_1 + 0xc);
local_960 = *(size_t *)(*(int *)param_1 + (iVar10 - *(int *)(param_1 + 0x20)));
}
else {
puVar15 = (undefined4 *)
((*(int *)(param_1 + 0xc) - *(int *)(param_1 + 0x20)) + *(int *)param_1);
if (puVar15 == (undefined4 *)0x0) {
puVar15 = &local_948;
}
local_944 = (undefined4 *)local_948;
local_944._1_3_ = (undefined3)(local_948 >> 8);
local_944 = (undefined4 *)
CONCAT31(local_944._1_3_,*(undefined1 *)((int)puVar15 + 3));
local_944._2_2_ = (undefined2)(local_948 >> 0x10);
local_944._0_2_ =
CONCAT11(*(undefined1 *)((int)puVar15 + 2),*(undefined1 *)((int)puVar15 + 3));
local_944._3_1_ = (undefined1)(local_948 >> 0x18);
local_944._0_3_ = CONCAT12(*(undefined1 *)((int)puVar15 + 1),(undefined2)local_944);
local_944 = (undefined4 *)CONCAT13(*(undefined1 *)puVar15,(undefined3)local_944);
uStack_9b0 = 0xbead13;
_V_memcpy(&local_948,&local_944,4);
iVar10 = *(int *)(param_1 + 0xc);
local_960 = local_948;
}
*(int *)(param_1 + 0xc) = iVar10 + 4;
goto LAB_00beaa0a;
}
LAB_00beac29:
local_960 = 0;
}
else {
if (((byte)param_1[0x15] & 1) == 0) {
uStack_9b0 = 0xbeaba1;
cVar7 = CUtlBuffer::CheckGet(param_1,2);
if (cVar7 == '\0') goto LAB_00beac29;
if (((byte)param_1[0x34] & 1) == 0) {
iVar10 = *(int *)(param_1 + 0xc);
sVar13 = *(short *)(*(int *)param_1 + (iVar10 - *(int *)(param_1 + 0x20)));
}
else {
puVar15 = (undefined4 *)
((*(int *)(param_1 + 0xc) - *(int *)(param_1 + 0x20)) + *(int *)param_1);
if (puVar15 == (undefined4 *)0x0) {
puVar15 = &local_948;
}
uVar5 = local_944._2_2_;
local_944 = (undefined4 *)CONCAT22(local_944._2_2_,(short)local_948);
local_944 = (undefined4 *)
CONCAT31(local_944._1_3_,*(undefined1 *)((int)puVar15 + 1));
local_944._0_2_ = CONCAT11(*(undefined1 *)puVar15,*(undefined1 *)((int)puVar15 + 1))
;
local_944 = (undefined4 *)CONCAT22(uVar5,(undefined2)local_944);
uStack_9b0 = 0xbeaca7;
_V_memcpy(&local_948,&local_944,2);
iVar10 = *(int *)(param_1 + 0xc);
sVar13 = (short)local_948;
}
*(int *)(param_1 + 0xc) = iVar10 + 2;
local_960 = (int)sVar13;
}
else {
local_948 = local_948 & 0xffff0000;
uStack_9b0 = 0xbea9fd;
CUtlBuffer::Scanf(param_1,"%d");
local_960 = (int)(short)local_948;
}
LAB_00beaa0a:
if (0 < (int)local_960) {
iVar10 = -((local_960 * 4 + 0xf & 0xfffffff0) + 0x10);
*(size_t *)((int)local_9a0 + iVar10) = local_960;
local_964 = (int)&local_980 + iVar10;
*(CUtlBuffer **)((int)local_9a0 + iVar10 + -8) = param_1;
*(size_t *)(&stack0xfffff65c + iVar10) = local_964;
*(CDmxSerializer **)((int)local_9a0 + iVar10 + -0xc) = local_980;
*(undefined4 *)((int)&uStack_9b0 + iVar10) = 0xbeaa58;
iVar11 = GetStringOffsetTable
(*(CDmxSerializer **)((int)local_9a0 + iVar10 + -0xc),
*(CUtlBuffer **)((int)local_9a0 + iVar10 + -8),
*(int **)(&stack0xfffff65c + iVar10),
*(int *)((int)local_9a0 + iVar10));
iVar14 = -((iVar11 + 0xfU & 0xfffffff0) + 0x10);
psVar16 = (size_t *)((int)local_9a0 + iVar14 + iVar10 + -0xc);
*(int *)(&stack0xfffff65c + iVar14 + iVar10) = iVar11;
sVar17 = (int)&local_980 + iVar14 + iVar10 + 3 & 0xfffffff0;
*(CUtlBuffer **)((int)local_9a0 + iVar14 + iVar10 + -0xc) = param_1;
*(size_t *)((int)local_9a0 + iVar14 + iVar10 + -8) = sVar17;
*(undefined4 *)((int)&uStack_9b0 + iVar14 + iVar10) = 0xbeaa7a;
CUtlBuffer::Get(*(CUtlBuffer **)((int)local_9a0 + iVar14 + iVar10 + -0xc),
*(void **)((int)local_9a0 + iVar14 + iVar10 + -8),
*(int *)(&stack0xfffff65c + iVar14 + iVar10));
goto LAB_00bea4d3;
}
}
local_964 = 0;
sVar17 = 0;
}
LAB_00bea4d3:
if (((byte)param_1[0x15] & 1) == 0) {
psVar16[1] = 4;
*psVar16 = (size_t)param_1;
psVar16[-1] = 0xbea8e0;
cVar7 = CUtlBuffer::CheckGet((CUtlBuffer *)*psVar16,psVar16[1]);
if (cVar7 != '\0') {
if (((byte)param_1[0x34] & 1) == 0) {
iVar10 = *(int *)(param_1 + 0xc);
local_978 = *(size_t *)(*(int *)param_1 + (iVar10 - *(int *)(param_1 + 0x20)));
}
else {
puVar15 = (undefined4 *)
((*(int *)(param_1 + 0xc) - *(int *)(param_1 + 0x20)) + *(int *)param_1);
if (puVar15 == (undefined4 *)0x0) {
puVar15 = &local_948;
}
local_944 = (undefined4 *)local_948;
local_944._1_3_ = (undefined3)(local_948 >> 8);
local_944 = (undefined4 *)CONCAT31(local_944._1_3_,*(undefined1 *)((int)puVar15 + 3));
local_944._2_2_ = (undefined2)(local_948 >> 0x10);
local_944._0_2_ =
CONCAT11(*(undefined1 *)((int)puVar15 + 2),*(undefined1 *)((int)puVar15 + 3));
local_944._3_1_ = (undefined1)(local_948 >> 0x18);
local_944._0_3_ = CONCAT12(*(undefined1 *)((int)puVar15 + 1),(undefined2)local_944);
uVar1 = *(undefined1 *)puVar15;
psVar16[1] = (size_t)&local_944;
*psVar16 = (size_t)&local_948;
psVar16[2] = 4;
local_944 = (undefined4 *)CONCAT13(uVar1,(undefined3)local_944);
psVar16[-1] = 0xbea94f;
_V_memcpy((void *)*psVar16,(void *)psVar16[1],psVar16[2]);
iVar10 = *(int *)(param_1 + 0xc);
local_978 = local_948;
}
*(int *)(param_1 + 0xc) = iVar10 + 4;
goto LAB_00bea50d;
}
}
else {
psVar16[1] = (size_t)"%d";
psVar16[2] = (size_t)&local_948;
*psVar16 = (size_t)param_1;
local_948 = 0;
psVar16[-1] = 0xbea501;
CUtlBuffer::Scanf((CUtlBuffer *)*psVar16,(char *)psVar16[1]);
local_978 = local_948;
LAB_00bea50d:
if (local_978 != 0) {
psVar6 = psVar16;
if ((-1 < (int)local_978) &&
(local_969 = 1 < param_2 && sVar17 == 0, 1 >= param_2 || sVar17 != 0)) {
local_93c = 0;
local_940 = local_978;
*psVar16 = local_978 << 2;
psVar16[-1] = 0xbea557;
local_944 = malloc(*psVar16);
local_938 = 0;
local_934 = local_944;
local_968 = 0;
local_97c = &local_944;
goto LAB_00bea6c3;
}
break;
}
}
local_969 = true;
goto LAB_00bea777;
}
local_944 = (undefined4 *)((uint)local_944 & 0xffffff00);
uStack_9b0 = 0xbea47b;
CUtlBuffer::Scanf(param_1,"%c");
cVar7 = (char)local_944;
LAB_00bea482:
if (cVar7 == '\0') goto LAB_00bea4ae;
psVar6 = (size_t *)&stack0xfffff654;
} while (param_1[0x14] == (CUtlBuffer)0x0);
}
psVar16 = psVar6;
local_969 = false;
goto LAB_00bea777;
while( true ) {
if (param_2 == 4) {
if (((byte)param_1[0x15] & 1) == 0) {
psVar16[1] = 2;
*psVar16 = (size_t)param_1;
psVar16[-1] = 0xbea840;
cVar7 = CUtlBuffer::CheckGet((CUtlBuffer *)*psVar16,psVar16[1]);
if (cVar7 == '\0') {
iVar14 = 0;
iVar10 = 0;
}
else {
if (((byte)param_1[0x34] & 1) == 0) {
iVar14 = *(int *)(param_1 + 0xc);
sVar13 = *(short *)(*(int *)param_1 + (iVar14 - *(int *)(param_1 + 0x20)));
}
else {
psVar12 = (short *)((*(int *)(param_1 + 0xc) - *(int *)(param_1 + 0x20)) +
*(int *)param_1);
if (psVar12 == (short *)0x0) {
psVar12 = &local_94c;
}
local_948 = CONCAT22(local_948._2_2_,local_94c);
local_948 = CONCAT31(local_948._1_3_,*(undefined1 *)((int)psVar12 + 1));
sVar13 = *psVar12;
psVar16[2] = 2;
*psVar16 = (size_t)&local_94c;
local_948._0_2_ = CONCAT11((char)sVar13,(undefined1)local_948);
psVar16[1] = (size_t)&local_948;
/* try { // try from 00beaacb to 00beab3f has its CatchHandler @ 00bead68 */
psVar16[-1] = 0xbeaad0;
_V_memcpy((void *)*psVar16,(void *)psVar16[1],psVar16[2]);
iVar14 = *(int *)(param_1 + 0xc);
sVar13 = local_94c;
}
iVar10 = (int)sVar13;
*(int *)(param_1 + 0xc) = iVar14 + 2;
iVar14 = (int)sVar13;
}
}
else {
psVar16[1] = (size_t)"%d";
local_94c = 0;
psVar16[2] = (size_t)&local_94c;
*psVar16 = (size_t)param_1;
/* try { // try from 00bea5b8 to 00bea633 has its CatchHandler @ 00bead68 */
psVar16[-1] = 0xbea5bd;
CUtlBuffer::Scanf((CUtlBuffer *)*psVar16,(char *)psVar16[1]);
iVar10 = (int)local_94c;
iVar14 = (int)local_94c;
}
if ((int)local_960 <= iVar14) goto LAB_00beab60;
local_974 = (undefined1 *)(*(int *)(local_964 + iVar10 * 4) + sVar17);
}
else {
psVar16[2] = 0x800;
psVar16[1] = (size_t)local_820;
*psVar16 = (size_t)param_1;
psVar16[-1] = 0xbea743;
CUtlBuffer::GetString((CUtlBuffer *)*psVar16,(char *)psVar16[1],psVar16[2]);
local_974 = local_820;
}
psVar16[2] = 0x10;
psVar16[1] = (size_t)local_930;
*psVar16 = (size_t)param_1;
psVar16[-1] = 0xbea5fe;
CUtlBuffer::Get((CUtlBuffer *)*psVar16,(void *)psVar16[1],psVar16[2]);
*psVar16 = 0x30;
psVar16[-1] = 0xbea60a;
sVar8 = DMXAlloc(*psVar16);
puVar3 = local_970;
*psVar16 = sVar8;
psVar16[1] = (size_t)puVar3;
psVar16[-1] = 0xbea61e;
CDmxElement::CDmxElement((CDmxElement *)*psVar16,(char *)psVar16[1]);
psVar16[1] = 1;
*psVar16 = sVar8;
local_948 = sVar8;
psVar16[-1] = 0xbea634;
CDmxElement::LockForChanges((CDmxElement *)*psVar16,SUB41(psVar16[1],0));
sVar2 = local_948;
psVar16[1] = (size_t)"name";
*psVar16 = sVar2;
/* try { // try from 00bea645 to 00bea673 has its CatchHandler @ 00bead3a */
psVar16[-1] = 0xbea64a;
uVar9 = CDmxElement::AddAttribute((CDmxElement *)*psVar16,(char *)psVar16[1]);
puVar3 = local_974;
*psVar16 = uVar9;
psVar16[1] = (size_t)puVar3;
psVar16[-1] = 0xbea65c;
CDmxAttribute::SetValue((CDmxAttribute *)*psVar16,(char *)psVar16[1]);
psVar16[1] = (size_t)local_930;
*psVar16 = local_948;
psVar16[-1] = 0xbea674;
CDmxElement::SetId((CDmxElement *)*psVar16,(UniqueId_t *)psVar16[1]);
if (sVar8 != 0) {
psVar16[1] = 0;
*psVar16 = sVar8;
psVar16[-1] = 0xbea688;
CDmxElement::LockForChanges((CDmxElement *)*psVar16,SUB41(psVar16[1],0));
}
psVar16[2] = (size_t)&local_948;
psVar16[1] = local_938;
*psVar16 = (size_t)local_97c;
/* try { // try from 00bea6a5 to 00bea742 has its CatchHandler @ 00bead68 */
psVar16[-1] = 0xbea6aa;
CUtlVector<CDmxElement*,CUtlMemory<CDmxElement*,int>>::InsertBefore
((CUtlVector<CDmxElement*,CUtlMemory<CDmxElement*,int>> *)*psVar16,psVar16[1],
(CDmxElement **)psVar16[2]);
local_968 = local_968 + 1;
if ((int)local_978 <= local_968) break;
LAB_00bea6c3:
if (sVar17 == 0) {
psVar16[2] = 0x100;
psVar16[1] = (size_t)local_920;
*psVar16 = (size_t)param_1;
psVar16[-1] = 0xbea89a;
CUtlBuffer::GetString((CUtlBuffer *)*psVar16,(char *)psVar16[1],psVar16[2]);
local_970 = local_920;
}
else {
if (((byte)param_1[0x15] & 1) == 0) {
psVar16[1] = 2;
*psVar16 = (size_t)param_1;
/* try { // try from 00bea7fb to 00bea899 has its CatchHandler @ 00bead68 */
psVar16[-1] = 0xbea800;
cVar7 = CUtlBuffer::CheckGet((CUtlBuffer *)*psVar16,psVar16[1]);
if (cVar7 == '\0') {
iVar14 = 0;
iVar10 = 0;
}
else {
if (((byte)param_1[0x34] & 1) == 0) {
iVar14 = *(int *)(param_1 + 0xc);
sVar13 = *(short *)(*(int *)param_1 + (iVar14 - *(int *)(param_1 + 0x20)));
}
else {
psVar12 = (short *)((*(int *)(param_1 + 0xc) - *(int *)(param_1 + 0x20)) +
*(int *)param_1);
if (psVar12 == (short *)0x0) {
psVar12 = &local_94e;
}
local_94a = local_94e;
local_94a = CONCAT11((char)((ushort)local_94e >> 8),*(undefined1 *)((int)psVar12 + 1));
sVar13 = *psVar12;
psVar16[2] = 2;
local_94a = CONCAT11((char)sVar13,(undefined1)local_94a);
psVar16[1] = (size_t)&local_94a;
*psVar16 = (size_t)&local_94e;
/* try { // try from 00bea9ba to 00bea9be has its CatchHandler @ 00bead68 */
psVar16[-1] = 0xbea9bf;
_V_memcpy((void *)*psVar16,(void *)psVar16[1],psVar16[2]);
iVar14 = *(int *)(param_1 + 0xc);
sVar13 = local_94e;
}
iVar10 = (int)sVar13;
*(int *)(param_1 + 0xc) = iVar14 + 2;
iVar14 = (int)sVar13;
}
}
else {
psVar16[1] = (size_t)"%d";
psVar16[2] = (size_t)&local_94e;
*psVar16 = (size_t)param_1;
local_94e = 0;
psVar16[-1] = 0xbea6f8;
CUtlBuffer::Scanf((CUtlBuffer *)*psVar16,(char *)psVar16[1]);
iVar10 = (int)local_94e;
iVar14 = (int)local_94e;
}
if ((int)local_960 <= iVar14) goto LAB_00beab60;
local_970 = (undefined1 *)(*(int *)(local_964 + iVar10 * 4) + sVar17);
}
}
iVar10 = 0;
*local_984 = (CDmxElement *)*local_944;
do {
puVar15 = local_944;
psVar16[6] = sVar17;
psVar16[7] = param_2;
psVar16[5] = local_964;
psVar16[4] = local_960;
psVar16[3] = (size_t)local_97c;
sVar2 = puVar15[iVar10];
psVar16[1] = (size_t)param_1;
psVar16[2] = sVar2;
*psVar16 = (size_t)local_980;
psVar16[-1] = 0xbeab40;
local_969 = (bool)UnserializeAttributes
((CDmxSerializer *)*psVar16,(CUtlBuffer *)psVar16[1],
(CDmxElement *)psVar16[2],(CUtlVector *)psVar16[3],psVar16[4],
(int *)psVar16[5],(char *)psVar16[6],psVar16[7]);
if (local_969 == false) goto LAB_00beab60;
iVar10 = iVar10 + 1;
} while (iVar10 < (int)local_978);
local_969 = param_1[0x14] == (CUtlBuffer)0x0;
LAB_00beab60:
puVar15 = local_97c;
local_938 = 0;
*psVar16 = (size_t)local_97c;
psVar16[-1] = 0xbeab78;
CUtlMemory<CDmxElement*,int>::Purge((CUtlMemory<CDmxElement*,int> *)*psVar16);
puVar4 = local_944;
*psVar16 = (size_t)puVar15;
local_934 = puVar4;
psVar16[-1] = 0xbeab8c;
CUtlMemory<CDmxElement*,int>::Purge((CUtlMemory<CDmxElement*,int> *)*psVar16);
LAB_00bea777:
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
*(undefined1 **)((int)psVar16 + -4) = &LAB_00bead3a;
__stack_chk_fail();
}
return local_969;
}
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.