CDmxSerializerKeyValues2::UnserializeElement
0x00bedb40 · 937 bytes · __thiscall
_ZN24CDmxSerializerKeyValues218UnserializeElementER10CUtlBufferPKcPi
Decompiled
undefined (4 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CDmxSerializerKeyValues2::UnserializeElement(CUtlBuffer&, char const*, int*) */
undefined4 __thiscall
CDmxSerializerKeyValues2::UnserializeElement
(CDmxSerializerKeyValues2 *this,CUtlBuffer *param_1,char *param_2,int *param_3)
{
char cVar1;
int iVar2;
CUtlCharConversion *pCVar3;
int iVar4;
int iVar5;
undefined4 uVar6;
int in_GS_OFFSET;
undefined2 local_258 [28];
char local_220 [256];
char local_120 [256];
int local_20;
*param_3 = -1;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
iVar2 = CreateDmxElement(this,param_2);
CUtlSymbolTable::AddString((char *)local_258);
if (_DAT_0105b768 < 0x40) {
(&g_KeyValues2ErrorStack)[_DAT_0105b768] = local_258[0];
}
iVar4 = _DAT_0105b768;
if (_DAT_0105b768 + 1 <= _DAT_0105b76c) {
iVar4 = _DAT_0105b76c;
}
_DAT_0105b768 = _DAT_0105b768 + 1;
_DAT_0105b76c = iVar4;
/* try { // try from 00bedbfd to 00bedc01 has its CatchHandler @ 00bedf1b */
CUtlBuffer::CUtlBuffer((CUtlBuffer *)local_258,0,0,0);
/* try { // try from 00bedc02 to 00bedef5 has its CatchHandler @ 00bedf00 */
pCVar3 = (CUtlCharConversion *)GetCStringCharConversion();
iVar4 = ReadToken(this,param_1,(CUtlBuffer *)local_258);
if (iVar4 == 0) {
do {
if (param_1[0x14] != (CUtlBuffer)0x0) {
LAB_00bede8e:
uVar6 = 1;
*param_3 = iVar2;
goto LAB_00bedd72;
}
iVar4 = ReadToken(this,param_1,(CUtlBuffer *)local_258);
if ((iVar4 == 7) || (iVar4 == -1)) {
CDmxKeyValues2ErrorStack::ReportError
((CDmxKeyValues2ErrorStack *)&g_KeyValues2ErrorStack,
"Expecting \'}\', didn\'t find it!");
break;
}
if (iVar4 == 1) goto LAB_00bede8e;
if (iVar4 != 5) {
CDmxKeyValues2ErrorStack::ReportError
((CDmxKeyValues2ErrorStack *)&g_KeyValues2ErrorStack,
"Expecting attribute name, didn\'t find it!");
break;
}
CUtlBuffer::GetDelimitedString((CUtlBuffer *)local_258,pCVar3,local_220,0x100);
iVar4 = ReadToken(this,param_1,(CUtlBuffer *)local_258);
if (iVar4 != 5) {
CDmxKeyValues2ErrorStack::ReportError
((CDmxKeyValues2ErrorStack *)&g_KeyValues2ErrorStack,
"Expecting attribute type for attribute %s, didn\'t find it!",local_220);
break;
}
CUtlBuffer::GetDelimitedString((CUtlBuffer *)local_258,pCVar3,local_120,0x100);
iVar4 = _V_stricmp("elementid",local_120);
iVar5 = 0;
if (iVar4 == 0) {
iVar4 = _V_stricmp("id",local_220);
if (iVar4 != 0) break;
cVar1 = UnserializeId(this,param_1,iVar2);
}
else {
do {
iVar4 = _V_stricmp((&g_pAttributeTypeName)[iVar5],local_120);
if (iVar4 == 0) {
if (iVar5 != 0) {
if (iVar5 == 0xf) {
cVar1 = UnserializeElementArrayAttribute(this,param_1,iVar2,local_220);
}
else if (iVar5 < 0xf) {
cVar1 = UnserializeAttribute(this,param_1,iVar2,local_220,iVar5);
}
else {
cVar1 = UnserializeArrayAttribute();
}
goto LAB_00bedd67;
}
break;
}
iVar5 = iVar5 + 1;
} while (iVar5 != 0x1d);
cVar1 = UnserializeElementAttribute(this,param_1,iVar2,local_220,local_120);
}
LAB_00bedd67:
} while (cVar1 != '\0');
}
else {
CDmxKeyValues2ErrorStack::ReportError
((CDmxKeyValues2ErrorStack *)&g_KeyValues2ErrorStack,
"Expecting \'{\', didn\'t find it!");
}
uVar6 = 0;
LAB_00bedd72:
CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_258);
_DAT_0105b768 = _DAT_0105b768 + -1;
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return uVar6;
}
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.