CAchievementMgr::PostInit
0x003e9f80 · 471 bytes · __thiscall
_ZN15CAchievementMgr8PostInitEv
Decompiled
undefined (1 param)
/* CAchievementMgr::PostInit() */
void __thiscall CAchievementMgr::PostInit(CAchievementMgr *this)
{
CUtlVector<CBaseAchievement*,CUtlMemory<CBaseAchievement*,int>> *this_00;
CUtlVector<CBaseAchievement*,CUtlMemory<CBaseAchievement*,int>> *this_01;
undefined4 *puVar1;
ushort uVar2;
char *pcVar3;
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>>
*this_02;
int *piVar4;
int iVar5;
int iVar6;
CBaseAchievement **ppCVar7;
CUtlVector<CBaseAchievement*,CUtlMemory<CBaseAchievement*,int>> *this_03;
int local_34;
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>>
*local_30;
undefined4 local_24;
int *local_20;
pcVar3 = (char *)COM_GetModDirectory();
this_02 = (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>>
*)(this + 0x38);
for (puVar1 = CBaseAchievementHelper::s_pFirst; puVar1 != (undefined4 *)0x0;
puVar1 = (undefined4 *)puVar1[1]) {
iVar6 = 0;
local_30 = this_02;
do {
piVar4 = (int *)(*(code *)*puVar1)();
piVar4[0x1c] = (int)this;
(**(code **)(*piVar4 + 0x10))(piVar4);
(**(code **)(*piVar4 + 0xac))(piVar4);
(**(code **)(*piVar4 + 0x88))(piVar4,iVar6);
if ((((char *)piVar4[0x11] == (char *)0x0) ||
(iVar5 = _V_strcmp(pcVar3,(char *)piVar4[0x11]), iVar5 == 0)) && (piVar4[0x20] < 1)) {
local_24 = (**(code **)(*piVar4 + 0x1c))(piVar4);
local_20 = piVar4;
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>>
::Insert(local_30,(Node_t *)&local_24);
}
else {
(**(code **)(*piVar4 + 4))(piVar4);
}
local_30 = local_30 + 0x1c;
iVar6 = iVar6 + 1;
} while (iVar6 != 2);
}
local_34 = 0;
this_03 = (CUtlVector<CBaseAchievement*,CUtlMemory<CBaseAchievement*,int>> *)(this + 0x70);
do {
uVar2 = 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>>
::FirstInorder(this_02);
this_00 = this_03 + 0x28;
for (; uVar2 != 0xffff;
uVar2 = 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>>
::NextInorder(this_02,uVar2)) {
iVar6 = (uint)uVar2 * 0x10 + *(int *)(this_02 + 4);
ppCVar7 = (CBaseAchievement **)(iVar6 + 0xc);
if (*(int *)(*(int *)(iVar6 + 0xc) + 0x80) < 1) {
CUtlVector<CBaseAchievement*,CUtlMemory<CBaseAchievement*,int>>::InsertBefore
(this_03,*(int *)(this_03 + 0xc),ppCVar7);
}
else {
CUtlVector<CBaseAchievement*,CUtlMemory<CBaseAchievement*,int>>::InsertBefore
(this_00,*(int *)(this_03 + 0x34),ppCVar7);
}
}
this_02 = this_02 + 0x1c;
CUtlVector<CBaseAchievement*,CUtlMemory<CBaseAchievement*,int>>::Sort
(this_03,AchievementIDCompare);
CUtlVector<CBaseAchievement*,CUtlMemory<CBaseAchievement*,int>>::AddVectorToTail
(this_03 + 200,(CUtlVector *)this_03);
CUtlVector<CBaseAchievement*,CUtlMemory<CBaseAchievement*,int>>::Sort
(this_03 + 200,AchievementOrderCompare);
this_01 = this_03 + 0xf0;
this_03 = this_03 + 0x14;
CUtlVector<CBaseAchievement*,CUtlMemory<CBaseAchievement*,int>>::AddVectorToTail
(this_01,(CUtlVector *)this_00);
CUtlVector<CBaseAchievement*,CUtlMemory<CBaseAchievement*,int>>::Sort
(this_01,AchievementOrderCompare);
ClearAchievementData(this,local_34);
local_34 = local_34 + 1;
} while (local_34 != 2);
return;
}
SourceMod gamedata
paste intoaddons/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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.