L L4D2node

CAchievementMgr::GetAchievementByID

0x003e7f20 · 299 bytes · __thiscall

_ZN15CAchievementMgr18GetAchievementByIDEii

Decompiled

undefined (3 params)

/* CAchievementMgr::GetAchievementByID(int, int) */

undefined4 __thiscall
CAchievementMgr::GetAchievementByID(CAchievementMgr *this,int param_1,int param_2)

{
  ushort uVar1;
  char cVar2;
  int iVar3;
  uint uVar4;
  int iVar5;
  int local_24 [5];
  
  uVar4 = (uint)*(ushort *)(this + param_2 * 0x1c + 0x48);
  local_24[0] = param_1;
  if (*(ushort *)(this + param_2 * 0x1c + 0x48) != 0xffff) {
    iVar3 = *(int *)(this + param_2 * 0x1c + 0x3c);
    do {
      while( true ) {
        iVar5 = uVar4 * 0x10;
        cVar2 = (**(code **)(this + param_2 * 0x1c + 0x38))(local_24,iVar3 + 8 + iVar5);
        if (cVar2 != '\0') break;
        cVar2 = (**(code **)(this + param_2 * 0x1c + 0x38))
                          (*(int *)(this + param_2 * 0x1c + 0x3c) + iVar5 + 8,local_24);
        if (cVar2 == '\0') {
          return *(undefined4 *)(*(int *)(this + param_2 * 0x1c + 0x3c) + 0xc + iVar5);
        }
        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') &&
           (iVar3 = __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), iVar3 != 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);
        }
        iVar3 = *(int *)(this + param_2 * 0x1c + 0x3c);
        uVar1 = *(ushort *)(iVar3 + 2 + iVar5);
        uVar4 = (uint)uVar1;
        if (uVar1 == 0xffff) {
          return 0;
        }
      }
      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') &&
         (iVar3 = __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), iVar3 != 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);
      }
      iVar3 = *(int *)(this + param_2 * 0x1c + 0x3c);
      uVar4 = (uint)*(ushort *)(iVar3 + iVar5);
    } while (*(ushort *)(iVar3 + iVar5) != 0xffff);
  }
  return 0;
}

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)