L L4D2node

CStudioHdr::CActivityToSequenceMapping::ResetMappings

0x0059f7f0 · 693 bytes · __cdecl

_ZN10CStudioHdr26CActivityToSequenceMapping13ResetMappingsEv

Decompiled

undefined (0 params)

/* CStudioHdr::CActivityToSequenceMapping::ResetMappings() */

void CStudioHdr::CActivityToSequenceMapping::ResetMappings(void)

{
  CUtlVector<CUtlVector<CStudioHdr::CActivityToSequenceMapping::HashValueType,CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int>>,CUtlMemory<CUtlVector<CStudioHdr::CActivityToSequenceMapping::HashValueType,CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int>>,int>>
  *this;
  ushort uVar1;
  undefined4 *puVar2;
  short sVar3;
  int iVar4;
  CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int> *this_00;
  int iVar5;
  uint uVar6;
  ushort *puVar7;
  int iVar8;
  
  uVar1 = g_StudioHdrToActivityMaps._16_2_;
  do {
    uVar6 = (uint)uVar1;
    if ((CUtlRBTree<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
         ::Links(unsigned_short)::s_Sentinel == '\0') &&
       (iVar4 = __cxa_guard_acquire(&CUtlRBTree<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                                     ::Links(unsigned_short)::s_Sentinel), iVar4 != 0)) {
      CUtlRBTree<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
      ::Links(unsigned_short)::s_Sentinel = -1;
      DAT_00f21322 = 0xffff;
      DAT_00f21324 = 0xffff;
      __cxa_guard_release(&CUtlRBTree<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                           ::Links(unsigned_short)::s_Sentinel);
    }
    sVar3 = CUtlRBTree<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
            ::Links(unsigned_short)::s_Sentinel;
    if (uVar1 != 0xffff) {
      sVar3 = *(short *)(uVar6 * 0x58 + g_StudioHdrToActivityMaps._4_4_);
    }
    if (sVar3 == -1) {
      for (; uVar6 != 0xffff; uVar6 = uVar6 & 0xffff) {
        iVar4 = g_StudioHdrToActivityMaps._4_4_ + uVar6 * 0x58;
        if (*(int *)(iVar4 + 0x50) == 0) {
          puVar2 = *(undefined4 **)(iVar4 + 0x54);
          if (puVar2 != (undefined4 *)0x0) {
            if ((void *)*puVar2 != (void *)0x0) {
              operator_delete__((void *)*puVar2);
            }
            iVar4 = puVar2[5];
            if (0 < iVar4) {
              iVar8 = 0;
              iVar5 = 0;
              do {
                iVar5 = iVar5 + 1;
                this_00 = (CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int> *)
                          (puVar2[2] + iVar8);
                iVar8 = iVar8 + 0x14;
                *(undefined4 *)(this_00 + 0xc) = 0;
                CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int>::Purge
                          (this_00);
                *(undefined4 *)(this_00 + 0x10) = *(undefined4 *)this_00;
              } while (iVar5 != iVar4);
            }
            this = (CUtlVector<CUtlVector<CStudioHdr::CActivityToSequenceMapping::HashValueType,CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int>>,CUtlMemory<CUtlVector<CStudioHdr::CActivityToSequenceMapping::HashValueType,CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int>>,int>>
                    *)(puVar2 + 2);
            CUtlVector<CUtlVector<CStudioHdr::CActivityToSequenceMapping::HashValueType,CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int>>,CUtlMemory<CUtlVector<CStudioHdr::CActivityToSequenceMapping::HashValueType,CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int>>,int>>
            ::RemoveAll(this);
            CUtlMemory<CUtlVector<CStudioHdr::CActivityToSequenceMapping::HashValueType,CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int>>,int>
            ::Purge((CUtlMemory<CUtlVector<CStudioHdr::CActivityToSequenceMapping::HashValueType,CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int>>,int>
                     *)this);
            puVar2[6] = puVar2[2];
            CUtlMemory<CUtlVector<CStudioHdr::CActivityToSequenceMapping::HashValueType,CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int>>,int>
            ::Purge((CUtlMemory<CUtlVector<CStudioHdr::CActivityToSequenceMapping::HashValueType,CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int>>,int>
                     *)this);
            operator_delete(puVar2);
          }
        }
        else {
          Msg("****************************************************************\n");
          Msg("****************************************************************\n");
          Msg("*************  DO NOT IGNORE ME  *******************************\n");
          Msg("****************************************************************\n");
          Msg("****************************************************************\n");
          iVar4 = uVar6 * 0x58 + g_StudioHdrToActivityMaps._4_4_;
          Warning("Studio activity sequence mapping leak! (%s, %d)\n",iVar4 + 0x10,
                  *(undefined4 *)(iVar4 + 0x50));
          Msg("****************************************************************\n");
          Msg("****************************************************************\n");
          Msg("****************************************************************\n");
          Msg("****************************************************************\n");
          Msg("****************************************************************\n");
        }
        uVar6 = CUtlRBTree<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                ::NextInorder((CUtlRBTree<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                               *)g_StudioHdrToActivityMaps,(ushort)uVar6);
      }
      CUtlRBTree<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
      ::RemoveAll((CUtlRBTree<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                   *)g_StudioHdrToActivityMaps);
      return;
    }
    if (CUtlRBTree<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
        ::Links(unsigned_short)::s_Sentinel == '\0') {
      iVar4 = __cxa_guard_acquire(&CUtlRBTree<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                                   ::Links(unsigned_short)::s_Sentinel);
      if (iVar4 != 0) {
        CUtlRBTree<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
        ::Links(unsigned_short)::s_Sentinel = -1;
        DAT_00f21322 = 0xffff;
        DAT_00f21324 = 0xffff;
        __cxa_guard_release(&CUtlRBTree<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                             ::Links(unsigned_short)::s_Sentinel);
      }
      if (uVar1 == 0xffff) goto LAB_0059f9d5;
LAB_0059f84e:
      puVar7 = (ushort *)(uVar6 * 0x58 + g_StudioHdrToActivityMaps._4_4_);
    }
    else {
      if (uVar1 != 0xffff) goto LAB_0059f84e;
LAB_0059f9d5:
      puVar7 = (ushort *)
               &CUtlRBTree<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<studiohdr_t_const*,StudioHdrToActivityMapEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                ::Links(unsigned_short)::s_Sentinel;
    }
    uVar1 = *puVar7;
  } 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)