Win32 - Fix crash on failure to toggle to fullscreen.
This commit is contained in:
parent
03bb053a7f
commit
2a57a4287a
|
@ -234,6 +234,7 @@ int SetVideoMode(int fs)
|
||||||
PaletteChanged=1;
|
PaletteChanged=1;
|
||||||
|
|
||||||
ResetVideo();
|
ResetVideo();
|
||||||
|
fullscreen=fs;
|
||||||
|
|
||||||
if(!InitializeDDraw(fs)) return(1); // DirectDraw not initialized
|
if(!InitializeDDraw(fs)) return(1); // DirectDraw not initialized
|
||||||
|
|
||||||
|
@ -410,6 +411,7 @@ int SetVideoMode(int fs)
|
||||||
ShowDDErr("Error getting attached surface.");
|
ShowDDErr("Error getting attached surface.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
// FIXME: The back buffer isn't cleared properly, causing massive flickering.
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!GetBPP())
|
if(!GetBPP())
|
||||||
|
@ -479,6 +481,8 @@ static void BlitScreenWindow(unsigned char *XBuf)
|
||||||
RECT drect;
|
RECT drect;
|
||||||
int specialmul;
|
int specialmul;
|
||||||
|
|
||||||
|
if (!lpDDSBack) return;
|
||||||
|
|
||||||
if(winspecial == 2 || winspecial == 1)
|
if(winspecial == 2 || winspecial == 1)
|
||||||
specialmul = 2;
|
specialmul = 2;
|
||||||
else if(winspecial == 4 || winspecial == 3)
|
else if(winspecial == 4 || winspecial == 3)
|
||||||
|
@ -547,12 +551,13 @@ static void BlitScreenFull(uint8 *XBuf)
|
||||||
else
|
else
|
||||||
specmul = 1;
|
specmul = 1;
|
||||||
|
|
||||||
|
|
||||||
if(fssync==3)
|
if(fssync==3)
|
||||||
lpDDSVPrimary=lpDDSDBack;
|
lpDDSVPrimary=lpDDSDBack;
|
||||||
else
|
else
|
||||||
lpDDSVPrimary=lpDDSPrimary;
|
lpDDSVPrimary=lpDDSPrimary;
|
||||||
|
|
||||||
|
if (!lpDDSVPrimary) return;
|
||||||
|
|
||||||
if(PaletteChanged==1)
|
if(PaletteChanged==1)
|
||||||
{
|
{
|
||||||
if(bpp>=16)
|
if(bpp>=16)
|
||||||
|
|
|
@ -975,8 +975,10 @@ static void ToggleFullscreen(void)
|
||||||
|
|
||||||
UpdateCheckedMenuItems();
|
UpdateCheckedMenuItems();
|
||||||
changerecursive=1;
|
changerecursive=1;
|
||||||
if(!SetVideoMode(fullscreen^1))
|
|
||||||
SetVideoMode(fullscreen);
|
int oldmode = fullscreen;
|
||||||
|
if(!SetVideoMode(oldmode ^1))
|
||||||
|
SetVideoMode(oldmode);
|
||||||
changerecursive=0;
|
changerecursive=0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
Loading…
Reference in New Issue