fix displaymanager crashes when rebooting snes9x (and maybe others) while paused (due to unset virtualsize).
This commit is contained in:
parent
b5db09dea9
commit
94e2fe2a10
|
@ -722,6 +722,16 @@ namespace BizHawk.Client.EmuHawk
|
||||||
return filterProgram;
|
return filterProgram;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Blank()
|
||||||
|
{
|
||||||
|
GL.BeginScene();
|
||||||
|
GL.BindRenderTarget(null);
|
||||||
|
GL.SetClearColor(Color.Black);
|
||||||
|
GL.Clear(OpenTK.Graphics.OpenGL.ClearBufferMask.ColorBufferBit);
|
||||||
|
GL.EndScene();
|
||||||
|
presentationPanel.GraphicsControl.SwapBuffers();
|
||||||
|
}
|
||||||
|
|
||||||
void UpdateSourceDrawingWork(JobInfo job)
|
void UpdateSourceDrawingWork(JobInfo job)
|
||||||
{
|
{
|
||||||
bool vsync = false;
|
bool vsync = false;
|
||||||
|
|
|
@ -1970,14 +1970,32 @@ namespace BizHawk.Client.EmuHawk
|
||||||
var video = _currentVideoProvider;
|
var video = _currentVideoProvider;
|
||||||
Size currVideoSize = new Size(video.BufferWidth, video.BufferHeight);
|
Size currVideoSize = new Size(video.BufferWidth, video.BufferHeight);
|
||||||
Size currVirtualSize = new Size(video.VirtualWidth, video.VirtualHeight);
|
Size currVirtualSize = new Size(video.VirtualWidth, video.VirtualHeight);
|
||||||
|
|
||||||
|
bool resizeFramebuffer = false;
|
||||||
if (currVideoSize != _lastVideoSize || currVirtualSize != _lastVirtualSize)
|
if (currVideoSize != _lastVideoSize || currVirtualSize != _lastVirtualSize)
|
||||||
|
resizeFramebuffer = true;
|
||||||
|
|
||||||
|
bool isZero = false;
|
||||||
|
if (currVideoSize.Width == 0 || currVideoSize.Height == 0 || currVirtualSize.Width == 0 || currVirtualSize.Height == 0)
|
||||||
|
isZero = true;
|
||||||
|
|
||||||
|
//don't resize if the new size is 0 somehow; we'll wait until we have a sensible size
|
||||||
|
if(isZero)
|
||||||
|
resizeFramebuffer = false;
|
||||||
|
|
||||||
|
if(resizeFramebuffer)
|
||||||
{
|
{
|
||||||
_lastVideoSize = currVideoSize;
|
_lastVideoSize = currVideoSize;
|
||||||
_lastVirtualSize = currVirtualSize;
|
_lastVirtualSize = currVirtualSize;
|
||||||
FrameBufferResized();
|
FrameBufferResized();
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalWin.DisplayManager.UpdateSource(video);
|
//rendering flakes out egregiously if we have a zero size
|
||||||
|
//can we fix it later not to?
|
||||||
|
if(isZero)
|
||||||
|
GlobalWin.DisplayManager.Blank();
|
||||||
|
else
|
||||||
|
GlobalWin.DisplayManager.UpdateSource(video);
|
||||||
}
|
}
|
||||||
|
|
||||||
// sends a simulation of a plain alt key keystroke
|
// sends a simulation of a plain alt key keystroke
|
||||||
|
@ -3627,6 +3645,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
UpdateDumpIcon();
|
UpdateDumpIcon();
|
||||||
SetMainformMovieInfo();
|
SetMainformMovieInfo();
|
||||||
CurrentlyOpenRomArgs = args;
|
CurrentlyOpenRomArgs = args;
|
||||||
|
GlobalWin.DisplayManager.Blank();
|
||||||
|
|
||||||
Global.Rewinder.Initialize();
|
Global.Rewinder.Initialize();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue