L L4D2node

CResponseSystem::ParseRule

0x005bde80 · 921 bytes · __thiscall

_ZN15CResponseSystem9ParseRuleEv

Decompiled

undefined (1 param)

/* CResponseSystem::ParseRule() */

void __thiscall CResponseSystem::ParseRule(CResponseSystem *this)

{
  CResponseSystem *pCVar1;
  CResponseSystem CVar2;
  byte bVar3;
  char cVar4;
  int iVar5;
  CUtlVector<unsigned_short,CUtlMemoryConservative<unsigned_short>> *this_00;
  undefined4 uVar6;
  uint uVar7;
  CUtlRBTree<CUtlMap<unsigned_int,Rule*,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,Rule*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,Rule*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
  *this_01;
  CResponseSystem *pCVar8;
  byte *pbVar9;
  int in_GS_OFFSET;
  int local_128;
  CUtlVector<unsigned_short,CUtlMemoryConservative<unsigned_short>> *local_124;
  char local_120 [128];
  char local_a0 [128];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  pCVar1 = this + 0x38c8;
  ParseToken(this);
  V_strncpy(local_120,(char *)pCVar1,0x80);
  ParseToken(this);
  iVar5 = _V_stricmp((char *)pCVar1,"{");
  if (iVar5 == 0) {
    this_00 = ::operator_new(0x26);
    *(undefined4 *)this_00 = 0;
    *(undefined4 *)(this_00 + 4) = 0;
    *(undefined4 *)(this_00 + 8) = 0;
    *(undefined4 *)(this_00 + 0xc) = 0;
    *(undefined4 *)(this_00 + 0x10) = 0;
    *(undefined4 *)(this_00 + 0x14) = 0;
    *(undefined4 *)(this_00 + 0x18) = 0;
    *(undefined4 *)(this_00 + 0x1c) = 0;
    this_00[0x24] = (CUtlVector<unsigned_short,CUtlMemoryConservative<unsigned_short>>)0x0;
    *(undefined4 *)(this_00 + 0x20) = 0;
    this_00[0x25] =
         (CUtlVector<unsigned_short,CUtlMemoryConservative<unsigned_short>>)
         ((byte)this_00[0x25] & 0xf8 | 4);
    *(char **)(this + 4) = local_120;
    this[8] = (CResponseSystem)0x1;
    while( true ) {
      if (this[0x3d7c] == (CResponseSystem)0x0) {
        if (0 < *(int *)(this + 0x3d8c)) {
          iVar5 = *(int *)(this + 0x3d80);
          uVar6 = RR_Parse(*(char **)(iVar5 + 8),(char *)pCVar1);
          *(undefined4 *)(iVar5 + 8) = uVar6;
          *(int *)(*(int *)(this + 0x3d80) + 0xc) = *(int *)(*(int *)(this + 0x3d80) + 0xc) + 1;
        }
      }
      else {
        this[0x3d7c] = (CResponseSystem)0x0;
      }
      iVar5 = _V_stricmp((char *)pCVar1,"}");
      if (iVar5 == 0) goto LAB_005be0c6;
      iVar5 = _V_strlen((char *)pCVar1);
      if (iVar5 < 1) break;
      uVar7 = 0xaaaaaaaa;
      CVar2 = this[0x38c8];
      pCVar8 = pCVar1;
      while (CVar2 != (CResponseSystem)0x0) {
        pCVar8 = pCVar8 + 1;
        uVar7 = (uint)(byte)CVar2 + uVar7 * 0x21;
        CVar2 = *pCVar8;
      }
      cVar4 = DispatchParseRule(this,(char *)pCVar1,uVar7,(CUtlMap *)(this + 0x3dcc),(Rule *)this_00
                               );
      if (cVar4 == '\0') {
        ParseRule()::instancedCriteria = ParseRule()::instancedCriteria + 1;
        V_snprintf(local_a0,0x80,"[%s%03i]",local_120,ParseRule()::instancedCriteria);
        this[0x3d7c] = (CResponseSystem)0x1;
        iVar5 = ParseOneCriterion(this,local_a0);
        if (iVar5 != 0xffff) {
          local_128 = CONCAT22(local_128._2_2_,(short)iVar5);
          CUtlVector<unsigned_short,CUtlMemoryConservative<unsigned_short>>::InsertBefore
                    (this_00,*(int *)(this_00 + 8),(ushort *)&local_128);
        }
      }
    }
    ResponseWarning(this,"Expecting more tokens in rule \'%s\'\n",local_120);
LAB_005be0c6:
    if (this[8] == (CResponseSystem)0x0) {
      DevMsg("Discarded rule %s\n",local_120);
      *(undefined4 *)(this_00 + 0x18) = 0;
      free(*(void **)(this_00 + 0x10));
      *(undefined4 *)(this_00 + 0x14) = 0;
      *(undefined4 *)(this_00 + 0x10) = 0;
      *(undefined4 *)(this_00 + 0x1c) = 0;
      *(undefined4 *)(this_00 + 8) = 0;
      free(*(void **)this_00);
      *(undefined4 *)(this_00 + 4) = 0;
      *(undefined4 *)this_00 = 0;
      *(undefined4 *)(this_00 + 0xc) = 0;
      operator_delete(this_00);
    }
    else {
      this_01 = (CUtlRBTree<CUtlMap<unsigned_int,Rule*,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,Rule*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,Rule*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                 *)ResponseRulePartition::GetDictForRule
                             ((ResponseRulePartition *)(this + 0x7c),this,(Rule *)this_00);
      local_124 = (CUtlVector<unsigned_short,CUtlMemoryConservative<unsigned_short>> *)
                  ResponseCopyString(local_120);
      bVar3 = *(byte *)local_124;
      if (bVar3 == 0) {
        iVar5 = -0x55555556;
      }
      else {
        iVar5 = -0x55555556;
        pbVar9 = (byte *)local_124;
        do {
          pbVar9 = pbVar9 + 1;
          iVar5 = (uint)bVar3 + iVar5 * 0x21;
          bVar3 = *pbVar9;
        } while (bVar3 != 0);
      }
      local_128 = iVar5;
      CUtlRBTree<CUtlMap<unsigned_int,char_const*,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,char_const*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,char_const*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
      ::Insert((CUtlRBTree<CUtlMap<unsigned_int,char_const*,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,char_const*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,char_const*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                *)(this_01 + 0x1c),(Node_t *)&local_128);
      local_128 = iVar5;
      local_124 = this_00;
      CUtlRBTree<CUtlMap<unsigned_int,Rule*,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,Rule*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,Rule*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
      ::Insert(this_01,(Node_t *)&local_128);
    }
  }
  else {
    ResponseWarning(this,"Expecting \'{\' in rule \'%s\', got \'%s\'\n",local_120,pCVar1);
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __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)