Use system's canonical framerate for rewind duration estimate

This commit is contained in:
YoshiRulz 2023-02-05 21:00:04 +10:00
parent f473db56c3
commit 3c3ab6578e
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
2 changed files with 16 additions and 3 deletions

View File

@ -950,7 +950,12 @@ namespace BizHawk.Client.EmuHawk
private void RewindOptionsMenuItem_Click(object sender, EventArgs e)
{
if (!Emulator.HasSavestates()) return;
using RewindConfig form = new(Config, CreateRewinder, () => this.Rewinder, Emulator.AsStatable());
using RewindConfig form = new(
Config,
PlatformFrameRates.GetFrameRate(Emulator.SystemId, Emulator.HasRegions() && Emulator.AsRegionable().Region is DisplayType.PAL), // why isn't there a helper for this
Emulator.AsStatable(),
CreateRewinder,
() => this.Rewinder);
if (this.ShowDialogWithTempMute(form).IsOk()) AddOnScreenMessage("Rewind and State settings saved");
}

View File

@ -12,15 +12,23 @@ namespace BizHawk.Client.EmuHawk
private readonly Config _config;
private readonly double _framerate;
private readonly Action _recreateRewinder;
private readonly Func<IRewinder> _getRewinder;
private readonly IStatable _statableCore;
public RewindConfig(Config config, Action recreateRewinder, Func<IRewinder> getRewinder, IStatable statableCore)
public RewindConfig(
Config config,
double framerate,
IStatable statableCore,
Action recreateRewinder,
Func<IRewinder> getRewinder)
{
_config = config;
_framerate = framerate;
_recreateRewinder = recreateRewinder;
_getRewinder = getRewinder;
_statableCore = statableCore;
@ -150,7 +158,7 @@ namespace BizHawk.Client.EmuHawk
estFrames = bufferSize / (double) _avgStateSize;
}
ApproxFramesLabel.Text = $"{estFrames:n0} frames";
EstTimeLabel.Text = $"{estFrames / 3600.0:n} minutes";
EstTimeLabel.Text = $"{estFrames / _framerate / 60.0:n} minutes";
}
private void BufferSizeUpDown_ValueChanged(object sender, EventArgs e)