L L4D2node

CDmxSerializerKeyValues2::UnserializeAttribute

0x00bed3e0 · 529 bytes · __thiscall

_ZN24CDmxSerializerKeyValues220UnserializeAttributeER10CUtlBufferiPKc17DmAttributeType_t

Decompiled

undefined (5 params)

/* CDmxSerializerKeyValues2::UnserializeAttribute(CUtlBuffer&, int, char const*, DmAttributeType_t)
    */

undefined4 __thiscall
CDmxSerializerKeyValues2::UnserializeAttribute
          (CDmxSerializerKeyValues2 *this,CUtlBuffer *param_1,int param_2,char *param_3,int param_5)

{
  char *pcVar1;
  char cVar2;
  int iVar3;
  undefined4 uVar4;
  CUtlCharConversion *pCVar5;
  int iVar6;
  undefined4 *puVar7;
  undefined4 uVar8;
  CDmxElement *this_00;
  int in_GS_OFFSET;
  undefined4 uStack_90;
  CDmxSerializerKeyValues2 *local_70 [2];
  CUtlBuffer local_68 [56];
  undefined1 local_30 [16];
  int local_20;
  
  puVar7 = (undefined4 *)&stack0xffffff74;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  local_70[0] = this;
  uStack_90 = 0xbed424;
  CUtlBuffer::CUtlBuffer(local_68,0,0,0);
                    /* try { // try from 00bed432 to 00bed4d7 has its CatchHandler @ 00bed60b */
  uStack_90 = 0xbed437;
  iVar3 = ReadToken(local_70[0],param_1,local_68);
  if (iVar3 == 5) {
    this_00 = (CDmxElement *)0x0;
    if (param_2 != -1) {
      this_00 = *(CDmxElement **)(param_2 * 0x14 + *(int *)local_70[0]);
    }
    uStack_90 = 0xbed4a4;
    cVar2 = CDmxElement::HasAttribute(this_00,param_3);
    if (cVar2 == '\0') {
      uStack_90 = 0xbed4d8;
      CDmxElement::LockForChanges(this_00,true);
                    /* try { // try from 00bed4df to 00bed4e3 has its CatchHandler @ 00bed61d */
      uStack_90 = 0xbed4e4;
      uVar4 = CDmxElement::AddAttribute(this_00,param_3);
      if (this_00 != (CDmxElement *)0x0) {
        uStack_90 = 0xbed4fb;
        CDmxElement::LockForChanges(this_00,false);
      }
      if (param_5 == 1) {
                    /* try { // try from 00bed505 to 00bed600 has its CatchHandler @ 00bed60b */
        uStack_90 = 0xbed50a;
        pCVar5 = (CUtlCharConversion *)GetCStringCharConversion();
        uStack_90 = 0xbed520;
        iVar6 = CUtlBuffer::PeekDelimitedStringLength(local_68,pCVar5,true);
        iVar3 = -((iVar6 + 0xfU & 0xfffffff0) + 0x10);
        pcVar1 = (char *)((int)local_70 + iVar3);
        *(int *)(local_68 + iVar3 + -0x18) = iVar6;
        *(CUtlCharConversion **)(local_68 + iVar3 + -0x20) = pCVar5;
        *(CUtlBuffer **)((int)local_70 + iVar3 + -0x1c) = local_68;
        *(char **)(local_68 + iVar3 + -0x1c) = pcVar1;
        *(undefined4 *)((int)&uStack_90 + iVar3) = 0xbed54d;
        CUtlBuffer::GetDelimitedString
                  (*(CUtlBuffer **)((int)local_70 + iVar3 + -0x1c),
                   *(CUtlCharConversion **)(local_68 + iVar3 + -0x20),
                   *(char **)(local_68 + iVar3 + -0x1c),*(int *)(local_68 + iVar3 + -0x18));
        uVar8 = 1;
        puVar7 = (undefined4 *)((int)local_70 + iVar3 + -0x1c);
        if (*pcVar1 != '\0') {
          *(char **)(local_68 + iVar3 + -0x20) = pcVar1;
          *(undefined4 *)(local_68 + iVar3 + -0x1c) = 0;
          *(undefined1 **)((int)local_70 + iVar3 + -0x1c) = local_30;
          *(undefined4 *)((int)&uStack_90 + iVar3) = 0xbed575;
          uVar8 = UniqueIdFromString(*(UniqueId_t **)((int)local_70 + iVar3 + -0x1c),
                                     *(char **)(local_68 + iVar3 + -0x20),
                                     *(int *)(local_68 + iVar3 + -0x1c));
          if ((char)uVar8 == '\0') {
            *(char **)(local_68 + iVar3 + -0x1c) = param_3;
            *(char **)(local_68 + iVar3 + -0x20) =
                 "Invalid format for element ID encountered for attribute \"%s\"";
            *(undefined2 **)((int)local_70 + iVar3 + -0x1c) = &g_KeyValues2ErrorStack;
            *(undefined4 *)((int)&uStack_90 + iVar3) = 0xbed593;
            CDmxKeyValues2ErrorStack::ReportError
                      (*(CDmxKeyValues2ErrorStack **)((int)local_70 + iVar3 + -0x1c),
                       *(char **)(local_68 + iVar3 + -0x20));
            puVar7 = (undefined4 *)((int)local_70 + iVar3 + -0x1c);
          }
          else {
            *(undefined1 **)(local_68 + iVar3 + -0x1c) = local_30;
            *(undefined4 *)(local_68 + iVar3 + -0x20) = uVar4;
            *(CDmxSerializerKeyValues2 **)((int)local_70 + iVar3 + -0x1c) = local_70[0];
            *(undefined4 *)((int)&uStack_90 + iVar3) = 0xbed601;
            CDmxElementDictionary::AddAttribute
                      (*(CDmxElementDictionary **)((int)local_70 + iVar3 + -0x1c),
                       *(CDmxAttribute **)(local_68 + iVar3 + -0x20),
                       *(UniqueId_t **)(local_68 + iVar3 + -0x1c));
            puVar7 = (undefined4 *)((int)local_70 + iVar3 + -0x1c);
          }
        }
        goto LAB_00bed456;
      }
      uStack_90 = 0xbed5bd;
      uVar8 = UnserializeAttributeValueFromToken();
      if ((char)uVar8 != '\0') goto LAB_00bed456;
      uStack_90 = 0xbed5df;
      CDmxKeyValues2ErrorStack::ReportError
                ((CDmxKeyValues2ErrorStack *)&g_KeyValues2ErrorStack,
                 "Error reading attribute \"%s\"");
    }
    else {
      uStack_90 = 0xbed4c0;
      CDmxKeyValues2ErrorStack::ReportError
                ((CDmxKeyValues2ErrorStack *)&g_KeyValues2ErrorStack,
                 "Encountered duplicate attribute definition for attribute \"%s\"!");
    }
  }
  else {
    uStack_90 = 0xbed454;
    CDmxKeyValues2ErrorStack::ReportError
              ((CDmxKeyValues2ErrorStack *)&g_KeyValues2ErrorStack,
               "Expecting quoted attribute value for attribute \"%s\", didn\'t find one!");
  }
  uVar8 = 0;
  puVar7 = (undefined4 *)&stack0xffffff74;
LAB_00bed456:
  *puVar7 = local_68;
  puVar7[-1] = 0xbed45e;
  CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)*puVar7);
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return uVar8;
  }
                    /* WARNING: Subroutine does not return */
  puVar7[-1] = &LAB_00bed60b;
  __stack_chk_fail();
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)