From 853b0fdd85ebf9d82184ebf80d63707d2f16d568 Mon Sep 17 00:00:00 2001 From: zeromus Date: Fri, 31 Dec 2021 16:28:48 -0500 Subject: [PATCH] "Unthrottled" should be saved to config --- src/BizHawk.Client.Common/config/Config.cs | 3 ++- src/BizHawk.Client.EmuHawk/MainForm.Events.cs | 4 ++-- src/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs | 2 +- src/BizHawk.Client.EmuHawk/MainForm.cs | 13 ++++++------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/BizHawk.Client.Common/config/Config.cs b/src/BizHawk.Client.Common/config/Config.cs index 783ad76fb9..694799910b 100644 --- a/src/BizHawk.Client.Common/config/Config.cs +++ b/src/BizHawk.Client.Common/config/Config.cs @@ -155,7 +155,8 @@ namespace BizHawk.Client.Common public int FrameSkip { get; set; } = 4; public int SpeedPercent { get; set; } = 100; public int SpeedPercentAlternate { get; set; } = 400; - public bool ClockThrottle { get; set; }= true; + public bool ClockThrottle { get; set; } = true; + public bool Unthrottled { get; set; } = false; public bool AutoMinimizeSkipping { get; set; } = true; public bool VSyncThrottle { get; set; } = false; diff --git a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs index d836b90f0e..633f032423 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -815,7 +815,7 @@ namespace BizHawk.Client.EmuHawk Speed400MenuItem.Enabled = Config.ClockThrottle; - miUnthrottled.Checked = _unthrottled; + miUnthrottled.Checked = Config.Unthrottled; } private void KeyPriorityMenuItem_DropDownOpened(object sender, EventArgs e) @@ -1047,7 +1047,7 @@ namespace BizHawk.Client.EmuHawk private void UnthrottledMenuItem_Click(object sender, EventArgs e) { - _unthrottled ^= true; + Config.Unthrottled ^= true; ThrottleMessage(); } diff --git a/src/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs b/src/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs index d4e553481b..05c00e6e44 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs @@ -24,7 +24,7 @@ namespace BizHawk.Client.EmuHawk FrameInch = true; return false; case "Toggle Throttle": - _unthrottled ^= true; + Config.Unthrottled ^= true; ThrottleMessage(); break; case "Soft Reset": diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index ec561e9510..b280ffd54b 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -1374,12 +1374,12 @@ namespace BizHawk.Client.EmuHawk public void Unthrottle() { - _unthrottled = true; + Config.Unthrottled = true; } public void Throttle() { - _unthrottled = false; + Config.Unthrottled = false; } private void ThrottleMessage() @@ -1400,7 +1400,7 @@ namespace BizHawk.Client.EmuHawk type = ":Clock"; } - string throttled = _unthrottled ? "Unthrottled" : "Throttled"; + string throttled = Config.Unthrottled ? "Unthrottled" : "Throttled"; string msg = $"{throttled}{type} "; AddOnScreenMessage(msg); @@ -1617,7 +1617,6 @@ namespace BizHawk.Client.EmuHawk public int GetApproxFramerate() => _lastFpsRounded; private readonly Throttle _throttle; - private bool _unthrottled; // For handling automatic pausing when entering the menu private bool _wasPaused; @@ -2201,12 +2200,12 @@ namespace BizHawk.Client.EmuHawk speedPercent = Math.Max(speedPercent / Rewinder.RewindFrequency, 5); } - DisableSecondaryThrottling = _unthrottled || turbo || fastForward || rewind; + DisableSecondaryThrottling = Config.Unthrottled || turbo || fastForward || rewind; // realtime throttle is never going to be so exact that using a double here is wrong _throttle.SetCoreFps(Emulator.VsyncRate()); _throttle.signal_paused = EmulatorPaused; - _throttle.signal_unthrottle = _unthrottled || turbo; + _throttle.signal_unthrottle = Config.Unthrottled || turbo; // zero 26-mar-2016 - vsync and vsync throttle here both is odd, but see comments elsewhere about triple buffering _throttle.signal_overrideSecondaryThrottle = (fastForward || rewind) && (Config.SoundThrottle || Config.VSyncThrottle || Config.VSync); @@ -3034,7 +3033,7 @@ namespace BizHawk.Client.EmuHawk if ((runFrame || force) && !BlockFrameAdvance) { var isFastForwarding = InputManager.ClientControls["Fast Forward"] || IsTurboing || InvisibleEmulation; - var isFastForwardingOrRewinding = isFastForwarding || isRewinding || _unthrottled; + var isFastForwardingOrRewinding = isFastForwarding || isRewinding || Config.Unthrottled; if (isFastForwardingOrRewinding != _lastFastForwardingOrRewinding) {