diff --git a/rehlds/engine/net.h b/rehlds/engine/net.h index 9cb749e..3557f11 100644 --- a/rehlds/engine/net.h +++ b/rehlds/engine/net.h @@ -53,6 +53,9 @@ // the server sends this value back #define S2C_CHALLENGE 'A' // + challenge value +// Send a userid, client remote address, is this server secure and engine build number +#define S2C_CONNECTION 'B' + // HLMaster rejected a server's connection because the server needs to be updated #define M2S_REQUESTRESTART 'O' diff --git a/rehlds/engine/server.h b/rehlds/engine/server.h index c0c3503..6d0eb02 100644 --- a/rehlds/engine/server.h +++ b/rehlds/engine/server.h @@ -730,6 +730,7 @@ void SV_EmitPings(client_t *client, sizebuf_t *msg); void SV_WriteEntitiesToClient(client_t *client, sizebuf_t *msg); void SV_CleanupEnts(void); qboolean SV_SendClientDatagram(client_t *client); +void SV_UpdateUserInfo(client_t *pClient); void SV_UpdateToReliableMessages(void); void SV_SkipUpdates(void); void SV_SendClientMessages(void); diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index 62717b1..4bd0cb2 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -2497,7 +2497,7 @@ void EXT_FUNC SV_ConnectClient_internal(void) #endif // REHLDS_FIXES bIsSecure = Steam_GSBSecure(); - Netchan_OutOfBandPrint(NS_SERVER, adr, "%c %i \"%s\" %i %i", 66, host_client->userid, NET_AdrToString(host_client->netchan.remote_address), bIsSecure, build_number()); + Netchan_OutOfBandPrint(NS_SERVER, adr, "%c %i \"%s\" %i %i", S2C_CONNECTION, host_client->userid, NET_AdrToString(host_client->netchan.remote_address), bIsSecure, build_number()); Log_Printf("\"%s<%i><%s><>\" connected, address \"%s\"\n", name, host_client->userid, SV_GetClientIDString(host_client), NET_AdrToString(host_client->netchan.remote_address)); #ifdef REHLDS_FIXES Q_strncpy(host_client->userinfo, userinfo, MAX_INFO_STRING - 1); @@ -4692,6 +4692,14 @@ qboolean SV_SendClientDatagram(client_t *client) return TRUE; } +void SV_UpdateUserInfo(client_t *pClient) +{ + pClient->sendinfo = FALSE; + pClient->sendinfo_time = realtime + 1.0; + SV_ExtractFromUserinfo(pClient); + SV_FullClientUpdate(pClient, &g_psv.reliable_datagram); +} + /* ../engine/sv_main.c:6062 */ void SV_UpdateToReliableMessages(void) { @@ -4715,10 +4723,7 @@ void SV_UpdateToReliableMessages(void) if (client->sendinfo && client->sendinfo_time <= realtime) #endif // REHLDS_FIXES { - client->sendinfo = FALSE; - client->sendinfo_time = realtime + 1.0; - SV_ExtractFromUserinfo(client); - SV_FullClientUpdate(client, &g_psv.reliable_datagram); + SV_UpdateUserInfo(client); } if (!client->fakeclient && (client->active || client->connected)) diff --git a/rehlds/public/rehlds/rehlds_api.h b/rehlds/public/rehlds/rehlds_api.h index 7923650..25decf3 100644 --- a/rehlds/public/rehlds/rehlds_api.h +++ b/rehlds/public/rehlds/rehlds_api.h @@ -35,7 +35,7 @@ #include "model.h" #define REHLDS_API_VERSION_MAJOR 2 -#define REHLDS_API_VERSION_MINOR 12 +#define REHLDS_API_VERSION_MINOR 13 //Steam_NotifyClientConnect hook typedef IHookChain IRehldsHook_Steam_NotifyClientConnect; @@ -280,6 +280,7 @@ struct RehldsFuncs_t { void(*Steam_NotifyClientDisconnect)(IGameClient* cl); void(*SV_StartSound)(int recipients, edict_t *entity, int channel, const char *sample, int volume, float attenuation, int flags, int pitch); bool(*SV_EmitSound2)(edict_t *entity, IGameClient *receiver, int channel, const char *sample, float volume, float attenuation, int flags, int pitch, int emitFlags, const float *pOrigin); + void (* SV_UpdateUserInfo)(IGameClient *pGameClient); }; class IRehldsApi { @@ -295,4 +296,4 @@ public: virtual IRehldsFlightRecorder* GetFlightRecorder() = 0; }; -#define VREHLDS_HLDS_API_VERSION "VREHLDS_HLDS_API_VERSION001" +#define VREHLDS_HLDS_API_VERSION "VREHLDS_HLDS_API_VERSION001" \ No newline at end of file diff --git a/rehlds/rehlds/rehlds_api_impl.cpp b/rehlds/rehlds/rehlds_api_impl.cpp index 7fe9a7f..312484f 100644 --- a/rehlds/rehlds/rehlds_api_impl.cpp +++ b/rehlds/rehlds/rehlds_api_impl.cpp @@ -133,6 +133,10 @@ void EXT_FUNC SV_StartSound_api(int recipients, edict_t *entity, int channel, co SV_StartSound(recipients, entity, channel, sample, volume, attenuation, flags, pitch); } +void EXT_FUNC SV_UpdateUserInfo_api(IGameClient *pGameClient) { + SV_UpdateUserInfo(pGameClient->GetClient()); +} + void* EXT_FUNC Rehlds_GetPluginApi(const char *name) { auto api = FindPluginApiByName(name); return api ? api->impl : NULL; @@ -200,7 +204,8 @@ RehldsFuncs_t g_RehldsApiFuncs = &Steam_NotifyClientConnect_api, &Steam_NotifyClientDisconnect_api, &SV_StartSound_api, - &SV_EmitSound2_api + &SV_EmitSound2_api, + &SV_UpdateUserInfo_api }; bool EXT_FUNC SV_EmitSound2_internal(edict_t *entity, IGameClient *pReceiver, int channel, const char *sample, float volume, float attenuation, int flags, int pitch, int emitFlags, const float *pOrigin)