L L4D2node

CStudioHdr::CActivityToSequenceMapping::FindMapping

0x000e50b0 · 1576 bytes · __cdecl

_ZN10CStudioHdr26CActivityToSequenceMapping11FindMappingEPKS_

Decompiled

undefined (1 param)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CStudioHdr::CActivityToSequenceMapping::FindMapping(CStudioHdr const*) */

undefined1 * CStudioHdr::CActivityToSequenceMapping::FindMapping(CStudioHdr *param_1)

{
  CUtlVector<CUtlVector<CStudioHdr::CActivityToSequenceMapping::HashValueType,CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int>>,CUtlMemory<CUtlVector<CStudioHdr::CActivityToSequenceMapping::HashValueType,CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int>>,int>>
  *this;
  int *piVar1;
  undefined4 *puVar2;
  undefined4 uVar3;
  uint uVar4;
  char cVar5;
  ushort uVar6;
  uint uVar7;
  int iVar8;
  int iVar9;
  CStudioHdr *this_00;
  int iVar10;
  CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int> *this_01;
  int iVar11;
  undefined1 *puVar12;
  int iVar13;
  int in_GS_OFFSET;
  bool bVar14;
  undefined4 local_d4;
  undefined4 local_d0;
  undefined4 local_cc;
  undefined4 local_c8;
  CActivityToSequenceMapping *local_c4;
  int local_c0 [20];
  int local_70 [20];
  int local_20;
  
  local_d4 = 0;
  local_d0 = 0;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (_exit == (CActivityToSequenceMapping *)0x0) {
    local_c4 = (CActivityToSequenceMapping *)0x0;
  }
  else {
    (**(code **)(_exit + 0x50))
              (_exit,&local_d4,0,0,0,0,"/data/src/engine/../public/studio.cpp",0x86a,
               &FindMapping(CStudioHdr_const*)::tm_fmt,"(%s)%s","Unaccounted",
               "CStudioHdr::CActivityToSequenceMapping::FindMapping");
    local_c4 = _exit;
  }
  iVar10 = _DAT_0040b9d4;
  local_cc = local_d4;
  local_c8 = local_d0;
                    /* try { // try from 000e5506 to 000e5554 has its CatchHandler @ 000e5738 */
  if (((_DAT_0040b028 != 0) || (DAT_0040b02c == '\0')) &&
     (iVar9 = ThreadGetCurrentId(), iVar10 == iVar9)) {
    if (*(char **)_DAT_0040b030 != "CStudioHdr::CActivityToSequenceMapping::FindMapping") {
      _DAT_0040b030 =
           (CActivityToSequenceMapping *)
           CVProfNode::GetSubNode((char *)_DAT_0040b030,0x2a4e04,&DAT_00000001,0x2a054b);
    }
    CVProfNode::EnterScope();
    DAT_0040b02c = '\0';
  }
  this_00 = param_1;
                    /* try { // try from 000e5199 to 000e51c7 has its CatchHandler @ 000e5752 */
  cVar5 = SequencesAvailable(param_1);
  if (cVar5 == '\0') {
LAB_000e5568:
    puVar12 = emptyMapping;
LAB_000e556d:
    uVar7 = g_StudioHdrToActivityMapsLock;
    if (DAT_0040b02c == '\0') goto LAB_000e548a;
LAB_000e557a:
    iVar10 = _DAT_0040b9d4;
    if ((_DAT_0040b028 == 0) || (iVar9 = ThreadGetCurrentId(), iVar10 != iVar9)) goto LAB_000e54a0;
  }
  else {
    if (*(int *)(param_1 + 4) == 0) {
      iVar10 = *(int *)(*(int *)param_1 + 0xbc);
    }
    else {
      iVar10 = *(int *)(*(int *)(param_1 + 4) + 0x14);
    }
    if (iVar10 < 2) goto LAB_000e5568;
    uVar7 = ThreadGetCurrentId();
    if (uVar7 == g_StudioHdrToActivityMapsLock) {
LAB_000e51e3:
      DAT_0034e6a4 = DAT_0034e6a4 + 1;
    }
    else {
      LOCK();
      bVar14 = g_StudioHdrToActivityMapsLock == 0;
      uVar4 = uVar7;
      if (!bVar14) {
        uVar4 = g_StudioHdrToActivityMapsLock;
      }
      g_StudioHdrToActivityMapsLock = uVar4;
      UNLOCK();
      if (bVar14) goto LAB_000e51e3;
                    /* try { // try from 000e55f5 to 000e55f9 has its CatchHandler @ 000e5752 */
      CThreadFastMutex::Lock(0x34e6a0,uVar7);
    }
    iVar10 = *(int *)param_1;
    local_c0[0] = iVar10;
                    /* try { // try from 000e5217 to 000e53b4 has its CatchHandler @ 000e56f5 */
    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>>
            ::Find((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,(Node_t *)local_c0);
    if (uVar6 == 0xffff) {
LAB_000e534e:
      local_70[0] = iVar10;
      uVar7 = 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>>
              ::Insert((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,(Node_t *)local_70);
      iVar8 = (uVar7 & 0xffff) * 0x58;
      iVar9 = g_StudioHdrToActivityMaps._4_4_ + iVar8;
      *(undefined4 *)(iVar9 + 0xc) = *(undefined4 *)(iVar10 + 8);
      V_strncpy((char *)(iVar9 + 0x10),(char *)(iVar10 + 0xc),0x40);
      *(undefined4 *)(g_StudioHdrToActivityMaps._4_4_ + 0x50 + iVar8) = 1;
      this_00 = operator_new(0x2c);
      *(undefined4 *)this_00 = 0;
      *(undefined4 *)(this_00 + 4) = 0;
      *(undefined4 *)(this_00 + 8) = 0;
      *(undefined4 *)(this_00 + 0xc) = 0;
      *(undefined4 *)(this_00 + 0x10) = 0;
      *(undefined4 *)(this_00 + 0x14) = 0;
      *(undefined4 *)(this_00 + 0x18) = 0;
                    /* try { // try from 000e53f5 to 000e53f9 has its CatchHandler @ 000e573c */
      CUtlVector<CUtlVector<CStudioHdr::CActivityToSequenceMapping::HashValueType,CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int>>,CUtlMemory<CUtlVector<CStudioHdr::CActivityToSequenceMapping::HashValueType,CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int>>,int>>
      ::SetCount((CUtlVector<CUtlVector<CStudioHdr::CActivityToSequenceMapping::HashValueType,CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int>>,CUtlMemory<CUtlVector<CStudioHdr::CActivityToSequenceMapping::HashValueType,CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int>>,int>>
                  *)(this_00 + 8),8);
      iVar10 = 0;
      do {
        *(undefined4 *)(*(int *)(this_00 + 8) + 0xc + iVar10) = 0;
        *(undefined4 *)(*(int *)(this_00 + 8) + 8 + iVar10) = 0;
        uVar3 = g_StudioHdrToActivityMaps._4_4_;
        iVar10 = iVar10 + 0x14;
      } while (iVar10 != 0xa0);
      *(CActivityToSequenceMapping *)(this_00 + 0x1e) = (CActivityToSequenceMapping)0x1;
      *(undefined4 *)(this_00 + 0x20) = 7;
      *(undefined4 *)(this_00 + 0x24) = 0;
      *(undefined4 *)(this_00 + 0x28) = 0;
      *(CStudioHdr **)(uVar3 + 0x54 + iVar8) = this_00;
                    /* try { // try from 000e544f to 000e5453 has its CatchHandler @ 000e56f5 */
      Initialize((CActivityToSequenceMapping *)this_00,param_1);
      puVar12 = *(undefined1 **)(g_StudioHdrToActivityMaps._4_4_ + 0x54 + iVar8);
    }
    else {
      iVar8 = (uint)uVar6 * 0x58;
      iVar9 = iVar8 + g_StudioHdrToActivityMaps._4_4_;
      if (*(int *)(iVar9 + 0xc) != *(int *)(iVar10 + 8)) {
LAB_000e5259:
        if (*(int *)(iVar9 + 0x50) != 0) {
                    /* try { // try from 000e5637 to 000e56e0 has its CatchHandler @ 000e56f5 */
          iVar9 = LoggingSystem_LogAssert
                            ("%s (%d) : %s\n","/data/src/engine/../public/studio.cpp",0x87a,
                             "Assertion Failed: g_StudioHdrToActivityMaps[i].nRefs == 0");
          if (iVar9 == 1) {
            cVar5 = ShouldUseNewAssertDialog();
            if ((cVar5 == '\0') ||
               (cVar5 = DoNewAssertDialog("/data/src/engine/../public/studio.cpp",0x87a,
                                          "Assertion Failed: g_StudioHdrToActivityMaps[i].nRefs == 0"
                                         ), cVar5 != '\0')) {
              raise(5);
            }
            _ExitOnFatalAssert("/data/src/engine/../public/studio.cpp",0x87a);
          }
          iVar9 = iVar8 + g_StudioHdrToActivityMaps._4_4_;
        }
        puVar2 = *(undefined4 **)(iVar9 + 0x54);
        if (puVar2 != (undefined4 *)0x0) {
          if ((void *)*puVar2 != (void *)0x0) {
            operator_delete__((void *)*puVar2);
          }
          iVar9 = puVar2[5];
          if (0 < iVar9) {
            iVar13 = 0;
            iVar11 = 0;
            do {
              iVar13 = iVar13 + 1;
              this_01 = (CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int> *)
                        (puVar2[2] + iVar11);
              iVar11 = iVar11 + 0x14;
              *(undefined4 *)(this_01 + 0xc) = 0;
              CUtlMemory<CStudioHdr::CActivityToSequenceMapping::HashValueType,int>::Purge(this_01);
              *(undefined4 *)(this_01 + 0x10) = *(undefined4 *)this_01;
            } while (iVar13 != iVar9);
          }
          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);
        }
        if (uVar6 != 0xffff) {
          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>>
          ::Unlink((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,uVar6);
          *(ushort *)(g_StudioHdrToActivityMaps._4_4_ + iVar8) = uVar6;
          *(undefined2 *)(g_StudioHdrToActivityMaps._4_4_ + 2 + iVar8) =
               g_StudioHdrToActivityMaps._20_2_;
          g_StudioHdrToActivityMaps._18_2_ = g_StudioHdrToActivityMaps._18_2_ + -1;
          g_StudioHdrToActivityMaps._20_2_ = uVar6;
        }
        goto LAB_000e534e;
      }
      this_00 = (CStudioHdr *)(iVar9 + 0x10);
      iVar9 = _V_strcmp((char *)this_00,(char *)(iVar10 + 0xc));
      if (iVar9 != 0) {
        iVar9 = iVar8 + g_StudioHdrToActivityMaps._4_4_;
        goto LAB_000e5259;
      }
      iVar8 = iVar8 + g_StudioHdrToActivityMaps._4_4_;
      piVar1 = (int *)(iVar8 + 0x50);
      *piVar1 = *piVar1 + 1;
      puVar12 = *(undefined1 **)(iVar8 + 0x54);
    }
    DAT_0034e6a4 = DAT_0034e6a4 + -1;
    if (DAT_0034e6a4 != 0) goto LAB_000e556d;
    LOCK();
    UNLOCK();
    g_StudioHdrToActivityMapsLock = 0;
    uVar7 = 0;
    if (DAT_0040b02c != '\0') goto LAB_000e557a;
LAB_000e548a:
    g_StudioHdrToActivityMapsLock = uVar7;
    iVar10 = _DAT_0040b9d4;
    iVar9 = ThreadGetCurrentId();
    if (iVar10 != iVar9) goto LAB_000e54a0;
  }
  this_00 = (CStudioHdr *)_DAT_0040b030;
  cVar5 = CVProfNode::ExitScope();
  if (cVar5 != '\0') {
    _DAT_0040b030 = *(CActivityToSequenceMapping **)(_DAT_0040b030 + 100);
  }
  DAT_0040b02c = _DAT_0040b030 == (CActivityToSequenceMapping *)0x40b034;
LAB_000e54a0:
  if (local_c4 != (CActivityToSequenceMapping *)0x0) {
    this_00 = (CStudioHdr *)local_c4;
    (**(code **)(local_c4 + 0x54))(local_c4,local_cc,local_c8,0,0,0);
  }
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail(this_00);
  }
  return puVar12;
}

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)