CDmxSerializer::Serialize
0x00be9e20 · 890 bytes · __cdecl
_ZN14CDmxSerializer9SerializeER10CUtlBufferP11CDmxElementPKc
Decompiled
undefined (3 params)
/* CDmxSerializer::Serialize(CUtlBuffer&, CDmxElement*, char const*) */
undefined4 CDmxSerializer::Serialize(CUtlBuffer *param_1,CDmxElement *param_2,char *param_3)
{
char cVar1;
int iVar2;
uint uVar3;
char *pcVar4;
undefined4 uVar5;
CDmxElement *pCVar6;
void *pvVar7;
undefined1 local_88;
undefined1 uStack_87;
undefined1 local_84;
undefined1 local_83;
undefined1 local_82;
undefined1 local_81;
undefined4 local_80;
undefined2 local_7c;
undefined1 local_7a;
undefined1 local_79;
CDmxSerializationDictionary local_78 [4];
CUtlMemory<UtlRBTreeNode_t<CDmxSerializationDictionary::DmxElementInfo_t,int>,int> local_74 [20];
undefined4 local_60;
undefined4 local_5c;
CUtlSymbolTable local_54 [18];
ushort local_42;
CDmxSerializationDictionary::CDmxSerializationDictionary(local_78,0);
/* try { // try from 00be9e51 to 00be9e78 has its CatchHandler @ 00bea1f0 */
CDmxSerializationDictionary::BuildElementList(local_78,(CDmxElement *)param_3,true);
CUtlSymbolTable::CUtlSymbolTable(local_54,0,0x10,false);
/* try { // try from 00be9e7c to 00bea173 has its CatchHandler @ 00bea1b3 */
for (iVar2 = CDmxSerializationDictionary::FirstRootElement(local_78); iVar2 != -1;
iVar2 = CDmxSerializationDictionary::NextRootElement(local_78,iVar2)) {
pCVar6 = (CDmxElement *)CDmxSerializationDictionary::GetRootElement(local_78,iVar2);
if (pCVar6 == (CDmxElement *)0x0) goto LAB_00bea010;
GatherSymbols((CDmxSerializer *)param_1,local_54,pCVar6);
}
uVar3 = (uint)local_42;
if (((byte)param_2[0x15] & 1) == 0) {
cVar1 = CUtlBuffer::CheckPut((CUtlBuffer *)param_2,4);
if (cVar1 != '\0') {
if (((byte)param_2[0x34] & 1) == 0) {
*(uint *)(*(int *)param_2 + (*(int *)(param_2 + 0x10) - *(int *)(param_2 + 0x20))) = uVar3;
iVar2 = *(int *)(param_2 + 0x10);
}
else {
iVar2 = *(int *)(param_2 + 0x10);
pvVar7 = (void *)((iVar2 - *(int *)(param_2 + 0x20)) + *(int *)param_2);
if (pvVar7 != (void *)0x0) {
local_84 = 0;
local_83 = 0;
uStack_87 = (undefined1)(local_42 >> 8);
local_82 = uStack_87;
local_88 = (undefined1)local_42;
local_81 = local_88;
_V_memcpy(pvVar7,&local_84,4);
iVar2 = *(int *)(param_2 + 0x10);
}
}
*(int *)(param_2 + 0x10) = iVar2 + 4;
CUtlBuffer::AddNullTermination((CUtlBuffer *)param_2);
}
}
else {
CUtlBuffer::Printf((CUtlBuffer *)param_2,"%d",uVar3);
}
iVar2 = 0;
if (uVar3 != 0) {
do {
local_7c = (undefined2)iVar2;
pcVar4 = (char *)CUtlSymbolTable::String(local_54,&local_7c);
CUtlBuffer::PutString((CUtlBuffer *)param_2,pcVar4);
iVar2 = iVar2 + 1;
} while (iVar2 < (int)uVar3);
}
uVar5 = CDmxSerializationDictionary::RootElementCount(local_78);
if (((byte)param_2[0x15] & 1) == 0) {
local_80 = uVar5;
cVar1 = CUtlBuffer::CheckPut((CUtlBuffer *)param_2,4);
if (cVar1 != '\0') {
if (((byte)param_2[0x34] & 1) == 0) {
*(undefined4 *)(*(int *)param_2 + (*(int *)(param_2 + 0x10) - *(int *)(param_2 + 0x20))) =
uVar5;
iVar2 = *(int *)(param_2 + 0x10);
}
else {
iVar2 = *(int *)(param_2 + 0x10);
pvVar7 = (void *)((iVar2 - *(int *)(param_2 + 0x20)) + *(int *)param_2);
if (pvVar7 != (void *)0x0) {
local_7c = CONCAT11(local_80._2_1_,local_80._3_1_);
local_7a = local_80._1_1_;
local_79 = (undefined1)local_80;
_V_memcpy(pvVar7,&local_7c,4);
iVar2 = *(int *)(param_2 + 0x10);
}
}
*(int *)(param_2 + 0x10) = iVar2 + 4;
CUtlBuffer::AddNullTermination((CUtlBuffer *)param_2);
}
}
else {
CUtlBuffer::Printf((CUtlBuffer *)param_2,"%d",uVar5);
}
for (iVar2 = CDmxSerializationDictionary::FirstRootElement(local_78); iVar2 != -1;
iVar2 = CDmxSerializationDictionary::NextRootElement(local_78,iVar2)) {
pCVar6 = (CDmxElement *)CDmxSerializationDictionary::GetRootElement(local_78,iVar2);
cVar1 = SaveElementDict((CDmxSerializer *)param_1,(CUtlBuffer *)param_2,local_54,pCVar6);
if (cVar1 == '\0') goto LAB_00bea010;
}
for (iVar2 = CDmxSerializationDictionary::FirstRootElement(local_78); iVar2 != -1;
iVar2 = CDmxSerializationDictionary::NextRootElement(local_78,iVar2)) {
pCVar6 = (CDmxElement *)CDmxSerializationDictionary::GetRootElement(local_78,iVar2);
cVar1 = SaveElement((CDmxSerializer *)param_1,(CUtlBuffer *)param_2,local_78,local_54,pCVar6);
if (cVar1 == '\0') goto LAB_00bea010;
}
uVar5 = 1;
LAB_00bea012:
CUtlSymbolTable::~CUtlSymbolTable(local_54);
CUtlRBTree<CDmxSerializationDictionary::DmxElementInfo_t,int,bool(*)(CDmxSerializationDictionary::DmxElementInfo_t_const&,CDmxSerializationDictionary::DmxElementInfo_t_const&),CUtlMemory<UtlRBTreeNode_t<CDmxSerializationDictionary::DmxElementInfo_t,int>,int>>
::RemoveAll((CUtlRBTree<CDmxSerializationDictionary::DmxElementInfo_t,int,bool(*)(CDmxSerializationDictionary::DmxElementInfo_t_const&,CDmxSerializationDictionary::DmxElementInfo_t_const&),CUtlMemory<UtlRBTreeNode_t<CDmxSerializationDictionary::DmxElementInfo_t,int>,int>>
*)local_78);
local_60 = 0xffffffff;
CUtlMemory<UtlRBTreeNode_t<CDmxSerializationDictionary::DmxElementInfo_t,int>,int>::Purge
(local_74);
local_5c = 0xffffffff;
CUtlMemory<UtlRBTreeNode_t<CDmxSerializationDictionary::DmxElementInfo_t,int>,int>::Purge
(local_74);
return uVar5;
LAB_00bea010:
uVar5 = 0;
goto LAB_00bea012;
}
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.