engine: client: make RefAPI's R_GetConfigName optional

This commit is contained in:
Alibek Omarov
2026-02-05 08:17:59 +05:00
parent f01818a3f8
commit fa34092ba2
3 changed files with 16 additions and 7 deletions

View File

@@ -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 );
}

View File

@@ -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 )

View File

@@ -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 )