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"
|
2023-06-18 22:16:43 +02:00
|
|
|
#ifndef DEDICATED
|
|
|
|
#include "windows/id3dx.h"
|
|
|
|
#endif // !DEDICATED
|
2021-12-27 16:53:35 +01:00
|
|
|
|
2023-02-15 20:54:09 +01:00
|
|
|
/*
|
|
|
|
==================
|
2023-06-18 22:16:43 +02:00
|
|
|
Host_Shutdown
|
2023-02-15 20:54:09 +01:00
|
|
|
|
2023-06-18 22:16:43 +02:00
|
|
|
shutdown host
|
|
|
|
systems
|
2023-02-15 20:54:09 +01:00
|
|
|
==================
|
|
|
|
*/
|
2023-06-18 22:16:43 +02:00
|
|
|
void Host_Shutdown()
|
2022-11-07 19:29:55 +01:00
|
|
|
{
|
2023-06-18 22:16:43 +02:00
|
|
|
#ifndef DEDICATED
|
|
|
|
DirectX_Shutdown();
|
|
|
|
#endif // DEDICATED
|
|
|
|
v_Host_Shutdown();
|
2022-11-07 19:29:55 +01:00
|
|
|
}
|
|
|
|
|
2023-02-15 20:54:09 +01:00
|
|
|
/*
|
|
|
|
==================
|
|
|
|
Host_Status_PrintClient
|
|
|
|
|
2023-06-18 22:16:43 +02:00
|
|
|
Print client info
|
|
|
|
to console
|
2023-02-15 20:54:09 +01:00
|
|
|
==================
|
|
|
|
*/
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2023-06-18 22:16:43 +02:00
|
|
|
/*
|
|
|
|
==================
|
|
|
|
DFS_InitializeFeatureFlagDefinitions
|
|
|
|
|
|
|
|
Initialize feature
|
|
|
|
flag definitions
|
|
|
|
==================
|
|
|
|
*/
|
|
|
|
bool DFS_InitializeFeatureFlagDefinitions(const char* pszFeatureFlags)
|
|
|
|
{
|
|
|
|
if (CommandLine()->CheckParm("-nodfs"))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return v_DFS_InitializeFeatureFlagDefinitions(pszFeatureFlags);
|
|
|
|
}
|
|
|
|
|
2022-01-23 18:26:48 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2023-11-26 13:21:20 +01:00
|
|
|
void VHostCmd::Detour(const bool bAttach) const
|
2022-11-07 19:29:55 +01:00
|
|
|
{
|
2023-11-26 13:21:20 +01:00
|
|
|
DetourSetup(&v_Host_Shutdown, &Host_Shutdown, bAttach);
|
|
|
|
DetourSetup(&v_Host_Status_PrintClient, &Host_Status_PrintClient, bAttach);
|
|
|
|
DetourSetup(&v_DFS_InitializeFeatureFlagDefinitions, &DFS_InitializeFeatureFlagDefinitions, bAttach);
|
2022-11-07 19:29:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
EngineParms_t* g_pEngineParms = nullptr;
|