CFrameTimer::ComputeFrameVariability
0x001767d0 · 631 bytes · __thiscall
_ZN11CFrameTimer23ComputeFrameVariabilityEv
Decompiled
undefined (1 param)
/* CFrameTimer::ComputeFrameVariability() */
void __thiscall CFrameTimer::ComputeFrameVariability(CFrameTimer *this)
{
int iVar1;
int iVar2;
int iVar3;
longdouble lVar4;
float fVar5;
double dVar6;
float fVar7;
float fVar8;
double dVar9;
double dVar10;
float fVar11;
iVar2 = *(int *)(this + 0x1ac);
dVar9 = *(double *)(this + 0x58);
*(float *)(this + iVar2 * 4 + 0xe4) = (float)dVar9;
iVar2 = iVar2 + 1;
if (iVar2 < 0x32) {
*(int *)(this + 0x1ac) = iVar2;
}
else {
*(undefined4 *)(this + 0x1ac) = 0;
iVar2 = 0;
}
fVar7 = 0.0;
fVar5 = 0.0;
iVar3 = 0;
iVar1 = iVar2;
while( true ) {
iVar1 = iVar1 + -1;
if (iVar1 < 0) {
iVar1 = 0x31;
}
if (*(float *)(this + iVar1 * 4 + 0xe4) == 0.0) break;
fVar5 = fVar5 + *(float *)(this + iVar1 * 4 + 0xe4);
iVar3 = iVar3 + 1;
if ((0.5 < fVar5) || (0x31 < iVar3)) goto LAB_00176878;
}
if (iVar3 == 0) {
*(undefined8 *)(this + 0x60) = 0;
*(undefined8 *)(this + 0x68) = 0;
return;
}
LAB_00176878:
iVar1 = 0;
fVar8 = 1.0;
fVar5 = 0.0;
fVar11 = 0.0;
while( true ) {
iVar2 = iVar2 + -1;
if (iVar2 < 0) {
iVar2 = 0x31;
}
fVar5 = fVar5 + fVar8;
iVar1 = iVar1 + 1;
fVar11 = *(float *)(this + iVar2 * 4 + 0xe4) * fVar8 + fVar11;
if (iVar3 <= iVar1) break;
lVar4 = (longdouble)__exp_finite((double)((float)iVar1 * (-2.0 / (float)iVar3)));
fVar8 = (float)lVar4;
}
fVar8 = fVar7;
if (fVar11 / fVar5 != 0.0) {
fVar8 = 1.0 / (fVar11 / fVar5);
}
dVar10 = 0.0;
if (dVar9 != 0.0) {
fVar7 = (float)(1.0 / dVar9);
}
iVar2 = 0;
iVar1 = 0;
dVar9 = 0.0;
*(double *)(this + 0x60) = (double)ABS(fVar7 - fVar8);
do {
fVar5 = *(float *)(this + iVar2 * 4 + 0xe4);
if (fVar5 != 0.0) {
dVar6 = 0.25;
if (fVar5 < 0.25) {
dVar6 = (double)fVar5;
}
dVar9 = dVar9 + dVar6;
iVar1 = iVar1 + 1;
}
iVar2 = iVar2 + 1;
} while (iVar2 != 0x32);
if (iVar1 < 2) {
return;
}
iVar2 = 0;
do {
fVar5 = *(float *)(this + iVar2 * 4 + 0xe4);
if (fVar5 != 0.0) {
dVar6 = 0.25;
if (fVar5 < 0.25) {
dVar6 = (double)fVar5;
}
dVar6 = dVar6 - dVar9 / (double)iVar1;
dVar10 = dVar10 + dVar6 * dVar6;
}
iVar2 = iVar2 + 1;
} while (iVar2 != 0x32);
*(double *)(this + 0x68) = SQRT(dVar10 / (double)(iVar1 + -1));
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.