From a3ff2787a76dc7297ce1ad4f00e5fcc5cb82e307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20W=C5=82odarczyk?= Date: Mon, 6 Jul 2026 11:12:32 +0200 Subject: [PATCH] Accept .exe binary name on Linux/macOS and fix AlwaysOn battery threshold build-macos.sh ships the macOS binary as eu07.exe, so IsValidBinaryFile must accept that extension on non-Windows too. Also fix the AlwaysOn battery default check to use a proper near-zero epsilon instead of an overly broad <0.2 threshold that clobbered legitimate low velocities. Co-Authored-By: Claude Sonnet 5 --- StarterNG/Classes/Settings.cs | 6 ++++-- StarterNG/MainWindow.axaml.cs | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/StarterNG/Classes/Settings.cs b/StarterNG/Classes/Settings.cs index ebc8fbd..1275cb9 100644 --- a/StarterNG/Classes/Settings.cs +++ b/StarterNG/Classes/Settings.cs @@ -256,8 +256,10 @@ public sealed class Settings return false; if (OperatingSystem.IsWindows()) return ext == ".exe"; - // Linux / macOS: no extension (eu07) or a known binary suffix - return ext.Length == 0 || ext is ".x86_64" or ".run" or ".appimage"; + // Linux / macOS: no extension (eu07), a known binary suffix, or .exe + // (some builds - notably this project's own build-macos.sh - ship the + // macOS binary under the historical "eu07.exe" name). + return ext.Length == 0 || ext is ".exe" or ".x86_64" or ".run" or ".appimage"; } private static readonly Encoding FileEncoding = ResolveEncoding(); diff --git a/StarterNG/MainWindow.axaml.cs b/StarterNG/MainWindow.axaml.cs index 8293ba3..69c9c0e 100644 --- a/StarterNG/MainWindow.axaml.cs +++ b/StarterNG/MainWindow.axaml.cs @@ -105,7 +105,7 @@ public partial class MainWindow : Window trainset.Velocity = Settings.Instance.BatteryDefault switch { BatteryDefault.AlwaysOff => 0f, - BatteryDefault.AlwaysOn => trainset.OriginalVelocity < 0.2f ? 0.1f : trainset.OriginalVelocity, + BatteryDefault.AlwaysOn => MathF.Abs(trainset.OriginalVelocity) < 0.01f ? 0.1f : trainset.OriginalVelocity, _ => trainset.OriginalVelocity }; }