CSceneEntity::PrefetchAnimBlocks
0x00818c60 · 1571 bytes · __thiscall
_ZN12CSceneEntity18PrefetchAnimBlocksEP12CChoreoScene
Decompiled
undefined (2 params)
/* CSceneEntity::PrefetchAnimBlocks(CChoreoScene*) */
void __thiscall CSceneEntity::PrefetchAnimBlocks(CSceneEntity *this,CChoreoScene *param_1)
{
int *piVar1;
char cVar2;
ushort uVar3;
int iVar4;
CChoreoEvent *this_00;
int iVar5;
CBaseAnimating *this_01;
char *pcVar6;
mstudioanimdesc_t *this_02;
int iVar7;
ushort *puVar8;
int iVar9;
int iVar10;
ushort uVar11;
int local_70;
int local_6c;
int local_60;
int local_5c;
CStudioHdr *local_58;
int local_50;
int local_48 [2];
int local_40;
CBaseAnimating *local_3c;
code *local_38;
int local_34;
int local_30;
undefined4 local_2c;
ushort local_28;
undefined2 local_26;
ushort local_24;
ushort local_22;
undefined4 local_20;
piVar1 = mdlcache;
local_28 = 0xffff;
local_26 = 0;
local_24 = 0xffff;
local_22 = 0xffff;
local_38 = CDefOps<CChoreoActor*>::LessFunc;
local_34 = 0;
local_30 = 0;
iVar10 = *(int *)(scene_async_prefetch_spew._28_4_ + 0x30);
local_2c = 0;
local_20 = 0;
/* try { // try from 00818cc7 to 00818cc9 has its CatchHandler @ 0081926a */
(**(code **)(*mdlcache + 0x68))(mdlcache);
local_60 = 0;
local_6c = 0;
/* try { // try from 00818cf5 to 0081909c has its CatchHandler @ 008192af */
for (local_70 = 0; iVar4 = CChoreoScene::GetNumEvents(param_1), local_70 < iVar4;
local_70 = local_70 + 1) {
this_00 = (CChoreoEvent *)CChoreoScene::GetEvent(param_1,local_70);
if (((this_00 != (CChoreoEvent *)0x0) &&
(iVar4 = CChoreoEvent::GetType(this_00), iVar4 - 6U < 2)) &&
(iVar5 = CChoreoEvent::GetActor(this_00), iVar4 = iVar5, uVar3 = local_28, iVar5 != 0)) {
while (local_48[0] = iVar4, uVar3 != 0xffff) {
while( true ) {
iVar9 = (uint)uVar3 * 0x10;
cVar2 = (*local_38)(local_48,local_34 + 8 + iVar9);
if (cVar2 != '\0') break;
cVar2 = (*local_38)(local_34 + iVar9 + 8,local_48);
if (cVar2 == '\0') {
this_01 = *(CBaseAnimating **)(local_34 + 0xc + iVar9);
goto LAB_00818df5;
}
if ((CUtlRBTree<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short,CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel == '\0') &&
(iVar4 = __cxa_guard_acquire(&CUtlRBTree<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short,CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel), iVar4 != 0)) {
CUtlRBTree<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short,CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel = 0xffff;
DAT_00f57f36 = 0xffff;
DAT_00f57f38 = 0xffff;
__cxa_guard_release(&CUtlRBTree<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short,CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel);
}
uVar3 = *(ushort *)(local_34 + 2 + iVar9);
if (uVar3 == 0xffff) goto LAB_00818dc0;
}
if ((CUtlRBTree<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short,CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel == '\0') &&
(iVar4 = __cxa_guard_acquire(&CUtlRBTree<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short,CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel), iVar4 != 0)) {
CUtlRBTree<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short,CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel = 0xffff;
DAT_00f57f36 = 0xffff;
DAT_00f57f38 = 0xffff;
__cxa_guard_release(&CUtlRBTree<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short,CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel);
}
iVar4 = local_48[0];
uVar3 = *(ushort *)(local_34 + iVar9);
}
LAB_00818dc0:
this_01 = (CBaseAnimating *)(**(code **)(*(int *)this + 0x3e0))(this,iVar5);
local_40 = iVar5;
local_3c = this_01;
CUtlRBTree<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short,CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Insert((CUtlRBTree<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short,CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
*)&local_38,(Node_t *)&local_40);
LAB_00818df5:
if (this_01 != (CBaseAnimating *)0x0) {
pcVar6 = (char *)CChoreoEvent::GetParameters(this_00);
iVar4 = CBaseAnimating::LookupSequence(this_01,pcVar6);
if (-1 < iVar4) {
local_58 = *(CStudioHdr **)(this_01 + 0x13e0);
if (local_58 == (CStudioHdr *)0x0) {
/* try { // try from 00819282 to 00819295 has its CatchHandler @ 008192af */
iVar5 = CBaseEntity::GetModel((CBaseEntity *)this_01);
if (iVar5 != 0) {
CBaseAnimating::LockStudioHdr(this_01);
}
local_58 = *(CStudioHdr **)(this_01 + 0x13e0);
if (local_58 == (CStudioHdr *)0x0) goto LAB_00818ce8;
}
if (*(int *)local_58 != 0) {
iVar9 = CStudioHdr::pSeqdesc(local_58,iVar4);
iVar5 = *(int *)(iVar9 + 0x44);
if (0 < iVar5) {
local_5c = 0;
do {
if (0 < *(int *)(iVar9 + 0x48)) {
local_50 = 0;
do {
while( true ) {
iVar7 = iVar5 + -1;
if (local_5c < iVar5) {
iVar7 = local_5c;
}
iVar5 = CStudioHdr::iRelativeAnim
(local_58,iVar4,
(int)*(short *)(iVar9 + (iVar5 * local_50 + iVar7) * 2 +
*(int *)(iVar9 + 0x3c)));
this_02 = (mstudioanimdesc_t *)CStudioHdr::pAnimdesc(local_58,iVar5);
local_60 = local_60 + 1;
if (iVar10 != 0) {
Msg("%s checking block %d\n",*(int *)local_58 + 0xc,
*(undefined4 *)(this_02 + 0x34));
}
local_40 = 0;
iVar5 = mstudioanimdesc_t::pAnim(this_02,&local_40);
if (iVar5 == 0) break;
local_6c = local_6c + 1;
if (1 < iVar10) {
Msg("%s:%s[%i:%i] was resident\n",*(int *)local_58 + 0xc,
this_02 + *(int *)(this_02 + 4),local_5c,local_50);
}
LAB_00818ec5:
local_50 = local_50 + 1;
iVar5 = *(int *)(iVar9 + 0x44);
if (*(int *)(iVar9 + 0x48) <= local_50) goto LAB_00818fc0;
}
if (iVar10 == 0) goto LAB_00818ec5;
Msg("%s:%s[%i:%i] async load\n",*(int *)local_58 + 0xc,
this_02 + *(int *)(this_02 + 4),local_5c,local_50);
local_50 = local_50 + 1;
iVar5 = *(int *)(iVar9 + 0x44);
} while (local_50 < *(int *)(iVar9 + 0x48));
}
LAB_00818fc0:
local_5c = local_5c + 1;
} while (local_5c < iVar5);
}
}
}
}
}
LAB_00818ce8:
}
if ((local_60 < 1) || (iVar10 == 0)) {
(**(code **)(*piVar1 + 0x6c))(piVar1);
if (local_22 == 0xffff) goto LAB_008190f2;
iVar10 = 0;
uVar3 = local_22;
if (0 < local_30) {
do {
uVar11 = (ushort)iVar10;
if ((iVar10 < local_30) && (uVar11 <= uVar3)) {
if ((CUtlRBTree<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short,CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel == '\0') &&
(iVar4 = __cxa_guard_acquire(&CUtlRBTree<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short,CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel), iVar4 != 0)) {
CUtlRBTree<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short,CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel = 0xffff;
DAT_00f57f36 = 0xffff;
DAT_00f57f38 = 0xffff;
__cxa_guard_release(&CUtlRBTree<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short,CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel);
}
puVar8 = (ushort *)(local_34 + iVar10 * 0x10);
uVar3 = local_22;
if (uVar11 != *puVar8) {
puVar8[1] = local_24;
*(ushort *)(local_34 + iVar10 * 0x10) = uVar11;
local_24 = uVar11;
}
}
} while (((uVar11 != uVar3) && ((int)(iVar10 + 1U & 0xffff) < local_30)) &&
(iVar10 = iVar10 + 1, iVar10 != 0xffff));
}
}
else {
Msg("%d of %d animations resident\n",local_6c,local_60);
(**(code **)(*piVar1 + 0x6c))(piVar1);
if (local_22 == 0xffff) goto LAB_008190f2;
iVar10 = 0;
uVar3 = local_22;
if (0 < local_30) {
do {
uVar11 = (ushort)iVar10;
if ((iVar10 < local_30) && (uVar11 <= uVar3)) {
if ((CUtlRBTree<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short,CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel == '\0') &&
(iVar4 = __cxa_guard_acquire(&CUtlRBTree<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short,CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel), iVar4 != 0)) {
CUtlRBTree<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short,CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel = 0xffff;
DAT_00f57f36 = 0xffff;
DAT_00f57f38 = 0xffff;
__cxa_guard_release(&CUtlRBTree<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short,CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel);
}
puVar8 = (ushort *)(local_34 + iVar10 * 0x10);
uVar3 = local_22;
if (*puVar8 != uVar11) {
puVar8[1] = local_24;
*(ushort *)(local_34 + iVar10 * 0x10) = uVar11;
local_24 = uVar11;
}
}
} while (((uVar11 != uVar3) && ((int)(iVar10 + 1U & 0xffff) < local_30)) &&
(iVar10 = iVar10 + 1, iVar10 != 0xffff));
}
}
local_28 = 0xffff;
local_26 = 0;
LAB_008190f2:
local_24 = 0xffff;
CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>
::Purge((CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>
*)&local_34);
local_22 = 0xffff;
CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>
::Purge((CUtlMemory<UtlRBTreeNode_t<CUtlMap<CChoreoActor*,CBaseFlex*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>
*)&local_34);
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.