diff --git a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs index 4ce48fb6c0..9cf8c50e74 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -2473,6 +2473,7 @@ namespace BizHawk.Client.EmuHawk } else if (result == DialogResult.No) { + UpdateChecker.GlobalConfig = Config; UpdateChecker.IgnoreNewVersion(); UpdateChecker.BeginCheck(skipCheck: true); // Trigger event to hide new version notification } diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index a90bf5e5f6..afa4237e96 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -151,6 +151,7 @@ namespace BizHawk.Client.EmuHawk this.BeginInvoke(() => { UpdateNotification.Visible = UpdateChecker.IsNewVersionAvailable; }); }; + UpdateChecker.GlobalConfig = Config; UpdateChecker.BeginCheck(); // Won't actually check unless enabled by user } @@ -2772,7 +2773,7 @@ namespace BizHawk.Client.EmuHawk _throttle.signal_frameAdvance = _runloopFrameAdvance; _throttle.signal_continuousFrameAdvancing = _runloopFrameProgress; - _throttle.Step(true, -1); + _throttle.Step(Config, Sound, allowSleep: true, forceFrameSkip: -1); } public void FrameAdvance() diff --git a/src/BizHawk.Client.EmuHawk/Throttle.cs b/src/BizHawk.Client.EmuHawk/Throttle.cs index 6a32202c31..aa8ae167d9 100644 --- a/src/BizHawk.Client.EmuHawk/Throttle.cs +++ b/src/BizHawk.Client.EmuHawk/Throttle.cs @@ -1,6 +1,8 @@ using System; using System.Diagnostics; using System.Threading; + +using BizHawk.Client.Common; using BizHawk.Common; //this throttle is nitsuja's fine-tuned techniques from desmume @@ -21,7 +23,7 @@ namespace BizHawk.Client.EmuHawk public bool signal_continuousFrameAdvancing; public bool signal_overrideSecondaryThrottle; - public void Step(bool allowSleep, int forceFrameSkip) + public void Step(Config config, Sound sound, bool allowSleep, int forceFrameSkip) { //TODO - figure out what allowSleep is supposed to be used for //TODO - figure out what forceFrameSkip is supposed to be used for @@ -61,7 +63,7 @@ namespace BizHawk.Client.EmuHawk else throw new InvalidOperationException(); #endif - int skipRate = (forceFrameSkip < 0) ? GlobalWin.Config.FrameSkip : forceFrameSkip; + int skipRate = (forceFrameSkip < 0) ? config.FrameSkip : forceFrameSkip; int ffSkipRate = (forceFrameSkip < 0) ? 3 : forceFrameSkip; if (lastSkipRate != skipRate) @@ -78,7 +80,7 @@ namespace BizHawk.Client.EmuHawk { //don't ever skip frames when continuous frame advancing. it's meant for precision work. //but we DO need to throttle - if (GlobalWin.Config.ClockThrottle) + if (config.ClockThrottle) extraThrottle = true; } else @@ -106,12 +108,12 @@ namespace BizHawk.Client.EmuHawk if (framesToSkip < 1) framesToSkip += ffSkipRate; } - else if ((extraThrottle || signal_paused || GlobalWin.Config.ClockThrottle || signal_overrideSecondaryThrottle) && allowSleep) + else if ((extraThrottle || signal_paused || config.ClockThrottle || signal_overrideSecondaryThrottle) && allowSleep) { - SpeedThrottle(signal_paused); + SpeedThrottle(sound, signal_paused); } - if (GlobalWin.Config.AutoMinimizeSkipping && GlobalWin.Config.FrameSkip != 0) + if (config.AutoMinimizeSkipping && config.FrameSkip != 0) { if (!signal_continuousFrameAdvancing) { @@ -304,7 +306,7 @@ namespace BizHawk.Client.EmuHawk return rv; } - void SpeedThrottle(bool paused) + void SpeedThrottle(Sound sound, bool paused) { AutoFrameSkip_BeforeThrottle(); @@ -320,7 +322,7 @@ namespace BizHawk.Client.EmuHawk if (elapsedTime >= timePerFrame) { - int maxMissedFrames = (int)Math.Ceiling((GlobalWin.Sound.SoundMaxBufferDeficitMs / 1000.0) / ((double)timePerFrame / afsfreq)); + int maxMissedFrames = (int)Math.Ceiling((sound.SoundMaxBufferDeficitMs / 1000.0) / ((double)timePerFrame / afsfreq)); if (maxMissedFrames < 3) maxMissedFrames = 3; diff --git a/src/BizHawk.Client.EmuHawk/UpdateChecker.cs b/src/BizHawk.Client.EmuHawk/UpdateChecker.cs index ca4193460b..6ab1d0e36f 100644 --- a/src/BizHawk.Client.EmuHawk/UpdateChecker.cs +++ b/src/BizHawk.Client.EmuHawk/UpdateChecker.cs @@ -3,6 +3,8 @@ using System.IO; using System.Net; using System.Threading; +using BizHawk.Client.Common; + using Newtonsoft.Json.Linq; namespace BizHawk.Client.EmuHawk @@ -12,28 +14,30 @@ namespace BizHawk.Client.EmuHawk private static readonly string _latestVersionInfoURL = "https://api.github.com/repos/TASVideos/BizHawk/releases/latest"; private static readonly TimeSpan _minimumCheckDuration = TimeSpan.FromHours(8); + public static Config GlobalConfig; + private static bool AutoCheckEnabled { - get => GlobalWin.Config.UpdateAutoCheckEnabled; - set => GlobalWin.Config.UpdateAutoCheckEnabled = value; + get => GlobalConfig.UpdateAutoCheckEnabled; + set => GlobalConfig.UpdateAutoCheckEnabled = value; } private static DateTime? LastCheckTimeUTC { - get => GlobalWin.Config.UpdateLastCheckTimeUtc; - set => GlobalWin.Config.UpdateLastCheckTimeUtc = value; + get => GlobalConfig.UpdateLastCheckTimeUtc; + set => GlobalConfig.UpdateLastCheckTimeUtc = value; } private static string LatestVersion { - get => GlobalWin.Config.UpdateLatestVersion; - set => GlobalWin.Config.UpdateLatestVersion = value; + get => GlobalConfig.UpdateLatestVersion; + set => GlobalConfig.UpdateLatestVersion = value; } private static string IgnoreVersion { - get => GlobalWin.Config.UpdateIgnoreVersion; - set => GlobalWin.Config.UpdateIgnoreVersion = value; + get => GlobalConfig.UpdateIgnoreVersion; + set => GlobalConfig.UpdateIgnoreVersion = value; } public static void BeginCheck(bool skipCheck = false) diff --git a/src/BizHawk.Client.EmuHawk/config/ProfileConfig.cs b/src/BizHawk.Client.EmuHawk/config/ProfileConfig.cs index 16048183b6..68135fd73c 100644 --- a/src/BizHawk.Client.EmuHawk/config/ProfileConfig.cs +++ b/src/BizHawk.Client.EmuHawk/config/ProfileConfig.cs @@ -75,6 +75,7 @@ namespace BizHawk.Client.EmuHawk _config.UpdateAutoCheckEnabled = AutoCheckForUpdates.Checked; if (_config.UpdateAutoCheckEnabled != oldUpdateAutoCheckEnabled) { + UpdateChecker.GlobalConfig = _config; if (!_config.UpdateAutoCheckEnabled) { UpdateChecker.ResetHistory();