2021-12-25 22:36:38 +01:00
|
|
|
//=============================================================================//
|
|
|
|
//
|
|
|
|
// Purpose: Interface the engine exposes to the game DLL
|
|
|
|
//
|
|
|
|
//=============================================================================//
|
|
|
|
|
|
|
|
#include "core/stdafx.h"
|
2022-04-09 16:16:40 +02:00
|
|
|
#include "tier1/cvar.h"
|
2022-03-26 00:24:13 +01:00
|
|
|
#include "common/protocol.h"
|
2022-05-20 11:52:19 +02:00
|
|
|
#include "engine/client/client.h"
|
2022-04-02 12:27:35 +02:00
|
|
|
#include "server/vengineserver_impl.h"
|
2021-12-25 22:36:38 +01:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Purpose: sets the persistence var in the CClient instance to 'ready'
|
|
|
|
//-----------------------------------------------------------------------------
|
2022-05-20 11:52:19 +02:00
|
|
|
bool HIVEngineServer__PersistenceAvailable(void* entidx, int clienthandle)
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2022-05-20 11:52:19 +02:00
|
|
|
CClient* pClient = g_pClient->GetClient(clienthandle); // Get client instance.
|
2022-03-26 00:24:13 +01:00
|
|
|
pClient->SetPersistenceState(PERSISTENCE::PERSISTENCE_READY); // Set the client instance to 'ready'.
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2022-05-20 11:52:19 +02:00
|
|
|
if (!g_bIsPersistenceVarSet[clienthandle] && sv_showconnecting->GetBool())
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2022-04-02 02:48:54 +02:00
|
|
|
CNetChan* pNetChan = pClient->GetNetChan();
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2022-04-06 00:49:17 +02:00
|
|
|
string svClientName = pNetChan->GetName();
|
2022-04-02 02:48:54 +02:00
|
|
|
string svIpAddress = pNetChan->GetAddress();
|
2022-06-14 20:56:55 +02:00
|
|
|
uint64_t nOriginID = pClient->GetOriginID();
|
2021-12-25 22:36:38 +01:00
|
|
|
|
|
|
|
DevMsg(eDLL_T::SERVER, "______________________________________________________________\n");
|
2022-04-26 20:24:51 +02:00
|
|
|
DevMsg(eDLL_T::SERVER, "+- NetChannel:\n");
|
2022-05-20 11:52:19 +02:00
|
|
|
DevMsg(eDLL_T::SERVER, " |- IDX : | '#%d'\n", clienthandle);
|
2022-04-02 02:48:54 +02:00
|
|
|
DevMsg(eDLL_T::SERVER, " |- UID : | '%s'\n", svClientName.c_str());
|
2022-06-14 20:56:55 +02:00
|
|
|
DevMsg(eDLL_T::SERVER, " |- OID : | '%llu'\n", nOriginID);
|
2022-04-02 02:48:54 +02:00
|
|
|
DevMsg(eDLL_T::SERVER, " |- ADR : | '%s'\n", svIpAddress.c_str());
|
|
|
|
DevMsg(eDLL_T::SERVER, " -------------------------------------------------------------\n");
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2022-05-20 11:52:19 +02:00
|
|
|
g_bIsPersistenceVarSet[clienthandle] = true;
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
2022-05-20 11:52:19 +02:00
|
|
|
return IVEngineServer__PersistenceAvailable(entidx, clienthandle);
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void IVEngineServer_Attach()
|
|
|
|
{
|
2022-03-26 00:24:13 +01:00
|
|
|
DetourAttach((LPVOID*)&IVEngineServer__PersistenceAvailable, &HIVEngineServer__PersistenceAvailable);
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void IVEngineServer_Detach()
|
|
|
|
{
|
2022-03-26 00:24:13 +01:00
|
|
|
DetourDetach((LPVOID*)&IVEngineServer__PersistenceAvailable, &HIVEngineServer__PersistenceAvailable);
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2022-01-05 22:56:49 +01:00
|
|
|
bool g_bIsPersistenceVarSet[MAX_PLAYERS];
|