L L4D2node

vprof_to_csv

0x00232ee0 · 2513 bytes · __cdecl

_ZL12vprof_to_csvRK8CCommand

Decompiled

undefined (1 param)

/* vprof_to_csv(CCommand const&) */

void vprof_to_csv(CCommand *param_1)

{
  int iVar1;
  ushort uVar2;
  undefined4 *puVar3;
  CUtlRBTree<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short,CUtlMap<char*,double,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
  *this;
  char cVar4;
  uint uVar5;
  int iVar6;
  int iVar7;
  int in_GS_OFFSET;
  int local_10ec;
  CUtlRBTree<CUtlMap<char*,int,unsigned_short>::Node_t,unsigned_short,CUtlMap<char*,int,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
  *local_10e8;
  int local_10e0;
  CUtlMap *local_10d8;
  undefined4 local_10d4;
  undefined4 local_10d0;
  undefined4 local_10cc [3];
  undefined4 *local_10c0;
  undefined4 local_10bc;
  undefined4 local_10b8;
  int local_10b4;
  undefined4 *local_10b0;
  code *local_10ac;
  undefined4 local_10a8;
  undefined4 local_10a4;
  undefined4 local_10a0;
  undefined2 local_109c;
  undefined2 local_109a;
  undefined2 local_1098;
  undefined2 local_1096;
  undefined4 local_1094;
  int local_1090 [5];
  int local_107c [6];
  CUtlRBTree<CUtlMap<char*,int,unsigned_short>::Node_t,unsigned_short,CUtlMap<char*,int,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
  *local_1064;
  char local_1060 [16];
  char local_1050 [32];
  char local_1030 [260];
  char local_f2c [260];
  char local_e28 [520];
  char local_c20 [1024];
  char local_820 [2048];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (*(int *)param_1 < 2) {
    Warning("vprof_to_csv requires an input filename (.VPROJ) and optional VPROF node names\n");
  }
  else {
    local_e28[0] = '\0';
    iVar7 = 1;
    do {
      iVar6 = iVar7 * 4;
      iVar7 = iVar7 + 1;
      V_strncat(local_e28,*(char **)(param_1 + iVar6 + 0x408),0x208,-1);
    } while (iVar7 < *(int *)param_1);
    local_109c = 0xffff;
    local_109a = 0;
    local_1098 = 0xffff;
    local_1096 = 0xffff;
    local_10c0 = (undefined4 *)0x0;
    local_10bc = 0;
    local_10b8 = 0;
    local_10b4 = 0;
    local_10b0 = (undefined4 *)0x0;
    local_10ac = CDefOps<char*>::LessFunc;
    local_10a8 = 0;
    local_10a4 = 0;
    local_10a0 = 0;
    local_1094 = 0;
                    /* try { // try from 00232ff1 to 00233090 has its CatchHandler @ 002338bd */
    V_SplitString(local_e28,"|",(CUtlVector *)&local_10c0);
    V_strncpy(local_1030,(char *)*local_10c0,0x104);
    operator_delete((void *)*local_10c0);
    iVar7 = local_10b4 + -1;
    if (0 < iVar7) {
                    /* try { // try from 0023382c to 0023388a has its CatchHandler @ 002338bd */
      _V_memmove(local_10c0,local_10c0 + 1,iVar7 * 4);
      local_10b4 = local_10b4 + -1;
      iVar7 = local_10b4;
      if (0 < local_10b4) {
        iVar6 = 0;
        do {
          local_10d4 = local_10c0[iVar6];
          local_10d0 = 0;
          CUtlRBTree<CUtlMap<char*,int,unsigned_short>::Node_t,unsigned_short,CUtlMap<char*,int,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
          ::Insert((CUtlRBTree<CUtlMap<char*,int,unsigned_short>::Node_t,unsigned_short,CUtlMap<char*,int,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                    *)&local_10ac,(Node_t *)&local_10d4);
          iVar6 = iVar6 + 1;
          iVar7 = local_10b4;
        } while (iVar6 < local_10b4);
      }
    }
    local_10b4 = iVar7;
    local_10e8 = (CUtlRBTree<CUtlMap<char*,int,unsigned_short>::Node_t,unsigned_short,CUtlMap<char*,int,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                  *)&local_10ac;
    V_StripExtension(local_1030,local_f2c,0x104);
    V_strncat(local_f2c,".csv",0x104,-1);
    local_1090[1] = 0;
    local_1090[2] = 0;
    local_1090[3] = 0;
    local_1090[4] = 0;
    local_1064 = local_10e8;
    local_107c[0] = 0;
    local_107c[1] = 0;
    local_107c[2] = 0;
    local_107c[3] = 0;
    local_107c[4] = 0;
    local_1090[0] = 0;
                    /* try { // try from 0023313b to 00233803 has its CatchHandler @ 00233935 */
    local_107c[5] = (**(code **)(g_pFileSystem[1] + 8))(g_pFileSystem + 1,local_f2c,&DAT_002b7513,0)
    ;
    CVProfRecorder::Playback_Start((CVProfRecorder *)g_VProfRecorder,local_1030);
    while (g_VProfRecorder[0x19f4] == '\0') {
      local_10d8 = operator_new(0x1c);
      *(code **)local_10d8 = CDefOps<char*>::LessFunc;
      *(undefined4 *)(local_10d8 + 4) = 0;
      *(undefined4 *)(local_10d8 + 8) = 0;
      *(undefined4 *)(local_10d8 + 0xc) = 0;
      *(undefined2 *)(local_10d8 + 0x10) = 0xffff;
      *(undefined2 *)(local_10d8 + 0x12) = 0;
      *(undefined2 *)(local_10d8 + 0x14) = 0xffff;
      *(undefined2 *)(local_10d8 + 0x16) = 0xffff;
      *(undefined4 *)(local_10d8 + 0x18) = 0;
      CUtlVector<CUtlMap<char*,double,unsigned_short>*,CUtlMemory<CUtlMap<char*,double,unsigned_short>*,int>>
      ::InsertBefore((CUtlVector<CUtlMap<char*,double,unsigned_short>*,CUtlMemory<CUtlMap<char*,double,unsigned_short>*,int>>
                      *)local_107c,local_107c[3],&local_10d8);
      CVPROFToCSVConverter::WriteNodeDataToDict
                ((CVPROFToCSVConverter *)local_1090,(CVProfNode *)(g_VProfRecorder + 0x1018),
                 local_10d8);
      CVProfRecorder::Playback_ReadTick((CVProfRecorder *)g_VProfRecorder,-1,(bool *)0x0);
    }
    V_strncpy(local_c20,"Tick Number,",0x400);
    iVar7 = 0;
    if (0 < local_1090[3]) {
      do {
        V_strncat(local_c20,*(char **)(local_1090[0] + iVar7 * 4),0x400,-1);
        if (iVar7 != local_1090[3] + -1) {
          V_strncat(local_c20,",",0x400,-1);
        }
        iVar7 = iVar7 + 1;
      } while (iVar7 < local_1090[3]);
    }
    V_strncat(local_c20,"\n",0x400,-1);
    (**(code **)(*g_pFileSystem + 100))(g_pFileSystem,local_107c[5],&DAT_002c48a3,local_c20);
    local_10ec = 0;
    if (0 < local_107c[3]) {
      do {
        local_10ec = local_10ec + 1;
        V_snprintf(local_1060,0x10,"%d",local_10ec);
        V_strncpy(local_820,local_1060,0x800);
        V_strncat(local_820,",",0x800,-1);
        iVar7 = local_10ec * 4 + -4;
        local_10e0 = 0;
        if (0 < local_1090[3]) {
          do {
            puVar3 = *(undefined4 **)(local_107c[0] + iVar7);
            local_10cc[0] = *(undefined4 *)(local_1090[0] + local_10e0 * 4);
            uVar5 = (uint)*(ushort *)(puVar3 + 4);
            if (*(ushort *)(puVar3 + 4) != 0xffff) {
              iVar6 = puVar3[1];
              do {
                while( true ) {
                  iVar1 = uVar5 * 0x14;
                  cVar4 = (*(code *)*puVar3)(local_10cc,iVar6 + 8 + iVar1);
                  if (cVar4 != '\0') break;
                  cVar4 = (*(code *)*puVar3)(puVar3[1] + iVar1 + 8,local_10cc);
                  if (cVar4 == '\0') {
                    V_snprintf(local_1050,0x20,"%f",
                               *(undefined8 *)
                                (*(int *)(*(int *)(local_107c[0] + iVar7) + 4) + 0xc + iVar1));
                    V_strncat(local_820,local_1050,0x800,-1);
                    goto LAB_0023347d;
                  }
                  if ((CUtlRBTree<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short,CUtlMap<char*,double,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                       ::Links(unsigned_short)::s_Sentinel == '\0') &&
                     (iVar6 = __cxa_guard_acquire(&
                                                  CUtlRBTree<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short,CUtlMap<char*,double,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                                                  ::Links(unsigned_short)::s_Sentinel), iVar6 != 0))
                  {
                    CUtlRBTree<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short,CUtlMap<char*,double,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                    ::Links(unsigned_short)::s_Sentinel = 0xffff;
                    DAT_00341ac2 = 0xffff;
                    DAT_00341ac4 = 0xffff;
                    __cxa_guard_release(&CUtlRBTree<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short,CUtlMap<char*,double,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                                         ::Links(unsigned_short)::s_Sentinel);
                  }
                  iVar6 = puVar3[1];
                  uVar2 = *(ushort *)(iVar6 + 2 + iVar1);
                  uVar5 = (uint)uVar2;
                  if (uVar2 == 0xffff) goto LAB_0023347d;
                }
                if ((CUtlRBTree<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short,CUtlMap<char*,double,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                     ::Links(unsigned_short)::s_Sentinel == '\0') &&
                   (iVar6 = __cxa_guard_acquire(&CUtlRBTree<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short,CUtlMap<char*,double,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                                                 ::Links(unsigned_short)::s_Sentinel), iVar6 != 0))
                {
                  CUtlRBTree<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short,CUtlMap<char*,double,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                  ::Links(unsigned_short)::s_Sentinel = 0xffff;
                  DAT_00341ac2 = 0xffff;
                  DAT_00341ac4 = 0xffff;
                  __cxa_guard_release(&CUtlRBTree<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short,CUtlMap<char*,double,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                                       ::Links(unsigned_short)::s_Sentinel);
                }
                iVar6 = puVar3[1];
                uVar2 = *(ushort *)(iVar6 + uVar5 * 0x14);
                uVar5 = (uint)uVar2;
              } while (uVar2 != 0xffff);
            }
LAB_0023347d:
            if (local_10e0 != local_1090[3] + -1) {
              V_strncat(local_820,",",0x800,-1);
            }
            local_10e0 = local_10e0 + 1;
          } while (local_10e0 < local_1090[3]);
        }
        V_strncat(local_820,"\n",0x800,-1);
        (**(code **)(*g_pFileSystem + 100))(g_pFileSystem,local_107c[5],&DAT_002c48a3,local_820);
      } while (local_10ec < local_107c[3]);
    }
    (**(code **)(g_pFileSystem[1] + 0xc))(g_pFileSystem + 1,local_107c[5]);
    iVar7 = 0;
    local_1090[3] = 0;
    if (0 < local_107c[3]) {
      do {
        this = *(CUtlRBTree<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short,CUtlMap<char*,double,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                 **)(local_107c[0] + iVar7 * 4);
        if (this != (CUtlRBTree<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short,CUtlMap<char*,double,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                     *)0x0) {
          CUtlRBTree<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short,CUtlMap<char*,double,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
          ::RemoveAll(this);
          *(undefined2 *)(this + 0x14) = 0xffff;
          CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short>,unsigned_short>
          ::Purge((CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short>,unsigned_short>
                   *)(this + 4));
          *(undefined2 *)(this + 0x16) = 0xffff;
          CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short>,unsigned_short>
          ::Purge((CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,double,unsigned_short>::Node_t,unsigned_short>,unsigned_short>
                   *)(this + 4));
          operator_delete(this);
        }
        iVar7 = iVar7 + 1;
      } while (iVar7 < local_107c[3]);
    }
    iVar7 = 0;
    local_107c[3] = 0;
    CUtlMemory<CUtlMap<char*,double,unsigned_short>*,int>::Purge
              ((CUtlMemory<CUtlMap<char*,double,unsigned_short>*,int> *)local_107c);
    local_107c[4] = local_107c[0];
    if (0 < local_10b4) {
      do {
        puVar3 = local_10c0 + iVar7;
        iVar7 = iVar7 + 1;
        operator_delete((void *)*puVar3);
      } while (iVar7 < local_10b4);
    }
    local_10b4 = 0;
    CUtlMemory<char*,int>::Purge((CUtlMemory<char*,int> *)&local_10c0);
    local_10b0 = local_10c0;
    CUtlRBTree<CUtlMap<char*,int,unsigned_short>::Node_t,unsigned_short,CUtlMap<char*,int,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
    ::RemoveAll(local_10e8);
    local_107c[3] = 0;
    CUtlMemory<CUtlMap<char*,double,unsigned_short>*,int>::Purge
              ((CUtlMemory<CUtlMap<char*,double,unsigned_short>*,int> *)local_107c);
    local_107c[4] = local_107c[0];
    CUtlMemory<CUtlMap<char*,double,unsigned_short>*,int>::Purge
              ((CUtlMemory<CUtlMap<char*,double,unsigned_short>*,int> *)local_107c);
    local_1090[3] = 0;
    CUtlMemory<char*,int>::Purge((CUtlMemory<char*,int> *)local_1090);
    local_1090[4] = local_1090[0];
    CUtlMemory<char*,int>::Purge((CUtlMemory<char*,int> *)local_1090);
    CUtlRBTree<CUtlMap<char*,int,unsigned_short>::Node_t,unsigned_short,CUtlMap<char*,int,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
    ::RemoveAll(local_10e8);
    local_1098 = 0xffff;
    CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>
    ::Purge((CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>
             *)&local_10a8);
    local_1096 = 0xffff;
    CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>
    ::Purge((CUtlMemory<UtlRBTreeNode_t<CUtlMap<char*,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>
             *)&local_10a8);
    local_10b4 = 0;
    CUtlMemory<char*,int>::Purge((CUtlMemory<char*,int> *)&local_10c0);
    local_10b0 = local_10c0;
    CUtlMemory<char*,int>::Purge((CUtlMemory<char*,int> *)&local_10c0);
  }
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return;
}

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)