From 4775d98b2b2016970115b5283c66f422cd4a4be5 Mon Sep 17 00:00:00 2001 From: VReaperV Date: Wed, 13 Aug 2025 18:37:17 +0300 Subject: [PATCH] NUKE glconfig_t, use WindowConfig instead Move the stuff actually used by cgame (window and display sizes and display aspect) to `WindowConfig`. --- src/engine/client/cg_msgdef.h | 4 ++-- src/engine/client/cl_cgame.cpp | 20 ++------------------ src/engine/renderer/tr_public.h | 10 ++-------- src/engine/renderer/tr_types.h | 21 ++------------------- 4 files changed, 8 insertions(+), 47 deletions(-) diff --git a/src/engine/client/cg_msgdef.h b/src/engine/client/cg_msgdef.h index 9918f5b3d3..14978a68fc 100644 --- a/src/engine/client/cg_msgdef.h +++ b/src/engine/client/cg_msgdef.h @@ -510,7 +510,7 @@ using CGameStaticInitMsg = IPC::SyncMessage< IPC::Message, int> >; using CGameInitMsg = IPC::SyncMessage< - IPC::Message, int, int, glconfig_t, GameStateCSs> + IPC::Message, int, int, WindowConfig, GameStateCSs> >; using CGameShutdownMsg = IPC::SyncMessage< IPC::Message> @@ -540,7 +540,7 @@ using CGameFocusEventMsg = IPC::SyncMessage< //TODO Check all rocket calls using CGameRocketInitMsg = IPC::SyncMessage< - IPC::Message, glconfig_t> + IPC::Message, WindowConfig> >; using CGameRocketFrameMsg = IPC::SyncMessage< IPC::Message, cgClientState_t> diff --git a/src/engine/client/cl_cgame.cpp b/src/engine/client/cl_cgame.cpp index 8075da1443..fac9c4a758 100644 --- a/src/engine/client/cl_cgame.cpp +++ b/src/engine/client/cl_cgame.cpp @@ -956,15 +956,7 @@ void CGameVM::CGameStaticInit() void CGameVM::CGameInit(int serverMessageNum, int clientNum) { - glconfig_t glConfig; - memset( &glConfig, 0, sizeof( glconfig_t ) ); - glConfig.displayAspect = cls.windowConfig.displayAspect; - glConfig.displayWidth = cls.windowConfig.displayWidth; - glConfig.displayHeight = cls.windowConfig.displayHeight; - glConfig.vidWidth = cls.windowConfig.vidWidth; - glConfig.vidHeight = cls.windowConfig.vidHeight; - - this->SendMsg(serverMessageNum, clientNum, glConfig, cl.gameState); + this->SendMsg(serverMessageNum, clientNum, cls.windowConfig, cl.gameState); NetcodeTable psTable; size_t psSize; this->SendMsg(psTable, psSize); @@ -1028,15 +1020,7 @@ void CGameVM::CGameTextInputEvent(int c) void CGameVM::CGameRocketInit() { - glconfig_t glConfig; - memset( &glConfig, 0, sizeof( glconfig_t ) ); - glConfig.displayAspect = cls.windowConfig.displayAspect; - glConfig.displayWidth = cls.windowConfig.displayWidth; - glConfig.displayHeight = cls.windowConfig.displayHeight; - glConfig.vidWidth = cls.windowConfig.vidWidth; - glConfig.vidHeight = cls.windowConfig.vidHeight; - - this->SendMsg( glConfig ); + this->SendMsg( cls.windowConfig ); } void CGameVM::CGameRocketFrame() diff --git a/src/engine/renderer/tr_public.h b/src/engine/renderer/tr_public.h index 1e15d3d9ff..63a79c7f33 100644 --- a/src/engine/renderer/tr_public.h +++ b/src/engine/renderer/tr_public.h @@ -170,12 +170,6 @@ struct GLConfig bool motionBlur; }; -struct WindowConfig { - float displayAspect; - int displayWidth, displayHeight; // the entire monitor (the one indicated by displayIndex) - int vidWidth, vidHeight; // what the game is using -}; - // // these are the functions exported by the refresh module // @@ -192,8 +186,8 @@ struct refexport_t // if necessary. // // BeginRegistration makes any existing media pointers invalid - // and returns the current gl configuration, including screen width - // and height, which can be used by the client to intelligently + // and returns the current window configuration, including screen and display width + // and height, and aspect ratio, which can be used by the client to intelligently // size display elements. Returns false if the renderer couldn't // be initialized. bool( *BeginRegistration )( WindowConfig* windowCfg ); diff --git a/src/engine/renderer/tr_types.h b/src/engine/renderer/tr_types.h index 6438b125a4..deedd1381a 100644 --- a/src/engine/renderer/tr_types.h +++ b/src/engine/renderer/tr_types.h @@ -273,30 +273,13 @@ enum class glHardwareType_t /** * Contains variables specific to the OpenGL configuration - * being run right now. These are constant once the OpenGL + * being run right now. These are constant once the OpenGL * subsystem is initialized. */ -struct glconfig_t -{ - char renderer_string[ MAX_STRING_CHARS ]; - char vendor_string[ MAX_STRING_CHARS ]; - char version_string[ MAX_STRING_CHARS ]; - - int maxTextureSize; // queried from GL - - int colorBits; - - glDriverType_t driverType; - glHardwareType_t hardwareType; - - textureCompression_t textureCompression; - - int displayIndex; +struct WindowConfig { float displayAspect; int displayWidth, displayHeight; // the entire monitor (the one indicated by displayIndex) int vidWidth, vidHeight; // what the game is using - - bool8_t smpActive; // dual processor }; #pragma pop_macro("bool")