L L4D2node

CEntFireAutoCompletionFunctor::CommandCompletionCallback

0x0061de50 · 2178 bytes · __thiscall

_ZN29CEntFireAutoCompletionFunctor25CommandCompletionCallbackEPKcR10CUtlVectorI10CUtlString10CUtlMemoryIS3_iEE

Decompiled

undefined (3 params)

/* CEntFireAutoCompletionFunctor::CommandCompletionCallback(char const*, CUtlVector<CUtlString,
   CUtlMemory<CUtlString, int> >&) */

ushort __thiscall
CEntFireAutoCompletionFunctor::CommandCompletionCallback
          (CEntFireAutoCompletionFunctor *this,char *param_1,CUtlVector *param_2)

{
  short sVar1;
  int iVar2;
  int iVar3;
  int *piVar4;
  int iVar5;
  uint uVar6;
  char *pcVar7;
  int iVar8;
  ushort *puVar9;
  ushort uVar10;
  char *pcVar11;
  int iVar12;
  CBaseEntity *pCVar13;
  ushort uVar14;
  int iVar15;
  ushort uVar16;
  int in_GS_OFFSET;
  CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
  *local_468;
  CUtlString local_458 [16];
  code *local_448;
  int local_444;
  int local_440;
  undefined4 local_43c;
  undefined2 local_438;
  ushort local_436;
  ushort local_434;
  ushort local_432;
  undefined4 local_430;
  char local_42c [256];
  CFmtStrN<256> local_32c [5];
  char local_327 [263];
  char local_220 [512];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (g_pGameRules != 0) {
    iVar2 = _V_strstr(param_1,"ent_fire");
    pcVar11 = param_1 + 9;
    if (iVar2 == 0) {
      pcVar11 = param_1;
    }
    iVar2 = _V_strstr(pcVar11," ");
    if (iVar2 == 0) {
      pCVar13 = (CBaseEntity *)0x0;
      iVar2 = _V_strlen(pcVar11);
      local_438 = 0xffff;
      local_436 = 0;
      local_448 = UtlStringLessFunc;
      local_444 = 0;
      local_440 = 0;
      local_43c = 0;
      local_434 = 0xffff;
      local_432 = 0xffff;
      local_430 = 0;
                    /* try { // try from 0061e411 to 0061e45f has its CatchHandler @ 0061e6c9 */
      while (pCVar13 = (CBaseEntity *)
                       CGlobalEntityList::NextEnt((CGlobalEntityList *)gEntList,pCVar13),
            pCVar13 != (CBaseEntity *)0x0) {
        while( true ) {
          local_468 = (CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
                       *)&local_448;
          if ((*(char **)(pCVar13 + 0x154) == (char *)0x0) ||
             (iVar3 = V_strnicmp(*(char **)(pCVar13 + 0x154),pcVar11,iVar2), iVar3 != 0)) break;
          pcVar7 = *(char **)(pCVar13 + 0x154);
          if (pcVar7 == (char *)0x0) {
            pcVar7 = "";
          }
          CUtlString::CUtlString(local_458,pcVar7);
                    /* try { // try from 0061e46d to 0061e471 has its CatchHandler @ 0061e722 */
          sVar1 = CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
                  ::Find(local_468,local_458);
          if (sVar1 == -1) {
                    /* try { // try from 0061e5fd to 0061e601 has its CatchHandler @ 0061e722 */
            CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
            ::Insert(local_468,local_458);
          }
          if (0x3f < local_436) {
            CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_458);
            goto LAB_0061e4ac;
          }
          CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_458);
                    /* try { // try from 0061e49d to 0061e510 has its CatchHandler @ 0061e6c9 */
          pCVar13 = (CBaseEntity *)CGlobalEntityList::NextEnt((CGlobalEntityList *)gEntList,pCVar13)
          ;
          if (pCVar13 == (CBaseEntity *)0x0) goto LAB_0061e4ac;
        }
      }
LAB_0061e4ac:
      local_468 = (CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
                   *)&local_448;
      uVar6 = CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
              ::FirstInorder(local_468);
      uVar6 = uVar6 & 0xffff;
      if (uVar6 != 0xffff) {
        do {
          pcVar11 = (char *)CUtlString::Get((CUtlString *)(local_444 + 8 + uVar6 * 0x18));
          V_strncpy(local_220,pcVar11,0x200);
          _V_strlower(local_220);
          CUtlString::CUtlString(local_458);
                    /* try { // try from 0061e52e to 0061e55d has its CatchHandler @ 0061e719 */
          CFmtStrN<256>::CFmtStrN(local_32c,"%s %s","ent_fire",local_220);
          CUtlString::operator=(local_458,local_327);
          CUtlVector<CUtlString,CUtlMemory<CUtlString,int>>::InsertBefore
                    ((CUtlVector<CUtlString,CUtlMemory<CUtlString,int>> *)param_2,
                     *(int *)(param_2 + 0xc),local_458);
          CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_458);
          uVar6 = CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
                  ::NextInorder(local_468,(ushort)uVar6);
          uVar6 = uVar6 & 0xffff;
        } while (uVar6 != 0xffff);
      }
      uVar16 = local_436;
      if (local_432 != 0xffff) {
        iVar2 = 0;
        uVar10 = local_432;
        if (0 < local_440) {
          do {
            uVar14 = (ushort)iVar2;
            if ((iVar2 < local_440) && (uVar14 <= uVar10)) {
              if ((CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
                   ::Links(unsigned_short)::s_Sentinel == '\0') &&
                 (iVar3 = __cxa_guard_acquire(&CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
                                               ::Links(unsigned_short)::s_Sentinel), iVar3 != 0)) {
                DAT_00f26b8e = 0xffff;
                CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
                ::Links(unsigned_short)::s_Sentinel = 0xffff;
                DAT_00f26b90 = 0xffff;
                __cxa_guard_release(&CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
                                     ::Links(unsigned_short)::s_Sentinel);
              }
              puVar9 = (ushort *)(local_444 + iVar2 * 0x18);
              uVar10 = local_432;
              if (*puVar9 != uVar14) {
                CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)(puVar9 + 4));
                *(ushort *)(local_444 + 2 + iVar2 * 0x18) = local_434;
                *(ushort *)(local_444 + iVar2 * 0x18) = uVar14;
                uVar10 = local_432;
                local_434 = uVar14;
              }
            }
          } while (((uVar10 != uVar14) && ((int)(iVar2 + 1U & 0xffff) < local_440)) &&
                  (iVar2 = iVar2 + 1, iVar2 != 0xffff));
        }
LAB_0061e230:
        local_438 = 0xffff;
        local_436 = 0;
      }
LAB_0061e245:
      local_434 = 0xffff;
      CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>::Purge
                ((CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short> *)&local_444
                );
      local_432 = 0xffff;
      CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>::Purge
                ((CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short> *)&local_444
                );
      goto LAB_0061e277;
    }
    iVar2 = _V_strstr(param_1,"ent_fire");
    if (iVar2 != 0) {
      param_1 = param_1 + 9;
    }
    iVar2 = _V_strstr(param_1," ");
    if (iVar2 != 0) {
      iVar3 = _V_strlen(param_1);
      iVar8 = iVar2 - (int)param_1;
      local_42c[0] = '\0';
      V_strncat(local_42c,param_1,0x100,iVar8);
      piVar4 = (int *)CGlobalEntityList::FindEntityByName
                                ((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,local_42c,
                                 (CBaseEntity *)0x0,(CBaseEntity *)0x0,(CBaseEntity *)0x0,
                                 (IEntityFindFilter *)0x0);
      if (piVar4 != (int *)0x0) {
        local_436 = 0;
        pcVar11 = (char *)(iVar2 + 1);
        local_438 = 0xffff;
        local_432 = 0xffff;
        local_448 = UtlStringLessFunc;
        local_444 = 0;
        local_440 = 0;
        local_43c = 0;
        local_434 = 0xffff;
        local_430 = 0;
        if (iVar3 <= iVar8) {
          pcVar11 = (char *)0x0;
        }
                    /* try { // try from 0061dff4 to 0061e094 has its CatchHandler @ 0061e717 */
        piVar4 = (int *)(**(code **)(*piVar4 + 0x30))(piVar4);
        if ((piVar4 != (int *)0x0) && (local_436 < 0x40)) {
          do {
            iVar2 = piVar4[1];
            if (0 < iVar2) {
              iVar15 = 0;
              do {
                iVar12 = iVar15 * 0x40 + *piVar4;
                if ((((*(ushort *)(iVar12 + 0xe) & 8) != 0) &&
                    ((*(ushort *)(iVar12 + 0xe) & 2) == 0)) &&
                   ((pcVar11 == (char *)0x0 ||
                    (iVar5 = V_strnicmp(pcVar11,*(char **)(iVar12 + 0x10),(iVar3 - iVar8) + -1),
                    iVar5 == 0)))) {
                  CUtlString::CUtlString(local_458,*(char **)(iVar12 + 0x10));
                    /* try { // try from 0061e0a8 to 0061e0ac has its CatchHandler @ 0061e6f2 */
                  sVar1 = CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
                          ::Find((CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
                                  *)&local_448,local_458);
                  if (sVar1 == -1) {
                    /* try { // try from 0061e2ab to 0061e2af has its CatchHandler @ 0061e6f2 */
                    CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
                    ::Insert((CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
                              *)&local_448,local_458);
                  }
                  if (0x3f < local_436) {
                    CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_458)
                    ;
                    break;
                  }
                  CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_458);
                }
                iVar15 = iVar15 + 1;
              } while (iVar15 != iVar2);
            }
            piVar4 = (int *)piVar4[3];
          } while ((piVar4 != (int *)0x0) && (local_436 < 0x40));
        }
        local_468 = (CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
                     *)&local_448;
        uVar6 = CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
                ::FirstInorder(local_468);
        uVar6 = uVar6 & 0xffff;
        if (uVar6 != 0xffff) {
          do {
                    /* try { // try from 0061e138 to 0061e160 has its CatchHandler @ 0061e717 */
            pcVar11 = (char *)CUtlString::Get((CUtlString *)(local_444 + 8 + uVar6 * 0x18));
            V_strncpy(local_220,pcVar11,0x200);
            _V_strlower(local_220);
            CUtlString::CUtlString(local_458);
                    /* try { // try from 0061e188 to 0061e1b7 has its CatchHandler @ 0061e704 */
            CFmtStrN<256>::CFmtStrN(local_32c,"%s %s %s","ent_fire",local_42c,local_220);
            CUtlString::operator=(local_458,local_327);
            CUtlVector<CUtlString,CUtlMemory<CUtlString,int>>::InsertBefore
                      ((CUtlVector<CUtlString,CUtlMemory<CUtlString,int>> *)param_2,
                       *(int *)(param_2 + 0xc),local_458);
            CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_458);
            uVar6 = CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
                    ::NextInorder(local_468,(ushort)uVar6);
            uVar6 = uVar6 & 0xffff;
          } while (uVar6 != 0xffff);
        }
        uVar16 = local_436;
        if (local_432 != 0xffff) {
          iVar2 = 0;
          uVar10 = local_432;
          if (0 < local_440) {
            do {
              uVar14 = (ushort)iVar2;
              if ((iVar2 < local_440) && (uVar14 <= uVar10)) {
                if ((CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
                     ::Links(unsigned_short)::s_Sentinel == '\0') &&
                   (iVar3 = __cxa_guard_acquire(&CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
                                                 ::Links(unsigned_short)::s_Sentinel), iVar3 != 0))
                {
                  CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
                  ::Links(unsigned_short)::s_Sentinel = 0xffff;
                  DAT_00f26b8e = 0xffff;
                  DAT_00f26b90 = 0xffff;
                  __cxa_guard_release(&CUtlRBTree<CUtlString,unsigned_short,bool(*)(CUtlString_const&,CUtlString_const&),CUtlMemory<UtlRBTreeNode_t<CUtlString,unsigned_short>,unsigned_short>>
                                       ::Links(unsigned_short)::s_Sentinel);
                }
                puVar9 = (ushort *)(local_444 + iVar2 * 0x18);
                uVar10 = local_432;
                if (uVar14 != *puVar9) {
                  CUtlMemory<unsigned_char,int>::Purge
                            ((CUtlMemory<unsigned_char,int> *)(puVar9 + 4));
                  *(ushort *)(local_444 + 2 + iVar2 * 0x18) = local_434;
                  *(ushort *)(local_444 + iVar2 * 0x18) = uVar14;
                  uVar10 = local_432;
                  local_434 = uVar14;
                }
              }
            } while (((uVar14 != uVar10) && ((int)(iVar2 + 1U & 0xffff) < local_440)) &&
                    (iVar2 = iVar2 + 1, iVar2 != 0xffff));
          }
          goto LAB_0061e230;
        }
        goto LAB_0061e245;
      }
    }
  }
  uVar16 = 0;
LAB_0061e277:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return uVar16;
  }
                    /* 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)