diff --git a/src/BizHawk.Client.Common/movie/tasproj/TasLagLog.cs b/src/BizHawk.Client.Common/movie/tasproj/TasLagLog.cs index 6ff8155b74..b32e904f2d 100644 --- a/src/BizHawk.Client.Common/movie/tasproj/TasLagLog.cs +++ b/src/BizHawk.Client.Common/movie/tasproj/TasLagLog.cs @@ -2,7 +2,6 @@ using System.IO; using System.Linq; using Newtonsoft.Json; -using BizHawk.Emulation.Common; namespace BizHawk.Client.Common { @@ -16,18 +15,7 @@ namespace BizHawk.Client.Common get { var result = _lagLog.TryGetValue(frame, out var lag); - if (result) - { - return lag; - } - - // TODO: don't do this here, the calling code should decide if showing the current emulator state is the right decision - if (frame == Global.Emulator.Frame) - { - return Global.Emulator.AsInputPollable().IsLagFrame; - } - - return null; + return result ? (bool?)lag : null; } set diff --git a/src/BizHawk.Client.Common/movie/tasproj/TasMovie.cs b/src/BizHawk.Client.Common/movie/tasproj/TasMovie.cs index 32b44891ed..2c2383beda 100644 --- a/src/BizHawk.Client.Common/movie/tasproj/TasMovie.cs +++ b/src/BizHawk.Client.Common/movie/tasproj/TasMovie.cs @@ -43,13 +43,26 @@ namespace BizHawk.Client.Common public override string PreferredExtension => Extension; public IStateManager TasStateManager { get; } - public ITasMovieRecord this[int index] => new TasMovieRecord + public ITasMovieRecord this[int index] { - HasState = TasStateManager.HasState(index), - LogEntry = GetInputLogEntry(index), - Lagged = LagLog[index + 1], - WasLagged = LagLog.History(index + 1) - }; + get + { + var lagIndex = index + 1; + var lagged = LagLog[lagIndex]; + if (lagged == null && Global.Emulator.Frame == lagIndex) + { + lagged = Global.Emulator.AsInputPollable().IsLagFrame; + } + + return new TasMovieRecord + { + HasState = TasStateManager.HasState(index), + LogEntry = GetInputLogEntry(index), + Lagged = lagged, + WasLagged = LagLog.History(lagIndex) + }; + } + } public override void StartNewRecording() {