From 607e62a1ae95ec8a923919998a8e101009410fc4 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 17 Dec 2023 17:30:18 +0300 Subject: [PATCH] engine: client: sanitize legacy protocol supported engine features flags Do not enable what can't be enabled in current protocol. --- engine/client/cl_parse.c | 2 +- engine/common/protocol.h | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index f19de6e0..1fb73748 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -904,7 +904,7 @@ void CL_ParseServerData( sizebuf_t *msg, qboolean legacy ) background = MSG_ReadOneBit( msg ); Q_strncpy( gamefolder, MSG_ReadString( msg ), sizeof( gamefolder )); host.features = (uint)MSG_ReadLong( msg ); - host.features &= ENGINE_FEATURES_MASK; + host.features &= legacy ? ENGINE_LEGACY_FEATURES_MASK : ENGINE_FEATURES_MASK; if( !legacy ) { diff --git a/engine/common/protocol.h b/engine/common/protocol.h index 868ebbea..4cd64bad 100644 --- a/engine/common/protocol.h +++ b/engine/common/protocol.h @@ -305,6 +305,14 @@ extern const char *clc_strings[clc_lastmsg+1]; #define MAX_LEGACY_EDICTS (1 << MAX_LEGACY_ENTITY_BITS) // 4096 edicts #define MIN_LEGACY_EDICTS 30 +// legacy engine features that can be implemented through currently supported features +#define ENGINE_LEGACY_FEATURES_MASK \ + ( ENGINE_WRITE_LARGE_COORD \ + | ENGINE_LOAD_DELUXEDATA \ + | ENGINE_LARGE_LIGHTMAPS \ + | ENGINE_COMPENSATE_QUAKE_BUG \ + | ENGINE_COMPUTE_STUDIO_LERP ) + // Master Server protocol #define MS_SCAN_REQUEST "1\xFF" "0.0.0.0:0\0" // TODO: implement IP filter