Leave shaders/tonemapping.glsl alone and validate the sim executable

Shaders: drop ApplyHdrShader and FindBundled. The Pascal starter only copied
starter/Reinhard.glsl over shaders/tonemapping.glsl when the user picked an
operator in the HDR combo (uSettings.pas ChangeHDR, its only caller being
cbHDRChange), never on an ordinary save. We ran it from SaveTo, so every save
replaced the file the game ships. That file has been tracked in the game repo
since 2020 and now defaults to AgX, so overwriting it with a 2021-vintage
Reinhard was a two-generation downgrade that also lost the NaN/Inf sanitize.
Also comments out gfx.postfx.tonemapping on save; the engine has no such key.

Executable: ResolveExecutable now validates its pick (file exists, has an
execute bit outside Windows, and the MZ/ELF header matches the running OS) and
returns the first candidate that passes instead of the first that matches by
name. .exe is no longer a Linux candidate - a Steam install with the native
binary still zipped would otherwise resolve to the Windows PE. On failure the
problem reaches the caller, and MainWindow shows it instead of swallowing the
exception, so a launch that does nothing is no longer silent. A manual pick
whose file is temporarily missing is kept in the combo rather than falling back
to auto and being overwritten on the next save.

Claude-Session: https://claude.ai/code/session_01HamVNWE9mwmz1vs2iEpNQq
This commit is contained in:
maj00r
2026-08-29 16:42:36 +02:00
parent 3b7a8135ea
commit c7853f6588
9 changed files with 148 additions and 54 deletions

View File

@@ -7,13 +7,13 @@ namespace StarterNG.Views;
public enum MessageBoxButtons
{
YesNo
YesNo,
Ok
}
public static class MessageBox
{
public static async Task<bool> Show(Window owner, string message, string title, MessageBoxButtons _)
public static async Task<bool> Show(Window owner, string message, string title, MessageBoxButtons buttons)
{
var win = new Window
{
@@ -33,6 +33,12 @@ public static class MessageBox
noBtn.Classes.Add("Flat");
noBtn.Click += (_, _) => win.Close();
if (buttons == MessageBoxButtons.Ok)
{
yesBtn.Content = App.Loc["Ok"];
noBtn.IsVisible = false;
}
win.Content = new StackPanel
{
Margin = new Avalonia.Thickness(16),

View File

@@ -158,9 +158,20 @@ public partial class Settings : UserControl
UartRadioChannelCb.IsChecked = s.UartRadioChannel;
UpdateFeedbackDetailVisibility();
SelectExeCb.SelectedIndex = s.SelectExeAutomatically
? 0
: Math.Max(0, FindComboIndexByContent(SelectExeCb, s.ExecutablePath));
if (s.SelectExeAutomatically)
{
SelectExeCb.SelectedIndex = 0;
}
else
{
int exeIdx = FindComboIndexByContent(SelectExeCb, s.ExecutablePath);
if (exeIdx < 0)
{
SelectExeCb.Items.Add(new ComboBoxItem { Content = s.ExecutablePath });
exeIdx = SelectExeCb.Items.Count - 1;
}
SelectExeCb.SelectedIndex = exeIdx;
}
DebugModeCb.IsChecked = s.DebugMode;
VirtualShuntingCb.IsChecked = s.VirtualShunting;
LogMissingVehicleFilesCb.IsChecked = s.LogMissingVehicleFiles;