2021-12-27 16:53:35 +01:00
|
|
|
#include "core/stdafx.h"
|
2022-11-07 19:29:55 +01:00
|
|
|
#include "tier0/commandline.h"
|
2023-02-15 20:54:09 +01:00
|
|
|
#include "host_cmd.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include "client/client.h"
|
2021-12-27 16:53:35 +01:00
|
|
|
|
2023-03-01 00:09:38 +01:00
|
|
|
#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1) && !defined (GAMEDLL_S2)
|
2023-02-15 20:54:09 +01:00
|
|
|
/*
|
|
|
|
==================
|
|
|
|
DFS_InitializeFeatureFlagDefinitions
|
|
|
|
|
|
|
|
Initialize feature
|
|
|
|
flag definitions
|
|
|
|
==================
|
|
|
|
*/
|
2022-11-07 19:29:55 +01:00
|
|
|
bool DFS_InitializeFeatureFlagDefinitions(const char* pszFeatureFlags)
|
|
|
|
{
|
|
|
|
if (CommandLine()->CheckParm("-nodfs"))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return v_DFS_InitializeFeatureFlagDefinitions(pszFeatureFlags);
|
|
|
|
}
|
2023-03-01 00:09:38 +01:00
|
|
|
#endif // !(GAMEDLL_S0) || !(GAMEDLL_S1) || !(GAMEDLL_S2)
|
2022-11-07 19:29:55 +01:00
|
|
|
|
2023-02-15 20:54:09 +01:00
|
|
|
/*
|
|
|
|
==================
|
|
|
|
Host_Status_PrintClient
|
|
|
|
|
|
|
|
Print client info
|
|
|
|
to console
|
|
|
|
==================
|
|
|
|
*/
|
|
|
|
void Host_Status_PrintClient(CClient* client, bool bShowAddress, void (*print) (const char* fmt, ...))
|
|
|
|
{
|
|
|
|
CNetChan* nci = client->GetNetChan();
|
|
|
|
const char* state = "challenging";
|
|
|
|
|
|
|
|
if (client->IsActive())
|
|
|
|
state = "active";
|
|
|
|
else if (client->IsSpawned())
|
|
|
|
state = "spawning";
|
|
|
|
else if (client->IsConnected())
|
|
|
|
state = "connecting";
|
|
|
|
|
|
|
|
if (nci != NULL)
|
|
|
|
{
|
2023-04-03 14:56:03 +02:00
|
|
|
print("# %i \"%s\" %llu %s %i %i %s %d\n",
|
2023-03-18 16:45:43 +01:00
|
|
|
client->GetHandle(), client->GetServerName(), client->GetNucleusID(), COM_FormatSeconds(static_cast<int>(nci->GetTimeConnected())),
|
2023-02-15 20:54:09 +01:00
|
|
|
static_cast<int>(1000.0f * nci->GetAvgLatency(FLOW_OUTGOING)), static_cast<int>(100.0f * nci->GetAvgLoss(FLOW_INCOMING)), state, nci->GetDataRate());
|
|
|
|
|
|
|
|
if (bShowAddress)
|
|
|
|
{
|
2023-04-03 14:56:03 +02:00
|
|
|
print(" %s\n", nci->GetAddress());
|
2023-02-15 20:54:09 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-04-03 14:56:03 +02:00
|
|
|
print("#%2i \"%s\" %llu %s\n", client->GetHandle(), client->GetServerName(), client->GetNucleusID(), state);
|
2023-02-15 20:54:09 +01:00
|
|
|
}
|
|
|
|
|
2023-04-03 14:56:03 +02:00
|
|
|
//print("\n");
|
2023-02-15 20:54:09 +01:00
|
|
|
}
|
|
|
|
|
2022-01-23 18:26:48 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2023-01-25 02:26:52 +01:00
|
|
|
void VHostCmd::Attach() const
|
2022-11-07 19:29:55 +01:00
|
|
|
{
|
2023-03-01 00:09:38 +01:00
|
|
|
#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1) && !defined (GAMEDLL_S2)
|
2022-11-07 19:29:55 +01:00
|
|
|
DetourAttach(&v_DFS_InitializeFeatureFlagDefinitions, &DFS_InitializeFeatureFlagDefinitions);
|
2023-03-01 00:09:38 +01:00
|
|
|
#endif // !(GAMEDLL_S0) || !(GAMEDLL_S1) || !(GAMEDLL_S2)
|
2023-02-15 20:54:09 +01:00
|
|
|
DetourAttach(&v_Host_Status_PrintClient, &Host_Status_PrintClient);
|
2022-11-07 19:29:55 +01:00
|
|
|
}
|
2022-01-23 18:26:48 +01:00
|
|
|
|
2023-01-25 02:26:52 +01:00
|
|
|
void VHostCmd::Detach() const
|
2022-11-07 19:29:55 +01:00
|
|
|
{
|
2023-03-01 00:09:38 +01:00
|
|
|
#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1) && !defined (GAMEDLL_S2)
|
2022-11-07 19:29:55 +01:00
|
|
|
DetourDetach(&v_DFS_InitializeFeatureFlagDefinitions, &DFS_InitializeFeatureFlagDefinitions);
|
2023-03-01 00:09:38 +01:00
|
|
|
#endif // !(GAMEDLL_S0) || !(GAMEDLL_S1) || !(GAMEDLL_S2)
|
2023-02-15 20:54:09 +01:00
|
|
|
DetourDetach(&v_Host_Status_PrintClient, &Host_Status_PrintClient);
|
2022-11-07 19:29:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
EngineParms_t* g_pEngineParms = nullptr;
|