Move GlobalWin.DisableSecondaryThrottling to MainForm
This commit is contained in:
parent
f0843689ed
commit
6dfb0a8af8
|
@ -47,14 +47,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private readonly Func<bool> _getIsSecondaryThrottlingDisabled;
|
||||
|
||||
private readonly OSDManager _osdManager;
|
||||
|
||||
private Config GlobalConfig => GlobalWin.Config;
|
||||
|
||||
private IEmulator GlobalEmulator => GlobalWin.Emulator;
|
||||
|
||||
public DisplayManager(OSDManager osdManager, IGL gl, PresentationPanel presentationPanel)
|
||||
public DisplayManager(OSDManager osdManager, IGL gl, PresentationPanel presentationPanel, Func<bool> getIsSecondaryThrottlingDisabled)
|
||||
{
|
||||
_getIsSecondaryThrottlingDisabled = getIsSecondaryThrottlingDisabled;
|
||||
_osdManager = osdManager;
|
||||
GL = gl;
|
||||
|
||||
|
@ -934,7 +937,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
//this makes sense... but we don't have the infrastructure to support it now (we'd have to enable triple buffering or something like that)
|
||||
//so what we're gonna do is disable vsync no matter what if throttling is off, and maybe nobody will notice.
|
||||
//update 26-mar-2016: this upsets me. When fast-forwarding and skipping frames, vsync should still work. But I'm not changing it yet
|
||||
if (GlobalWin.DisableSecondaryThrottling)
|
||||
if (_getIsSecondaryThrottlingDisabled())
|
||||
vsync = false;
|
||||
|
||||
//for now, it's assumed that the presentation panel is the main window, but that may not always be true
|
||||
|
|
|
@ -28,11 +28,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public static int ExitCode;
|
||||
|
||||
/// <summary>
|
||||
/// Used to disable secondary throttling (e.g. vsync, audio) for unthrottled modes or when the primary (clock) throttle is taking over (e.g. during fast forward/rewind).
|
||||
/// </summary>
|
||||
public static bool DisableSecondaryThrottling { get; set; }
|
||||
|
||||
public static Dictionary<string, object> UserBag { get; set; } = new Dictionary<string, object>();
|
||||
|
||||
public static Config Config { get; set; }
|
||||
|
|
|
@ -340,7 +340,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
GraphicsControl = { MainWindow = true }
|
||||
};
|
||||
GlobalWin.DisplayManager = new DisplayManager(OSD, GlobalWin.GL, PresentationPanel);
|
||||
GlobalWin.DisplayManager = new DisplayManager(OSD, GlobalWin.GL, PresentationPanel, () => DisableSecondaryThrottling);
|
||||
Controls.Add(PresentationPanel);
|
||||
Controls.SetChildIndex(PresentationPanel, 0);
|
||||
|
||||
|
@ -793,6 +793,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
private bool IsTurboSeeking => PauseOnFrame.HasValue && Config.TurboSeek;
|
||||
public bool IsTurboing => InputManager.ClientControls["Turbo"] || IsTurboSeeking;
|
||||
|
||||
/// <summary>
|
||||
/// Used to disable secondary throttling (e.g. vsync, audio) for unthrottled modes or when the primary (clock) throttle is taking over (e.g. during fast forward/rewind).
|
||||
/// </summary>
|
||||
public static bool DisableSecondaryThrottling { get; set; }
|
||||
|
||||
public void AddOnScreenMessage(string message) => OSD.AddMessage(message);
|
||||
|
||||
public void ClearHolds()
|
||||
|
@ -2063,7 +2068,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
speedPercent = Math.Max(speedPercent / Rewinder.RewindFrequency, 5);
|
||||
}
|
||||
|
||||
GlobalWin.DisableSecondaryThrottling = _unthrottled || turbo || fastForward || rewind;
|
||||
DisableSecondaryThrottling = _unthrottled || turbo || fastForward || rewind;
|
||||
|
||||
// realtime throttle is never going to be so exact that using a double here is wrong
|
||||
_throttle.SetCoreFps(Emulator.VsyncRate());
|
||||
|
@ -3019,7 +3024,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
UpdateToolsAfter();
|
||||
}
|
||||
|
||||
Sound.UpdateSound(atten);
|
||||
Sound.UpdateSound(atten, DisableSecondaryThrottling);
|
||||
}
|
||||
|
||||
private void UpdateFpsDisplay(long currentTimestamp, bool isRewinding, bool isFastForwarding)
|
||||
|
|
|
@ -143,7 +143,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void UpdateSound(float atten)
|
||||
public void UpdateSound(float atten, bool isSecondaryThrottlingDisabled)
|
||||
{
|
||||
if (!GlobalWin.Config.SoundEnabled || !IsStarted || _bufferedProvider == null || _disposed)
|
||||
{
|
||||
|
@ -175,7 +175,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_outputProvider.BaseSoundProvider.GetSamplesSync(out samples, out sampleCount);
|
||||
sampleOffset = 0;
|
||||
|
||||
if (GlobalWin.DisableSecondaryThrottling && sampleCount > samplesNeeded)
|
||||
if (isSecondaryThrottlingDisabled && sampleCount > samplesNeeded)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
if (GlobalWin.DisableSecondaryThrottling) // This indicates rewind or fast-forward
|
||||
if (isSecondaryThrottlingDisabled) // This indicates rewind or fast-forward
|
||||
{
|
||||
_outputProvider.OnVolatility();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue