From 9211007a18a8f608f10f45f4c83d68469b881718 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Fri, 22 Jul 2022 05:06:05 +1000 Subject: [PATCH] Fix bug in `PlayMovie.PreHighlightMovie` heuristics for the record, the bug was that it had `_movieList[indices[0]]` in the loop instead of `_movieList[indices[i]]` --- src/BizHawk.Client.EmuHawk/movie/PlayMovie.cs | 22 +++---------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/movie/PlayMovie.cs b/src/BizHawk.Client.EmuHawk/movie/PlayMovie.cs index 3be9e40b33..0096cd5b01 100644 --- a/src/BizHawk.Client.EmuHawk/movie/PlayMovie.cs +++ b/src/BizHawk.Client.EmuHawk/movie/PlayMovie.cs @@ -212,27 +212,11 @@ namespace BizHawk.Client.EmuHawk HighlightMovie(tas[0]); return; } - - if (tas.Count > 1) - { - indices = new List(tas); - } // Final tie breaker - Last used file - var file = new FileInfo(_movieList[indices[0]].Filename); - var time = file.LastAccessTime; - var mostRecent = indices[0]; - for (var i = 1; i < indices.Count; i++) - { - file = new FileInfo(_movieList[indices[0]].Filename); - if (file.LastAccessTime > time) - { - time = file.LastAccessTime; - mostRecent = indices[i]; - } - } - - HighlightMovie(mostRecent); + HighlightMovie(tas.Select(movieIndex => (Index: movieIndex, Timestamp: new FileInfo(_movieList[movieIndex].Filename).LastAccessTime)) + .OrderByDescending(static tuple => tuple.Timestamp) + .First().Index); } private void HighlightMovie(int index)