net_status
0x001c4310 · 1071 bytes · __cdecl
_ZL10net_statusRK8CCommand
Decompiled
undefined (1 param)
/* net_status(CCommand const&) */
uint net_status(CCommand *param_1)
{
int *piVar1;
int iVar2;
uint uVar3;
uint uVar4;
undefined4 uVar5;
char *pcVar6;
undefined *puVar7;
char *pcVar8;
undefined4 *puVar9;
int iVar10;
bool bVar11;
longdouble lVar12;
float fVar13;
int iVar14;
undefined8 in_stack_ffffffb0;
undefined4 uVar16;
ulonglong uVar15;
float local_3c;
float local_38;
float local_34;
float local_30;
float local_2c;
float local_28;
float local_24;
float local_20;
uVar16 = (undefined4)((ulonglong)in_stack_ffffffb0 >> 0x20);
uVar4 = ThreadGetCurrentId();
if (uVar4 != DAT_003ac4b4) {
LOCK();
bVar11 = DAT_003ac4b4 != 0;
uVar3 = uVar4;
if (bVar11) {
uVar3 = DAT_003ac4b4;
}
DAT_003ac4b4 = uVar3;
UNLOCK();
if (bVar11) {
CThreadFastMutex::Lock(0x3ac4b4,uVar4);
goto LAB_001c4346;
}
}
DAT_003ac4b8 = DAT_003ac4b8 + 1;
LAB_001c4346:
iVar2 = DAT_003ac4ac;
/* try { // try from 001c435b to 001c46f1 has its CatchHandler @ 001c4747 */
uVar5 = netadr_s::ToString((netadr_s *)&net_local_adr,true);
ConMsg("Net status for host %s:\n",uVar5);
uVar15 = CONCAT44(uVar16,iVar2);
pcVar8 = "dedicated";
if (net_dedicated == '\0') {
pcVar8 = "listen";
}
pcVar6 = "Multiplayer";
if (net_multiplayer == '\0') {
pcVar6 = "Singleplayer";
}
ConMsg("- Config: %s, %s, %i connections\n",pcVar6,pcVar8,iVar2);
ConMsg("- Ports: ");
iVar10 = 0;
do {
uVar16 = (undefined4)(uVar15 >> 0x20);
uVar4 = NET_GetUDPPort(iVar10);
if (iVar10 == 0) {
puVar7 = &DAT_002bbe1c;
}
else {
puVar9 = (undefined4 *)s_SocketDescMap;
do {
puVar7 = (undefined *)puVar9[2];
if (puVar7 == (undefined *)0x0) {
puVar7 = &DAT_002b558d;
break;
}
piVar1 = puVar9 + 3;
puVar9 = puVar9 + 2;
} while (iVar10 != *piVar1);
}
uVar15 = CONCAT44(uVar16,uVar4) & 0xffffffff0000ffff;
iVar14 = iVar10;
ConMsg("%s%d %u, ",puVar7,iVar10,uVar4 & 0xffff);
iVar10 = iVar10 + 1;
if (iVar10 == 3) {
ConMsg("%d total.\n",3,iVar14,uVar15);
if (0 < iVar2) {
local_28 = 0.0;
local_2c = 0.0;
local_38 = 0.0;
local_3c = 0.0;
local_20 = 0.0;
local_24 = 0.0;
local_34 = 0.0;
local_30 = 0.0;
iVar10 = 0;
do {
piVar1 = *(int **)(s_NetChannels + iVar10 * 4);
lVar12 = (longdouble)(**(code **)(*piVar1 + 0x28))(piVar1,0);
local_30 = (float)lVar12 + local_30;
lVar12 = (longdouble)(**(code **)(*piVar1 + 0x28))(piVar1,1);
local_34 = (float)lVar12 + local_34;
lVar12 = (longdouble)(**(code **)(*piVar1 + 0x2c))(piVar1,1);
local_38 = (float)lVar12 + local_38;
lVar12 = (longdouble)(**(code **)(*piVar1 + 0x2c))(piVar1,0);
local_3c = (float)lVar12 + local_3c;
lVar12 = (longdouble)(**(code **)(*piVar1 + 0x38))(piVar1,1);
local_20 = (float)lVar12 + local_20;
lVar12 = (longdouble)(**(code **)(*piVar1 + 0x38))(piVar1,0);
local_24 = (float)lVar12 + local_24;
lVar12 = (longdouble)(**(code **)(*piVar1 + 0x34))(piVar1,1);
local_28 = (float)lVar12 + local_28;
lVar12 = (longdouble)(**(code **)(*piVar1 + 0x34))(piVar1,0);
iVar10 = iVar10 + 1;
local_2c = (float)lVar12 + local_2c;
} while (iVar10 != iVar2);
fVar13 = 1.0 / (float)iVar10;
ConMsg("- Latency: avg out %.2fs, in %.2fs\n",(double)(local_30 * fVar13),
(double)(local_34 * fVar13));
ConMsg("- Loss: avg out %.1f, in %.1f\n",(double)(local_3c * fVar13),
(double)(local_38 * fVar13));
ConMsg("- Packets: net total out %.1f/s, in %.1f/s\n",(double)local_24,(double)local_20);
ConMsg(" per client out %.1f/s, in %.1f/s\n",(double)(local_24 * fVar13),
(double)(local_20 * fVar13));
ConMsg("- Data: net total out %.1f, in %.1f kB/s\n",(double)(local_2c * 0.0009765625),
(double)(local_28 * 0.0009765625));
ConMsg(" per client out %.1f, in %.1f kB/s\n",
(double)(fVar13 * 0.0009765625 * local_2c),(double)(local_28 * fVar13 * 0.0009765625)
);
}
uVar4 = DAT_003ac4b4;
DAT_003ac4b8 = DAT_003ac4b8 - 1;
if (DAT_003ac4b8 == 0) {
LOCK();
DAT_003ac4b4 = DAT_003ac4b8;
UNLOCK();
return uVar4;
}
return DAT_003ac4b8;
}
} while( true );
}
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.