CServerBenchmark::StartBenchmark
0x003ded40 · 441 bytes · __thiscall
_ZN16CServerBenchmark14StartBenchmarkEv
Decompiled
undefined (1 param)
/* CServerBenchmark::StartBenchmark() */
undefined4 __thiscall CServerBenchmark::StartBenchmark(CServerBenchmark *this)
{
float fVar1;
int *piVar2;
int iVar3;
longdouble lVar4;
double in_XMM0_Qa;
piVar2 = (int *)CommandLine_Tier0();
iVar3 = (**(code **)(*piVar2 + 0x28))(piVar2,"-sv_benchmark");
piVar2 = CServerBenchmarkHook::s_pBenchmarkHook;
if (iVar3 != 0) {
*(undefined4 *)(this + 0x54) = 1;
if (piVar2 == (int *)0x0) {
Error("This game doesn\'t support server benchmarks (no CServerBenchmarkHook found).");
}
*(undefined4 *)(this + 4) = 1;
lVar4 = (longdouble)Plat_FloatTime();
piVar2 = engine;
*(undefined4 *)(this + 0x14) = 0x40400000;
*(undefined4 *)(this + 0x28) = 0;
*(undefined4 *)(this + 0x1c) = 0xffffffff;
*(float *)(this + 0xc) = (float)lVar4;
(**(code **)(*piVar2 + 0x1c4))(piVar2,1);
(**(code **)*CServerBenchmarkHook::s_pBenchmarkHook)(CServerBenchmarkHook::s_pBenchmarkHook);
(**(code **)(*CServerBenchmarkHook::s_pBenchmarkHook + 8))
(CServerBenchmarkHook::s_pBenchmarkHook,this + 0x40);
return 1;
}
if (*(int *)(this + 4) == 0) {
return 0;
}
Benchmark_ValidTime();
fVar1 = *(float *)(this + 8);
if (*(int *)(this + 0x54) == 2) {
iVar3 = (**(code **)(filesystem[1] + 8))
(filesystem + 1,"sv_benchmark_results.txt",&DAT_00bf9593,"DEFAULT_WRITE_PATH")
;
if (iVar3 != 0) {
(**(code **)(*filesystem + 100))
(filesystem,iVar3,"sv_benchmark := %.2f\n",
(double)(float)(in_XMM0_Qa - (double)fVar1));
}
(**(code **)(filesystem[1] + 0xc))(filesystem + 1,iVar3);
(**(code **)(*engine + 0x94))(engine,"quit\n");
}
piVar2 = engine;
*(undefined4 *)(this + 4) = 0;
(**(code **)(*piVar2 + 0x1c4))(piVar2,0);
return 0;
}
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.