L L4D2node

CCvarUtilities::WriteVariables

0x001293f0 · 1101 bytes · __thiscall

_ZN14CCvarUtilities14WriteVariablesER10CUtlBufferib

Decompiled

undefined (4 params)

/* CCvarUtilities::WriteVariables(CUtlBuffer&, int, bool) */

void __thiscall
CCvarUtilities::WriteVariables(CCvarUtilities *this,CUtlBuffer *param_1,int param_2,bool param_3)

{
  char cVar1;
  int *piVar2;
  ConVar *pCVar3;
  int *piVar4;
  int iVar5;
  char *pcVar6;
  int iVar7;
  undefined4 uVar8;
  bool bVar9;
  int iVar10;
  ConVar *local_44;
  code *local_40;
  int local_3c;
  int local_38;
  undefined4 local_34;
  int local_30;
  undefined4 local_2c;
  int local_28;
  int local_24;
  undefined4 local_20;
  
  local_40 = CVarSortFunc;
  local_3c = 0;
  local_38 = 0;
  local_34 = 0;
  local_30 = -1;
  local_2c = 0;
  local_28 = -1;
  local_24 = -1;
  local_20 = 0;
                    /* try { // try from 00129449 to 0012944e has its CatchHandler @ 0012986f */
  piVar2 = (int *)(**(code **)(*g_pCVar + 0x98))(g_pCVar);
                    /* try { // try from 0012945c to 001296fd has its CatchHandler @ 0012988a */
  (**(code **)(*piVar2 + 8))(piVar2);
  do {
    cVar1 = (**(code **)(*piVar2 + 0x10))(piVar2);
    iVar5 = local_30;
    if (cVar1 == '\0') {
      while( true ) {
        iVar7 = iVar5;
        if ((CUtlRBTree<ConVar*,int,bool(*)(ConVar*const&,ConVar*const&),CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int>>
             ::Links(int)::s_Sentinel == '\0') &&
           (iVar5 = __cxa_guard_acquire(&CUtlRBTree<ConVar*,int,bool(*)(ConVar*const&,ConVar*const&),CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int>>
                                         ::Links(int)::s_Sentinel), iVar5 != 0)) {
          CUtlRBTree<ConVar*,int,bool(*)(ConVar*const&,ConVar*const&),CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int>>
          ::Links(int)::s_Sentinel = -1;
          DAT_00340da8 = 0xffffffff;
          DAT_00340dac = 0xffffffff;
          __cxa_guard_release(&CUtlRBTree<ConVar*,int,bool(*)(ConVar*const&,ConVar*const&),CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int>>
                               ::Links(int)::s_Sentinel);
        }
        iVar5 = CUtlRBTree<ConVar*,int,bool(*)(ConVar*const&,ConVar*const&),CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int>>
                ::Links(int)::s_Sentinel;
        if (iVar7 != -1) {
          iVar5 = *(int *)(local_3c + iVar7 * 0x14);
        }
        if (iVar5 == -1) break;
        if ((CUtlRBTree<ConVar*,int,bool(*)(ConVar*const&,ConVar*const&),CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int>>
             ::Links(int)::s_Sentinel == '\0') &&
           (iVar5 = __cxa_guard_acquire(&CUtlRBTree<ConVar*,int,bool(*)(ConVar*const&,ConVar*const&),CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int>>
                                         ::Links(int)::s_Sentinel), iVar5 != 0)) {
          CUtlRBTree<ConVar*,int,bool(*)(ConVar*const&,ConVar*const&),CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int>>
          ::Links(int)::s_Sentinel = -1;
          DAT_00340da8 = 0xffffffff;
          DAT_00340dac = 0xffffffff;
          __cxa_guard_release(&CUtlRBTree<ConVar*,int,bool(*)(ConVar*const&,ConVar*const&),CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int>>
                               ::Links(int)::s_Sentinel);
        }
        iVar5 = CUtlRBTree<ConVar*,int,bool(*)(ConVar*const&,ConVar*const&),CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int>>
                ::Links(int)::s_Sentinel;
        if (iVar7 != -1) {
          iVar5 = *(int *)(local_3c + iVar7 * 0x14);
        }
      }
      if (iVar7 != -1) {
        do {
          piVar4 = *(int **)(local_3c + iVar7 * 0x14 + 0x10);
          if (param_2 < 0) {
            uVar8 = (**(code **)(*piVar4 + 0x1c))();
          }
          else {
            uVar8 = (**(code **)(*piVar4 + 0x34))(piVar4);
          }
          pcVar6 = "FCVAR_NEVER_AS_STRING";
          if (((*(byte *)((int)piVar4 + 0x15) & 0x10) == 0) &&
             (pcVar6 = *(char **)(piVar4[7] + 0x24), pcVar6 == (char *)0x0)) {
            pcVar6 = "";
          }
          CUtlBuffer::Printf(param_1,"%s \"%s\"\n",uVar8,pcVar6);
          pcVar6 = "FCVAR_NEVER_AS_STRING";
          if (((*(byte *)((int)piVar4 + 0x15) & 0x10) == 0) &&
             (pcVar6 = *(char **)(piVar4[7] + 0x24), pcVar6 == (char *)0x0)) {
            pcVar6 = "";
          }
          DevMsg(2,"%s \"%s\"\n",uVar8,pcVar6);
          iVar7 = CUtlRBTree<ConVar*,int,bool(*)(ConVar*const&,ConVar*const&),CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int>>
                  ::NextInorder((CUtlRBTree<ConVar*,int,bool(*)(ConVar*const&,ConVar*const&),CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int>>
                                 *)&local_40,iVar7);
        } while (iVar7 != -1);
      }
      (**(code **)(*piVar2 + 4))(piVar2);
      if (local_24 != -1) {
        iVar10 = 0;
        iVar5 = local_24;
        iVar7 = 0;
        if (0 < local_38) {
          do {
            if (((-1 < iVar7) && (iVar7 < local_38)) && (iVar7 <= iVar5)) {
              if ((CUtlRBTree<ConVar*,int,bool(*)(ConVar*const&,ConVar*const&),CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int>>
                   ::Links(int)::s_Sentinel == '\0') &&
                 (iVar5 = __cxa_guard_acquire(&CUtlRBTree<ConVar*,int,bool(*)(ConVar*const&,ConVar*const&),CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int>>
                                               ::Links(int)::s_Sentinel), iVar5 != 0)) {
                CUtlRBTree<ConVar*,int,bool(*)(ConVar*const&,ConVar*const&),CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int>>
                ::Links(int)::s_Sentinel = -1;
                DAT_00340da8 = 0xffffffff;
                DAT_00340dac = 0xffffffff;
                __cxa_guard_release(&CUtlRBTree<ConVar*,int,bool(*)(ConVar*const&,ConVar*const&),CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int>>
                                     ::Links(int)::s_Sentinel);
              }
              iVar5 = local_24;
              if (*(int *)(local_3c + iVar10) != iVar7) {
                ((int *)(local_3c + iVar10))[1] = local_28;
                *(int *)(local_3c + iVar10) = iVar7;
                local_28 = iVar7;
              }
            }
          } while (((iVar5 != iVar7) && (iVar7 + 1 < local_38)) &&
                  (iVar10 = iVar10 + 0x14, bVar9 = -2 < iVar7, iVar7 = iVar7 + 1, bVar9));
        }
        local_30 = -1;
        local_2c = 0;
      }
      local_28 = 0xffffffff;
      CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int>::Purge
                ((CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int> *)&local_3c);
      local_24 = 0xffffffff;
      CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int>::Purge
                ((CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int> *)&local_3c);
      return;
    }
    pCVar3 = (ConVar *)(**(code **)(*piVar2 + 0x14))(piVar2);
    cVar1 = (**(code **)(*(int *)pCVar3 + 8))(pCVar3);
    if ((cVar1 == '\0') &&
       (local_44 = pCVar3, cVar1 = (**(code **)(*(int *)pCVar3 + 0xc))(pCVar3,0x80), cVar1 != '\0'))
    {
      if (-1 < param_2) {
        cVar1 = (**(code **)(*(int *)local_44 + 0xc))(local_44,0x8000);
        if (cVar1 == '\0') {
          bVar9 = false;
        }
        else {
          bVar9 = true;
          if (param_2 != 0) goto LAB_00129468;
        }
        cVar1 = (**(code **)(*(int *)local_44 + 0xc))(local_44,0x40000);
        if (cVar1 != '\0') {
          if (((local_44 != (ConVar *)0x0) &&
              (piVar4 = (int *)__dynamic_cast(local_44,&ConVar::typeinfo,
                                              &CSplitScreenAddedConVar::typeinfo,0),
              piVar4 != (int *)0x0)) &&
             (iVar5 = (**(code **)(*piVar4 + 0x38))(piVar4), param_2 != iVar5)) goto LAB_00129468;
          bVar9 = true;
        }
        if (param_3 != bVar9) goto LAB_00129468;
      }
      CUtlRBTree<ConVar*,int,bool(*)(ConVar*const&,ConVar*const&),CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int>>
      ::Insert((CUtlRBTree<ConVar*,int,bool(*)(ConVar*const&,ConVar*const&),CUtlMemory<UtlRBTreeNode_t<ConVar*,int>,int>>
                *)&local_40,&local_44);
    }
LAB_00129468:
    (**(code **)(*piVar2 + 0xc))(piVar2);
  } 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)