L L4D2node

CAchievementMgr::GetAchievementByName

0x003e86e0 · 637 bytes · __thiscall

_ZN15CAchievementMgr20GetAchievementByNameEPKci

Decompiled

undefined (3 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CAchievementMgr::GetAchievementByName(char const*, int) */

int * __thiscall
CAchievementMgr::GetAchievementByName(CAchievementMgr *this,char *param_1,int param_2)

{
  char cVar1;
  int iVar2;
  uint uVar3;
  ushort *puVar4;
  char *pcVar5;
  int iVar6;
  int iVar7;
  int *piVar8;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_28;
  undefined4 local_24;
  int local_20;
  
  local_34 = 0;
  local_30 = 0;
  if (___atan2f_finite == 0) {
    local_20 = 0;
  }
  else {
    (**(code **)(___atan2f_finite + 0x50))
              (___atan2f_finite,&local_34,0,0,0,0,
               "/data/src/game/server/../../game/shared/achievementmgr.cpp",0x1b0,
               &GetAchievementByName(char_const*,int)::tm_fmt,"(%s)%s","Unaccounted",
               "GetAchievementByName");
    local_20 = ___atan2f_finite;
  }
  iVar2 = _DAT_0105db00;
  local_28 = local_34;
  local_24 = local_30;
                    /* try { // try from 003e8876 to 003e88c4 has its CatchHandler @ 003e8994 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar7 = ThreadGetCurrentId(), iVar2 == iVar7)) {
    if ((char *)*_DAT_0105d15c != "GetAchievementByName") {
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xbfaf8c,(char *)0x1,0xbfafa1);
    }
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
  iVar7 = 0;
  iVar2 = param_2 * 0x1c;
  uVar3 = *(uint *)(this + iVar2 + 0x40);
  if ((short)uVar3 != 0) {
    do {
      while (((int)uVar3 <= iVar7 || (*(ushort *)(this + iVar2 + 0x4e) < (ushort)iVar7))) {
        iVar7 = iVar7 + 1;
        if ((int)(uVar3 & 0xffff) <= iVar7) goto LAB_003e880f;
      }
      if ((CUtlRBTree<CUtlMap<int,CBaseAchievement*,unsigned_short>::Node_t,unsigned_short,CUtlMap<int,CBaseAchievement*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<int,CBaseAchievement*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
           ::Links(unsigned_short)::s_Sentinel == '\0') &&
         (iVar6 = __cxa_guard_acquire(&CUtlRBTree<CUtlMap<int,CBaseAchievement*,unsigned_short>::Node_t,unsigned_short,CUtlMap<int,CBaseAchievement*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<int,CBaseAchievement*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                                       ::Links(unsigned_short)::s_Sentinel), iVar6 != 0)) {
        CUtlRBTree<CUtlMap<int,CBaseAchievement*,unsigned_short>::Node_t,unsigned_short,CUtlMap<int,CBaseAchievement*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<int,CBaseAchievement*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
        ::Links(unsigned_short)::s_Sentinel = 0xffff;
        DAT_00f137de = 0xffff;
        DAT_00f137e0 = 0xffff;
        __cxa_guard_release(&CUtlRBTree<CUtlMap<int,CBaseAchievement*,unsigned_short>::Node_t,unsigned_short,CUtlMap<int,CBaseAchievement*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<int,CBaseAchievement*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                             ::Links(unsigned_short)::s_Sentinel);
      }
      puVar4 = (ushort *)(iVar7 * 0x10 + *(int *)(this + iVar2 + 0x3c));
      if (((ushort)iVar7 != *puVar4) && (piVar8 = *(int **)(puVar4 + 6), piVar8 != (int *)0x0)) {
                    /* try { // try from 003e87ec to 003e87fd has its CatchHandler @ 003e8973 */
        pcVar5 = (char *)(**(code **)(*piVar8 + 0x20))(piVar8);
        iVar6 = _V_stricmp(param_1,pcVar5);
        if (iVar6 == 0) goto LAB_003e8811;
      }
      uVar3 = *(uint *)(this + iVar2 + 0x40);
      iVar7 = iVar7 + 1;
    } while (iVar7 < (int)(uVar3 & 0xffff));
  }
LAB_003e880f:
  piVar8 = (int *)0x0;
LAB_003e8811:
  iVar2 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar7 = ThreadGetCurrentId(), iVar2 == iVar7)) {
    cVar1 = CVProfNode::ExitScope();
    if (cVar1 != '\0') {
      _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
    }
    DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
  }
  if (local_20 != 0) {
    (**(code **)(local_20 + 0x54))(local_20,local_28,local_24,0,0,0);
  }
  return piVar8;
}

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)