CServerDemoSystem::Think
0x008207a0 · 868 bytes · __thiscall
_ZN17CServerDemoSystem5ThinkEv
Decompiled
undefined (1 param)
/* CServerDemoSystem::Think() */
void __thiscall CServerDemoSystem::Think(CServerDemoSystem *this)
{
Vector *pVVar1;
float fVar2;
CCircularBuffer *this_00;
code *pcVar3;
char cVar4;
int iVar5;
int iVar6;
int iVar7;
CBaseEntity *this_01;
KeyValues *this_02;
ServerDemoPacket_BaseEntity *this_03;
ServerDemoPacket_BaseAnimating *this_04;
ServerDemoPacket_BaseAnimatingOverlay *this_05;
float fVar8;
CBaseEntity *pCVar9;
matrix3x4_t local_4c [60];
if (((g_bAllowServerDemoWrite != '\0') && (*(undefined4 **)(this + 4) != (undefined4 *)0x0)) &&
(this_00 = (CCircularBuffer *)**(undefined4 **)(this + 4), this_00 != (CCircularBuffer *)0x0))
{
pcVar3 = *(code **)(*engine + 0xbc);
iVar5 = CCircularBuffer::GetSize(this_00);
iVar6 = CCircularBuffer::GetWriteAvailable((CCircularBuffer *)**(undefined4 **)(this + 4));
iVar7 = CCircularBuffer::GetSize((CCircularBuffer *)**(undefined4 **)(this + 4));
(*pcVar3)(engine,0,"%% circular buffer used: %2f",
(double)((float)(iVar5 - iVar6) / (float)iVar7));
fVar2 = *(float *)(sv_demo_entity_record_rate._28_4_ + 0x2c);
if ((60.0 < fVar2) || (20.0 <= fVar2)) {
fVar8 = 60.0;
if (fVar2 <= 60.0) {
fVar8 = fVar2;
}
fVar8 = 1.0 / fVar8;
}
else {
fVar8 = 0.05;
}
if (fVar8 <= *(float *)(gpGlobals + 0xc) - *(float *)(this + 8)) {
iVar5 = (int)*(float *)(gpGlobals + 0xc);
if (*(int *)(this + 0xc) == iVar5) {
*(int *)(this + 0x10) = *(int *)(this + 0x10) + 1;
}
else {
*(int *)(this + 0xc) = iVar5;
*(undefined4 *)(this + 0x10) = 0;
}
pCVar9 = (CBaseEntity *)0x0;
while( true ) {
this_01 = (CBaseEntity *)CGlobalEntityList::NextEnt((CGlobalEntityList *)gEntList,pCVar9);
if (this_01 == (CBaseEntity *)0x0) break;
this_02 = KeyValues::operator_new((KeyValues *)0x2c,(uint)pCVar9);
/* try { // try from 008208fb to 008208ff has its CatchHandler @ 00820b25 */
KeyValues::KeyValues(this_02,"entity",(IKeyValuesSystem *)0x0,false);
KeyValues::SetPtr(this_02,"serverdemo",*(void **)(this + 4));
cVar4 = (**(code **)(*(int *)this_01 + 0xd8))(this_01,this_02);
if (cVar4 != '\0') {
this_03 = (ServerDemoPacket_BaseEntity *)
KeyValues::GetPtr(this_02,"baseentity",(void *)0x0);
if (this_03 != (ServerDemoPacket_BaseEntity *)0x0) {
pVVar1 = (Vector *)(this_01 + 0x2e0);
if (((byte)this_01[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_01);
if (((byte)this_01[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_01);
}
}
AngleMatrix((QAngle *)(this_01 + 0x37c),pVVar1,local_4c);
this_04 = (ServerDemoPacket_BaseAnimating *)
KeyValues::GetPtr(this_02,"baseanimating",(void *)0x0);
this_05 = (ServerDemoPacket_BaseAnimatingOverlay *)
KeyValues::GetPtr(this_02,"baseanimatingoverlay",(void *)0x0);
if (((*(int *)this_03 != 0) ||
((this_04 != (ServerDemoPacket_BaseAnimating *)0x0 &&
(*(int *)(this_04 + 4) != 0 || *(int *)this_04 != 0)))) ||
((this_05 != (ServerDemoPacket_BaseAnimatingOverlay *)0x0 &&
(*(int *)(this_05 + 0x1e8) != 0 || *(int *)(this_05 + 0x1e4) != 0)))) {
(**(code **)(*debugoverlay + 0x28))(debugoverlay,local_4c,0x41c80000,0);
if (((byte)this_01[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_01);
}
ServerDemoPacket_BaseEntity::AddTextOverlaysForModifiedFields(this_03,pVVar1);
if (this_04 != (ServerDemoPacket_BaseAnimating *)0x0) {
if (((byte)this_01[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_01);
}
ServerDemoPacket_BaseAnimating::AddTextOverlaysForModifiedFields(this_04,pVVar1);
}
if (this_05 != (ServerDemoPacket_BaseAnimatingOverlay *)0x0) {
if (((byte)this_01[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_01);
}
ServerDemoPacket_BaseAnimatingOverlay::AddTextOverlaysForModifiedFields
(this_05,pVVar1);
}
}
}
(**(code **)(*g_pServerDemoSystem + 0xc))(g_pServerDemoSystem,this_02);
this_01[0x10] = (CBaseEntity)0x0;
}
KeyValues::deleteThis();
pCVar9 = this_01;
}
*(undefined4 *)(this + 8) = *(undefined4 *)(gpGlobals + 0xc);
}
}
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.