From fa34092ba23f0dc3dc3c3079932afc14368d20e2 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 5 Feb 2026 08:17:59 +0500 Subject: [PATCH] engine: client: make RefAPI's R_GetConfigName optional --- engine/client/ref_common.c | 13 +++++++++---- engine/common/con_utils.c | 9 +++++++-- engine/server/sv_frame.c | 1 - 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/engine/client/ref_common.c b/engine/client/ref_common.c index 7fc5e441..122807e9 100644 --- a/engine/client/ref_common.c +++ b/engine/client/ref_common.c @@ -315,10 +315,15 @@ static screenfade_t *pfnRefGetScreenFade( void ) static qboolean R_Init_Video_( ref_graphic_apis_t type ) { - host.apply_opengl_config = true; - Cbuf_AddTextf( "exec %s.cfg\n", ref.dllFuncs.R_GetConfigName()); - Cbuf_Execute(); - host.apply_opengl_config = false; + const char *config_name = ref.dllFuncs.R_GetConfigName ? ref.dllFuncs.R_GetConfigName() : NULL; + + if( config_name ) + { + host.apply_opengl_config = true; + Cbuf_AddTextf( "exec %s.cfg\n", config_name ); + Cbuf_Execute(); + host.apply_opengl_config = false; + } return R_Init_Video( type ); } diff --git a/engine/common/con_utils.c b/engine/common/con_utils.c index 7012a82a..e24513f0 100644 --- a/engine/common/con_utils.c +++ b/engine/common/con_utils.c @@ -1542,14 +1542,19 @@ save opengl variables into opengl.cfg */ void Host_WriteOpenGLConfig( void ) { + const char *config_name; string name; file_t *f; - if( Sys_CheckParm( "-nowriteconfig" ) ) + if( Sys_CheckParm( "-nowriteconfig" ) || !ref.dllFuncs.R_GetConfigName ) return; - Q_snprintf( name, sizeof( name ), "%s.cfg", ref.dllFuncs.R_GetConfigName() ); + config_name = ref.dllFuncs.R_GetConfigName(); + if( !config_name ) + return; + + Q_snprintf( name, sizeof( name ), "%s.cfg", config_name ); f = FS_Open( va( "%s.new", name ), "w", false ); if( f ) diff --git a/engine/server/sv_frame.c b/engine/server/sv_frame.c index fd71183d..89c8ce53 100644 --- a/engine/server/sv_frame.c +++ b/engine/server/sv_frame.c @@ -821,7 +821,6 @@ void SV_SendClientMessages( void ) { sv_client_t *cl; int i; - double updaterate_time; double time_until_next_message; if( sv.state == ss_dead )