mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
Try to recover to gl_mode 4 if the choosen mode could not be set.
This is just another hack to help stupid (mostly Ubuntu) users and imo completly unnecessary.
This commit is contained in:
parent
2320693f6a
commit
8a5dde5372
1 changed files with 26 additions and 3 deletions
|
@ -142,6 +142,7 @@ UpdateHardwareGamma(void)
|
|||
*/
|
||||
static qboolean GLimp_InitGraphics( qboolean fullscreen )
|
||||
{
|
||||
int counter = 0;
|
||||
int flags;
|
||||
int stencil_bits;
|
||||
|
||||
|
@ -192,10 +193,32 @@ static qboolean GLimp_InitGraphics( qboolean fullscreen )
|
|||
/* Set the icon */
|
||||
SetSDLIcon();
|
||||
|
||||
if ((surface = SDL_SetVideoMode(vid.width, vid.height, 0, flags)) == NULL)
|
||||
while (1)
|
||||
{
|
||||
Sys_Error("(SDLGL) SDL SetVideoMode failed: %s\n", SDL_GetError());
|
||||
return false;
|
||||
if ((surface = SDL_SetVideoMode(vid.width, vid.height, 0, flags)) == NULL)
|
||||
{
|
||||
if (counter == 1)
|
||||
{
|
||||
Sys_Error(PRINT_ALL, "Failed to revert to gl_mode 4. Exiting...\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
ri.Con_Printf(PRINT_ALL, "SDL SetVideoMode failed: %s\n", SDL_GetError());
|
||||
ri.Con_Printf(PRINT_ALL, "Reverting to gl_mode 4 (640x480) and windowed mode.\n");
|
||||
|
||||
/* Try to recover */
|
||||
ri.Cvar_SetValue("gl_mode", 4);
|
||||
ri.Cvar_SetValue("vid_fullscreen", 0);
|
||||
vid.width = 640;
|
||||
vid.height = 480;
|
||||
|
||||
counter++;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize the stencil buffer */
|
||||
|
|
Loading…
Reference in a new issue