CServerBenchmark::UpdateBenchmark
0x003df300 · 2325 bytes · __thiscall
_ZN16CServerBenchmark15UpdateBenchmarkEv
Decompiled
undefined (1 param)
/* CServerBenchmark::UpdateBenchmark() */
void __thiscall CServerBenchmark::UpdateBenchmark(CServerBenchmark *this)
{
float fVar1;
code *pcVar2;
uint uVar3;
code *pcVar4;
undefined4 uVar5;
char *pcVar6;
CBaseEntity *pCVar7;
undefined4 *puVar8;
int iVar9;
undefined *puVar10;
int *piVar11;
int *piVar12;
int iVar13;
int iVar14;
longdouble lVar15;
longdouble lVar16;
longdouble lVar17;
float fVar18;
int local_64;
CBasePlayer *local_48;
float local_44;
float local_40;
CBasePlayer *local_3c;
float local_38;
float local_34;
float local_30;
float local_2c;
float local_28;
int local_24;
float local_20;
double dVar19;
piVar12 = (int *)&stack0xffffff84;
if (*(int *)(this + 4) != 0) {
if (*(int *)(this + 4) == 1) {
lVar15 = (longdouble)Plat_FloatTime();
fVar18 = *(float *)(this + 0xc);
fVar1 = *(float *)(this + 0x14);
if ((float)lVar15 - fVar18 < fVar1) {
lVar15 = (longdouble)Plat_FloatTime();
fVar18 = (fVar18 + fVar1) - (float)lVar15;
iVar13 = (int)fVar18;
if ((float)iVar13 < fVar18) {
iVar13 = iVar13 + 1;
}
if (iVar13 == *(int *)(this + 0x1c)) {
return;
}
Msg();
*(int *)(this + 0x1c) = iVar13;
return;
}
Msg();
lVar15 = (longdouble)Plat_FloatTime();
fVar18 = (float)lVar15;
dVar19 = (double)CONCAT44((float)lVar15,fVar18);
*(float *)(this + 0xc) = fVar18;
*(float *)(this + 0x10) = fVar18;
Benchmark_ValidTime();
iVar13 = gpGlobals;
*(float *)(this + 8) = (float)dVar19;
uVar5 = *(undefined4 *)(iVar13 + 0x18);
*(undefined4 *)(this + 4) = 2;
*(undefined4 *)(this + 0x24) = 0;
*(undefined4 *)(this + 0x20) = 0;
*(undefined4 *)(this + 0x18) = uVar5;
if (*(int *)(sv_benchmark_autovprofrecord._28_4_ + 0x30) != 0) {
(**(code **)(*engine + 0x94))();
(**(code **)(*engine + 0x98))();
}
RandomSeed();
CUniformRandomStream::SetSeed((int)(this + 0x58));
}
iVar13 = *(int *)(gpGlobals + 0x18);
iVar14 = *(int *)(this + 0x18);
lVar15 = (longdouble)Plat_FloatTime();
if (3.0 < (float)lVar15 - *(float *)(this + 0x10)) {
*(float *)(this + 0x10) = (float)lVar15;
Msg();
iVar9 = *(int *)(sv_benchmark_numticks._28_4_ + 0x30);
}
else {
iVar9 = *(int *)(sv_benchmark_numticks._28_4_ + 0x30);
}
if (iVar9 <= iVar13 - iVar14) {
if (*(int *)(sv_benchmark_autovprofrecord._28_4_ + 0x30) != 0) {
(**(code **)(*engine + 0x94))();
(**(code **)(*engine + 0x98))();
}
Benchmark_ValidTime();
Warning();
Warning();
Warning();
Warning();
if (0 < *(int *)(gpGlobals + 0x14)) {
iVar13 = 1;
do {
pCVar7 = (CBaseEntity *)UTIL_PlayerByIndex(iVar13);
if ((((pCVar7 != (CBaseEntity *)0x0) && (((byte)pCVar7[0x151] & 1) != 0)) &&
(CBaseEntity::GetTeamNumber(pCVar7), ((byte)pCVar7[0x14d] & 8) != 0)) &&
(CBaseEntity::CalcAbsolutePosition(pCVar7), ((byte)pCVar7[0x14d] & 8) != 0)) {
CBaseEntity::CalcAbsolutePosition(pCVar7);
}
iVar13 = iVar13 + 1;
} while (iVar13 <= *(int *)(gpGlobals + 0x14));
}
Warning();
Warning();
Benchmark_ValidTime();
if (*(int *)(this + 0x54) == 2) {
iVar13 = (**(code **)(filesystem[1] + 8))();
if (iVar13 != 0) {
(**(code **)(*filesystem + 100))();
}
(**(code **)(filesystem[1] + 0xc))();
(**(code **)(*engine + 0x94))();
}
piVar12 = engine;
*(undefined4 *)(this + 4) = 0;
(**(code **)(*piVar12 + 0x1c4))();
return;
}
if ((*(int *)(this + 0x28) < 0x16) &&
(iVar13 = *(int *)(gpGlobals + 0x18) - *(int *)(this + 0x18),
iVar13 == (iVar13 / 0x32) * 0x32)) {
(**(code **)(*CServerBenchmarkHook::s_pBenchmarkHook + 0xc))();
uVar5 = sv_benchmark_numticks._28_4_;
*(int *)(this + 0x28) = *(int *)(this + 0x28) + 1;
iVar9 = *(int *)(uVar5 + 0x30);
}
iVar14 = iVar9 / 100 + *(int *)(this + 0x20);
iVar13 = (**(code **)(*(int *)this + 0x18))();
piVar11 = (int *)&stack0xffffff84;
if ((iVar14 <= iVar13) &&
(*(int *)(this + 0x20) = iVar14, piVar11 = (int *)&stack0xffffff84,
*(int *)(this + 0x38) < 100)) {
local_30 = 0.0;
local_2c = 0.0;
local_28 = 0.0;
local_24 = 0;
local_20 = 0.0;
if (0 < *(int *)(gpGlobals + 0x14)) {
iVar13 = 1;
do {
/* try { // try from 003df8db to 003df981 has its CatchHandler @ 003dfc75 */
local_3c = (CBasePlayer *)UTIL_PlayerByIndex(iVar13);
if ((local_3c != (CBasePlayer *)0x0) && (((byte)local_3c[0x151] & 1) != 0)) {
CUtlVector<CBasePlayer*,CUtlMemory<CBasePlayer*,int>>::InsertBefore
((CUtlVector<CBasePlayer*,CUtlMemory<CBasePlayer*,int>> *)&local_30,local_24,
&local_3c);
}
iVar13 = iVar13 + 1;
} while (iVar13 <= *(int *)(gpGlobals + 0x14));
piVar12 = (int *)&stack0xffffff84;
if ((0 < local_24) && (piVar12 = (int *)&stack0xffffff84, 0 < *(int *)(this + 0x4c))) {
iVar13 = (**(code **)(*(int *)this + 0x10))();
pcVar6 = *(char **)(*(int *)(this + 0x40) + iVar13 * 4);
iVar13 = (**(code **)(*(int *)this + 0x10))();
(**(code **)(**(int **)((int)local_30 + iVar13 * 4) + 0x234))();
local_64 = 0xf;
local_48 = local_3c;
local_44 = local_38;
local_40 = local_34 + 50.0;
do {
/* try { // try from 003df9cd to 003dfa4a has its CatchHandler @ 003dfc4b */
lVar15 = (longdouble)(**(code **)(*(int *)this + 0x14))();
lVar16 = (longdouble)(**(code **)(*(int *)this + 0x14))();
local_3c = (CBasePlayer *)((float)lVar16 + (float)local_48);
local_38 = (float)lVar15 + local_44;
local_34 = local_40;
pCVar7 = (CBaseEntity *)
CreatePhysicsProp(pcVar6,(Vector *)&local_48,(Vector *)&local_3c,
*(IHandleEntity **)((int)local_30 + iVar13 * 4),false,
"prop_physics_multiplayer");
if (pCVar7 != (CBaseEntity *)0x0) {
local_3c = (CBasePlayer *)&DAT_ffffffff;
/* try { // try from 003dfba0 to 003dfc3a has its CatchHandler @ 003dfc4b */
puVar8 = (undefined4 *)(**(code **)(*(int *)pCVar7 + 0xc))();
local_3c = (CBasePlayer *)*puVar8;
CUtlVector<CHandle<CBaseEntity>,CUtlMemory<CHandle<CBaseEntity>,int>>::InsertBefore
((CUtlVector<CHandle<CBaseEntity>,CUtlMemory<CHandle<CBaseEntity>,int>> *)
(this + 0x2c),*(int *)(this + 0x38),(CHandle *)&local_3c);
lVar15 = (longdouble)(**(code **)(*(int *)this + 0x14))();
lVar16 = (longdouble)(**(code **)(*(int *)this + 0x14))();
lVar17 = (longdouble)(**(code **)(*(int *)this + 0x14))();
local_3c = (CBasePlayer *)(float)lVar17;
local_38 = (float)lVar16;
local_34 = (float)lVar15;
CBaseEntity::SetAbsVelocity(pCVar7,(Vector *)&local_3c);
piVar12 = (int *)&stack0xffffff80;
break;
}
local_64 = local_64 + -1;
piVar12 = (int *)&stack0xffffff80;
} while (local_64 != 0);
}
}
local_24 = 0;
*piVar12 = (int)&local_30;
piVar12[-1] = 0x3dfa71;
CUtlMemory<CBasePlayer*,int>::Purge((CUtlMemory<CBasePlayer*,int> *)*piVar12);
*piVar12 = (int)&local_30;
local_20 = local_30;
piVar12[-1] = 0x3dfa7f;
CUtlMemory<CBasePlayer*,int>::Purge((CUtlMemory<CBasePlayer*,int> *)*piVar12);
piVar11 = piVar12;
}
iVar13 = *(int *)this;
iVar14 = *(int *)(sv_benchmark_numticks._28_4_ + 0x30) / 0x14 + *(int *)(this + 0x24);
*piVar11 = (int)this;
pcVar2 = *(code **)(iVar13 + 0x18);
piVar11[-1] = 0x3df3ee;
iVar13 = (*pcVar2)();
if ((iVar14 <= iVar13) && (*(int *)(this + 0x24) = iVar14, 0 < *(int *)(this + 0x38))) {
iVar13 = 0;
do {
while ((((uVar3 = *(uint *)(*(int *)(this + 0x2c) + iVar13 * 4), uVar3 != 0xffffffff &&
(puVar10 = g_pEntityList + (uVar3 & 0xfff) * 0x10,
puVar10 != (undefined *)0xfffffffc)) && (*(uint *)(puVar10 + 8) == uVar3 >> 0xc))
&& ((*(int *)(puVar10 + 4) != 0 &&
(piVar12 = *(int **)(*(int *)(puVar10 + 4) + 0x238), piVar12 != (int *)0x0))))) {
iVar14 = *(int *)this;
piVar11[2] = 0x48927c00;
iVar13 = iVar13 + 1;
piVar11[1] = 0x48927c00;
*piVar11 = (int)this;
pcVar2 = *(code **)(iVar14 + 0x14);
piVar11[-1] = 0x3df475;
(*pcVar2)();
iVar14 = *(int *)this;
piVar11[2] = 0x48927c00;
piVar11[1] = -0x376d8400;
*piVar11 = (int)this;
pcVar2 = *(code **)(iVar14 + 0x14);
piVar11[-1] = 0x3df48f;
(*pcVar2)();
iVar14 = *(int *)this;
piVar11[2] = 0x48927c00;
piVar11[1] = -0x376d8400;
*piVar11 = (int)this;
pcVar2 = *(code **)(iVar14 + 0x14);
piVar11[-1] = 0x3df4a9;
(*pcVar2)();
iVar14 = *(int *)this;
pcVar2 = *(code **)(*piVar12 + 0xf4);
piVar11[2] = 0x48f42400;
piVar11[1] = 0;
*piVar11 = (int)this;
pcVar4 = *(code **)(iVar14 + 0x14);
piVar11[-1] = 0x3df4ce;
lVar15 = (longdouble)(*pcVar4)();
iVar14 = *(int *)this;
piVar11[2] = 0x48f42400;
piVar11[1] = -0x370bdc00;
*piVar11 = (int)this;
pcVar4 = *(code **)(iVar14 + 0x14);
piVar11[-1] = 0x3df4f3;
lVar16 = (longdouble)(*pcVar4)();
iVar14 = *(int *)this;
piVar11[2] = 0x48f42400;
piVar11[1] = -0x370bdc00;
*piVar11 = (int)this;
pcVar4 = *(code **)(iVar14 + 0x14);
piVar11[-1] = 0x3df518;
lVar17 = (longdouble)(*pcVar4)();
local_30 = (float)lVar17;
piVar11[1] = (int)&local_30;
*piVar11 = (int)piVar12;
piVar11[-1] = 0x3df548;
local_2c = (float)lVar16;
local_28 = (float)lVar15;
(*pcVar2)();
if (*(int *)(this + 0x38) <= iVar13) goto LAB_003df551;
}
iVar13 = iVar13 + 1;
} while (iVar13 < *(int *)(this + 0x38));
}
LAB_003df551:
iVar13 = *CServerBenchmarkHook::s_pBenchmarkHook;
*piVar11 = (int)CServerBenchmarkHook::s_pBenchmarkHook;
pcVar2 = *(code **)(iVar13 + 4);
piVar11[-1] = 0x3df55e;
(*pcVar2)();
}
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.