dont vsync when fastforwarding or unthrottling

This commit is contained in:
zeromus 2011-09-04 05:18:38 +00:00
parent 647cae698e
commit 60f2b411b6
3 changed files with 24 additions and 4 deletions

View File

@ -31,6 +31,11 @@ namespace BizHawk.MultiClient
public static AutofireController AutofireGBControls;
public static AutofireController AutofireGenControls;
/// <summary>
/// whether vsync is force-disabled by use of fast forward
/// </summary>
public static bool ForceNoVsync;
//the movie will be spliced inbetween these if it is present
public static CopyControllerAdapter MovieInputSourceAdapter = new CopyControllerAdapter();
public static CopyControllerAdapter MovieOutputHardpoint = new CopyControllerAdapter();

View File

@ -291,8 +291,11 @@ namespace BizHawk.MultiClient
void SyncThrottle()
{
bool fastforward = Global.ClientControls["Fast Forward"];
Global.ForceNoVsync = unthrottled || fastforward;
throttle.signal_unthrottle = unthrottled;
if (Global.ClientControls["Fast Forward"])
if (fastforward)
throttle.SetSpeedPercent(Global.Config.SpeedPercentAlternate);
else
throttle.SetSpeedPercent(Global.Config.SpeedPercent);

View File

@ -158,6 +158,8 @@ namespace BizHawk.MultiClient
private Sprite Sprite;
private Font MessageFont;
private Font AlertFont;
private bool Vsync;
public Direct3DRenderPanel(Direct3D direct3D, Control control)
{
@ -202,15 +204,25 @@ namespace BizHawk.MultiClient
}
}
private bool VsyncRequested
{
get
{
if (Global.ForceNoVsync) return false;
return Global.Config.DisplayVSync;
}
}
public void CreateDevice()
{
DestroyDevice();
Vsync = VsyncRequested;
var pp = new PresentParameters
{
BackBufferWidth = Math.Max(1, backingControl.ClientSize.Width),
BackBufferHeight = Math.Max(1, backingControl.ClientSize.Height),
DeviceWindowHandle = backingControl.Handle,
PresentationInterval = Global.Config.DisplayVSync ? PresentInterval.One : PresentInterval.Immediate
PresentationInterval = Vsync ? PresentInterval.One : PresentInterval.Immediate
};
var flags = CreateFlags.SoftwareVertexProcessing;
@ -229,7 +241,7 @@ namespace BizHawk.MultiClient
public void Render()
{
if (Device == null || Resized)
if (Device == null || Resized || Vsync != VsyncRequested)
CreateDevice();
Resized = false;
@ -268,7 +280,7 @@ namespace BizHawk.MultiClient
return;
}
if (Device == null || Resized)
if (Device == null || Resized || Vsync != VsyncRequested)
CreateDevice();
Resized = false;