CBaseEntity::PhysicsRunSpecificThink
0x00478530 · 1357 bytes · __cdecl
_ZN11CBaseEntity23PhysicsRunSpecificThinkEiMS_FvvE
Decompiled
undefined (2 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CBaseEntity::PhysicsRunSpecificThink(int, void (CBaseEntity::*)()) */
uint CBaseEntity::PhysicsRunSpecificThink(int param_1,_func_void *param_2)
{
float fVar1;
ushort uVar2;
undefined4 uVar3;
int iVar4;
uint uVar5;
char cVar6;
int iVar7;
float *pfVar8;
int iVar9;
int iVar10;
short *psVar11;
int iVar12;
undefined4 uVar13;
ushort *puVar14;
undefined *puVar15;
undefined4 uVar16;
uint uVar17;
int iVar18;
char *pcVar19;
float fVar20;
float local_38 [2];
undefined4 local_30;
undefined4 local_2c;
undefined4 local_28;
undefined4 local_24;
undefined4 local_20;
iVar7 = GetNextThinkTick((CBaseEntity *)param_1,(int)param_2);
if ((iVar7 < 1) || (iVar9 = *(int *)(gpGlobals + 0x18), iVar9 < iVar7)) {
return 1;
}
fVar20 = *(float *)(gpGlobals + 0x1c);
fVar1 = *(float *)(gpGlobals + 0xc);
uVar3 = *(undefined4 *)(param_1 + 0xd0);
if (iVar9 != _DAT_00f7e6fc) {
if (DAT_00f7e700 != '\0') {
if (DAT_00f7e6f2 != 0) {
Msg("-----------------\nThink report frame %i\n",iVar9);
uVar2 = DAT_00f7e6f0;
while( true ) {
uVar17 = (uint)uVar2;
if ((CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel == '\0') &&
(iVar10 = __cxa_guard_acquire(&CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel), iVar10 != 0)) {
CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel = 0xffff;
DAT_00f1624c = 0xffff;
DAT_00f1624e = 0xffff;
__cxa_guard_release(&CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel);
}
if (uVar2 == 0xffff) {
psVar11 = &CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel;
}
else {
psVar11 = (short *)(DAT_00f7e6e4 + uVar17 * 0x24);
}
if (*psVar11 == -1) break;
if ((CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel == '\0') &&
(iVar10 = __cxa_guard_acquire(&CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel), iVar10 != 0)) {
CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel = 0xffff;
DAT_00f1624c = 0xffff;
DAT_00f1624e = 0xffff;
__cxa_guard_release(&CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel);
}
if (uVar2 == 0xffff) {
puVar14 = &CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel;
}
else {
puVar14 = (ushort *)(DAT_00f7e6e4 + uVar17 * 0x24);
}
uVar2 = *puVar14;
}
for (; uVar17 != 0xffff; uVar17 = uVar17 & 0xffff) {
iVar10 = DAT_00f7e6e4 + uVar17 * 0x24;
if (((iVar10 != -8) && (iVar4 = *(int *)(iVar10 + 0x1c), iVar4 != 0)) &&
(Msg("thinktime %f, %i entities\n",(double)*(float *)(iVar10 + 8),iVar4), 0 < iVar4)) {
iVar18 = 0;
do {
uVar5 = *(uint *)(*(int *)(iVar10 + 0x10) + iVar18 * 4);
if (((uVar5 == 0xffffffff) ||
(puVar15 = g_pEntityList + (uVar5 & 0xfff) * 0x10,
puVar15 == (undefined *)0xfffffffc)) || (*(uint *)(puVar15 + 8) != uVar5 >> 0xc))
{
uVar13 = 0;
uVar16 = 0;
pcVar19 = "NULL";
iVar12 = 0;
}
else {
iVar12 = *(int *)(puVar15 + 4);
if (iVar12 == 0) {
uVar13 = 0;
uVar16 = 0;
pcVar19 = "NULL";
}
else {
pcVar19 = *(char **)(iVar12 + 0x7c);
uVar16 = *(undefined4 *)(iVar12 + 0x9c);
uVar13 = *(undefined4 *)(iVar12 + 0xd0);
if (pcVar19 == (char *)0x0) {
pcVar19 = "";
}
}
}
iVar18 = iVar18 + 1;
Msg(" %p : %30s (last %5i/next %5i)\n",iVar12,pcVar19,uVar16,uVar13);
} while (iVar18 != iVar4);
}
uVar17 = CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
::NextInorder((CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
*)&g_ThinkChecker,(ushort)uVar17);
}
}
CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
::RemoveAll((CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
*)&g_ThinkChecker);
_DAT_00f7e6fc = iVar9;
}
DAT_00f7e700 = *(int *)(sv_thinktimecheck._28_4_ + 0x30) != 0;
}
if (DAT_00f7e700 != '\0') {
local_30 = 0;
local_2c = 0;
local_28 = 0;
local_24 = 0;
local_38[0] = (float)iVar7 * fVar20;
local_20 = 0;
uVar2 = DAT_00f7e6f0;
fVar20 = local_38[0];
if (local_38[0] <= fVar1) {
local_38[0] = fVar1;
fVar20 = fVar1;
}
while (uVar2 != 0xffff) {
while( true ) {
uVar17 = (uint)uVar2;
iVar7 = uVar17 * 0x24;
/* try { // try from 004786ae to 004786ea has its CatchHandler @ 00478ab4 */
cVar6 = (*g_ThinkChecker)(local_38,DAT_00f7e6e4 + 8 + iVar7);
if (cVar6 == '\0') break;
if ((CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel == '\0') &&
(iVar7 = __cxa_guard_acquire(&CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel), iVar7 != 0)) {
CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel = 0xffff;
DAT_00f1624c = 0xffff;
DAT_00f1624e = 0xffff;
__cxa_guard_release(&CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel);
}
uVar2 = *(ushort *)(DAT_00f7e6e4 + uVar17 * 0x24);
if (uVar2 == 0xffff) goto LAB_004786d8;
}
/* try { // try from 0047877c to 00478781 has its CatchHandler @ 00478ab4 */
cVar6 = (*g_ThinkChecker)(DAT_00f7e6e4 + iVar7 + 8,local_38);
if (cVar6 == '\0') {
if (uVar17 != 0xffff) goto LAB_004786ee;
break;
}
if ((CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel == '\0') &&
(iVar9 = __cxa_guard_acquire(&CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel), iVar9 != 0)) {
CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel = 0xffff;
DAT_00f1624c = 0xffff;
DAT_00f1624e = 0xffff;
__cxa_guard_release(&CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel);
}
uVar2 = *(ushort *)(DAT_00f7e6e4 + 2 + iVar7);
}
LAB_004786d8:
uVar17 = CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
::Insert((CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>
*)&g_ThinkChecker,(ThinkSync *)local_38);
uVar17 = uVar17 & 0xffff;
LAB_004786ee:
local_24 = 0;
iVar7 = DAT_00f7e6e4 + uVar17 * 0x24;
CUtlMemory<CHandle<CBaseEntity>,int>::Purge((CUtlMemory<CHandle<CBaseEntity>,int> *)&local_30);
local_20 = local_30;
CUtlMemory<CHandle<CBaseEntity>,int>::Purge((CUtlMemory<CHandle<CBaseEntity>,int> *)&local_30);
*(float *)(iVar7 + 8) = fVar20;
*(undefined4 *)(iVar7 + 0xc) = uVar3;
local_38[0] = -NAN;
pfVar8 = (float *)(**(code **)(*(int *)param_1 + 0xc))(param_1);
local_38[0] = *pfVar8;
CUtlVector<CHandle<CBaseEntity>,CUtlMemory<CHandle<CBaseEntity>,int>>::InsertBefore
((CUtlVector<CHandle<CBaseEntity>,CUtlMemory<CHandle<CBaseEntity>,int>> *)
(iVar7 + 0x10),*(int *)(iVar7 + 0x1c),(CHandle *)local_38);
}
SetNextThink((CBaseEntity *)param_1,(int)param_2,-1.0);
PhysicsDispatchThink((_func_void *)param_1);
SetLastThink((CBaseEntity *)param_1,(int)param_2,*(float *)(gpGlobals + 0xc));
return *(uint *)(param_1 + 0x14c) & 1 ^ 1;
}
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.