mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-25 17:39:12 +01:00
Compare commits
2 Commits
v1.6.325
...
fix/ini-ke
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b778122fb5 | ||
| 94112af005 |
14
.github/dependabot.yml
vendored
14
.github/dependabot.yml
vendored
@@ -1,14 +0,0 @@
|
||||
# Pull requests for new versions of the pinned actions and of the NuGet packages,
|
||||
# so a fix for a vulnerability reaches the build without anyone watching for it.
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: github-actions
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
|
||||
- package-ecosystem: nuget
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
open-pull-requests-limit: 5
|
||||
@@ -68,6 +68,71 @@ public class ExternalIniTests
|
||||
Assert.Contains("fieldofview 60", installation.Files.ReadAllText(UserIni));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_renderer_written_in_by_hand_while_the_starter_runs_survives_its_save()
|
||||
{
|
||||
// Notepad: "gfxrenderer vulkan", a word the starter does not offer.
|
||||
var installation = WithIni("gfxrenderer default\nfieldofview 45\n");
|
||||
Edited(installation, "gfxrenderer vulkan\nfieldofview 45\n");
|
||||
|
||||
installation.SettingsStore.Settings.FieldOfView = 60;
|
||||
installation.SettingsStore.Save();
|
||||
|
||||
string saved = installation.Files.ReadAllText(UserIni);
|
||||
Assert.Contains("gfxrenderer vulkan", saved);
|
||||
Assert.Contains("fieldofview 60", saved);
|
||||
Assert.Equal("vulkan", installation.SettingsStore.Settings.RendererWord);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_renderer_written_in_by_hand_and_read_again_survives_the_next_save()
|
||||
{
|
||||
var installation = WithIni("gfxrenderer default\n");
|
||||
Edited(installation, "gfxrenderer vulkan\n");
|
||||
|
||||
// "Wczytać ponownie?" - yes.
|
||||
installation.SettingsStore.Load();
|
||||
installation.SettingsStore.Save();
|
||||
|
||||
Assert.Contains("gfxrenderer vulkan", installation.Files.ReadAllText(UserIni));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_change_on_disk_not_read_again_is_not_lost_on_the_next_save()
|
||||
{
|
||||
var installation = WithIni("gfxrenderer default\nfieldofview 45\nvsync no\n");
|
||||
var store = installation.SettingsStore;
|
||||
Edited(installation, "gfxrenderer vulkan\nfieldofview 45\nvsync yes\n");
|
||||
Assert.True(store.HasChangeOnDiskToAskAbout());
|
||||
|
||||
// "Wczytać ponownie?" - no: not asked again about the same change.
|
||||
store.LeaveChangeOnDisk();
|
||||
Assert.False(store.HasChangeOnDiskToAskAbout());
|
||||
|
||||
store.Settings.FieldOfView = 60;
|
||||
store.Save();
|
||||
|
||||
string saved = installation.Files.ReadAllText(UserIni);
|
||||
Assert.Contains("gfxrenderer vulkan", saved);
|
||||
Assert.Contains("vsync yes", saved);
|
||||
Assert.Contains("fieldofview 60", saved);
|
||||
Assert.True(store.LastSaveMerged);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_later_change_on_disk_is_asked_about_again()
|
||||
{
|
||||
var installation = WithIni("fieldofview 45\n");
|
||||
var store = installation.SettingsStore;
|
||||
Edited(installation, "fieldofview 50\n");
|
||||
store.LeaveChangeOnDisk();
|
||||
|
||||
installation.Files.WithFile(UserIni, "fieldofview 55\n")
|
||||
.WrittenAt(UserIni, installation.Files.GetLastWriteTimeUtc(UserIni).AddMinutes(1));
|
||||
|
||||
Assert.True(store.HasChangeOnDiskToAskAbout());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_file_nobody_else_touched_saves_as_before()
|
||||
{
|
||||
@@ -97,6 +162,8 @@ public class ExternalIniTests
|
||||
Assert.False(unreadable.ContainsKey("gfxrenderer"));
|
||||
Assert.False(unreadable.ContainsKey("gfx.framebuffer.width"));
|
||||
Assert.False(unreadable.ContainsKey("calibratein"));
|
||||
// The default features in another order: the same line.
|
||||
Assert.False(WithIni("uartfeature local|main|scnd|train\n").SettingsStore.UnreadableValues().ContainsKey("uartfeature"));
|
||||
// The file keeps what it says until the setting is changed.
|
||||
installation.SettingsStore.Save();
|
||||
Assert.Contains("fieldofview abc", installation.Files.ReadAllText(UserIni));
|
||||
|
||||
@@ -37,18 +37,18 @@ public class GraphicsSettingsTests
|
||||
private static string? Line(string text, string key) =>
|
||||
Lines(text).FirstOrDefault(l => l == key || l.StartsWith(key + " ", StringComparison.Ordinal));
|
||||
|
||||
// As application.cpp on master has them: a word it does not know gets the full renderer.
|
||||
// As application.cpp on master has them; a word the starter does not know is the file's own, written back as it is.
|
||||
[Theory]
|
||||
[InlineData("default", "default")]
|
||||
[InlineData("full", "default")]
|
||||
[InlineData("gl46", "default")]
|
||||
[InlineData("vulkan", "default")]
|
||||
[InlineData("vulkan14", "default")]
|
||||
[InlineData("full", "full")]
|
||||
[InlineData("gl46", "gl46")]
|
||||
[InlineData("vulkan", "vulkan")]
|
||||
[InlineData("vulkan14", "vulkan14")]
|
||||
[InlineData("legacy", "legacy")]
|
||||
[InlineData("simpleshader", "legacy")]
|
||||
[InlineData("off", "legacy")]
|
||||
[InlineData("simple", "simple")]
|
||||
[InlineData("experimental", "default")]
|
||||
[InlineData("experimental", "experimental")]
|
||||
public void A_renderer_is_written_by_the_name_master_knows(string read, string written)
|
||||
{
|
||||
Assert.Equal($"gfxrenderer {written}", Line(Write(Read($"gfxrenderer {read}\n")), "gfxrenderer"));
|
||||
@@ -93,7 +93,7 @@ public class GraphicsSettingsTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Keys_of_the_vulkan_renderer_master_does_not_have_go_on_a_save()
|
||||
public void Keys_of_the_vulkan_renderer_master_does_not_have_stay_on_a_save()
|
||||
{
|
||||
string[] vulkan =
|
||||
{
|
||||
@@ -107,7 +107,8 @@ public class GraphicsSettingsTests
|
||||
|
||||
string saved = installation.Files.ReadAllText(UserIni);
|
||||
Assert.Contains("calibratein 0 0 0 0", saved);
|
||||
Assert.All(vulkan, line => Assert.Null(Line(saved, line.Split(' ')[0])));
|
||||
// Written in by hand for a build that has that renderer: the starter does not know them, and leaves them.
|
||||
Assert.All(vulkan, line => Assert.Equal(line, Line(saved, line.Split(' ')[0])));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -961,23 +961,34 @@ public class SettingsStoreTests
|
||||
Assert.Contains($"gfxrenderer {word}\n", SavedLines(installation));
|
||||
}
|
||||
|
||||
// Words master does not know start the full renderer with a line in its log, and the
|
||||
// experimental renderer is not in a player's build: a save puts "default" in their place.
|
||||
// A word the starter does not know is written in by hand for a build that has it, such as one with Vulkan:
|
||||
// shown, and left as it is until another renderer is chosen.
|
||||
[Theory]
|
||||
[InlineData("full")]
|
||||
[InlineData("opengl")]
|
||||
[InlineData("gl46")]
|
||||
[InlineData("vulkan")]
|
||||
[InlineData("vulkan14")]
|
||||
[InlineData("experimental")]
|
||||
[InlineData("null")]
|
||||
public void A_renderer_word_master_does_not_run_is_saved_as_default(string word)
|
||||
public void A_renderer_word_the_starter_does_not_know_stays_until_another_is_chosen(string word)
|
||||
{
|
||||
var installation = WithHome(new InMemoryFileSystem().WithFile(UserIni, $"gfxrenderer {word}\n"));
|
||||
installation.SettingsStore.Load();
|
||||
var installation = WithHome(new InMemoryFileSystem().WithFile(UserIni, $"gfxrenderer {word}\nfieldofview 45\n"));
|
||||
var store = installation.SettingsStore;
|
||||
store.Load();
|
||||
|
||||
installation.SettingsStore.Save();
|
||||
Assert.Equal(word, store.Settings.RendererWord);
|
||||
Assert.Equal(word, store.UnreadableValues()["gfxrenderer"]);
|
||||
store.Settings.FieldOfView = 60;
|
||||
store.Save();
|
||||
Assert.Contains($"gfxrenderer {word}\n", SavedLines(installation));
|
||||
|
||||
// Picking one from the list, even the full renderer it runs as, is a choice.
|
||||
store.Settings.RendererWord = null;
|
||||
store.Settings.RenderEngine = 0;
|
||||
store.Save();
|
||||
Assert.Contains("gfxrenderer default\n", SavedLines(installation));
|
||||
Assert.False(store.UnreadableValues().ContainsKey("gfxrenderer"));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
||||
182
StarterNG.Tests/SettingsUnknownValueTests.cs
Normal file
182
StarterNG.Tests/SettingsUnknownValueTests.cs
Normal file
@@ -0,0 +1,182 @@
|
||||
using Avalonia.Controls;
|
||||
using StarterNG.Application;
|
||||
using StarterNG.Controls;
|
||||
using StarterNG.Tests.Fakes;
|
||||
|
||||
namespace StarterNG.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// Values of eu07.ini the starter does not know, or a control cannot show, as the settings page
|
||||
/// shows them: as the file writes them, with a note, until the player sets them by hand - or the
|
||||
/// move to the standard mode puts them right.
|
||||
/// </summary>
|
||||
[Collection(AvaloniaControls.Name)]
|
||||
public class SettingsUnknownValueTests
|
||||
{
|
||||
// The standard mode already, unless a test moves to it.
|
||||
private const string Standard = "starter.settings.standard yes\n";
|
||||
|
||||
private static void WithPage(string ini, Action<StarterNG.Views.Settings, AppServices, Func<string>> act)
|
||||
{
|
||||
var installation = new TestInstallation(new InMemoryFileSystem());
|
||||
installation.Environment.AsWindows();
|
||||
var services = AppServices.Initialize(installation.Paths, installation.Files, installation.Clock,
|
||||
installation.Environment);
|
||||
string path = services.SettingsPaths.UserConfigPath();
|
||||
installation.Files.WriteAllText(path, ini);
|
||||
services.SettingsStore.Load();
|
||||
|
||||
HeadlessDrawing.Ensure();
|
||||
var context = SynchronizationContext.Current;
|
||||
SynchronizationContext.SetSynchronizationContext(new Avalonia.Threading.AvaloniaSynchronizationContext());
|
||||
Window? window = null;
|
||||
try
|
||||
{
|
||||
var page = new StarterNG.Views.Settings();
|
||||
window = Controls.Show(page, 1600, 1000, themed: true);
|
||||
act(page, services, () => installation.Files.ReadAllText(path).Replace("\r\n", "\n"));
|
||||
}
|
||||
finally
|
||||
{
|
||||
window?.Close();
|
||||
SynchronizationContext.SetSynchronizationContext(context);
|
||||
}
|
||||
}
|
||||
|
||||
private static ComboBox List(StarterNG.Views.Settings page, string name) => page.FindControl<ComboBox>(name)!;
|
||||
|
||||
private static string? Shown(ComboBox list) => (list.SelectedItem as ComboBoxItem)?.Content as string;
|
||||
|
||||
private static string? Note(StarterNG.Views.Settings page, string key) =>
|
||||
Avalonia.LogicalTree.LogicalExtensions.GetLogicalDescendants(page).OfType<SettingRow>()
|
||||
.First(row => row.ConfigKey == key).UnknownValue;
|
||||
|
||||
[Fact]
|
||||
public void A_renderer_word_is_on_the_list_chosen_and_saved_as_it_is()
|
||||
{
|
||||
WithPage(Standard + "gfxrenderer vulkan\nfieldofview 45\n", (page, _, saved) =>
|
||||
{
|
||||
Assert.Equal("vulkan", Shown(List(page, "RenderEngineCb")));
|
||||
Assert.Contains("vulkan", Note(page, "gfxrenderer"));
|
||||
Assert.False(page.HasUnsavedChanges);
|
||||
|
||||
page.Save();
|
||||
|
||||
Assert.Contains("gfxrenderer vulkan\n", saved());
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Another_renderer_picked_from_the_list_replaces_it()
|
||||
{
|
||||
WithPage(Standard + "gfxrenderer vulkan\n", (page, services, saved) =>
|
||||
{
|
||||
List(page, "RenderEngineCb").SelectedIndex = 0;
|
||||
|
||||
page.Save();
|
||||
|
||||
Assert.Contains("gfxrenderer default\n", saved());
|
||||
Assert.Null(services.Settings.RendererWord);
|
||||
Assert.Null(Note(page, "gfxrenderer"));
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_value_a_list_does_not_offer_is_listed_as_written_and_kept()
|
||||
{
|
||||
WithPage(Standard + "starter.batterydefault 7\ngfx.shadow.rank.cutoff 9\n", (page, _, saved) =>
|
||||
{
|
||||
Assert.Equal("7", Shown(List(page, "ReadyOverrideCb")));
|
||||
Assert.Equal("9", Shown(List(page, "ShadowDisplayCb")));
|
||||
Assert.Contains("7", Note(page, "starter.batterydefault"));
|
||||
Assert.Contains("9", Note(page, "gfx.shadow.rank.cutoff"));
|
||||
Assert.False(page.HasUnsavedChanges);
|
||||
|
||||
page.Save();
|
||||
|
||||
Assert.Contains("starter.batterydefault 7\n", saved());
|
||||
Assert.Contains("gfx.shadow.rank.cutoff 9\n", saved());
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Picking_the_value_the_starter_shows_by_default_replaces_the_files_own()
|
||||
{
|
||||
// "7" is read as the scenery's choice, the first on the list: picked by hand, it is written.
|
||||
WithPage(Standard + "starter.batterydefault 7\n", (page, _, saved) =>
|
||||
{
|
||||
List(page, "ReadyOverrideCb").SelectedIndex = 0;
|
||||
Assert.Null(Note(page, "starter.batterydefault"));
|
||||
|
||||
page.Save();
|
||||
|
||||
Assert.Contains("starter.batterydefault 0\n", saved());
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_list_put_back_at_the_files_value_keeps_it()
|
||||
{
|
||||
WithPage(Standard + "starter.batterydefault 7\n", (page, _, saved) =>
|
||||
{
|
||||
var list = List(page, "ReadyOverrideCb");
|
||||
var fileValue = list.SelectedItem;
|
||||
list.SelectedIndex = 1;
|
||||
list.SelectedItem = fileValue;
|
||||
|
||||
page.Save();
|
||||
|
||||
Assert.Contains("starter.batterydefault 7\n", saved());
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_control_set_by_hand_to_the_default_replaces_a_value_it_could_not_read()
|
||||
{
|
||||
WithPage(Standard + "vsync moze\n", (page, _, saved) =>
|
||||
{
|
||||
Assert.Contains("moze", Note(page, "vsync"));
|
||||
var box = page.FindControl<CheckBox>("VSyncCb")!;
|
||||
box.IsChecked = true;
|
||||
box.IsChecked = false;
|
||||
|
||||
page.Save();
|
||||
|
||||
Assert.Contains("vsync no\n", saved());
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_level_for_other_settings_leaves_a_value_of_the_file_alone()
|
||||
{
|
||||
WithPage(Standard + "starter.batterydefault 7\ngfxrenderer vulkan\n", (page, _, saved) =>
|
||||
{
|
||||
page.FindControl<Panel>("PresetButtons")!.Children.OfType<Button>().First()
|
||||
.RaiseEvent(new Avalonia.Interactivity.RoutedEventArgs(Button.ClickEvent));
|
||||
|
||||
Assert.Equal("7", Shown(List(page, "ReadyOverrideCb")));
|
||||
page.Save();
|
||||
|
||||
Assert.Contains("starter.batterydefault 7\n", saved());
|
||||
Assert.Contains("gfxrenderer vulkan\n", saved());
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void The_move_to_the_standard_mode_puts_values_of_the_file_right()
|
||||
{
|
||||
WithPage("gfxrenderer vulkan\nstarter.batterydefault 7\nvsync moze\ngfx.usegles yes\n", (page, _, saved) =>
|
||||
{
|
||||
page.MoveToStandardOnce();
|
||||
|
||||
string text = saved();
|
||||
Assert.Contains("gfxrenderer default\n", text);
|
||||
Assert.Contains("starter.batterydefault 0\n", text);
|
||||
Assert.Contains("vsync no\n", text);
|
||||
// What lets some machines run the simulator at all stays.
|
||||
Assert.Contains("gfx.usegles yes\n", text);
|
||||
Assert.Null(Note(page, "gfxrenderer"));
|
||||
Assert.NotEqual("7", Shown(List(page, "ReadyOverrideCb")));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,41 @@ public sealed class SettingsStore
|
||||
// it has it: a value outside what the starter offers, its spacing, its comment.
|
||||
private IReadOnlyDictionary<string, string> _synced = new Dictionary<string, string>();
|
||||
|
||||
// Keys set by the player's hand since the file was read: written as the screen has them,
|
||||
// even where that is what the starter shows for a value of the file it does not know.
|
||||
private readonly HashSet<string> _chosen = new(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>
|
||||
/// <paramref name="keys"/> were set by hand - a control moved, a level or the defaults
|
||||
/// put on them, the move to the standard mode: a save writes them, and a value of the
|
||||
/// file the starter does not know goes. Until then it stays as it is.
|
||||
/// </summary>
|
||||
public void Choose(IEnumerable<string> keys) => _chosen.UnionWith(keys);
|
||||
|
||||
/// <summary>The value of the file is chosen again, as it is: it stays in the file.</summary>
|
||||
public void Unchoose(IEnumerable<string> keys) => _chosen.ExceptWith(keys);
|
||||
|
||||
public bool IsChosen(string key) => _chosen.Contains(key);
|
||||
|
||||
/// <summary>
|
||||
/// Whether the file's value of <paramref name="key"/> means what <paramref name="shown"/> does,
|
||||
/// written its own way: yes and tak, 45 and 45.0, the UART features in another order.
|
||||
/// </summary>
|
||||
public bool FileMeans(string key, string? shown)
|
||||
{
|
||||
string? raw = FileValueOf(key);
|
||||
return raw is null || shown is null ? raw == shown : Means(key, raw, shown);
|
||||
}
|
||||
|
||||
private static bool Means(string key, string raw, string shown) =>
|
||||
string.Equals(key, "uartfeature", StringComparison.OrdinalIgnoreCase)
|
||||
? Uart.FeaturesStand(raw, shown)
|
||||
: SameValue(raw, shown);
|
||||
|
||||
/// <summary>The key as the file writes it, where the simulator gets to it; null where it does not.</summary>
|
||||
public string? FileValueOf(string key) =>
|
||||
_config.IsPastEnd(key) || _config.GetRaw(key) is not { Length: > 0 } raw ? null : raw;
|
||||
|
||||
public SettingsStore(IFileSystem files, IClock clock, IDiagnosticsLog log, SettingsPaths paths,
|
||||
SettingsSerializer serializer, ExecutableLocator executables)
|
||||
{
|
||||
@@ -138,6 +173,7 @@ public sealed class SettingsStore
|
||||
|
||||
_serializer.Read(Settings, _config);
|
||||
_synced = Render(Settings);
|
||||
_chosen.Clear();
|
||||
// after the snapshot, so the next save writes it; a profile of before goes the same way as the ini would
|
||||
if (!LoadFailed)
|
||||
SettingsSerializer.MoveToTrainTapes(Settings);
|
||||
@@ -367,7 +403,7 @@ public sealed class SettingsStore
|
||||
continue;
|
||||
if (_config.IsPastEnd(key) || _config.GetRaw(key) is not { Length: > 0 } raw)
|
||||
continue;
|
||||
if (read.TryGetValue(key, out string? shown) && shown == fallback && !SameValue(raw, shown))
|
||||
if (read.TryGetValue(key, out string? shown) && shown == fallback && !Means(key, raw, shown))
|
||||
unreadable[key] = raw;
|
||||
}
|
||||
|
||||
@@ -385,6 +421,10 @@ public sealed class SettingsStore
|
||||
if (!readable)
|
||||
unreadable[key.Key] = raw;
|
||||
}
|
||||
|
||||
// Kept as written, and offered on the list under its own word.
|
||||
if (!_config.IsPastEnd("gfxrenderer") && WithFile(_config).RendererWord is { } renderer)
|
||||
unreadable["gfxrenderer"] = renderer;
|
||||
return unreadable;
|
||||
}
|
||||
|
||||
@@ -473,8 +513,7 @@ public sealed class SettingsStore
|
||||
return Uart.FeaturesStand(_config.GetRaw(key), value);
|
||||
if (SettingsSerializer.FixedLengthKeys.Contains(key, StringComparer.OrdinalIgnoreCase))
|
||||
return _config.GetRaw(key) == value;
|
||||
if (string.Equals(key, "gfxrenderer", StringComparison.OrdinalIgnoreCase) &&
|
||||
!SimulatorSettings.KeptRendererWord(_config.GetRaw(key)))
|
||||
if (_chosen.Contains(key))
|
||||
return false;
|
||||
if (string.Equals(key, "mousescale", StringComparison.OrdinalIgnoreCase) &&
|
||||
!SettingsSerializer.MouseScaleStands(_config.GetRaw(key)))
|
||||
@@ -567,6 +606,35 @@ public sealed class SettingsStore
|
||||
}
|
||||
}
|
||||
|
||||
// When the file stood as it was last asked about; a save still goes onto what it holds.
|
||||
private DateTime _askedAboutUtc = DateTime.MinValue;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the file changed elsewhere since it was read here, written here or last asked
|
||||
/// about. Declined (<see cref="LeaveChangeOnDisk"/>), a change is not asked about again.
|
||||
/// </summary>
|
||||
public bool HasChangeOnDiskToAskAbout() =>
|
||||
IsConfigNewerOnDisk() && DiskWriteTimeUtc() is { } written && written > _askedAboutUtc;
|
||||
|
||||
/// <summary>
|
||||
/// The player chose not to read the file again. The screen stays as it is, but what was
|
||||
/// written in elsewhere is no more lost for that: the next save goes onto it.
|
||||
/// </summary>
|
||||
public void LeaveChangeOnDisk() => _askedAboutUtc = DiskWriteTimeUtc() ?? _clock.UtcNow;
|
||||
|
||||
private DateTime? DiskWriteTimeUtc()
|
||||
{
|
||||
string path = string.IsNullOrEmpty(_savePath) ? _paths.UserConfigPath() : _savePath;
|
||||
try
|
||||
{
|
||||
return _files.FileExists(path) ? _files.GetLastWriteTimeUtc(path) : null;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsConfigNewerOnDisk()
|
||||
{
|
||||
string path = string.IsNullOrEmpty(_savePath) ? _paths.UserConfigPath() : _savePath;
|
||||
|
||||
@@ -53,6 +53,13 @@ public sealed class SimulatorSettings
|
||||
public bool LogMissingVehicleFiles;
|
||||
|
||||
public int RenderEngine;
|
||||
|
||||
/// <summary>
|
||||
/// The file's gfxrenderer word where it is none the starter knows - vulkan, written in by
|
||||
/// hand for a build that has it: written back as it is until another renderer is chosen.
|
||||
/// </summary>
|
||||
public string? RendererWord;
|
||||
|
||||
public int Width = 1280;
|
||||
public int Height = 720;
|
||||
public int BufferScalePercent = 100;
|
||||
@@ -197,11 +204,10 @@ public sealed class SimulatorSettings
|
||||
public static readonly string[] RenderEngines = { "default", "legacy", "simple" };
|
||||
|
||||
/// <summary>
|
||||
/// The words of the file that stay as they are while the choice stands: those application.cpp
|
||||
/// on master knows, but "experimental". Any other word starts the full renderer with a line in
|
||||
/// the log, so a save puts "default" in its place.
|
||||
/// The words the starter places among <see cref="RenderEngines"/>: those application.cpp on
|
||||
/// master knows, but "experimental". Any other word is kept as <see cref="RendererWord"/>.
|
||||
/// </summary>
|
||||
public static bool KeptRendererWord(string? word) =>
|
||||
public static bool KnownRendererWord(string? word) =>
|
||||
word?.Trim().ToLowerInvariant() is "default" or "legacy" or "simple" or "simpleshader" or "off";
|
||||
|
||||
/// <summary>Where <paramref name="word"/> stands among <see cref="RenderEngines"/>, as the simulator reads it.</summary>
|
||||
|
||||
@@ -91,7 +91,9 @@ public sealed class SettingsSerializer
|
||||
s.VirtualShunting = c.GetBool("ai.trainman", true);
|
||||
s.LogMissingVehicleFiles = c.GetBool("starter.logmissingvehicles", false);
|
||||
|
||||
s.RenderEngine = SimulatorSettings.RenderEngineOf(c.GetString("gfxrenderer", "default"));
|
||||
string renderer = c.GetString("gfxrenderer", "default").Trim();
|
||||
s.RenderEngine = SimulatorSettings.RenderEngineOf(renderer);
|
||||
s.RendererWord = renderer.Length > 0 && !SimulatorSettings.KnownRendererWord(renderer) ? renderer : null;
|
||||
s.Width = c.GetInt("width", 1280);
|
||||
s.Height = c.GetInt("height", 720);
|
||||
s.BufferScalePercent = ReadBufferScale(c);
|
||||
@@ -226,13 +228,8 @@ public sealed class SettingsSerializer
|
||||
{
|
||||
"gfx.postfx.tonemapping",
|
||||
"starter.developertools",
|
||||
// The OpenGL 4.6 and Vulkan renderers', which the simulator's master does not have.
|
||||
"gfx.antialiasing", "gfx.buffer.percent", "gfx.vulkan.device", "gfx.dlss.preset", "gfx.framegeneration",
|
||||
"gfx.reflex", "gfx.raytracing", "gfx.raytracing.range", "gfx.ssr", "gfx.lights.clustered", "gfx.lights.shadows",
|
||||
"gfx.contactshadows", "gfx.shadow.sdsm", "gfx.postfx.ao", "gfx.postfx.ao.lighting", "gfx.postfx.ao.quality",
|
||||
"gfx.cabprobe", "gfx.cabprobe.interval", "gfx.cabprobe.bounce", "gfx.cabprobe.reflections", "gfx.fog",
|
||||
"gfx.fog.quality", "gfx.clouds", "gfx.clouds.shadows", "gfx.postfx.bloom", "gfx.postfx.autoexposure",
|
||||
"gfx.grass", "gfx.grass.distance", "gfx.grass.fadedistance", "gfx.grass.density", "gfx.precipitation.particles",
|
||||
// The keys of the OpenGL 4.6 and Vulkan renderers (gfx.vulkan.device, gfx.raytracing...) are not here:
|
||||
// written in by hand for a build that has them, they stay as the file has them.
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -286,7 +283,7 @@ public sealed class SettingsSerializer
|
||||
c.SetBool("ai.trainman", s.VirtualShunting);
|
||||
c.SetBool("starter.logmissingvehicles", s.LogMissingVehicleFiles);
|
||||
|
||||
c.Set("gfxrenderer", SimulatorSettings.RenderEngines[Clamp(s.RenderEngine, 0, SimulatorSettings.RenderEngines.Length - 1)]);
|
||||
c.Set("gfxrenderer", s.RendererWord ?? SimulatorSettings.RenderEngines[Clamp(s.RenderEngine, 0, SimulatorSettings.RenderEngines.Length - 1)]);
|
||||
c.SetInt("width", s.Width);
|
||||
c.SetInt("height", s.Height);
|
||||
c.SetInt("starter.bufferscale", s.BufferScalePercent);
|
||||
|
||||
@@ -845,7 +845,7 @@ public partial class MainWindow : Window
|
||||
{
|
||||
if (_askingAboutSettings || (DateTime.UtcNow - _openedUtc).TotalSeconds < 3)
|
||||
return;
|
||||
if (!AppServices.Current.SettingsStore.IsConfigNewerOnDisk())
|
||||
if (!AppServices.Current.SettingsStore.HasChangeOnDiskToAskAbout())
|
||||
return;
|
||||
|
||||
_askingAboutSettings = true;
|
||||
@@ -862,7 +862,7 @@ public partial class MainWindow : Window
|
||||
SettingsView?.ReloadFromSettings();
|
||||
}
|
||||
else
|
||||
AppServices.Current.SettingsStore.TouchConfigAge();
|
||||
AppServices.Current.SettingsStore.LeaveChangeOnDisk();
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ public partial class Settings
|
||||
|
||||
private void ShowGraphics(SimulatorSettings s)
|
||||
{
|
||||
RenderEngineCb.SelectedIndex = s.RenderEngine;
|
||||
ShowRenderer(s);
|
||||
SelectTag(AntiAliasingCb, AntiAliasingTag(s.AntiAliasing));
|
||||
_fullscreenAsRead = s.Fullscreen;
|
||||
SelectTag(DisplayModeCb, DisplayModeOf(s.Fullscreen, s.FullscreenWindowed));
|
||||
@@ -34,8 +34,18 @@ public partial class Settings
|
||||
}
|
||||
|
||||
private void CaptureGraphics(SimulatorSettings s)
|
||||
{
|
||||
if (_fileRendererItem is not null && ReferenceEquals(RenderEngineCb.SelectedItem, _fileRendererItem))
|
||||
{
|
||||
s.RenderEngine = 0;
|
||||
s.RendererWord = _fileRendererItem.Tag as string;
|
||||
}
|
||||
else
|
||||
{
|
||||
s.RenderEngine = Math.Max(0, RenderEngineCb.SelectedIndex);
|
||||
s.RendererWord = null;
|
||||
}
|
||||
if (!ShowsFileValue(AntiAliasingCb))
|
||||
s.AntiAliasing = AntiAliasingFromTag(SelectedTag(AntiAliasingCb));
|
||||
s.FullscreenMonitor = SelectedTag(MonitorCb) ?? string.Empty;
|
||||
|
||||
@@ -45,6 +55,32 @@ public partial class Settings
|
||||
s.Fullscreen = mode == BorderlessMode ? _fullscreenAsRead : mode == FullscreenMode;
|
||||
}
|
||||
|
||||
/// <summary>The renderer the file names in a word the list does not offer, listed under that word.</summary>
|
||||
private ComboBoxItem? _fileRendererItem;
|
||||
|
||||
private void ShowRenderer(SimulatorSettings s)
|
||||
{
|
||||
if (_fileRendererItem is not null)
|
||||
{
|
||||
if (s.RendererWord is not null && Equals(_fileRendererItem.Tag, s.RendererWord))
|
||||
{
|
||||
RenderEngineCb.SelectedItem = _fileRendererItem;
|
||||
return;
|
||||
}
|
||||
RenderEngineCb.Items.Remove(_fileRendererItem);
|
||||
_fileRendererItem = null;
|
||||
}
|
||||
|
||||
if (s.RendererWord is { } word)
|
||||
{
|
||||
_fileRendererItem = new ComboBoxItem { Tag = word, Content = word };
|
||||
RenderEngineCb.Items.Add(_fileRendererItem);
|
||||
RenderEngineCb.SelectedItem = _fileRendererItem;
|
||||
}
|
||||
else
|
||||
RenderEngineCb.SelectedIndex = s.RenderEngine;
|
||||
}
|
||||
|
||||
// ── How the simulator shows: full screen, borderless or in a window ──────
|
||||
|
||||
private const string FullscreenMode = "fullscreen";
|
||||
|
||||
@@ -416,9 +416,19 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
|
||||
// A reloaded file may name another simulator, or start a server.
|
||||
RefreshDerivedRows();
|
||||
UpdateUnknownValues();
|
||||
UpdateGpuNote();
|
||||
NoteShownValues();
|
||||
// The language is the starter's to keep (App.Initialize), and a value written another way is no unknown one.
|
||||
var store = AppServices.Current.SettingsStore;
|
||||
_unlikeOnScreen = new HashSet<string>(
|
||||
_shownUnlikeSettings.Where(pair => !string.Equals(pair.Key, "lang", StringComparison.OrdinalIgnoreCase) &&
|
||||
!store.FileMeans(pair.Key, pair.Value.Shown))
|
||||
.Select(pair => pair.Key),
|
||||
StringComparer.OrdinalIgnoreCase);
|
||||
ShowFileValueItems(FileValues());
|
||||
// A list at the file's value now hands over what the settings hold.
|
||||
NoteShownValues();
|
||||
UpdateUnknownValues();
|
||||
UpdatePresetMarks();
|
||||
}
|
||||
|
||||
@@ -533,12 +543,24 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
/// Puts <paramref name="s"/> on the screen as edits waiting for Save: what it
|
||||
/// changes marks the screen dirty, as a change by hand would.
|
||||
/// </summary>
|
||||
private void ShowAsEdits(SimulatorSettings s)
|
||||
/// <param name="chosen">The keys these edits choose; a list at the file's value keeps it for any other.</param>
|
||||
private void ShowAsEdits(SimulatorSettings s, IReadOnlyCollection<string> chosen)
|
||||
{
|
||||
var store = AppServices.Current.SettingsStore;
|
||||
var held = store.Render(AppServices.Current.Settings);
|
||||
var shown = store.Render(s);
|
||||
var atFileValue = FileValueLists()
|
||||
.Where(pair => ShowsFileValue(pair.List) && !chosen.Contains(pair.Key, StringComparer.OrdinalIgnoreCase) &&
|
||||
held.GetValueOrDefault(pair.Key) == shown.GetValueOrDefault(pair.Key))
|
||||
.Select(pair => (pair.List, Item: pair.List.SelectedItem))
|
||||
.ToList();
|
||||
|
||||
_showingEdits = true;
|
||||
try
|
||||
{
|
||||
ShowValues(s);
|
||||
foreach (var (list, item) in atFileValue)
|
||||
list.SelectedItem = item;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -628,7 +650,7 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
{
|
||||
var trial = Trial();
|
||||
var applied = _presetMemory.Apply(preset, trial);
|
||||
ShowAsEdits(trial);
|
||||
ShowAsEdits(trial, applied.ChosenKeys.ToList());
|
||||
|
||||
// Chosen as a whole, its values are choices, not ones the screen could not show.
|
||||
ForgetShown(applied.ChosenKeys);
|
||||
@@ -640,7 +662,7 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
private void ApplyGroupLevel(GraphicsGroup group, GraphicsPreset level)
|
||||
{
|
||||
var trial = Groups.Apply(group, level, Trial());
|
||||
ShowAsEdits(trial);
|
||||
ShowAsEdits(trial, group.Keys.ToList());
|
||||
foreach (string key in group.Keys.Where(key => SimulatorKeys.All.Any(known => known.Key == key)))
|
||||
_keyRows.Show(key, SimulatorKeys.Named(key).RawIn(trial));
|
||||
|
||||
@@ -825,9 +847,11 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
private void NoteShownValues() =>
|
||||
_shownUnlikeSettings = AppServices.Current.SettingsStore.ShownUnlike(Trial());
|
||||
|
||||
/// <summary><paramref name="keys"/> are the player's choice now: a value of the file the screen could not show goes on a save.</summary>
|
||||
private void ForgetShown(IEnumerable<string> keys)
|
||||
{
|
||||
var forgotten = new HashSet<string>(keys, StringComparer.OrdinalIgnoreCase);
|
||||
AppServices.Current.SettingsStore.Choose(forgotten);
|
||||
_shownUnlikeSettings = _shownUnlikeSettings
|
||||
.Where(pair => !forgotten.Contains(pair.Key))
|
||||
.ToDictionary(pair => pair.Key, pair => pair.Value, StringComparer.OrdinalIgnoreCase);
|
||||
@@ -855,7 +879,7 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
}
|
||||
|
||||
private string SelectedRenderer() =>
|
||||
SimulatorSettings.RenderEngines.ElementAtOrDefault(RenderEngineCb.SelectedIndex) ?? "full";
|
||||
SelectedTag(RenderEngineCb) ?? SimulatorSettings.RenderEngines.ElementAtOrDefault(RenderEngineCb.SelectedIndex) ?? "full";
|
||||
|
||||
private RendererKind SelectedRendererKind() => Renderers.KindOf(SelectedRenderer());
|
||||
|
||||
@@ -882,7 +906,8 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
s.InvertMouseVertical = IsChecked(MouseVertInvertCb);
|
||||
|
||||
s.IgnoreGamepad = IsChecked(GamepadIgnoreCb);
|
||||
s.FeedbackMode = Math.Max(0, FeedbackCb.SelectedIndex);
|
||||
// A list at the file's own value leaves the setting as it was read.
|
||||
if (!ShowsFileValue(FeedbackCb)) s.FeedbackMode = Math.Max(0, FeedbackCb.SelectedIndex);
|
||||
s.FeedbackPort = (int)(FeedbackPortNud.Value ?? 888);
|
||||
CaptureUart(s);
|
||||
|
||||
@@ -894,7 +919,7 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
s.LogMissingVehicleFiles = IsChecked(LogMissingVehicleFilesCb);
|
||||
|
||||
CaptureGraphics(s);
|
||||
s.Gpu = SelectedGpu();
|
||||
if (!ShowsFileValue(GpuCb)) s.Gpu = SelectedGpu();
|
||||
ReadResolution(s);
|
||||
s.BufferScalePercent = (int)bufferScale.Value;
|
||||
s.MaxTextureSize = 1 << (int)textureResolutionSlider.Value;
|
||||
@@ -915,8 +940,8 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
s.ShadowMapResolution = 1 << (int)shaderResolutionSlider.Value;
|
||||
s.ShadowProjectionRange = (int)shaderRange.Value;
|
||||
s.CabShadowsRange = (int)_cabShadows.Value;
|
||||
s.ShadowRankCutoff = Math.Max(0, ShadowDisplayCb.SelectedIndex) + 1;
|
||||
s.ReflectionsFidelity = Math.Max(0, ReflectionsDetailsCb.SelectedIndex);
|
||||
if (!ShowsFileValue(ShadowDisplayCb)) s.ShadowRankCutoff = Math.Max(0, ShadowDisplayCb.SelectedIndex) + 1;
|
||||
if (!ShowsFileValue(ReflectionsDetailsCb)) s.ReflectionsFidelity = Math.Max(0, ReflectionsDetailsCb.SelectedIndex);
|
||||
s.FieldOfView = Math.Clamp((int)fovSlider.Value, 10, 75);
|
||||
s.PythonScreens = IsChecked(RenderScreensCb);
|
||||
s.PythonThreadedUpload = IsChecked(RenderScreensThreadCb);
|
||||
@@ -951,11 +976,13 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
s.AmbientVolume = (int)AmbientVolumeSlider.Value;
|
||||
s.SkipPipeline = IsChecked(SkipPipelineCb);
|
||||
s.DebugLogVisible = IsChecked(DebugLogVisibleCb);
|
||||
if (!ShowsFileValue(PyScreenPriorityCb))
|
||||
s.PythonScreenUpdateRate = ParsePriorityTag((PyScreenPriorityCb.SelectedItem as ComboBoxItem)?.Tag);
|
||||
|
||||
s.AutoCloseStarter = IsChecked(AutoCloseStarterCb);
|
||||
s.LargeThumbnails = IsChecked(LargeThumbnailsCb);
|
||||
s.AutoExpandSceneryTree = IsChecked(AutoExpandTreeCb);
|
||||
if (!ShowsFileValue(ReadyOverrideCb))
|
||||
s.ReadyOverride = (ConsistReadyOverride)Math.Clamp(ReadyOverrideCb.SelectedIndex, 0, 2);
|
||||
|
||||
s.CompressTextures = IsChecked(CompressTexCb);
|
||||
@@ -1420,6 +1447,8 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
|
||||
store.KeepCopy(".before-standard");
|
||||
var moved = AdvancedKeys();
|
||||
// A value the starter does not know, or a control cannot show, is put right too.
|
||||
moved.UnionWith(FileValues().Keys);
|
||||
moved.ExceptWith(SettingsStore.KeptOnMoveToStandard);
|
||||
_clamping = true;
|
||||
try
|
||||
@@ -1447,7 +1476,7 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
/// <summary>Puts <paramref name="keys"/> at the simulator's own values, as edits waiting for Save.</summary>
|
||||
private void ShowDefaults(IReadOnlyCollection<string> keys)
|
||||
{
|
||||
ShowAsEdits(AppServices.Current.SettingsStore.WithDefaults(Trial(), keys));
|
||||
ShowAsEdits(AppServices.Current.SettingsStore.WithDefaults(Trial(), keys), keys);
|
||||
foreach (string key in keys)
|
||||
_keyRows.ShowDefault(key);
|
||||
// Put back by hand, a value is a choice like any other.
|
||||
@@ -1505,10 +1534,86 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
|
||||
private bool Advanced => AppServices.Current.Settings.AdvancedSettings;
|
||||
|
||||
/// <summary>Under each setting, the value of eu07.ini for it the starter cannot read, as the file has it.</summary>
|
||||
/// <summary>A value of eu07.ini a list does not offer, listed under the file's own words.</summary>
|
||||
private sealed record FileValue(string Raw);
|
||||
|
||||
/// <summary>The lists that take a value of the file they do not offer, with their keys.</summary>
|
||||
private IEnumerable<(ComboBox List, string Key)> FileValueLists() => new[]
|
||||
{
|
||||
(FeedbackCb, "feedbackmode"), (GpuCb, "starter.gpu"), (ShadowDisplayCb, "gfx.shadow.rank.cutoff"),
|
||||
(ReflectionsDetailsCb, "gfx.reflections.fidelity"), (PyScreenPriorityCb, "python.updatetime"),
|
||||
(ReadyOverrideCb, "starter.batterydefault"), (AntiAliasingCb, "multisampling")
|
||||
};
|
||||
|
||||
private static bool ShowsFileValue(ComboBox list) => list.SelectedItem is ComboBoxItem { Tag: FileValue };
|
||||
|
||||
// Keys the controls showed otherwise than the file has them when it was read.
|
||||
private HashSet<string> _unlikeOnScreen = new(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>
|
||||
/// The values of eu07.ini the starter does not know, or that a control cannot show, as the
|
||||
/// file writes them, but for those the player has set since.
|
||||
/// </summary>
|
||||
private Dictionary<string, string> FileValues()
|
||||
{
|
||||
var store = AppServices.Current.SettingsStore;
|
||||
var values = new Dictionary<string, string>(store.UnreadableValues(), StringComparer.OrdinalIgnoreCase);
|
||||
foreach (string key in _unlikeOnScreen)
|
||||
if (!values.ContainsKey(key) && store.FileValueOf(key) is { } raw)
|
||||
values[key] = raw;
|
||||
foreach (string key in values.Keys.Where(store.IsChosen).ToList())
|
||||
values.Remove(key);
|
||||
return values;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The lists put at the file's value where they do not offer it, chosen as it is until the player picks another.
|
||||
/// </summary>
|
||||
private void ShowFileValueItems(IReadOnlyDictionary<string, string> values)
|
||||
{
|
||||
WhileLoading(() =>
|
||||
{
|
||||
foreach (var (list, key) in FileValueLists())
|
||||
{
|
||||
foreach (var item in list.Items.OfType<ComboBoxItem>().Where(item => item.Tag is FileValue).ToList())
|
||||
list.Items.Remove(item);
|
||||
if (!values.TryGetValue(key, out string? raw))
|
||||
continue;
|
||||
var shown = new ComboBoxItem { Tag = new FileValue(raw), Content = raw };
|
||||
list.Items.Add(shown);
|
||||
list.SelectedItem = shown;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>The keys of the row <paramref name="control"/> sits in.</summary>
|
||||
private static string[] RowKeys(Control control) =>
|
||||
(control.FindLogicalAncestorOfType<SettingRow>()?.ConfigKey ?? string.Empty)
|
||||
.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
||||
|
||||
/// <summary>
|
||||
/// A control moved: its keys are the player's choice now, written as the screen has them -
|
||||
/// but for a list put back at the file's own value, which stays as the file has it.
|
||||
/// </summary>
|
||||
private void ChosenByHand(Control control)
|
||||
{
|
||||
if (_loading || _showingEdits)
|
||||
return;
|
||||
var keys = RowKeys(control);
|
||||
if (keys.Length == 0)
|
||||
return;
|
||||
if (control is ComboBox list &&
|
||||
(ShowsFileValue(list) || (_fileRendererItem is not null && ReferenceEquals(list.SelectedItem, _fileRendererItem))))
|
||||
AppServices.Current.SettingsStore.Unchoose(keys);
|
||||
else
|
||||
ForgetShown(keys);
|
||||
UpdateUnknownValues();
|
||||
}
|
||||
|
||||
/// <summary>Under each setting, the value of eu07.ini for it the starter does not know or cannot show, as the file has it.</summary>
|
||||
private void UpdateUnknownValues()
|
||||
{
|
||||
var unreadable = AppServices.Current.SettingsStore.UnreadableValues();
|
||||
var unreadable = FileValues();
|
||||
foreach (var row in SettingsStack.GetLogicalDescendants().OfType<SettingRow>())
|
||||
{
|
||||
var keys = (row.ConfigKey ?? string.Empty)
|
||||
@@ -1698,16 +1803,16 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
case { Tag: SimulatorKey }:
|
||||
break;
|
||||
case CheckBox cb:
|
||||
cb.IsCheckedChanged += (_, _) => OnControlChanged();
|
||||
cb.IsCheckedChanged += (_, _) => OnControlChanged(cb);
|
||||
break;
|
||||
case Slider slider:
|
||||
slider.ValueChanged += (_, _) => OnControlChanged();
|
||||
slider.ValueChanged += (_, _) => OnControlChanged(slider);
|
||||
break;
|
||||
case ComboBox combo:
|
||||
combo.SelectionChanged += (_, _) => OnControlChanged();
|
||||
combo.SelectionChanged += (_, _) => OnControlChanged(combo);
|
||||
break;
|
||||
case NumericUpDown nud:
|
||||
nud.ValueChanged += (_, _) => OnControlChanged();
|
||||
nud.ValueChanged += (_, _) => OnControlChanged(nud);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1729,8 +1834,10 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
edited();
|
||||
};
|
||||
|
||||
private void OnControlChanged()
|
||||
private void OnControlChanged(Control? control = null)
|
||||
{
|
||||
if (control is not null)
|
||||
ChosenByHand(control);
|
||||
MarkDirty();
|
||||
QueuePresetMarks();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user