L L4D2node

stuffcmds

0x00117270 · 1242 bytes · __cdecl

_ZL9stuffcmdsRK8CCommand

Decompiled

undefined (1 param)

/* stuffcmds(CCommand const&) */

void stuffcmds(CCommand *param_1)

{
  code *pcVar1;
  char cVar2;
  int *piVar3;
  int iVar4;
  char *pcVar5;
  undefined4 uVar6;
  undefined **ppuVar7;
  int iVar8;
  int in_GS_OFFSET;
  int local_258 [4];
  int local_248;
  byte local_243;
  int local_240;
  int local_238;
  char local_220 [512];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (*(int *)param_1 == 1) {
    CUtlBuffer::CUtlBuffer((CUtlBuffer *)local_258,0,0,1);
    iVar8 = 1;
LAB_001172f0:
                    /* try { // try from 001172f0 to 0011775c has its CatchHandler @ 0011775f */
    piVar3 = (int *)CommandLine_Tier0();
    iVar4 = (**(code **)(*piVar3 + 0x24))(piVar3);
    if (iVar4 <= iVar8) goto LAB_00117670;
    piVar3 = (int *)CommandLine_Tier0();
    pcVar5 = (char *)(**(code **)(*piVar3 + 0x2c))(piVar3,iVar8);
    if (pcVar5 != (char *)0x0) {
      if (*pcVar5 == '-') {
        piVar3 = (int *)CommandLine_Tier0();
        iVar4 = (**(code **)(*piVar3 + 0x18))(piVar3,pcVar5,0);
        iVar8 = (iVar8 - (uint)(iVar4 == 0)) + 2;
        goto LAB_001172f0;
      }
      if (*pcVar5 == '+') {
        piVar3 = (int *)CommandLine_Tier0();
        iVar4 = (**(code **)(*piVar3 + 0x18))(piVar3,pcVar5,0);
        if (iVar4 == 0) {
          CUtlBuffer::PutString((CUtlBuffer *)local_258,pcVar5 + 1);
          if ((((local_243 & 1) != 0) && (local_248 != 0)) &&
             (*(char *)(local_258[0] + ((local_248 + -1) - local_238)) == '\n')) {
            iVar4 = 0;
            if ((local_243 & 0x10) == 0) {
              iVar4 = local_240;
            }
            while (iVar4 = iVar4 + -1, -1 < iVar4) {
              cVar2 = CUtlBuffer::CheckPut((CUtlBuffer *)local_258,1);
              if (cVar2 != '\0') {
                *(undefined1 *)(local_258[0] + (local_248 - local_238)) = 9;
                local_248 = local_248 + 1;
                CUtlBuffer::AddNullTermination((CUtlBuffer *)local_258);
              }
            }
          }
LAB_00117510:
          cVar2 = CUtlBuffer::CheckPut((CUtlBuffer *)local_258,1);
          if (cVar2 == '\0') goto LAB_001173c5;
          *(undefined1 *)(local_258[0] + (local_248 - local_238)) = 10;
          local_248 = local_248 + 1;
          CUtlBuffer::AddNullTermination((CUtlBuffer *)local_258);
          iVar8 = iVar8 + 1;
        }
        else {
          pcVar5 = (char *)va("%s %s\n",pcVar5 + 1,iVar4);
          CUtlBuffer::PutString((CUtlBuffer *)local_258,pcVar5);
          iVar8 = iVar8 + 2;
        }
        goto LAB_001172f0;
      }
      piVar3 = (int *)CommandLine_Tier0();
      pcVar5 = (char *)(**(code **)(*piVar3 + 0x2c))(piVar3,iVar8);
      V_strncpy(local_220,pcVar5,0x200);
      V_FixSlashes(local_220,'/');
      _V_strlower(local_220);
      pcVar5 = (char *)V_GetFileExtension(local_220);
      if (pcVar5 != (char *)0x0) {
        ppuVar7 = &g_FileAssociations;
        do {
          iVar4 = _V_strcmp(pcVar5,*ppuVar7 + 1);
          if (iVar4 == 0) {
            piVar3 = (int *)CommandLine_Tier0();
            pcVar1 = *(code **)(*piVar3 + 0x28);
            uVar6 = va("+%s",ppuVar7[1]);
            iVar4 = (*pcVar1)(piVar3,uVar6);
            if (iVar4 == 0) {
              V_strncpy(Cmd_TranslateFileAssociation(char_const*)::sz,local_220,0x200);
              V_FileBase(Cmd_TranslateFileAssociation(char_const*)::sz,local_220,0x200);
              V_snprintf(Cmd_TranslateFileAssociation(char_const*)::sz,0x200,"%s %s",ppuVar7[1],
                         local_220);
              CUtlBuffer::PutString
                        ((CUtlBuffer *)local_258,Cmd_TranslateFileAssociation(char_const*)::sz);
              if ((((local_243 & 1) != 0) && (local_248 != 0)) &&
                 (*(char *)(local_258[0] + ((local_248 + -1) - local_238)) == '\n')) {
                iVar4 = 0;
                if ((local_243 & 0x10) == 0) {
                  iVar4 = local_240;
                }
                while (iVar4 = iVar4 + -1, -1 < iVar4) {
                  while (cVar2 = CUtlBuffer::CheckPut((CUtlBuffer *)local_258,1), cVar2 != '\0') {
                    *(undefined1 *)(local_258[0] + (local_248 - local_238)) = 9;
                    local_248 = local_248 + 1;
                    CUtlBuffer::AddNullTermination((CUtlBuffer *)local_258);
                    iVar4 = iVar4 + -1;
                    if (iVar4 < 0) goto LAB_00117510;
                  }
                }
              }
              goto LAB_00117510;
            }
          }
          ppuVar7 = ppuVar7 + 2;
        } while (ppuVar7 != &CCollisionBSPData::nullsurface);
      }
    }
LAB_001173c5:
    iVar8 = iVar8 + 1;
    goto LAB_001172f0;
  }
  ConMsg("stuffcmds : execute command line parameters\n");
LAB_0011729b:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return;
LAB_00117670:
  if ((((local_243 & 1) != 0) && (local_248 != 0)) &&
     (*(char *)(local_258[0] + ((local_248 + -1) - local_238)) == '\n')) {
    iVar8 = 0;
    if ((local_243 & 0x10) == 0) {
      iVar8 = local_240;
    }
    while (iVar8 = iVar8 + -1, -1 < iVar8) {
      while (cVar2 = CUtlBuffer::CheckPut((CUtlBuffer *)local_258,1), cVar2 != '\0') {
        *(undefined1 *)(local_258[0] + (local_248 - local_238)) = 9;
        local_248 = local_248 + 1;
        CUtlBuffer::AddNullTermination((CUtlBuffer *)local_258);
        iVar8 = iVar8 + -1;
        if (iVar8 < 0) goto LAB_001176f0;
      }
    }
  }
LAB_001176f0:
  cVar2 = CUtlBuffer::CheckPut((CUtlBuffer *)local_258,1);
  if (cVar2 != '\0') {
    *(undefined1 *)(local_258[0] + (local_248 - local_238)) = 0;
    local_248 = local_248 + 1;
    CUtlBuffer::AddNullTermination((CUtlBuffer *)local_258);
  }
  if (1 < local_248) {
    Cbuf_InsertText(0,local_258[0],0);
  }
  CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_258);
  goto LAB_0011729b;
}

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)