"Unthrottled" should be saved to config

This commit is contained in:
zeromus 2021-12-31 16:28:48 -05:00
parent 007442773a
commit 853b0fdd85
4 changed files with 11 additions and 11 deletions

View File

@ -155,7 +155,8 @@ namespace BizHawk.Client.Common
public int FrameSkip { get; set; } = 4; public int FrameSkip { get; set; } = 4;
public int SpeedPercent { get; set; } = 100; public int SpeedPercent { get; set; } = 100;
public int SpeedPercentAlternate { get; set; } = 400; 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 AutoMinimizeSkipping { get; set; } = true;
public bool VSyncThrottle { get; set; } = false; public bool VSyncThrottle { get; set; } = false;

View File

@ -815,7 +815,7 @@ namespace BizHawk.Client.EmuHawk
Speed400MenuItem.Enabled = Speed400MenuItem.Enabled =
Config.ClockThrottle; Config.ClockThrottle;
miUnthrottled.Checked = _unthrottled; miUnthrottled.Checked = Config.Unthrottled;
} }
private void KeyPriorityMenuItem_DropDownOpened(object sender, EventArgs e) private void KeyPriorityMenuItem_DropDownOpened(object sender, EventArgs e)
@ -1047,7 +1047,7 @@ namespace BizHawk.Client.EmuHawk
private void UnthrottledMenuItem_Click(object sender, EventArgs e) private void UnthrottledMenuItem_Click(object sender, EventArgs e)
{ {
_unthrottled ^= true; Config.Unthrottled ^= true;
ThrottleMessage(); ThrottleMessage();
} }

View File

@ -24,7 +24,7 @@ namespace BizHawk.Client.EmuHawk
FrameInch = true; FrameInch = true;
return false; return false;
case "Toggle Throttle": case "Toggle Throttle":
_unthrottled ^= true; Config.Unthrottled ^= true;
ThrottleMessage(); ThrottleMessage();
break; break;
case "Soft Reset": case "Soft Reset":

View File

@ -1374,12 +1374,12 @@ namespace BizHawk.Client.EmuHawk
public void Unthrottle() public void Unthrottle()
{ {
_unthrottled = true; Config.Unthrottled = true;
} }
public void Throttle() public void Throttle()
{ {
_unthrottled = false; Config.Unthrottled = false;
} }
private void ThrottleMessage() private void ThrottleMessage()
@ -1400,7 +1400,7 @@ namespace BizHawk.Client.EmuHawk
type = ":Clock"; type = ":Clock";
} }
string throttled = _unthrottled ? "Unthrottled" : "Throttled"; string throttled = Config.Unthrottled ? "Unthrottled" : "Throttled";
string msg = $"{throttled}{type} "; string msg = $"{throttled}{type} ";
AddOnScreenMessage(msg); AddOnScreenMessage(msg);
@ -1617,7 +1617,6 @@ namespace BizHawk.Client.EmuHawk
public int GetApproxFramerate() => _lastFpsRounded; public int GetApproxFramerate() => _lastFpsRounded;
private readonly Throttle _throttle; private readonly Throttle _throttle;
private bool _unthrottled;
// For handling automatic pausing when entering the menu // For handling automatic pausing when entering the menu
private bool _wasPaused; private bool _wasPaused;
@ -2201,12 +2200,12 @@ namespace BizHawk.Client.EmuHawk
speedPercent = Math.Max(speedPercent / Rewinder.RewindFrequency, 5); 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 // realtime throttle is never going to be so exact that using a double here is wrong
_throttle.SetCoreFps(Emulator.VsyncRate()); _throttle.SetCoreFps(Emulator.VsyncRate());
_throttle.signal_paused = EmulatorPaused; _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 // 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); _throttle.signal_overrideSecondaryThrottle = (fastForward || rewind) && (Config.SoundThrottle || Config.VSyncThrottle || Config.VSync);
@ -3034,7 +3033,7 @@ namespace BizHawk.Client.EmuHawk
if ((runFrame || force) && !BlockFrameAdvance) if ((runFrame || force) && !BlockFrameAdvance)
{ {
var isFastForwarding = InputManager.ClientControls["Fast Forward"] || IsTurboing || InvisibleEmulation; var isFastForwarding = InputManager.ClientControls["Fast Forward"] || IsTurboing || InvisibleEmulation;
var isFastForwardingOrRewinding = isFastForwarding || isRewinding || _unthrottled; var isFastForwardingOrRewinding = isFastForwarding || isRewinding || Config.Unthrottled;
if (isFastForwardingOrRewinding != _lastFastForwardingOrRewinding) if (isFastForwardingOrRewinding != _lastFastForwardingOrRewinding)
{ {