diff --git a/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.IO.cs b/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.IO.cs index 8ac524dde6..32977a366e 100644 --- a/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.IO.cs +++ b/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.IO.cs @@ -51,19 +51,15 @@ namespace BizHawk.Client.Common public void SetCycleValues() //TODO IEmulator should not be an instance prop of movies, it should be passed in to every call (i.e. from MovieService) --yoshi { // The saved cycle value will only be valid if the end of the movie has been emulated. - if (this.IsAtEnd()) + if (this.IsAtEnd() && Emulator.AsCycleTiming() is { } cycleCore) { - var cycleCore = Emulator.AsCycleTiming(); - if (cycleCore != null) - { - Header[HeaderKeys.CycleCount] = cycleCore.CycleCount.ToString(); - Header[HeaderKeys.ClockRate] = cycleCore.ClockRate.ToString(CultureInfo.InvariantCulture); - } + // legacy movies may incorrectly have no ClockRate header value set + Header[HeaderKeys.ClockRate] = cycleCore.ClockRate.ToString(NumberFormatInfo.InvariantInfo); + Header[HeaderKeys.CycleCount] = cycleCore.CycleCount.ToString(); } else { - Header.Remove(HeaderKeys.CycleCount); - Header.Remove(HeaderKeys.ClockRate); + Header.Remove(HeaderKeys.CycleCount); // don't allow invalid cycle count fields to stay set } } diff --git a/src/BizHawk.Client.EmuHawk/MainForm.Movie.cs b/src/BizHawk.Client.EmuHawk/MainForm.Movie.cs index e3bbcd687d..dcf0e287f3 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.Movie.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.Movie.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Globalization; using System.Windows.Forms; using BizHawk.Client.Common; @@ -279,8 +280,7 @@ namespace BizHawk.Client.EmuHawk if (Emulator.HasCycleTiming()) { - movie.HeaderEntries.Add(HeaderKeys.CycleCount, "0"); - movie.HeaderEntries.Add(HeaderKeys.ClockRate, "0"); + movie.HeaderEntries.Add(HeaderKeys.ClockRate, Emulator.AsCycleTiming().ClockRate.ToString(NumberFormatInfo.InvariantInfo)); } } }