mirror of
https://github.com/blendogames/thirtyflightsofloving.git
synced 2025-01-18 06:22:30 +00:00
Fall back to using r_mode when GetSystemMetrics() API calls fail in win32/vid_dll.c->VID_GetModeInfo().
Previous handling of API call failure could cause repeat returns of false, resulting in a fatal error.
This commit is contained in:
parent
d552aa1e48
commit
304e3e30c4
1 changed files with 7 additions and 8 deletions
|
@ -565,14 +565,13 @@ qboolean VID_GetModeInfo (int *width, int *height, int mode)
|
||||||
int dskWidth=0, dskHeight=0;
|
int dskWidth=0, dskHeight=0;
|
||||||
dskWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
|
dskWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
|
||||||
dskHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
|
dskHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
|
||||||
// Check for API call failure
|
// Check that API call succeeded
|
||||||
if ( (dskWidth == 0) || (dskHeight == 0) )
|
if ( (dskWidth > 0) && (dskHeight > 0) ) {
|
||||||
return false;
|
*width = dskWidth;
|
||||||
|
*height = dskHeight;
|
||||||
*width = dskWidth;
|
return true;
|
||||||
*height = dskHeight;
|
}
|
||||||
|
// Fall back to r_mode if the above fails
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == -1) // custom mode
|
if (mode == -1) // custom mode
|
||||||
|
|
Loading…
Reference in a new issue