From 02ea1277fc111d222ddba0c61a5964320da604e6 Mon Sep 17 00:00:00 2001 From: maj00r Date: Tue, 3 Nov 2026 21:51:54 +0100 Subject: [PATCH] Read the last run's log before a start has to A start notes down which vehicles the player drove in the run before, as the log begins anew. With the tape window never opened nothing of a long run's log had been read yet, and Start waited on the whole of it. It is now read off the UI thread when the simulator exits and when the starter opens. --- StarterNG/Application/HaslerTapes.cs | 11 +++++++++++ StarterNG/MainWindow.axaml.cs | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/StarterNG/Application/HaslerTapes.cs b/StarterNG/Application/HaslerTapes.cs index df067c0..3d0b464 100644 --- a/StarterNG/Application/HaslerTapes.cs +++ b/StarterNG/Application/HaslerTapes.cs @@ -113,6 +113,17 @@ public sealed class HaslerTapes } } + /// + /// Reads what the log of the last launch has gained since the last look. A start + /// notes that down before the log begins anew, and after a long run, with nothing + /// read of it yet, it would wait on the whole log. + /// + public void FollowLastRun() + { + if (Launches().LastOrDefault() is { } launch) + PlayerIn(launch); + } + /// /// The launches noted so far, oldest first. Read again only when the file has /// changed: this runs every few seconds next to a running simulator. diff --git a/StarterNG/MainWindow.axaml.cs b/StarterNG/MainWindow.axaml.cs index 8d71cd0..1956dd0 100644 --- a/StarterNG/MainWindow.axaml.cs +++ b/StarterNG/MainWindow.axaml.cs @@ -103,6 +103,7 @@ public partial class MainWindow : Window _openedUtc = DateTime.UtcNow; UpdateStartButton(); _sceneryFilesTimer.Start(); + FollowLastRun(); }; Activated += (_, _) => CheckExternalSettings(); _sceneryFilesTimer.Tick += async (_, _) => await LookAtSceneryFilesAsync(); @@ -693,11 +694,22 @@ public partial class MainWindow : Window _ = simulator.WaitForExitAsync().ContinueWith(_ => Dispatcher.UIThread.Post(() => { AppServices.Current.State.SimulatorRunning = false; + FollowLastRun(); RestoreFromSimulator(); ReportIfCrashed(simulator, executable, started); }), TaskScheduler.Default); } + /// + /// The player's vehicles in the last run, read from its log off the UI thread + /// while nobody waits: the next start has to have them before the log begins anew. + /// + private static void FollowLastRun() + { + if (AppServices.Current.Settings.PhysicsLog) + _ = Task.Run(AppServices.Current.Tapes.FollowLastRun); + } + /// /// Says why the simulator is gone when it did not end the way a session does: /// an error code, or a close so soon after the start that nobody played - a