L L4D2node

CResponseSystem::ParseOneCriterion

0x005bcda0 · 1350 bytes · __thiscall

_ZN15CResponseSystem17ParseOneCriterionEPKc

Decompiled

undefined (2 params)

/* CResponseSystem::ParseOneCriterion(char const*) */

uint __thiscall CResponseSystem::ParseOneCriterion(CResponseSystem *this,char *param_1)

{
  CResponseDict<Criteria,unsigned_short> *this_00;
  CResponseSystem *__nptr;
  byte bVar1;
  CResponseSystem CVar2;
  bool bVar3;
  char cVar4;
  short sVar5;
  ushort uVar6;
  undefined2 uVar7;
  int iVar8;
  undefined4 uVar9;
  byte *pbVar10;
  CResponseSystem *pCVar11;
  byte *pbVar12;
  uint uVar13;
  int in_GS_OFFSET;
  double dVar14;
  uint local_170;
  Criteria *local_164;
  ushort local_14e;
  uint local_14c;
  undefined2 local_148;
  undefined2 uStack_146;
  undefined2 uStack_144;
  undefined2 local_142;
  undefined1 local_140;
  undefined4 local_13f;
  undefined4 local_13b;
  byte local_137;
  undefined2 local_136;
  undefined2 local_134;
  void *local_132;
  undefined4 local_12e;
  undefined4 local_12a;
  undefined4 local_126;
  char local_120 [128];
  char local_a0 [128];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  this_00 = (CResponseDict<Criteria,unsigned_short> *)(this + 0x44);
  sVar5 = CResponseDict<Criteria,unsigned_short>::Find(this_00,param_1);
  if (sVar5 == -1) {
    pbVar10 = (byte *)ResponseCopyString(param_1);
    bVar1 = *pbVar10;
    if (bVar1 == 0) {
      uVar13 = 0xaaaaaaaa;
    }
    else {
      uVar13 = 0xaaaaaaaa;
      pbVar12 = pbVar10;
      do {
        pbVar12 = pbVar12 + 1;
        uVar13 = (uint)bVar1 + uVar13 * 0x21;
        bVar1 = *pbVar12;
      } while (bVar1 != 0);
    }
    local_148 = SUB42(pbVar10,0);
    uStack_146 = (undefined2)((uint)pbVar10 >> 0x10);
    local_14c = uVar13;
    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 + 0x60),(Node_t *)&local_14c);
    local_137 = local_137 & 0x80;
    local_148 = 0xffff;
    local_136 = 0xffff;
    local_134 = 0xffff;
    local_13f = 0;
    local_13b = 0;
    local_132 = (void *)0x0;
    local_12e = 0;
    local_12a = 0;
    local_126 = 0;
    uStack_146 = 0;
    uStack_144 = 0;
    local_142 = float16::ConvertFloatTo16bits(1.0);
    local_140 = 0;
    local_14c = uVar13;
                    /* try { // try from 005bd2a3 to 005bd2a7 has its CatchHandler @ 005bd2f3 */
    local_170 = CUtlRBTree<CUtlMap<unsigned_int,Criteria,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,Criteria,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,Criteria,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                ::Insert((CUtlRBTree<CUtlMap<unsigned_int,Criteria,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,Criteria,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,Criteria,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                          *)this_00,(Node_t *)&local_14c);
    local_12a = 0;
    free(local_132);
    local_170 = local_170 & 0xffff;
    local_164 = (Criteria *)(local_170 * 0x34 + *(int *)(this + 0x48) + 0xc);
  }
  else {
    if ((ParseOneCriterion(char_const*)::dummy == '\0') &&
       (iVar8 = __cxa_guard_acquire(&ParseOneCriterion(char_const*)::dummy), iVar8 != 0)) {
      Criteria::Criteria((Criteria *)&ParseOneCriterion(char_const*)::dummy);
      __cxa_guard_release(&ParseOneCriterion(char_const*)::dummy);
      __cxa_atexit(Criteria::~Criteria,&ParseOneCriterion(char_const*)::dummy,&__dso_handle);
    }
    bVar1 = *param_1;
    if (bVar1 == 0) {
      iVar8 = -0x55555556;
    }
    else {
      iVar8 = -0x55555556;
      pbVar10 = (byte *)param_1;
      do {
        pbVar10 = pbVar10 + 1;
        iVar8 = (uint)bVar1 + iVar8 * 0x21;
        bVar1 = *pbVar10;
      } while (bVar1 != 0);
    }
    ResponseWarning(this,"Multiple definitions for criteria \'%s\' [%d]\n",param_1,iVar8);
    local_170 = 0xffff;
    local_164 = (Criteria *)&ParseOneCriterion(char_const*)::dummy;
  }
  bVar3 = false;
  __nptr = this + 0x38c8;
  do {
    cVar4 = TokenWaiting(this);
joined_r0x005bce6c:
    if ((cVar4 == '\0') && (bVar3)) {
      iVar8 = *(int *)(local_164 + 0x1e);
joined_r0x005bcff7:
      if (iVar8 < 1) {
        ComputeMatcher(this,local_164,(Matcher *)(local_164 + 9));
      }
      if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
        return local_170;
      }
                    /* WARNING: Subroutine does not return */
      __stack_chk_fail();
    }
    ParseToken(this);
    CVar2 = this[0x38c8];
    if (CVar2 == (CResponseSystem)0x0) {
      local_14c = 0xaaaaaaaa;
    }
    else {
      local_14c = 0xaaaaaaaa;
      pCVar11 = __nptr;
      do {
        pCVar11 = pCVar11 + 1;
        local_14c = (uint)(byte)CVar2 + local_14c * 0x21;
        CVar2 = *pCVar11;
      } while (CVar2 != (CResponseSystem)0x0);
    }
    sVar5 = CUtlRBTree<unsigned_int,unsigned_short,bool(*)(unsigned_int_const&,unsigned_int_const&),CUtlMemory<UtlRBTreeNode_t<unsigned_int,unsigned_short>,unsigned_short>>
            ::Find((CUtlRBTree<unsigned_int,unsigned_short,bool(*)(unsigned_int_const&,unsigned_int_const&),CUtlMemory<UtlRBTreeNode_t<unsigned_int,unsigned_short>,unsigned_short>>
                    *)(this + 0x3e20),&local_14c);
    if (sVar5 != -1) {
      this[0x3d7c] = (CResponseSystem)0x1;
      iVar8 = *(int *)(local_164 + 0x1e);
      goto joined_r0x005bcff7;
    }
    iVar8 = _V_stricmp((char *)__nptr,"{");
    if (iVar8 == 0) {
LAB_005bcef2:
      if (this[0x3d7c] != (CResponseSystem)0x0) goto LAB_005bcf94;
      do {
        if (0 < *(int *)(this + 0x3d8c)) {
          iVar8 = *(int *)(this + 0x3d80);
          uVar9 = RR_Parse(*(char **)(iVar8 + 8),(char *)__nptr);
          *(undefined4 *)(iVar8 + 8) = uVar9;
          *(int *)(*(int *)(this + 0x3d80) + 0xc) = *(int *)(*(int *)(this + 0x3d80) + 0xc) + 1;
        }
        while( true ) {
          iVar8 = _V_stricmp((char *)__nptr,"}");
          if (iVar8 == 0) {
            bVar3 = true;
            cVar4 = TokenWaiting(this);
            goto joined_r0x005bce6c;
          }
          uVar6 = CResponseDict<Criteria,unsigned_short>::Find(this_00,(char *)__nptr);
          if (uVar6 == 0xffff) {
            ResponseWarning(this,"Skipping unrecongized subcriterion \'%s\' in \'%s\'\n",__nptr,
                            param_1);
            goto LAB_005bcef2;
          }
          local_14e = uVar6;
          CUtlVector<unsigned_short,CUtlMemoryConservative<unsigned_short>>::InsertBefore
                    ((CUtlVector<unsigned_short,CUtlMemoryConservative<unsigned_short>> *)
                     (local_164 + 0x16),*(int *)(local_164 + 0x1e),&local_14e);
          if (this[0x3d7c] == (CResponseSystem)0x0) break;
LAB_005bcf94:
          this[0x3d7c] = (CResponseSystem)0x0;
        }
      } while( true );
    }
    iVar8 = _V_stricmp((char *)__nptr,"required");
    if (iVar8 == 0) {
      local_164[8] = (Criteria)0x1;
    }
    else {
      iVar8 = _V_stricmp((char *)__nptr,"weight");
      if (iVar8 == 0) {
        ParseToken(this);
        dVar14 = strtod((char *)__nptr,(char **)0x0);
        uVar7 = float16::ConvertFloatTo16bits((float)dVar14);
        *(undefined2 *)(local_164 + 6) = uVar7;
      }
      else {
        V_strncpy(local_120,(char *)__nptr,0x80);
        ParseToken(this);
        V_strncpy(local_a0,(char *)__nptr,0x80);
        AI_CriteriaSet::ComputeCriteriaSymbol((char *)&local_14e);
        *(ushort *)local_164 = local_14e;
        uVar9 = ResponseCopyString(local_a0);
        bVar3 = true;
        *(undefined4 *)(local_164 + 2) = uVar9;
      }
    }
  } while( true );
}

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)