So I was able to locate the lua_GetNetStats and NetClient__GetNetStats on OS X (function prototype is identical for windows, obviously offsets are different).
Can someone give me some help on making sense of actually how to calculate the latency? I'm a bit confused by what is going on.
I've provided the Windows information since it's the same on mac, just trying to get help:
Code:
006B82C0 NetClient__GetNetStats
007125B0 lua_GetNetStats
The actual lua function:
Code:
signed int __cdecl lua_GetNetStats(int a1)
{
int v2; // eax@1
unsigned int v3; // [sp+10h] [bp-Ch]@1
float v4; // [sp+14h] [bp-8h]@1
float v5; // [sp+18h] [bp-4h]@1
v2 = sub_61F9D0();
NetClient__GetNetStats(v2, (int)&v5, (int)&v4, (int)&v3);
FrameScript_PushNumber(a1, v5);
FrameScript_PushNumber(a1, v4);
FrameScript_PushNumber(a1, (double)v3);
return 3;
}
Code:
int __thiscall NetClient__GetNetStats(int this, int a2, int a3, int a4)
{
unsigned int v4; // eax@1
int v5; // edx@1
unsigned int v6; // ecx@1
struct _RTL_CRITICAL_SECTION *v7; // ebx@1
unsigned int v8; // edi@1
int v9; // esi@1
double v10; // st7@1
int v11; // eax@6
v9 = this;
v7 = (struct _RTL_CRITICAL_SECTION *)(this + 11912);
sub_55F450((LPCRITICAL_SECTION)(this + 11912));
v10 = (double)(unsigned int)(sub_473610() - *(_DWORD *)(v9 + 11908)) * 0.001000000047497451;
*(float *)a2 = (double)*(unsigned int *)(v9 + 11904) * 0.0009765625 / v10;
v8 = 0;
*(float *)a3 = 0.0009765625 * (double)*(unsigned int *)(v9 + 11900) / v10;
v6 = *(_DWORD *)(v9 + 11892);
v5 = *(_DWORD *)(v9 + 11896);
v4 = 0;
if ( v6 == v5 )
goto LABEL_11;
do
{
if ( v6 >= 0x10 )
{
v6 = 0;
if ( !v5 )
break;
}
v4 += *(_DWORD *)(v9 + 4 * v6++ + 11828);
++v8;
}
while ( v6 != v5 );
if ( v8 )
v11 = v4 / v8;
else
LABEL_11:
v11 = 0;
*(_DWORD *)a4 = v11;
return sub_55F460(v7);
}
Obviously the lag variable is the 3rd FrameScript_PushNumber variable (v3). I think my biggest issue is understanding what "this" is. Because if I can't understand this I can't actually implement the 3rd part of NetClient__GetNetStats where v11 is calculated.
Edit: Also, anyone know if it's possible to get "real" latency vs. once every 30 seconds? I realize the lua function is only updated once every 30 seconds, ideally I'd like something a little more real time if possible?
Thanks in advance!!