fix some edge case display values in RewindConfig

specifically when rewind is disabled or if it's enabled and no state exists.
This commit is contained in:
Morilli 2025-02-14 14:41:20 +01:00
parent 8bc446bfa3
commit 84c79b9053
1 changed files with 3 additions and 3 deletions

View File

@ -46,7 +46,7 @@ namespace BizHawk.Client.EmuHawk
FullnessLabel.Text = $"{fullnessRatio:P2}";
var stateCount = rewinder.Count;
RewindFramesUsedLabel.Text = stateCount.ToString();
_avgStateSize = stateCount is 0 ? 0UL : (ulong) Math.Round(rewinder.Size * fullnessRatio / stateCount);
_avgStateSize = stateCount is 0 ? (ulong) _statableCore.CloneSavestate().Length : (ulong) Math.Round(rewinder.Size * fullnessRatio / stateCount);
}
else
{
@ -155,10 +155,10 @@ namespace BizHawk.Client.EmuHawk
private void CalculateEstimates()
{
double estFrames = 0.0;
var bufferSize = 1L << (int) BufferSizeUpDown.Value;
labelEx1.Text = bufferSize.ToString();
if (_avgStateSize is not 0UL)
{
var bufferSize = 1L << (int) BufferSizeUpDown.Value;
labelEx1.Text = bufferSize.ToString();
bufferSize *= 1024 * 1024;
estFrames = bufferSize / (double) _avgStateSize;
}