diff options
-rw-r--r-- | code/client/cl_main.c | 2 | ||||
-rw-r--r-- | code/sdl/sdl_glimp.c | 36 | ||||
-rw-r--r-- | code/sys/sys_local.h | 1 | ||||
-rw-r--r-- | code/sys/sys_unix.c | 12 | ||||
-rw-r--r-- | code/sys/sys_win32.c | 19 |
5 files changed, 53 insertions, 17 deletions
diff --git a/code/client/cl_main.c b/code/client/cl_main.c index 6856e73..860b7a6 100644 --- a/code/client/cl_main.c +++ b/code/client/cl_main.c @@ -2104,7 +2104,7 @@ void CL_CheckForResend( void ) { // The challenge request shall be followed by a client challenge so no malicious server can hijack this connection. Com_sprintf(data, sizeof(data), "getchallenge %d", clc.challenge); - NET_OutOfBandPrint(NS_CLIENT, clc.serverAddress, data); + NET_OutOfBandPrint(NS_CLIENT, clc.serverAddress, "%s", data); break; case CA_CHALLENGING: diff --git a/code/sdl/sdl_glimp.c b/code/sdl/sdl_glimp.c index 0b143d7..ba08ade 100644 --- a/code/sdl/sdl_glimp.c +++ b/code/sdl/sdl_glimp.c @@ -665,31 +665,35 @@ of OpenGL */ void GLimp_Init( void ) { - qboolean success = qtrue; - r_allowSoftwareGL = ri.Cvar_Get( "r_allowSoftwareGL", "0", CVAR_LATCH ); r_sdlDriver = ri.Cvar_Get( "r_sdlDriver", "", CVAR_ROM ); Sys_GLimpInit( ); - // create the window and set up the context - if( !GLimp_StartDriverAndSetMode( r_mode->integer, r_fullscreen->integer ) ) + // Create the window and set up the context + if( GLimp_StartDriverAndSetMode( r_mode->integer, r_fullscreen->integer ) ) + goto success; + + // Try again, this time in a platform specific "safe mode" + Sys_GLimpSafeInit( ); + + if( GLimp_StartDriverAndSetMode( r_mode->integer, r_fullscreen->integer ) ) + goto success; + + // Finally, try the default screen resolution + if( r_mode->integer != R_MODE_FALLBACK ) { - if( r_mode->integer != R_MODE_FALLBACK ) - { - ri.Printf( PRINT_ALL, "Setting r_mode %d failed, falling back on r_mode %d\n", - r_mode->integer, R_MODE_FALLBACK ); - ri.Cvar_Set("r_ext_multisample", "0"); - if( !GLimp_StartDriverAndSetMode( R_MODE_FALLBACK, r_fullscreen->integer ) ) - success = qfalse; - } - else - success = qfalse; + ri.Printf( PRINT_ALL, "Setting r_mode %d failed, falling back on r_mode %d\n", + r_mode->integer, R_MODE_FALLBACK ); + + if( GLimp_StartDriverAndSetMode( R_MODE_FALLBACK, r_fullscreen->integer ) ) + goto success; } - if( !success ) - ri.Error( ERR_FATAL, "GLimp_Init() - could not load OpenGL subsystem\n" ); + // Nothing worked, give up + ri.Error( ERR_FATAL, "GLimp_Init() - could not load OpenGL subsystem\n" ); +success: // This values force the UI to disable driver selection glConfig.driverType = GLDRV_ICD; glConfig.hardwareType = GLHW_GENERIC; diff --git a/code/sys/sys_local.h b/code/sys/sys_local.h index a114c79..6174876 100644 --- a/code/sys/sys_local.h +++ b/code/sys/sys_local.h @@ -48,6 +48,7 @@ unsigned int CON_LogRead( char *out, unsigned int outSize ); char *Sys_StripAppBundle( char *pwd ); #endif +void Sys_GLimpSafeInit( void ); void Sys_GLimpInit( void ); void Sys_PlatformInit( void ); void Sys_SigHandler( int signal ); diff --git a/code/sys/sys_unix.c b/code/sys/sys_unix.c index c05fda5..c10a6b2 100644 --- a/code/sys/sys_unix.c +++ b/code/sys/sys_unix.c @@ -518,6 +518,18 @@ void Sys_ErrorDialog( const char *error ) /* ============== +Sys_GLimpSafeInit + +Unix specific "safe" GL implementation initialisation +============== +*/ +void Sys_GLimpSafeInit( void ) +{ + // NOP +} + +/* +============== Sys_GLimpInit Unix specific GL implementation initialisation diff --git a/code/sys/sys_win32.c b/code/sys/sys_win32.c index eeee856..b3d2167 100644 --- a/code/sys/sys_win32.c +++ b/code/sys/sys_win32.c @@ -583,6 +583,25 @@ static qboolean SDL_VIDEODRIVER_externallySet = qfalse; /* ============== +Sys_GLimpSafeInit + +Windows specific "safe" GL implementation initialisation +============== +*/ +void Sys_GLimpSafeInit( void ) +{ +#ifndef DEDICATED + if( !SDL_VIDEODRIVER_externallySet ) + { + // Here, we want to let SDL decide what do to unless + // explicitly requested otherwise + _putenv( "SDL_VIDEODRIVER=" ); + } +#endif +} + +/* +============== Sys_GLimpInit Windows specific GL implementation initialisation |