L L4D2node

CStudioHdr::CActivityToSequenceMapping::FindMapping

0x005a02f0 · 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 (___atan2f_finite == (CActivityToSequenceMapping *)0x0) {
    local_c4 = (CActivityToSequenceMapping *)0x0;
  }
  else {
    (**(code **)(___atan2f_finite + 0x50))
              (___atan2f_finite,&local_d4,0,0,0,0,"/data/src/game/server/../../public/studio.cpp",
               0x86a,&FindMapping(CStudioHdr_const*)::tm_fmt,"(%s)%s","Unaccounted",
               "CStudioHdr::CActivityToSequenceMapping::FindMapping");
    local_c4 = ___atan2f_finite;
  }
  iVar10 = _DAT_0105db00;
  local_cc = local_d4;
  local_c8 = local_d0;
                    /* try { // try from 005a0746 to 005a0794 has its CatchHandler @ 005a0978 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar9 = ThreadGetCurrentId(), iVar10 == iVar9)) {
    if (*(char **)_DAT_0105d15c != "CStudioHdr::CActivityToSequenceMapping::FindMapping") {
      _DAT_0105d15c =
           (CActivityToSequenceMapping *)
           CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc56978,(char *)0x1,0xbfafa1);
    }
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
  this_00 = param_1;
                    /* try { // try from 005a03d9 to 005a0407 has its CatchHandler @ 005a0992 */
  cVar5 = SequencesAvailable(param_1);
  if (cVar5 == '\0') {
LAB_005a07a8:
    puVar12 = emptyMapping;
LAB_005a07ad:
    uVar7 = g_StudioHdrToActivityMapsLock;
    if (DAT_0105d158 == '\0') goto LAB_005a06ca;
LAB_005a07ba:
    iVar10 = _DAT_0105db00;
    if ((_DAT_0105d154 == 0) || (iVar9 = ThreadGetCurrentId(), iVar10 != iVar9)) goto LAB_005a06e0;
  }
  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_005a07a8;
    uVar7 = ThreadGetCurrentId();
    if (uVar7 == g_StudioHdrToActivityMapsLock) {
LAB_005a0423:
      DAT_00fb7524 = DAT_00fb7524 + 1;
    }
    else {
      LOCK();
      bVar14 = g_StudioHdrToActivityMapsLock == 0;
      uVar4 = uVar7;
      if (!bVar14) {
        uVar4 = g_StudioHdrToActivityMapsLock;
      }
      g_StudioHdrToActivityMapsLock = uVar4;
      UNLOCK();
      if (bVar14) goto LAB_005a0423;
                    /* try { // try from 005a0835 to 005a0839 has its CatchHandler @ 005a0992 */
      CThreadFastMutex::Lock(0xfb7520,uVar7);
    }
    iVar10 = *(int *)param_1;
    local_c0[0] = iVar10;
                    /* try { // try from 005a0457 to 005a05f4 has its CatchHandler @ 005a0935 */
    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_005a058e:
      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 005a0635 to 005a0639 has its CatchHandler @ 005a097c */
      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 005a068f to 005a0693 has its CatchHandler @ 005a0935 */
      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_005a0499:
        if (*(int *)(iVar9 + 0x50) != 0) {
                    /* try { // try from 005a0877 to 005a0920 has its CatchHandler @ 005a0935 */
          iVar9 = LoggingSystem_LogAssert
                            ("%s (%d) : %s\n","/data/src/game/server/../../public/studio.cpp",0x87a,
                             "Assertion Failed: g_StudioHdrToActivityMaps[i].nRefs == 0");
          if (iVar9 == 1) {
            cVar5 = ShouldUseNewAssertDialog();
            if ((cVar5 == '\0') ||
               (cVar5 = DoNewAssertDialog("/data/src/game/server/../../public/studio.cpp",0x87a,
                                          "Assertion Failed: g_StudioHdrToActivityMaps[i].nRefs == 0"
                                         ), cVar5 != '\0')) {
              raise(5);
            }
            _ExitOnFatalAssert("/data/src/game/server/../../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_005a058e;
      }
      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_005a0499;
      }
      iVar8 = iVar8 + g_StudioHdrToActivityMaps._4_4_;
      piVar1 = (int *)(iVar8 + 0x50);
      *piVar1 = *piVar1 + 1;
      puVar12 = *(undefined1 **)(iVar8 + 0x54);
    }
    DAT_00fb7524 = DAT_00fb7524 + -1;
    if (DAT_00fb7524 != 0) goto LAB_005a07ad;
    LOCK();
    UNLOCK();
    g_StudioHdrToActivityMapsLock = 0;
    uVar7 = 0;
    if (DAT_0105d158 != '\0') goto LAB_005a07ba;
LAB_005a06ca:
    g_StudioHdrToActivityMapsLock = uVar7;
    iVar10 = _DAT_0105db00;
    iVar9 = ThreadGetCurrentId();
    if (iVar10 != iVar9) goto LAB_005a06e0;
  }
  this_00 = (CStudioHdr *)_DAT_0105d15c;
  cVar5 = CVProfNode::ExitScope();
  if (cVar5 != '\0') {
    _DAT_0105d15c = *(CActivityToSequenceMapping **)(_DAT_0105d15c + 100);
  }
  DAT_0105d158 = _DAT_0105d15c == (CActivityToSequenceMapping *)0x105d160;
LAB_005a06e0:
  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)