diff --git a/BizHawk.Client.Common/movie/tasproj/TasLagLog.cs b/BizHawk.Client.Common/movie/tasproj/TasLagLog.cs index 889affa8d7..345df229d0 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasLagLog.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasLagLog.cs @@ -11,6 +11,9 @@ namespace BizHawk.Client.Common { private readonly SortedList LagLog = new SortedList(); + // TODO: eventually we want multiple levels of history + private readonly SortedList RemovedFrames = new SortedList(); + public bool? this[int frame] { get @@ -55,20 +58,38 @@ namespace BizHawk.Client.Common public void Clear() { + if (LagLog.Any()) + { + RemovedFrames.Clear(); + foreach (var lag in LagLog) + { + RemovedFrames.Add(lag.Key, lag.Value); + } + } + LagLog.Clear(); + } public void RemoveFrom(int frame) { if (frame > 0 && frame <= LagLog.Count) { + RemovedFrames.Clear(); + for (int i = LagLog.Count - 1; i > frame; i--) // Reverse order because removing from a sorted list re-indexes the items after the removed item { + RemovedFrames.Add(i, LagLog[i]); LagLog.RemoveAt(i); } } else if (frame == 0) { + RemovedFrames.Clear(); + foreach (var lag in LagLog) + { + RemovedFrames.Add(lag.Key, lag.Value); + } this.Clear(); } @@ -96,5 +117,15 @@ namespace BizHawk.Client.Common } } } + + public bool? History(int frame) + { + if (RemovedFrames.ContainsKey(frame)) + { + return RemovedFrames[frame]; + } + + return null; + } } } diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs index 7e41a6934c..ed00cd525a 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs @@ -79,7 +79,8 @@ namespace BizHawk.Client.Common { State = StateManager[index], LogEntry = GetInputLogEntry(index), - Lagged = LagLog[index + 1] + Lagged = LagLog[index + 1], + WasLagged = LagLog.History(index + 1) }; } } diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovieRecord.cs b/BizHawk.Client.Common/movie/tasproj/TasMovieRecord.cs index f98441c21d..ec588f31ba 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovieRecord.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovieRecord.cs @@ -7,6 +7,7 @@ namespace BizHawk.Client.Common { public KeyValuePair State { get; set; } public bool? Lagged { get; set; } + public bool? WasLagged { get; set; } public string LogEntry { get; set; } public bool HasState diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs index 8e10b9155b..3c66772e6a 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs @@ -91,8 +91,6 @@ namespace BizHawk.Client.EmuHawk return; } - - if (columnName == FrameColumnName) { if (Emulator.Frame == index) @@ -109,6 +107,12 @@ namespace BizHawk.Client.EmuHawk LagZone_FrameCol : GreenZone_FrameCol; } + else if (record.WasLagged.HasValue) + { + color = record.WasLagged.Value ? + LagZone_Invalidated_FrameCol : + GreenZone_Invalidated_FrameCol; + } else { color = Color.White; @@ -134,6 +138,12 @@ namespace BizHawk.Client.EmuHawk LagZone_InputLog : GreenZone_InputLog; } + else if (record.WasLagged.HasValue) + { + color = record.WasLagged.Value ? + LagZone_Invalidated_InputLog : + GreenZone_Invalidated_FrameCol; + } else { color = Color.FromArgb(0xFFFEEE);