diff --git a/StarterNG.Tests/ExternalIniTests.cs b/StarterNG.Tests/ExternalIniTests.cs
index 7086035..55a4655 100644
--- a/StarterNG.Tests/ExternalIniTests.cs
+++ b/StarterNG.Tests/ExternalIniTests.cs
@@ -71,17 +71,17 @@ public class ExternalIniTests
[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.
+ // Notepad: "gfxrenderer null", a word the starter does not offer.
var installation = WithIni("gfxrenderer default\nfieldofview 45\n");
- Edited(installation, "gfxrenderer vulkan\nfieldofview 45\n");
+ Edited(installation, "gfxrenderer null\nfieldofview 45\n");
installation.SettingsStore.Settings.FieldOfView = 60;
installation.SettingsStore.Save();
string saved = installation.Files.ReadAllText(UserIni);
- Assert.Contains("gfxrenderer vulkan", saved);
+ Assert.Contains("gfxrenderer null", saved);
Assert.Contains("fieldofview 60", saved);
- Assert.Equal("vulkan", installation.SettingsStore.Settings.RendererWord);
+ Assert.Equal("null", installation.SettingsStore.Settings.RendererWord);
}
[Fact]
@@ -188,8 +188,9 @@ public class ExternalIniTests
string saved = installation.Files.ReadAllText(UserIni);
Assert.Contains("maxcabtexturesize 4096", saved);
Assert.Contains("shadowtune 4096 250 400 300", saved);
- Assert.Contains("gfx.framebuffer.width 1920", saved);
- Assert.Contains("gfx.framebuffer.height 1080", saved);
+ // The render scale is the simulator's own key now, at the whole window.
+ Assert.Contains("gfx.buffer.percent 1", saved);
+ Assert.DoesNotContain("\ngfx.framebuffer.width", "\n" + saved);
Assert.Contains("fieldofview 50", saved);
}
diff --git a/StarterNG.Tests/GraphicsPresetTests.cs b/StarterNG.Tests/GraphicsPresetTests.cs
index 6de00f4..f039a85 100644
--- a/StarterNG.Tests/GraphicsPresetTests.cs
+++ b/StarterNG.Tests/GraphicsPresetTests.cs
@@ -13,98 +13,199 @@ public class GraphicsPresetTests
return installation.SettingsStore.Settings;
}
- private static SimulatorSettings AtHigh()
+ private static SimulatorSettings At(GraphicsPreset preset)
{
var settings = Defaults().Copy();
- GraphicsPreset.High.ApplyTo(settings);
+ preset.ApplyTo(settings);
return settings;
}
+ private static SimulatorSettings AtHigh() => At(GraphicsPreset.High);
+
+ /// The keys two renderings give different values, a key one leaves out at its default.
+ private static IEnumerable Differing(IReadOnlyDictionary one, IReadOnlyDictionary other)
+ {
+ string? Value(IReadOnlyDictionary keys, string key) =>
+ keys.TryGetValue(key, out string? value) ? value : SimulatorKeys.All.FirstOrDefault(k => k.Key == key)?.Default;
+ return one.Keys.Union(other.Keys).Where(key => Value(one, key) != Value(other, key));
+ }
+
[Fact]
- public void The_keys_named_are_the_keys_a_level_sets()
+ public void A_level_sets_no_key_but_those_it_names()
{
var store = new TestInstallation().SettingsStore;
- var low = Defaults().Copy();
- var top = Defaults().Copy();
- (GraphicsPreset.Minimal with { Extras = null }).ApplyTo(low);
- (GraphicsPreset.Ultra with { Extras = null, Top = null }).ApplyTo(top);
+ var own = store.Render(Defaults());
+ foreach (var preset in GraphicsPreset.All)
+ Assert.Empty(Differing(own, store.Render(At(preset))).Except(GraphicsPreset.AllKeys));
+ }
- var lowKeys = store.Render(low);
- var topKeys = store.Render(top);
- var differing = lowKeys.Keys.Union(topKeys.Keys)
- .Where(key => lowKeys.GetValueOrDefault(key) != topKeys.GetValueOrDefault(key));
+ [Fact]
+ public void Every_key_of_a_level_belongs_to_one_part_or_to_the_anti_aliasing()
+ {
+ var inGroups = GraphicsGroup.All.SelectMany(group => group.Keys).ToList();
- Assert.Equal(GraphicsPreset.Keys.OrderBy(k => k), differing.OrderBy(k => k));
+ Assert.Equal(inGroups.Distinct(), inGroups);
+ Assert.Empty(GraphicsPreset.All.SelectMany(preset => preset.Keys.Keys).Except(inGroups));
}
// ── The scale ────────────────────────────────────────────────────────────
- private static void Climbs(Func value, int repeatsAllowed)
+ private static void Climbs(Func value)
{
var values = GraphicsPreset.All.Select(value).ToList();
-
Assert.Equal(values.OrderBy(v => v), values);
- Assert.True(values.Count - values.Distinct().Count() <= repeatsAllowed, string.Join(", ", values));
}
[Fact]
- public void Every_slider_moves_from_level_to_level_as_far_as_it_has_steps_for_six()
+ public void Every_part_of_the_picture_gets_better_or_stays_from_level_to_level()
{
- // Sizes and filtering run out of steps above High.
- Climbs(p => p.TextureSize, 1);
- Climbs(p => p.CabTextureSize, 2);
- Climbs(p => p.Anisotropy, 1);
+ Climbs(p => p.TextureSize);
+ Climbs(p => p.CabTextureSize);
+ Climbs(p => p.Anisotropy);
+ Climbs(p => p.ShadowMap);
+ Climbs(p => p.ShadowRange);
+ Climbs(p => p.ShadowRank);
+ Climbs(p => p.ReflectionsFidelity);
+ Climbs(p => p.ReflectionsRate);
+ Climbs(p => p.SplineFidelity);
+ Climbs(p => p.DrawRangeFactor);
+ Climbs(p => p.SmokeFidelity);
- // Four steps or three for six levels.
- Climbs(p => (int)p.AntiAliasing, 2);
- Climbs(p => p.SmokeFidelity, 2);
- Climbs(p => p.SplineFidelity, 2);
- Climbs(p => p.ReflectionsFidelity, 3);
- Climbs(p => p.ShadowRank, 3);
-
- // The simulator takes no more than its own 7 lights.
- Climbs(p => p.DynamicLights, 2);
- Climbs(p => p.DrawRangeFactor, 3);
- Climbs(p => p.CabShadowsRange, 1);
-
- Climbs(p => p.ShadowMap, 2);
- Climbs(p => p.ShadowRange, 1);
- // The old starter's steps begin at once a second: the lower levels share it.
- Climbs(p => p.ReflectionsRate, 2);
- }
-
- [Fact]
- public void No_step_up_a_scale_is_more_than_a_few_steps_of_its_slider()
- {
- // In steps of what the screen offers, so Ultra does not jump to the top from far below.
- var rates = GraphicsPreset.All.Select(p => Steps.IndexOf(SliderRanges.ReflectionUpdates, p.ReflectionsRate)).ToList();
- Assert.All(rates.Zip(rates.Skip(1)), step => Assert.InRange(step.Second - step.First, 0, 2));
-
- foreach (Func fidelity in new Func[] { p => p.SmokeFidelity, p => p.SplineFidelity })
+ foreach (string name in GraphicsPreset.Low.Keys.Keys)
{
- var levels = GraphicsPreset.All.Select(fidelity).ToList();
- Assert.All(levels.Zip(levels.Skip(1)), step => Assert.InRange(step.Second - step.First, 0, 1));
+ var key = SimulatorKeys.Named(name);
+ Climbs(p => key.Kind switch
+ {
+ SimulatorKeyKind.Choice => key.ChoiceIndex(p.Keys[name]),
+ SimulatorKeyKind.Toggle => SimulatorKey.ParseToggle(p.Keys[name]) ? 1 : 0,
+ _ => key.ParseNumber(p.Keys[name])
+ });
}
}
[Fact]
- public void High_is_the_simulators_own_but_where_that_is_the_bottom_of_a_scale()
+ public void Every_level_sets_the_same_keys()
{
- var store = new TestInstallation().SettingsStore;
- var own = store.Render(Defaults());
- var high = store.Render(AtHigh());
-
- var differing = own.Keys.Union(high.Keys)
- .Where(key => own.GetValueOrDefault(key) != high.GetValueOrDefault(key));
-
- Assert.Equal(new[] { "gfx.reflections.fidelity", "gfx.reflections.framerate", "gfx.shadows.cab.range",
- "gfx.smoke.fidelity", "splinefidelity" }, differing.OrderBy(k => k));
- Assert.Equal(1, Defaults().SmokeFidelity);
- Assert.Equal(1, Defaults().SplineFidelity);
+ foreach (var preset in GraphicsPreset.All)
+ Assert.Equal(GraphicsPreset.High.Keys.Keys.OrderBy(k => k), preset.Keys.Keys.OrderBy(k => k));
}
[Fact]
- public void A_player_with_no_settings_of_their_own_starts_at_high()
+ public void Every_value_of_a_level_is_one_its_row_offers()
+ {
+ foreach (var preset in GraphicsPreset.All)
+ foreach (var (name, value) in preset.Keys)
+ {
+ var key = SimulatorKeys.Named(name);
+ switch (key.Kind)
+ {
+ case SimulatorKeyKind.Choice:
+ Assert.True(key.ChoiceIndex(value) >= 0, $"{preset.NameKey} {name} {value}");
+ break;
+ case SimulatorKeyKind.Number:
+ Assert.InRange(key.ParseNumber(value), key.Minimum, key.Maximum);
+ break;
+ }
+ }
+ }
+
+ [Fact]
+ public void High_is_the_simulators_own_but_for_the_smoke_and_the_track_curves()
+ {
+ var store = new TestInstallation().SettingsStore;
+
+ var differing = Differing(store.Render(Defaults()), store.Render(AtHigh()));
+
+ Assert.Equal(new[] { "gfx.smoke.fidelity", "splinefidelity" }, differing.OrderBy(k => k, StringComparer.Ordinal));
+ }
+
+ [Fact]
+ public void Very_high_is_not_everything_at_its_top()
+ {
+ var top = GraphicsPreset.VeryHigh;
+
+ Assert.True(top.AntiAliasing <= AntiAliasingMode.Msaa4);
+ Assert.True(top.ShadowMap <= 4096);
+ Assert.False(top.Keys.ContainsKey("gfx.raytracing"));
+ Assert.NotEqual("ultra", top.Keys["gfx.clouds"]);
+ Assert.NotEqual("ultra", top.Keys["gfx.fog.quality"]);
+ }
+
+ [Fact]
+ public void Low_draws_no_screen_space_effects()
+ {
+ Assert.Equal(AntiAliasingMode.Off, GraphicsPreset.Low.AntiAliasing);
+ Assert.Equal("no", GraphicsPreset.Low.Keys["gfx.ssr"]);
+ Assert.Equal("no", GraphicsPreset.Low.Keys["gfx.postfx.ao"]);
+ Assert.Equal("no", GraphicsPreset.Low.Keys["gfx.contactshadows"]);
+ }
+
+ [Fact]
+ public void Every_level_sits_on_the_steps_the_screen_offers()
+ {
+ foreach (var preset in GraphicsPreset.All)
+ {
+ Assert.True(Steps.IndexOf(Steps.Anisotropy, preset.Anisotropy) >= 0, preset.NameKey);
+ Assert.True(Steps.IndexOf(SliderRanges.ReflectionUpdates, preset.ReflectionsRate) >= 0, preset.NameKey);
+ Assert.True(Steps.IndexOf(SliderRanges.DrawRangeFactors, preset.DrawRangeFactor) >= 0, preset.NameKey);
+ foreach (int size in new[] { preset.TextureSize, preset.CabTextureSize, preset.ShadowMap })
+ Assert.True(size is >= 512 and <= 8192 && (size & (size - 1)) == 0, preset.NameKey);
+ Assert.True(preset.CabTextureSize <= GraphicsRules.MaxCabTextureSize, preset.NameKey);
+ Assert.True(preset.ShadowRange >= SimulatorSettings.ShadowRangeFloor(preset.ShadowMap), preset.NameKey);
+ Assert.True(preset.ShadowRange <= GraphicsRules.MaxShadowRange, preset.NameKey);
+ }
+ }
+
+ [Fact]
+ public void A_level_leaves_the_screen_and_the_matters_of_taste_as_they_are()
+ {
+ var settings = Defaults().Copy();
+ settings.MotionBlur = false;
+ settings.ChromaticAberration = false;
+ settings.Smoke = false;
+ settings.PythonScreens = false;
+ settings.FieldOfView = 60;
+ settings.BufferScalePercent = 75;
+ settings.Backend = GraphicsBackend.OpenGL;
+
+ GraphicsPreset.VeryHigh.ApplyTo(settings);
+
+ Assert.False(settings.MotionBlur);
+ Assert.False(settings.ChromaticAberration);
+ Assert.False(settings.Smoke);
+ Assert.False(settings.PythonScreens);
+ Assert.Equal(60, settings.FieldOfView);
+ Assert.Equal(75, settings.BufferScalePercent);
+ Assert.Equal(GraphicsBackend.OpenGL, settings.Backend);
+ }
+
+ [Fact]
+ public void A_level_applied_is_recognised_until_one_value_moves()
+ {
+ foreach (var preset in GraphicsPreset.All)
+ {
+ var settings = At(preset);
+ Assert.Same(preset, GraphicsPreset.Matching(settings));
+
+ settings.Extra["gfx.ssr"] = preset.Keys["gfx.ssr"] == "high" ? "low" : "high";
+ Assert.Null(GraphicsPreset.Matching(settings));
+ }
+ }
+
+ [Fact]
+ public void A_level_is_recognised_with_its_words_written_as_numbers()
+ {
+ var settings = AtHigh();
+ settings.Extra["gfx.ssr"] = "2";
+ settings.Extra["gfx.lights.shadows"] = "2";
+
+ Assert.Same(GraphicsPreset.High, GraphicsPreset.Matching(settings));
+ }
+
+ // ── The first start ──────────────────────────────────────────────────────
+
+ [Fact]
+ public void A_player_with_no_settings_of_their_own_starts_at_high_on_vulkan()
{
var installation = new TestInstallation();
var store = installation.SettingsStore;
@@ -118,8 +219,10 @@ public class GraphicsPresetTests
var again = new TestInstallation(installation.Files).SettingsStore;
again.Load();
Assert.Same(GraphicsPreset.High, GraphicsPreset.Matching(again.Settings));
- // Nothing of an older starter to bring into the standard mode.
+ Assert.Equal(GraphicsBackend.Vulkan, again.Settings.Backend);
+ // Nothing of an older starter to bring into the standard mode, nor of an older layout.
Assert.True(again.Settings.MovedToStandard);
+ Assert.Equal(SimulatorSettings.CurrentRevision, again.Settings.Revision);
}
[Fact]
@@ -159,369 +262,10 @@ public class GraphicsPresetTests
Assert.Equal(first, installation.Files.ReadAllText(copy));
}
- [Fact]
- public void Ultra_is_the_top_of_what_the_old_starter_offered()
- {
- var ultra = GraphicsPreset.Ultra;
-
- Assert.Equal(8192, ultra.TextureSize);
- Assert.Equal(GraphicsRules.MaxCabTextureSize, ultra.CabTextureSize);
- Assert.Equal(8192, ultra.ShadowMap);
- Assert.Equal(GraphicsRules.MaxShadowRange, ultra.ShadowRange);
- Assert.Equal(Steps.Anisotropy.Max(), ultra.Anisotropy);
- Assert.Equal(AntiAliasingMode.Msaa8, ultra.AntiAliasing);
- Assert.Equal(SliderRanges.ReflectionUpdates.Max(), ultra.ReflectionsRate);
- Assert.Equal(4, ultra.SmokeFidelity);
- Assert.Equal(4, ultra.SplineFidelity);
- Assert.Equal(SliderRanges.DrawRangeFactors.Max(), ultra.DrawRangeFactor);
- Assert.Equal(100, ultra.CabShadowsRange);
-
- var extras = ultra.Extras!;
- Assert.Equal(200, extras.PythonUpdateMs);
- Assert.True(extras.MotionBlur && extras.ChromaticAberration && extras.Smoke);
-
- Assert.True(ultra.Top!.Screens);
- }
-
- [Fact]
- public void No_level_goes_past_what_the_old_starter_gave()
- {
- foreach (var preset in GraphicsPreset.All)
- {
- Assert.True(preset.ShadowRange <= GraphicsRules.MaxShadowRange, preset.NameKey);
- Assert.True(preset.CabTextureSize <= GraphicsRules.MaxCabTextureSize, preset.NameKey);
- }
- }
-
- [Fact]
- public void No_level_sets_what_only_the_advanced_mode_shows()
- {
- var set = GraphicsPreset.Keys.Concat(GraphicsExtras.Keys).Concat(GraphicsTop.Keys).ToList();
-
- // The rows of keys by name, the buffer and the resources are all the advanced mode's.
- Assert.Empty(set.Intersect(SimulatorKeys.All.Select(key => key.Key)));
- Assert.Empty(set.Intersect(new[] { "starter.bufferscale", "gfx.framebuffer.width", "gfx.framebuffer.height",
- "compresstex", "python.mipmaps", "gfx.skippipeline" }));
- }
-
- [Fact]
- public void A_level_leaves_what_only_the_advanced_mode_shows_as_it_is()
- {
- foreach (var preset in GraphicsPreset.All)
- {
- var settings = Defaults().Copy();
- settings.BufferScalePercent = 80;
- settings.CompressTextures = false;
- settings.ScreenMipmaps = false;
- settings.Extra["basedrawrange"] = "3000";
- settings.Extra["targetfps"] = "60";
-
- preset.ApplyTo(settings);
-
- Assert.Equal(80, settings.BufferScalePercent);
- Assert.False(settings.CompressTextures);
- Assert.False(settings.ScreenMipmaps);
- Assert.Equal("3000", settings.Extra["basedrawrange"]);
- Assert.Equal("60", settings.Extra["targetfps"]);
- Assert.Same(preset, GraphicsPreset.Matching(settings));
- }
- }
-
- [Fact]
- public void At_ultra_the_shadows_are_longest()
- {
- // The bottom of that scale.
- Assert.Equal(0.2, GraphicsPreset.Ultra.Top!.ShadowAngleLimit);
- }
-
- [Fact]
- public void Ultra_undoes_what_was_moved_earlier()
- {
- var settings = Defaults().Copy();
- settings.ShadowAngleLimit = 0.8;
- settings.IgnoreIrrelevantTrains = true;
- settings.PythonScreens = false;
-
- GraphicsPreset.Ultra.ApplyTo(settings);
-
- Assert.Same(GraphicsPreset.Ultra, GraphicsPreset.Matching(settings));
- Assert.Equal(0.2, settings.ShadowAngleLimit);
- Assert.True(settings.PythonScreens);
- Assert.True(settings.IgnoreIrrelevantTrains);
- }
-
- [Fact]
- public void Ultra_leaves_the_screens_in_their_own_windows_to_the_player()
- {
- var settings = Defaults().Copy();
- settings.Extra["python.displaywindows"] = "yes";
-
- GraphicsPreset.Ultra.ApplyTo(settings);
-
- Assert.Equal("yes", settings.Extra["python.displaywindows"]);
- Assert.Same(GraphicsPreset.Ultra, GraphicsPreset.Matching(settings));
- }
-
- [Fact]
- public void The_other_levels_leave_what_only_ultra_sets()
- {
- foreach (var preset in GraphicsPreset.All.Where(preset => preset != GraphicsPreset.Ultra))
- {
- var settings = Defaults().Copy();
- settings.IgnoreIrrelevantTrains = true;
- settings.ShadowAngleLimit = 0.8;
-
- preset.ApplyTo(settings);
-
- Assert.True(settings.IgnoreIrrelevantTrains, preset.NameKey);
- Assert.Equal(0.8, settings.ShadowAngleLimit);
- Assert.Same(preset, GraphicsPreset.Matching(settings));
- }
- }
-
- [Fact]
- public void Ultra_is_not_recognised_with_one_of_its_values_moved()
- {
- var settings = Defaults().Copy();
- GraphicsPreset.Ultra.ApplyTo(settings);
- Assert.Same(GraphicsPreset.Ultra, GraphicsPreset.Matching(settings));
-
- settings.ReflectionsFramerate = 25;
-
- Assert.Null(GraphicsPreset.Matching(settings));
- }
-
- [Fact]
- public void Shadows_reach_further_with_every_level_that_has_them()
- {
- static double Reach(GraphicsPreset preset) =>
- SimulatorSettings.ShadowReach(preset.ShadowRange, preset.ShadowMap, legacyRenderer: false);
-
- var reaches = GraphicsPreset.All.Where(preset => preset.Shadows).Select(Reach).ToList();
-
- Assert.Equal(reaches.Distinct().OrderBy(reach => reach), reaches);
- Assert.Equal(250, Reach(GraphicsPreset.High));
- Assert.Equal(800, Reach(GraphicsPreset.VeryHigh));
- }
-
- [Fact]
- public void Without_extras_the_settings_are_what_the_simulator_goes_by()
- {
- Assert.Equal(GraphicsExtras.None, GraphicsExtras.Of(Defaults()));
- Assert.Equal(GraphicsTop.None, GraphicsTop.Of(Defaults()));
- }
-
- [Fact]
- public void A_level_leaves_what_only_the_lowest_one_sets()
- {
- var settings = Defaults().Copy();
- settings.MotionBlur = false;
-
- GraphicsPreset.Low.ApplyTo(settings);
-
- Assert.False(settings.MotionBlur);
- Assert.Same(GraphicsPreset.Low, GraphicsPreset.Matching(settings));
- }
-
- [Fact]
- public void Every_level_is_within_what_the_sliders_offer()
- {
- foreach (var preset in GraphicsPreset.All)
- {
- Assert.True(preset.TextureSize >= SliderRanges.MinTextureSize, preset.NameKey);
- Assert.True(preset.ShadowMap >= SliderRanges.MinShadowMap, preset.NameKey);
- Assert.True(preset.DynamicLights >= SliderRanges.MinDynamicLights, preset.NameKey);
- Assert.Contains(preset.ReflectionsRate, SliderRanges.ReflectionUpdates);
- }
- }
-
- [Fact]
- public void The_lowest_level_is_not_recognised_with_one_of_its_extras_undone()
- {
- var settings = Defaults().Copy();
- GraphicsPreset.Minimal.ApplyTo(settings);
-
- settings.Smoke = true;
-
- Assert.Null(GraphicsPreset.Matching(settings));
- }
-
- [Fact]
- public void The_extras_sit_on_the_steps_the_screen_offers()
- {
- foreach (var extras in new[] { GraphicsPreset.Minimal.Extras!, GraphicsPreset.Ultra.Extras! })
- Assert.Contains(extras.PythonUpdateMs, new[] { 200, 400, 800, 1600 });
- }
-
- // ── Leaving an end of the scale ──────────────────────────────────────────
-
- [Fact]
- public void A_level_between_the_ends_chooses_only_its_own_keys()
- {
- var settings = Defaults().Copy();
- settings.MotionBlur = false;
- settings.ShadowAngleLimit = 0.8;
-
- var applied = new GraphicsPresetMemory().Apply(GraphicsPreset.Medium, settings);
-
- Assert.Same(GraphicsPreset.Medium, GraphicsPreset.Matching(settings));
- Assert.False(settings.MotionBlur);
- Assert.Equal(0.8, settings.ShadowAngleLimit);
- Assert.Equal(GraphicsPreset.Keys, applied.ChosenKeys);
- }
-
- [Fact]
- public void Leaving_the_lowest_level_brings_back_what_was_there_before_it()
- {
- var memory = new GraphicsPresetMemory();
- var settings = Defaults().Copy();
- settings.MotionBlur = false;
- var before = GraphicsExtras.Of(settings);
-
- var entering = memory.Apply(GraphicsPreset.Minimal, settings);
- Assert.Equal(GraphicsPreset.Minimal.Extras, GraphicsExtras.Of(settings));
- Assert.Equal(GraphicsPreset.Keys.Concat(GraphicsExtras.Keys), entering.ChosenKeys);
-
- var leaving = memory.Apply(GraphicsPreset.Medium, settings);
-
- Assert.Equal(before, GraphicsExtras.Of(settings));
- Assert.Same(GraphicsPreset.Medium, GraphicsPreset.Matching(settings));
- Assert.Equal(GraphicsPreset.Keys.Concat(GraphicsExtras.Keys), leaving.ChosenKeys);
- }
-
- [Fact]
- public void Leaving_ultra_brings_back_what_was_there_before_it()
- {
- var memory = new GraphicsPresetMemory();
- var settings = Defaults().Copy();
- settings.MotionBlur = false;
- settings.ShadowAngleLimit = 0.8;
- var extras = GraphicsExtras.Of(settings);
- var top = GraphicsTop.Of(settings);
-
- memory.Apply(GraphicsPreset.Ultra, settings);
- var applied = memory.Apply(GraphicsPreset.VeryHigh, settings);
-
- Assert.Equal(extras, GraphicsExtras.Of(settings));
- Assert.Equal(top, GraphicsTop.Of(settings));
- Assert.Same(GraphicsPreset.VeryHigh, GraphicsPreset.Matching(settings));
- Assert.Equal(GraphicsPreset.Keys.Concat(GraphicsExtras.Keys).Concat(GraphicsTop.Keys), applied.ChosenKeys);
- }
-
- [Fact]
- public void Leaving_an_end_chosen_before_this_run_gives_the_simulators_own_values()
- {
- var settings = Defaults().Copy();
- GraphicsPreset.Ultra.ApplyTo(settings);
-
- new GraphicsPresetMemory().Apply(GraphicsPreset.Low, settings);
-
- Assert.Equal(GraphicsExtras.None, GraphicsExtras.Of(settings));
- Assert.Equal(GraphicsTop.None, GraphicsTop.Of(settings));
- Assert.Same(GraphicsPreset.Low, GraphicsPreset.Matching(settings));
- }
-
- [Fact]
- public void One_end_to_the_other_keeps_what_was_there_before_either()
- {
- var memory = new GraphicsPresetMemory();
- var settings = Defaults().Copy();
- settings.MotionBlur = false;
- settings.ShadowAngleLimit = 0.8;
- var extras = GraphicsExtras.Of(settings);
- var top = GraphicsTop.Of(settings);
-
- memory.Apply(GraphicsPreset.Minimal, settings);
- memory.Apply(GraphicsPreset.Ultra, settings);
- Assert.Same(GraphicsPreset.Ultra, GraphicsPreset.Matching(settings));
-
- memory.Apply(GraphicsPreset.Minimal, settings);
- Assert.Same(GraphicsPreset.Minimal, GraphicsPreset.Matching(settings));
- // Ultra's own values go, Minimal has no say over them.
- Assert.Equal(top, GraphicsTop.Of(settings));
-
- memory.Apply(GraphicsPreset.Medium, settings);
- Assert.Equal(extras, GraphicsExtras.Of(settings));
- }
-
- [Fact]
- public void What_was_remembered_comes_back_only_once()
- {
- var memory = new GraphicsPresetMemory();
- var settings = Defaults().Copy();
- settings.MotionBlur = false;
-
- memory.Apply(GraphicsPreset.Minimal, settings);
- memory.Apply(GraphicsPreset.Medium, settings);
- Assert.False(settings.MotionBlur);
-
- // Moved since, and no end left behind this time: it stays as moved.
- settings.MotionBlur = true;
- var applied = memory.Apply(GraphicsPreset.High, settings);
-
- Assert.True(settings.MotionBlur);
- Assert.Equal(GraphicsPreset.Keys, applied.ChosenKeys);
- }
-
- [Fact]
- public void A_level_applied_twice_at_an_end_remembers_what_came_before_the_first()
- {
- var memory = new GraphicsPresetMemory();
- var settings = Defaults().Copy();
- settings.MotionBlur = false;
- var before = GraphicsExtras.Of(settings);
-
- memory.Apply(GraphicsPreset.Minimal, settings);
- memory.Apply(GraphicsPreset.Minimal, settings);
- memory.Apply(GraphicsPreset.Low, settings);
-
- Assert.Equal(before, GraphicsExtras.Of(settings));
- }
-
- [Fact]
- public void A_level_applied_is_recognised_until_one_value_moves()
- {
- foreach (var preset in GraphicsPreset.All)
- {
- var settings = Defaults().Copy();
- preset.ApplyTo(settings);
- Assert.Same(preset, GraphicsPreset.Matching(settings));
-
- settings.DynamicLights = 6;
- Assert.Null(GraphicsPreset.Matching(settings));
- }
- }
-
- [Fact]
- public void Every_level_sits_on_the_steps_the_screen_offers()
- {
- foreach (var preset in GraphicsPreset.All)
- {
- Assert.True(Steps.IndexOf(Steps.Anisotropy, preset.Anisotropy) >= 0, preset.NameKey);
- Assert.True(Steps.IndexOf(SliderRanges.ReflectionUpdates, preset.ReflectionsRate) >= 0, preset.NameKey);
- Assert.True(Steps.IndexOf(SliderRanges.DrawRangeFactors, preset.DrawRangeFactor) >= 0, preset.NameKey);
- foreach (int size in new[] { preset.TextureSize, preset.CabTextureSize, preset.ShadowMap })
- Assert.True(size is >= 512 and <= 8192 && (size & (size - 1)) == 0, preset.NameKey);
- Assert.True(preset.ShadowRange >= SimulatorSettings.ShadowRangeFloor(preset.ShadowMap), preset.NameKey);
- Assert.True(Steps.IndexOf(SliderRanges.CabShadowRanges, preset.CabShadowsRange) >= 0, preset.NameKey);
- }
- }
-
// ── A level for one part ─────────────────────────────────────────────────
private static GraphicsGroupLevels Groups() => new(new TestInstallation().SettingsStore);
- [Fact]
- public void Every_key_a_level_sets_but_those_of_the_whole_belongs_to_one_part()
- {
- var inGroups = GraphicsGroup.All.SelectMany(group => group.Keys).ToList();
-
- Assert.Equal(inGroups.Distinct(), inGroups);
- Assert.Empty(inGroups.Except(GraphicsPreset.Keys).Except(GraphicsExtras.Keys).Except(GraphicsTop.Keys));
- Assert.Equal(new[] { "dynamiclights", "gfx.extraeffects", "gfx.smoke.fidelity", "multisampling" },
- GraphicsPreset.Keys.Except(inGroups).OrderBy(key => key, StringComparer.Ordinal));
- }
-
[Fact]
public void One_part_moves_alone()
{
@@ -533,9 +277,10 @@ public class GraphicsPresetTests
Assert.Equal(GraphicsPreset.Low.ShadowMap, moved.ShadowMapResolution);
Assert.Equal(GraphicsPreset.Low.ShadowRange, moved.ShadowProjectionRange);
Assert.Equal(GraphicsPreset.Low.ShadowRank, moved.ShadowRankCutoff);
+ Assert.Equal("low", moved.Extra["gfx.lights.shadows"]);
Assert.Equal(settings.MaxTextureSize, moved.MaxTextureSize);
- Assert.Equal(settings.DynamicLights, moved.DynamicLights);
- Assert.Equal(settings.BufferScalePercent, moved.BufferScalePercent);
+ Assert.Equal(settings.Extra["gfx.ssr"], moved.Extra["gfx.ssr"]);
+ Assert.Equal(settings.AntiAliasing, moved.AntiAliasing);
var levels = groups.LevelsOf(moved);
Assert.Same(GraphicsPreset.Low, levels[GraphicsGroup.Shadows]);
@@ -544,12 +289,10 @@ public class GraphicsPresetTests
}
[Fact]
- public void Every_part_shows_ultra_when_the_whole_is_at_ultra()
+ public void Every_part_shows_the_level_the_whole_is_at()
{
- var settings = Defaults().Copy();
- GraphicsPreset.Ultra.ApplyTo(settings);
-
- Assert.All(Groups().LevelsOf(settings).Values, level => Assert.Same(GraphicsPreset.Ultra, level));
+ foreach (var preset in GraphicsPreset.All)
+ Assert.All(Groups().LevelsOf(At(preset)).Values, level => Assert.Same(preset, level));
}
[Fact]
@@ -565,17 +308,15 @@ public class GraphicsPresetTests
}
[Fact]
- public void Every_part_at_a_level_and_the_rest_with_it_is_that_level()
+ public void Every_part_at_a_level_and_the_anti_aliasing_with_it_is_that_level()
{
var groups = Groups();
- foreach (var level in GraphicsPreset.All.Where(level => level.Extras is null))
+ foreach (var level in GraphicsPreset.All)
{
var settings = Defaults().Copy();
foreach (var group in GraphicsGroup.All)
settings = groups.Apply(group, level, settings);
settings.AntiAliasing = level.AntiAliasing;
- settings.DynamicLights = level.DynamicLights;
- settings.SmokeFidelity = level.SmokeFidelity;
Assert.Same(level, GraphicsPreset.Matching(settings));
}
@@ -589,34 +330,4 @@ public class GraphicsPresetTests
foreach (var level in GraphicsPreset.All)
Assert.Same(level, groups.LevelsOf(groups.Apply(group, level, Defaults()))[group]);
}
-
- [Fact]
- public void Leaving_an_end_in_a_part_gives_the_simulators_own_for_what_only_the_end_sets()
- {
- var groups = Groups();
- var settings = AtHigh();
- settings.ShadowAngleLimit = 0.8;
-
- var ultra = groups.Apply(GraphicsGroup.Shadows, GraphicsPreset.Ultra, settings);
- Assert.Equal(0.2, ultra.ShadowAngleLimit);
- Assert.Same(GraphicsPreset.Ultra, groups.LevelsOf(ultra)[GraphicsGroup.Shadows]);
-
- var back = groups.Apply(GraphicsGroup.Shadows, GraphicsPreset.High, ultra);
- Assert.Equal(GraphicsTop.None.ShadowAngleLimit, back.ShadowAngleLimit);
- Assert.Same(GraphicsPreset.High, groups.LevelsOf(back)[GraphicsGroup.Shadows]);
- }
-
- [Fact]
- public void A_level_in_a_part_between_the_ends_leaves_what_only_an_end_sets()
- {
- var settings = AtHigh();
- settings.MotionBlur = false;
-
- settings.Smoke = false;
-
- var shadows = Groups().Apply(GraphicsGroup.Shadows, GraphicsPreset.VeryHigh, settings);
- Assert.False(shadows.Smoke);
- Assert.False(shadows.MotionBlur);
- Assert.Equal(GraphicsPreset.VeryHigh.ShadowMap, shadows.ShadowMapResolution);
- }
}
diff --git a/StarterNG.Tests/GraphicsSettingsTests.cs b/StarterNG.Tests/GraphicsSettingsTests.cs
index 1ac97dd..985207b 100644
--- a/StarterNG.Tests/GraphicsSettingsTests.cs
+++ b/StarterNG.Tests/GraphicsSettingsTests.cs
@@ -37,88 +37,95 @@ 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 the starter does not know is the file's own, written back as it is.
+ // As utilities/Globals.cpp has them; a word the simulator does not know is the file's own, written back as it is.
[Theory]
- [InlineData("default", "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", "experimental")]
- public void A_renderer_is_written_by_the_name_master_knows(string read, string written)
+ [InlineData("VULKAN14", "vulkan")]
+ [InlineData("default", "default")]
+ [InlineData("full", "default")]
+ [InlineData("gl46", "default")]
+ [InlineData("opengl", "default")]
+ [InlineData("legacy", "default")]
+ [InlineData("simple", "default")]
+ [InlineData("experimental", "default")]
+ [InlineData("null", "null")]
+ public void A_renderer_is_written_by_the_name_the_simulator_reads_it_as(string read, string written)
{
Assert.Equal($"gfxrenderer {written}", Line(Write(Read($"gfxrenderer {read}\n")), "gfxrenderer"));
}
[Fact]
- public void Without_a_renderer_in_the_file_the_full_one_is_chosen()
+ public void Without_a_renderer_in_the_file_vulkan_is_chosen_and_written()
{
- Assert.Equal(0, Read("").RenderEngine);
- Assert.Equal("gfxrenderer default", Line(Write(Read("")), "gfxrenderer"));
+ // The simulator's own is OpenGL: the starter writes Vulkan whatever the file had.
+ Assert.Equal(GraphicsBackend.Vulkan, Read("").Backend);
+ Assert.Equal("gfxrenderer vulkan", Line(Write(Read("")), "gfxrenderer"));
}
[Fact]
- public void An_older_renderer_stays_chosen_and_can_be_chosen_again()
+ public void Opengl_stays_chosen_and_vulkan_can_be_chosen_again()
{
- var installation = WithIni("gfxrenderer legacy\n");
+ var installation = WithIni("gfxrenderer default\n");
var store = installation.SettingsStore;
+ Assert.Equal(GraphicsBackend.OpenGL, store.Settings.Backend);
store.Settings.FieldOfView = 50;
store.Save();
- Assert.Contains("gfxrenderer legacy", installation.Files.ReadAllText(UserIni));
+ Assert.Contains("gfxrenderer default", installation.Files.ReadAllText(UserIni));
- store.Settings.RenderEngine = SimulatorSettings.RenderEngineOf("simple");
+ store.Settings.Backend = GraphicsBackend.Vulkan;
store.Save();
- Assert.Contains("gfxrenderer simple", installation.Files.ReadAllText(UserIni));
+ Assert.Equal("gfxrenderer vulkan", Line(installation.Files.ReadAllText(UserIni), "gfxrenderer"));
}
[Fact]
- public void Keys_only_the_legacy_renderer_or_windows_read_stay_in_the_file()
+ public void Keys_the_simulator_no_longer_goes_by_are_taken_out_on_a_save()
{
string[] old =
{
- "usevbo no", "gfx.angleplatform vulkan", "gfx.usegles yes", "gfx.shadows.cab.range 20"
+ "usevbo no", "gfx.angleplatform vulkan", "gfx.usegles yes", "gfx.shadows.cab.range 20", "shadows yes",
+ "skyenabled yes", "smoothtraction yes", "gfx.framebuffer.width 1280", "gfx.framebuffer.height 720",
+ "starter.bufferscale 100"
};
var installation = WithIni(string.Join("\n", old) + "\n");
- installation.SettingsStore.Settings.FieldOfView = 50;
installation.SettingsStore.Save();
string saved = installation.Files.ReadAllText(UserIni);
- Assert.All(old, line => Assert.Contains(line, saved));
+ Assert.All(old, line => Assert.Null(Line(saved, line.Split(' ')[0])));
}
[Fact]
- public void Keys_of_the_vulkan_renderer_master_does_not_have_stay_on_a_save()
+ public void Keys_of_the_new_renderers_are_kept_as_the_file_has_them()
{
string[] vulkan =
{
"gfx.antialiasing dlss", "gfx.dlss.preset k", "gfx.framegeneration x2", "gfx.reflex on",
"gfx.raytracing yes", "gfx.ssr high", "gfx.postfx.ao gtao", "gfx.clouds ultra", "gfx.grass yes",
- "gfx.buffer.percent 0.67", "gfx.vulkan.device RTX", "gfx.fog yes", "gfx.cabprobe medium"
+ "gfx.buffer.percent 0.67", "gfx.vulkan.device RTX", "gfx.fog yes", "gfx.cabprobe medium", "gfx.gpucull no"
};
- var installation = WithIni("calibratein 0 0 0 0\n" + string.Join("\n", vulkan) + "\n");
+ var installation = WithIni("calibratein 0 0 0 0\nmultisampling 0\n" + string.Join("\n", vulkan) + "\n");
installation.SettingsStore.Save();
string saved = installation.Files.ReadAllText(UserIni);
Assert.Contains("calibratein 0 0 0 0", saved);
- // 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])));
+ Assert.Equal(AntiAliasingMode.Dlss, installation.SettingsStore.Settings.AntiAliasing);
+ Assert.Equal(67, installation.SettingsStore.Settings.BufferScalePercent);
}
[Fact]
- public void Levels_leave_the_switches_only_an_older_simulator_reads()
+ public void The_faster_choices_the_simulator_does_not_make_itself_are_written()
{
- var s = new SimulatorSettings { UseVbo = false, UseGLES = true, RenderAngleVulkan = true };
+ var installation = WithIni("width 1280\n");
- GraphicsPreset.Ultra.ApplyTo(s);
+ installation.SettingsStore.Save();
- Assert.Equal((false, true, true), (s.UseVbo, s.UseGLES, s.RenderAngleVulkan));
+ string saved = installation.Files.ReadAllText(UserIni);
+ foreach (var key in SimulatorKeys.All.Where(key => key.Writes))
+ Assert.Equal($"{key.Key} {key.Default}", Line(saved, key.Key));
+ Assert.Equal("gfx.gpucull yes", Line(saved, "gfx.gpucull"));
}
[Theory]
@@ -127,20 +134,40 @@ public class GraphicsSettingsTests
[InlineData("multisampling 2\n", AntiAliasingMode.Msaa4)]
[InlineData("multisampling 3\n", AntiAliasingMode.Msaa8)]
[InlineData("", AntiAliasingMode.Msaa4)]
- public void Multisampling_is_read_as_master_reads_it(string text, AntiAliasingMode expected)
+ [InlineData("gfx.antialiasing taa\n", AntiAliasingMode.Taa)]
+ [InlineData("multisampling 3\ngfx.antialiasing taa\n", AntiAliasingMode.Taa)]
+ [InlineData("gfx.antialiasing taa\nmultisampling 3\n", AntiAliasingMode.Msaa8)]
+ [InlineData("multisampling 2\ngfx.antialiasing dlaa\n", AntiAliasingMode.Dlaa)]
+ [InlineData("multisampling 1\ngfx.antialiasing off\n", AntiAliasingMode.Off)]
+ public void The_anti_aliasing_is_read_from_the_key_further_down(string text, AntiAliasingMode expected)
{
Assert.Equal(expected, Read(text).AntiAliasing);
}
- [Fact]
- public void Multisampling_is_written_to_its_own_key_only()
+ [Theory]
+ [InlineData(AntiAliasingMode.Msaa2, "1", "msaax2")]
+ [InlineData(AntiAliasingMode.Taa, "0", "taa")]
+ [InlineData(AntiAliasingMode.Dlss, "0", "dlss")]
+ [InlineData(AntiAliasingMode.Off, "0", "off")]
+ public void The_anti_aliasing_is_written_to_both_keys(AntiAliasingMode mode, string multisampling, string word)
{
- var s = Read("multisampling 1\n");
+ string text = Write(new SimulatorSettings { AntiAliasing = mode });
- string text = Write(s);
+ Assert.Equal($"multisampling {multisampling}", Line(text, "multisampling"));
+ Assert.Equal($"gfx.antialiasing {word}", Line(text, "gfx.antialiasing"));
+ }
- Assert.Equal("multisampling 1", Line(text, "multisampling"));
- Assert.Null(Line(text, "gfx.antialiasing"));
+ [Fact]
+ public void A_save_puts_the_newer_anti_aliasing_key_below_the_older()
+ {
+ var installation = WithIni("gfx.antialiasing msaax4\nwidth 1280\nmultisampling 2\n");
+ installation.SettingsStore.Settings.AntiAliasing = AntiAliasingMode.Taa;
+
+ installation.SettingsStore.Save();
+
+ var lines = Lines(installation.Files.ReadAllText(UserIni)).ToList();
+ Assert.True(lines.IndexOf("gfx.antialiasing taa") > lines.IndexOf("multisampling 0"));
+ Assert.Equal(AntiAliasingMode.Taa, Read(installation.Files.ReadAllText(UserIni)).AntiAliasing);
}
[Fact]
@@ -154,113 +181,37 @@ public class GraphicsSettingsTests
}
[Fact]
- public void The_render_scale_is_the_starters_own_key_or_the_framebuffer_against_the_window()
+ public void The_render_scale_is_the_buffer_percent_or_what_an_older_starter_left()
{
+ Assert.Equal(50, Read("gfx.buffer.percent 0.5\n").BufferScalePercent);
+ Assert.Equal(75, Read("gfx.buffer.percent 75\n").BufferScalePercent);
Assert.Equal(75, Read("starter.bufferscale 75\n").BufferScalePercent);
Assert.Equal(50, Read("width 1920\ngfx.framebuffer.width 960\n").BufferScalePercent);
Assert.Equal(100, Read("").BufferScalePercent);
}
[Fact]
- public void The_render_scale_is_written_as_the_framebuffer_master_reads()
+ public void The_render_scale_is_written_as_the_buffer_percent()
{
var s = Read("width 1920\nheight 1080\nstarter.bufferscale 50\n");
string text = Write(s);
- Assert.Equal("gfx.framebuffer.width 960", Line(text, "gfx.framebuffer.width"));
- Assert.Equal("gfx.framebuffer.height 540", Line(text, "gfx.framebuffer.height"));
- Assert.Null(Line(text, "gfx.buffer.percent"));
- }
-
- // Borderless, the simulator takes the window's size from the monitor (application.cpp) and
- // leaves width and height unread; -1 is its own word for a buffer of the window's size
- // (opengl33renderer.cpp).
- [Fact]
- public void A_borderless_screen_draws_into_a_buffer_of_the_windows_own_size()
- {
- var s = Read("fullscreenwindowed yes\nwidth 1280\nheight 720\n");
-
- string text = Write(s);
-
- Assert.Equal("gfx.framebuffer.width -1", Line(text, "gfx.framebuffer.width"));
- Assert.Equal("gfx.framebuffer.height -1", Line(text, "gfx.framebuffer.height"));
- Assert.Equal("width 1280", Line(text, "width"));
- Assert.Equal(100, Read(text).BufferScalePercent);
- }
-
- [Fact]
- public void A_borderless_screen_with_a_smaller_buffer_takes_its_part_of_the_monitor()
- {
- var s = Read("fullscreenwindowed yes\nfullscreenmonitor HDMI-1:1920,0\nwidth 1280\nheight 720\nstarter.bufferscale 50\n");
- var asked = new List();
- var serializer = new SettingsSerializer(id =>
- {
- asked.Add(id);
- return (2560, 1440);
- });
- var c = new ConfigFile();
-
- serializer.Write(s, c);
-
- Assert.Equal("1280", c.GetRaw("gfx.framebuffer.width"));
- Assert.Equal("720", c.GetRaw("gfx.framebuffer.height"));
- Assert.Equal("50", c.GetRaw("starter.bufferscale"));
- Assert.Equal(new[] { "HDMI-1:1920,0" }, asked.Distinct());
- var read = new SimulatorSettings();
- serializer.Read(read, c);
- Assert.Equal(50, read.BufferScalePercent);
- }
-
- [Fact]
- public void A_borderless_screen_on_a_monitor_of_unknown_size_keeps_the_windows_own_buffer()
- {
- var s = Read("fullscreenwindowed yes\nwidth 1280\nheight 720\nstarter.bufferscale 50\n");
- var c = new ConfigFile();
-
- new SettingsSerializer(_ => null).Write(s, c);
-
- Assert.Equal("-1", c.GetRaw("gfx.framebuffer.width"));
- Assert.Equal("-1", c.GetRaw("gfx.framebuffer.height"));
- }
-
- [Fact]
- public void A_buffer_of_the_window_left_in_a_borderless_file_goes_on_a_save()
- {
- // As this starter wrote it before: the size of the resolution row, which borderless does not use.
- var installation = WithIni("fullscreenwindowed yes\nwidth 1280\nheight 720\nstarter.bufferscale 100\n" +
- "gfx.framebuffer.width 1280\ngfx.framebuffer.height 720\n");
-
- installation.SettingsStore.Save();
-
- string saved = installation.Files.ReadAllText(UserIni);
- Assert.Equal("gfx.framebuffer.width -1", Line(saved, "gfx.framebuffer.width"));
- Assert.Equal("gfx.framebuffer.height -1", Line(saved, "gfx.framebuffer.height"));
- }
-
- [Fact]
- public void A_buffer_the_file_has_for_a_window_or_a_full_screen_stays_until_changed()
- {
- var installation = WithIni("fullscreenwindowed no\nwidth 1280\nheight 720\nstarter.bufferscale 100\n" +
- "gfx.framebuffer.width 1280\ngfx.framebuffer.height 720\n");
-
- installation.SettingsStore.Save();
-
- string saved = installation.Files.ReadAllText(UserIni);
- Assert.Equal("gfx.framebuffer.width 1280", Line(saved, "gfx.framebuffer.width"));
- Assert.Equal("gfx.framebuffer.height 720", Line(saved, "gfx.framebuffer.height"));
+ Assert.Equal("gfx.buffer.percent 0.5", Line(text, "gfx.buffer.percent"));
+ Assert.Null(Line(text, "gfx.framebuffer.width"));
+ Assert.Null(Line(text, "starter.bufferscale"));
}
[Fact]
public void A_level_is_recognised_after_it_is_applied_and_survives_a_save()
{
- for (int engine = 0; engine < SimulatorSettings.RenderEngines.Length; engine++)
+ foreach (var backend in new[] { GraphicsBackend.Vulkan, GraphicsBackend.OpenGL })
{
foreach (var level in GraphicsPreset.All)
{
var installation = WithIni("");
var store = installation.SettingsStore;
- store.Settings.RenderEngine = engine;
+ store.Settings.Backend = backend;
level.ApplyTo(store.Settings);
Assert.Same(level, GraphicsPreset.Matching(store.Settings));
@@ -270,6 +221,7 @@ public class GraphicsSettingsTests
again.Environment.With("HOME", "/home/kolejarz");
again.SettingsStore.Load();
Assert.Same(level, GraphicsPreset.Matching(again.SettingsStore.Settings));
+ Assert.Equal(backend, again.SettingsStore.Settings.Backend);
}
}
}
@@ -279,7 +231,7 @@ public class GraphicsSettingsTests
{
var s = new SimulatorSettings();
GraphicsPreset.High.ApplyTo(s);
- s.DynamicLights = 2;
+ s.ShadowRankCutoff = 1;
Assert.Null(GraphicsPreset.Matching(s));
}
@@ -318,7 +270,7 @@ public class GraphicsSettingsTests
Assert.True(installation.SettingsStore.ImportFrom("/backup/eu07.ini"));
var s = installation.SettingsStore.Settings;
Assert.Equal(60, s.FieldOfView);
- Assert.Equal(SimulatorSettings.RenderEngineOf("legacy"), s.RenderEngine);
+ Assert.Equal(GraphicsBackend.OpenGL, s.Backend);
Assert.Equal("eu07_local.exe", s.ExecutablePath);
// Nothing is written until saved, and the save keeps the user's own lines.
diff --git a/StarterNG.Tests/LocalizationTests.cs b/StarterNG.Tests/LocalizationTests.cs
index cdb5b90..46cf1cf 100644
--- a/StarterNG.Tests/LocalizationTests.cs
+++ b/StarterNG.Tests/LocalizationTests.cs
@@ -31,9 +31,13 @@ public class LocalizationTests
var english = Strings(all.Single(l => l.Code == "en").Path);
var other = Strings(all.Single(l => l.Code == code).Path);
+ // The developer tab's rows (Ini.*) and the words of their lists (Choice.*) come in English where a
+ // language lacks them (SimulatorKeyRows), as the descriptions do.
var missing = english.Keys
.Where(key => !key.EndsWith("Desc", StringComparison.Ordinal) &&
- !key.StartsWith("Cmd.", StringComparison.Ordinal))
+ !key.StartsWith("Cmd.", StringComparison.Ordinal) &&
+ !key.StartsWith("Ini.", StringComparison.Ordinal) &&
+ !key.StartsWith("Choice.", StringComparison.Ordinal))
.Where(key => !other.ContainsKey(key));
Assert.Empty(missing);
diff --git a/StarterNG.Tests/RenderersTests.cs b/StarterNG.Tests/RenderersTests.cs
deleted file mode 100644
index 589a1f4..0000000
--- a/StarterNG.Tests/RenderersTests.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using StarterNG.Domain.Settings;
-
-namespace StarterNG.Tests;
-
-public class RenderersTests
-{
- [Theory]
- [InlineData("default", RendererKind.Modern)]
- [InlineData("full", RendererKind.Modern)]
- [InlineData("vulkan", RendererKind.Modern)]
- [InlineData("legacy", RendererKind.Legacy)]
- [InlineData("simple", RendererKind.Legacy)]
- [InlineData("simpleshader", RendererKind.Legacy)]
- [InlineData("OFF", RendererKind.Legacy)]
- public void A_renderer_word_draws_with_the_renderer_master_gives_it(string word, RendererKind kind) =>
- Assert.Equal(kind, Renderers.KindOf(word));
-}
diff --git a/StarterNG.Tests/SettingsStoreTests.cs b/StarterNG.Tests/SettingsStoreTests.cs
index e9be865..25c5bbf 100644
--- a/StarterNG.Tests/SettingsStoreTests.cs
+++ b/StarterNG.Tests/SettingsStoreTests.cs
@@ -951,13 +951,12 @@ public class SettingsStoreTests
Assert.Equal(floor, SimulatorSettings.ShadowRangeFloor(mapSize));
[Theory]
- [InlineData(150, 1024, false, 150)]
- [InlineData(150, 4096, false, 300)]
- [InlineData(150, 4096, true, 150)]
- [InlineData(100, 8192, false, 1200)]
- [InlineData(400, 8192, false, 1600)]
- public void Shadows_reach_as_far_as_the_renderer_stretches_them(int range, int mapSize, bool legacy, int reach) =>
- Assert.Equal(reach, SimulatorSettings.ShadowReach(range, mapSize, legacy));
+ [InlineData(150, 1024, 150)]
+ [InlineData(150, 4096, 300)]
+ [InlineData(100, 8192, 1200)]
+ [InlineData(400, 8192, 1600)]
+ public void Shadows_reach_as_far_as_the_renderer_stretches_them(int range, int mapSize, int reach) =>
+ Assert.Equal(reach, SimulatorSettings.ShadowReach(range, mapSize));
[Theory]
[InlineData("anisotropicfiltering 12")]
@@ -975,10 +974,15 @@ public class SettingsStoreTests
[Theory]
[InlineData("default")]
+ [InlineData("full")]
+ [InlineData("opengl")]
+ [InlineData("gl46")]
+ [InlineData("vulkan14")]
[InlineData("simpleshader")]
[InlineData("off")]
[InlineData("legacy")]
[InlineData("simple")]
+ [InlineData("experimental")]
public void A_renderer_word_the_simulator_reads_as_another_stays_until_changed(string word)
{
var installation = WithHome(new InMemoryFileSystem().WithFile(UserIni, $"gfxrenderer {word}\n"));
@@ -989,16 +993,11 @@ public class SettingsStoreTests
Assert.Contains($"gfxrenderer {word}\n", SavedLines(installation));
}
- // 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.
+ // A word the starter does not know is written in by hand: "null" of the test runs, or one of a newer simulator.
+ // 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")]
+ [InlineData("whatever")]
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}\nfieldofview 45\n"));
@@ -1011,60 +1010,61 @@ public class SettingsStoreTests
store.Save();
Assert.Contains($"gfxrenderer {word}\n", SavedLines(installation));
- // Picking one from the list, even the full renderer it runs as, is a choice.
+ // Picking one from the list, even the renderer it runs as, is a choice.
store.Settings.RendererWord = null;
- store.Settings.RenderEngine = 0;
+ store.Settings.Backend = GraphicsBackend.Vulkan;
store.Save();
- Assert.Contains("gfxrenderer default\n", SavedLines(installation));
+ Assert.Contains("gfxrenderer vulkan\n", SavedLines(installation));
Assert.False(store.UnreadableValues().ContainsKey("gfxrenderer"));
}
[Theory]
- [InlineData(0, "default")]
- [InlineData(1, "legacy")]
- [InlineData(2, "simple")]
- public void A_chosen_renderer_is_saved_as_the_simulator_reads_it(int engine, string saved)
+ [InlineData(GraphicsBackend.Vulkan, "vulkan")]
+ [InlineData(GraphicsBackend.OpenGL, "default")]
+ public void A_chosen_renderer_is_saved_as_the_simulator_reads_it(GraphicsBackend backend, string saved)
{
- // application.cpp on master knows default, legacy and simple; "simpleshader" and "off"
- // from older starters are legacy, and any other word gets the full renderer.
+ // utilities/Globals.cpp knows default (OpenGL 4.6) and vulkan; the words of the renderers it no longer has
+ // it reads as default.
var installation = WithHome(new InMemoryFileSystem().WithFile(UserIni, "gfxrenderer simpleshader\n"));
installation.SettingsStore.Load();
- installation.SettingsStore.Settings.RenderEngine = engine == 1 ? 0 : engine;
+ installation.SettingsStore.Settings.Backend = backend == GraphicsBackend.Vulkan ? GraphicsBackend.OpenGL : GraphicsBackend.Vulkan;
installation.SettingsStore.Save();
- installation.SettingsStore.Settings.RenderEngine = engine;
+ installation.SettingsStore.Settings.Backend = backend;
installation.SettingsStore.Save();
Assert.Contains($"gfxrenderer {saved}\n", SavedLines(installation));
}
[Theory]
- [InlineData("full", 0)]
- [InlineData("gl46", 0)]
- [InlineData("opengl", 0)]
- [InlineData("vulkan", 0)]
- [InlineData("VULKAN14", 0)]
- [InlineData("whatever", 0)]
- [InlineData("experimental", 0)]
- [InlineData("simpleshader", 1)]
- public void A_renderer_word_stands_where_the_simulator_reads_it(string word, int engine)
+ [InlineData("full", GraphicsBackend.OpenGL)]
+ [InlineData("gl46", GraphicsBackend.OpenGL)]
+ [InlineData("opengl", GraphicsBackend.OpenGL)]
+ [InlineData("default", GraphicsBackend.OpenGL)]
+ [InlineData("vulkan", GraphicsBackend.Vulkan)]
+ [InlineData("VULKAN14", GraphicsBackend.Vulkan)]
+ [InlineData("whatever", GraphicsBackend.OpenGL)]
+ [InlineData("experimental", GraphicsBackend.OpenGL)]
+ [InlineData("simpleshader", GraphicsBackend.OpenGL)]
+ public void A_renderer_word_stands_where_the_simulator_reads_it(string word, GraphicsBackend backend)
{
- Assert.Equal(engine, SimulatorSettings.RenderEngineOf(word));
+ Assert.Equal(backend, SimulatorSettings.BackendOf(word));
}
[Fact]
- public void The_buffer_is_written_as_the_framebuffer_master_reads()
+ public void The_buffer_is_written_as_the_simulator_reads_it()
{
- var installation = WithHome(new InMemoryFileSystem().WithFile(UserIni, "width 1000\nheight 500\n"));
+ var installation = WithHome(new InMemoryFileSystem().WithFile(UserIni,
+ "width 1000\nheight 500\ngfx.framebuffer.width 1000\ngfx.framebuffer.height 500\n"));
installation.SettingsStore.Load();
installation.SettingsStore.Settings.BufferScalePercent = 50;
installation.SettingsStore.Save();
string saved = SavedLines(installation);
- Assert.DoesNotContain("gfx.buffer.percent", saved);
- Assert.Contains("gfx.framebuffer.width 500\n", saved);
- Assert.Contains("gfx.framebuffer.height 250\n", saved);
+ Assert.Contains("gfx.buffer.percent 0.5\n", saved);
+ Assert.DoesNotContain("\ngfx.framebuffer.width", saved);
+ Assert.DoesNotContain("\ngfx.framebuffer.height", saved);
}
[Theory]
@@ -1074,8 +1074,9 @@ public class SettingsStoreTests
[InlineData("gfx.framebuffer.width 500\n", 100)]
[InlineData("starter.bufferscale 60\n", 60)]
[InlineData("starter.bufferscale 60\nwidth 1000\ngfx.framebuffer.width 800\n", 60)]
- [InlineData("gfx.buffer.percent 0.5\n", 100)]
- public void The_buffer_is_read_from_the_starters_key_or_the_framebuffer(string ini, int percent)
+ [InlineData("gfx.buffer.percent 0.5\n", 50)]
+ [InlineData("gfx.buffer.percent 0.6\nstarter.bufferscale 80\n", 60)]
+ public void The_buffer_is_read_from_the_simulators_key_or_what_an_older_starter_left(string ini, int percent)
{
var installation = WithHome(new InMemoryFileSystem().WithFile(UserIni, ini));
@@ -1285,26 +1286,23 @@ public class SettingsStoreTests
Assert.Equal(60, store.Settings.FieldOfView);
}
- // The move to the standard mode puts back the keys of the rows it hides: the row of the
- // render scale has the frame buffer's two, and the percent it is worked out from is the starter's own.
+ // The render scale put back is the whole window, whichever way the file had it.
[Theory]
- [InlineData("width 1920\nheight 1080\nstarter.bufferscale 50\ngfx.framebuffer.width 960\ngfx.framebuffer.height 540\n")]
+ [InlineData("width 1920\nheight 1080\ngfx.buffer.percent 0.5\n")]
+ [InlineData("width 1920\nheight 1080\nstarter.bufferscale 50\n")]
[InlineData("width 1920\nheight 1080\ngfx.framebuffer.width 960\ngfx.framebuffer.height 540\n")]
- public void The_frame_buffer_put_back_takes_the_render_scale_with_it(string ini)
+ public void The_render_scale_put_back_is_the_whole_window(string ini)
{
var installation = WithHome(new InMemoryFileSystem().WithFile(UserIni, ini));
var store = installation.SettingsStore;
store.Load();
Assert.Equal(50, store.Settings.BufferScalePercent);
- var reset = store.WithDefaults(store.Settings, new[] { "gfx.framebuffer.width", "gfx.framebuffer.height" });
+ var reset = store.WithDefaults(store.Settings, new[] { "gfx.buffer.percent" });
Assert.Equal(100, reset.BufferScalePercent);
Assert.Equal(1920, reset.Width);
- var written = store.Render(reset);
- Assert.Equal("100", written["starter.bufferscale"]);
- Assert.Equal("1920", written["gfx.framebuffer.width"]);
- Assert.Equal("1080", written["gfx.framebuffer.height"]);
+ Assert.Equal("1", store.Render(reset)["gfx.buffer.percent"]);
}
// ── What the screen shows otherwise ──────────────────────────────────────
@@ -1610,7 +1608,6 @@ public class SettingsStoreTests
[Theory]
[InlineData("starter.gpu")]
- [InlineData("gfx.usegles")]
public void The_move_to_the_standard_mode_keeps_what_lets_a_machine_run_the_simulator(string key) =>
Assert.Contains(key, StarterNG.Application.SettingsStore.KeptOnMoveToStandard);
diff --git a/StarterNG.Tests/SettingsUnknownValueTests.cs b/StarterNG.Tests/SettingsUnknownValueTests.cs
index 760829e..298460b 100644
--- a/StarterNG.Tests/SettingsUnknownValueTests.cs
+++ b/StarterNG.Tests/SettingsUnknownValueTests.cs
@@ -54,24 +54,24 @@ public class SettingsUnknownValueTests
[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) =>
+ WithPage(Standard + "gfxrenderer null\nfieldofview 45\n", (page, _, saved) =>
{
- Assert.Equal("vulkan", Shown(List(page, "RenderEngineCb")));
- Assert.Contains("vulkan", Note(page, "gfxrenderer"));
+ Assert.Equal("null", Shown(List(page, "RenderEngineCb")));
+ Assert.Contains("null", Note(page, "gfxrenderer"));
Assert.False(page.HasUnsavedChanges);
page.Save();
- Assert.Contains("gfxrenderer vulkan\n", saved());
+ Assert.Contains("gfxrenderer null\n", saved());
});
}
[Fact]
public void Another_renderer_picked_from_the_list_replaces_it()
{
- WithPage(Standard + "gfxrenderer vulkan\n", (page, services, saved) =>
+ WithPage(Standard + "gfxrenderer null\n", (page, services, saved) =>
{
- List(page, "RenderEngineCb").SelectedIndex = 0;
+ List(page, "RenderEngineCb").SelectedIndex = 1;
page.Save();
@@ -165,18 +165,67 @@ public class SettingsUnknownValueTests
[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) =>
+ WithPage("gfxrenderer null\nstarter.batterydefault 7\nvsync moze\nstarter.gpu system\n", (page, _, saved) =>
+ {
+ page.MoveToStandardOnce();
+
+ string text = saved();
+ Assert.Contains("gfxrenderer vulkan\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("starter.gpu system\n", text);
+ Assert.Null(Note(page, "gfxrenderer"));
+ Assert.NotEqual("7", Shown(List(page, "ReadyOverrideCb")));
+ });
+ }
+
+ // A player of the standard mode of an older starter: Vulkan, every optimisation on and the developer's settings
+ // at the starter's own values, the picture's level and what the player chose in the standard mode as it was.
+ [Fact]
+ public void The_standard_mode_of_an_older_layout_moves_to_vulkan_and_the_fast_choices()
+ {
+ WithPage(Standard + "gfxrenderer default\ngfx.gpucull no\nphysicslog yes\nfriction 2\nmaxtexturesize 1024\n" +
+ "fieldofview 60\ngfx.ssr low\nblackbox yes\n", (page, services, saved) =>
+ {
+ page.MoveToStandardOnce();
+
+ string text = saved();
+ Assert.Contains("gfxrenderer vulkan\n", text);
+ Assert.Contains("gfx.gpucull yes\n", text);
+ Assert.Contains("physicslog no\n", text);
+ Assert.Contains("friction 1\n", text);
+ Assert.Contains("maxtexturesize 1024\n", text);
+ Assert.Contains("gfx.ssr low\n", text);
+ Assert.Contains("fieldofview 60\n", text);
+ Assert.Contains("blackbox yes\n", text);
+ Assert.Contains($"starter.settings.revision {StarterNG.Domain.Settings.SimulatorSettings.CurrentRevision}\n", text);
+ });
+ }
+
+ [Fact]
+ public void The_advanced_mode_of_an_older_layout_keeps_what_its_developer_chose()
+ {
+ WithPage(Standard + "starter.settings.advanced yes\ngfxrenderer default\ngfx.gpucull no\n", (page, services, 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")));
+ Assert.Contains("gfx.gpucull no\n", text);
+ Assert.True(services.Settings.AdvancedSettings);
+ Assert.Equal(StarterNG.Domain.Settings.SimulatorSettings.CurrentRevision, services.Settings.Revision);
+ });
+ }
+
+ [Fact]
+ public void The_layout_of_this_starter_is_moved_to_once_only()
+ {
+ WithPage(Standard + "starter.settings.revision 2\ngfxrenderer default\n", (page, _, saved) =>
+ {
+ page.MoveToStandardOnce();
+
+ Assert.Contains("gfxrenderer default\n", saved());
});
}
}
diff --git a/StarterNG.Tests/SliderStepsTests.cs b/StarterNG.Tests/SliderStepsTests.cs
index 5fb853b..61d2e6a 100644
--- a/StarterNG.Tests/SliderStepsTests.cs
+++ b/StarterNG.Tests/SliderStepsTests.cs
@@ -10,10 +10,10 @@ public class SliderStepsTests
public void The_old_starters_steps_are_offered_and_a_value_outside_them_stays()
{
var slider = new Avalonia.Controls.Slider();
- var steps = new SliderSteps(slider, SliderRanges.ReflectionUpdates) { Value = 1 / 300.0 };
+ var steps = new SliderSteps(slider, SliderRanges.ReflectionUpdates) { Value = 0.5 };
- // The simulator's own once in five minutes, shown before the old starter's 1 to 60.
- Assert.Equal(1 / 300.0, steps.Value);
+ // Twice a second is none of the steps: shown among them, between once in five seconds and once a second.
+ Assert.Equal(0.5, steps.Value);
Assert.Equal(SliderRanges.ReflectionUpdates.Length, slider.Maximum);
slider.Value = slider.Maximum;
@@ -44,11 +44,11 @@ public class SliderStepsTests
public void Clamping_leaves_a_value_between_two_steps_where_it_is()
{
var slider = new Avalonia.Controls.Slider();
- var steps = new SliderSteps(slider, SliderRanges.CabShadowRanges) { Clamps = true, Value = 15 };
+ var steps = new SliderSteps(slider, SliderRanges.DrawRangeFactors) { Clamps = true, Value = 1.5 };
- Assert.Equal(15, steps.Value);
+ Assert.Equal(1.5, steps.Value);
steps.Value = -5;
- Assert.Equal(0, steps.Value);
+ Assert.Equal(1, steps.Value);
}
}
diff --git a/StarterNG.Tests/StartSimulationTests.cs b/StarterNG.Tests/StartSimulationTests.cs
index b291945..e34c29f 100644
--- a/StarterNG.Tests/StartSimulationTests.cs
+++ b/StarterNG.Tests/StartSimulationTests.cs
@@ -152,12 +152,12 @@ public class StartSimulationTests
}
[Theory]
- [InlineData(0)]
- [InlineData(3)]
- public void Any_renderer_is_left_for_the_simulator_to_take(int renderer)
+ [InlineData(StarterNG.Domain.Settings.GraphicsBackend.Vulkan)]
+ [InlineData(StarterNG.Domain.Settings.GraphicsBackend.OpenGL)]
+ public void Any_renderer_is_left_for_the_simulator_to_take(StarterNG.Domain.Settings.GraphicsBackend renderer)
{
var (start, launcher, installation) = Rig(files => files.WithExecutable(Build, "\u007fELF binary"));
- installation.SettingsStore.Settings.RenderEngine = renderer;
+ installation.SettingsStore.Settings.Backend = renderer;
Assert.Equal(SimulationStartOutcome.Started, start.Execute(freeFly: true, saveSettings: false).Outcome);
Assert.NotNull(launcher.Executable);
diff --git a/StarterNG/Application/AppServices.cs b/StarterNG/Application/AppServices.cs
index 3639820..e4948f1 100644
--- a/StarterNG/Application/AppServices.cs
+++ b/StarterNG/Application/AppServices.cs
@@ -65,10 +65,7 @@ public sealed class AppServices
SceneryFiles = new SceneryFileWatch(files, Sceneries, Library, State);
Executables = new ExecutableLocator(files, paths, environment, log);
- // Read when a borderless screen with a smaller buffer is first written, and once.
- var monitors = new Lazy>(() => Monitors.List(environment));
- SettingsStore = new SettingsStore(files, clock, log, settingsPaths,
- new SettingsSerializer(id => Monitors.SizeOf(monitors.Value, id)), Executables);
+ SettingsStore = new SettingsStore(files, clock, log, settingsPaths, new SettingsSerializer(), Executables);
MissingVehicleLog = new MissingVehicleLog(SettingsStore.Settings, missingAssets, Library, log);
Favorites = new FavoriteSceneries(files, log, settingsPaths.FavoritesPath());
Tapes = new HaslerTapes(files, paths, log, clock, Timetables, () => State.SimulatorRunning);
diff --git a/StarterNG/Application/GraphicsGroupLevels.cs b/StarterNG/Application/GraphicsGroupLevels.cs
index 4d7937a..2fbf114 100644
--- a/StarterNG/Application/GraphicsGroupLevels.cs
+++ b/StarterNG/Application/GraphicsGroupLevels.cs
@@ -12,10 +12,7 @@ public sealed class GraphicsGroupLevels
public GraphicsGroupLevels(SettingsStore store) => _store = store;
- ///
- /// The level each group is at in , null where it is at none. At
- /// Ultra the level under it fits too, as it leaves alone what only Ultra sets: the highest counts.
- ///
+ /// The level each group is at in , null where it is at none.
public IReadOnlyDictionary LevelsOf(SimulatorSettings settings)
{
var now = _store.Render(settings);
@@ -24,18 +21,10 @@ public sealed class GraphicsGroupLevels
(GraphicsPreset?)rendered.LastOrDefault(level => Same(group, level.Keys, now)).Level);
}
- ///
- /// A copy of with the group at . What only
- /// an end of the scale sets goes back to the simulator's own on leaving that end.
- ///
+ /// A copy of with the group at .
public SimulatorSettings Apply(GraphicsGroup group, GraphicsPreset level, SimulatorSettings settings)
{
- var current = LevelsOf(settings)[group];
var source = settings.Copy();
- if (level.Extras is null && current?.Extras is not null)
- GraphicsExtras.None.ApplyTo(source);
- if (level.Top is null && current?.Top is not null)
- GraphicsTop.None.ApplyTo(source);
level.ApplyTo(source);
return _store.WithKeysOf(settings, source, group.Keys);
}
diff --git a/StarterNG/Application/SettingsStore.cs b/StarterNG/Application/SettingsStore.cs
index 566d9b3..b404211 100644
--- a/StarterNG/Application/SettingsStore.cs
+++ b/StarterNG/Application/SettingsStore.cs
@@ -131,8 +131,9 @@ public sealed class SettingsStore
return;
GraphicsPreset.High.ApplyTo(Settings);
- // Nothing of an older starter to bring over: the settings start in the standard mode.
+ // Nothing of an older starter to bring over: the settings start in the standard mode, of this layout.
Settings.MovedToStandard = true;
+ Settings.Revision = SimulatorSettings.CurrentRevision;
Save();
}
@@ -181,12 +182,11 @@ public sealed class SettingsStore
}
///
- /// What lets some machines run the simulator at all: the card it is put on (offloading
- /// to the discrete one fails with some drivers) and OpenGL ES where desktop OpenGL does
- /// not work. The move to the standard mode, done without asking, leaves them as they are.
+ /// What lets some machines run the simulator at all: the card it is put on (offloading to the discrete one
+ /// fails with some drivers). The move to the standard mode, done without asking, leaves it as it is.
///
public static readonly IReadOnlySet KeptOnMoveToStandard =
- new HashSet(StringComparer.OrdinalIgnoreCase) { "starter.gpu", "gfx.usegles" };
+ new HashSet(StringComparer.OrdinalIgnoreCase) { "starter.gpu" };
///
/// The mode is this installation's, like its simulator and its card: another file, a
@@ -268,6 +268,7 @@ public sealed class SettingsStore
ApplyChanges(_config, Changes(Settings));
RemoveDuplicates(_config, path);
+ KeepAntiAliasingLast(_config);
if (merged)
{
// What is held follows the file: the player's changes and the others' together.
@@ -312,6 +313,12 @@ public sealed class SettingsStore
Save();
}
+ ///
+ /// Of gfx.antialiasing and the older multisampling the simulator heeds the one further down, so the newer goes
+ /// below the older, which only the simulators before it read.
+ ///
+ private static void KeepAntiAliasingLast(ConfigFile config) => config.MoveAfter("gfx.antialiasing", "multisampling");
+
private static void ApplyChanges(ConfigFile config, IReadOnlyList changes)
{
foreach (var change in changes)
@@ -379,6 +386,7 @@ public sealed class SettingsStore
var copy = ConfigFile.Parse(_config.ToText());
ApplyChanges(copy, Changes(settings ?? Settings));
copy.RemoveDuplicates(SettingsSerializer.RepeatableKeys);
+ KeepAntiAliasingLast(copy);
try
{
@@ -437,6 +445,7 @@ public sealed class SettingsStore
bool readable = key.Kind switch
{
SimulatorKeyKind.Toggle => Bool(first) is not null,
+ SimulatorKeyKind.Choice => key.ChoiceIndex(first) >= 0,
SimulatorKeyKind.Number => double.TryParse(first, NumberStyles.Float, CultureInfo.InvariantCulture, out _),
_ => true
};
@@ -453,7 +462,7 @@ public sealed class SettingsStore
// Written from other keys, or rewritten on purpose whatever they say: what they hold is no setting of their own.
private static readonly HashSet NotReadAlone = new(StringComparer.OrdinalIgnoreCase)
{
- "mousescale", "gfxrenderer", "gfx.shadowmap.enabled", "gfx.framebuffer.width", "gfx.framebuffer.height"
+ "mousescale", "gfxrenderer", "multisampling"
};
private SimulatorSettings WithFile(ConfigFile config)
@@ -542,9 +551,9 @@ public sealed class SettingsStore
return false;
if (overCap.Contains(key))
return false;
- // The simulator goes by these to the letter: a buffer of a window's size stretched
- // over the monitor, a monitor's name it does not find. The file's own is no choice to keep.
- if (AsWritten(key) && _config.GetRaw(key) != value)
+ // The simulator goes by this to the letter: a monitor's name it does not find. The file's own is no
+ // choice to keep.
+ if (string.Equals(key, "fullscreenmonitor", StringComparison.OrdinalIgnoreCase) && _config.GetRaw(key) != value)
return false;
string? synced = _synced.GetValueOrDefault(key);
if (shown.TryGetValue(key, out var onScreen) && onScreen.Shown == value && onScreen.Held == synced)
@@ -552,11 +561,6 @@ public sealed class SettingsStore
return _config.Has(key) && synced == value;
}
- bool AsWritten(string key) =>
- string.Equals(key, "fullscreenmonitor", StringComparison.OrdinalIgnoreCase) ||
- (settings.FullscreenWindowed &&
- SettingsSerializer.FramebufferKeys.Contains(key, StringComparer.OrdinalIgnoreCase));
-
void Add(string key, string? value)
{
// To the simulator a key past endconfig is not set yet, whatever it says.
diff --git a/StarterNG/Domain/Settings/GraphicsPreset.cs b/StarterNG/Domain/Settings/GraphicsPreset.cs
index 4d6af06..9188821 100644
--- a/StarterNG/Domain/Settings/GraphicsPreset.cs
+++ b/StarterNG/Domain/Settings/GraphicsPreset.cs
@@ -5,208 +5,139 @@ using System.Linq;
namespace StarterNG.Domain.Settings;
///
-/// What only the two ends of the scale touch: the effects left to taste at every other
-/// level and how often the screens refresh. The lowest level gives them up, the highest
-/// takes the most there is.
-///
-/// python.updatetime, one of the steps of its list.
-public sealed record GraphicsExtras(
- bool MotionBlur,
- bool ChromaticAberration,
- bool Smoke,
- int PythonUpdateMs)
-{
- /// The eu07.ini keys these values live in.
- public static readonly IReadOnlyList Keys = new[]
- {
- "gfx.postfx.motionblur.enabled", "gfx.postfx.chromaticaberration.enabled",
- "gfx.smoke", "python.updatetime"
- };
-
- /// The simulator's own, for leaving a level chosen before this run: what was there earlier is gone.
- public static readonly GraphicsExtras None = new(true, true, true, 200);
-
- public static GraphicsExtras Of(SimulatorSettings s) =>
- new(s.MotionBlur, s.ChromaticAberration, s.Smoke, s.PythonScreenUpdateRate);
-
- public void ApplyTo(SimulatorSettings s)
- {
- s.MotionBlur = MotionBlur;
- s.ChromaticAberration = ChromaticAberration;
- s.Smoke = Smoke;
- s.PythonScreenUpdateRate = PythonUpdateMs;
- }
-}
-
-///
-/// What only Ultra sets, with no scale to climb: the longest shadows, at the bottom of their
-/// limit, and the screens drawn. What only the advanced mode shows no level sets.
-///
-/// gfx.shadow.angle.min: how low the sun counts for shadows, so how long they
-/// get: up to 5× the height of what casts them at 0.2, no longer than it at 1 (opengl33renderer.cpp).
-/// python.enabled.
-public sealed record GraphicsTop(double ShadowAngleLimit, bool Screens)
-{
- /// The eu07.ini keys these values live in.
- public static readonly IReadOnlyList Keys = new[] { "gfx.shadow.angle.min", "python.enabled" };
-
- /// What they are with nothing set, as .
- public static readonly GraphicsTop None = new(0.2, true);
-
- public static GraphicsTop Of(SimulatorSettings s) => new(s.ShadowAngleLimit, s.PythonScreens);
-
- public void ApplyTo(SimulatorSettings s)
- {
- s.ShadowAngleLimit = ShadowAngleLimit;
- s.PythonScreens = Screens;
- }
-}
-
-///
-/// A level of detail set in one go: what weighs on the graphics card. Every scale climbs in
-/// even steps from to , as far as it has steps for six
-/// levels. A level sets only what the standard mode shows, and only to what its sliders offer
-/// (, the old starter's ranges): never past the old starter. The screen
-/// (resolution, buffer, field of view), the frame pacing and the effects that are a matter of
-/// taste - motion blur, chromatic aberration - stay as they are, except at the two ends of the
-/// scale, which have .
+/// A level of detail set in one go, as games offer them: what weighs on the graphics card, from Low for a weak or
+/// old card to Very high for a strong one. High is about the simulator's own values, the start of a player with no
+/// settings of their own; Very high is the most worth having, not everything at its top - ray tracing, MSAA x8 and
+/// the largest shadow maps cost far more than they show, and stay for the developer tab. The screen (resolution,
+/// render scale, field of view), the frame pacing and the effects that are a matter of taste - motion blur,
+/// chromatic aberration - are no level's.
///
/// Its name's translation key.
-/// gfx.shadows.cab.range, in metres, read only by the legacy renderer.
-/// multisampling.
-/// gfx.reflections.framerate, in updates a second, one of the old starter's steps.
+/// gfx.reflections.framerate, in updates a second.
/// gfx.drawrange.factor.max: how far the regulator may stretch the draw range.
+/// The it sets, in the file's words.
public sealed record GraphicsPreset(
string NameKey,
int TextureSize,
int CabTextureSize,
double Anisotropy,
+ bool ExtraEffects,
AntiAliasingMode AntiAliasing,
- int DynamicLights,
- int SmokeFidelity,
- bool Shadows,
int ShadowMap,
int ShadowRange,
int ShadowRank,
- bool EnvMap,
int ReflectionsFidelity,
double ReflectionsRate,
- bool ExtraEffects,
int SplineFidelity,
double DrawRangeFactor,
- int CabShadowsRange,
- GraphicsExtras? Extras = null,
- GraphicsTop? Top = null)
+ int SmokeFidelity,
+ IReadOnlyDictionary Keys)
{
+ /// The simulator's own rate of the reflections: once in five minutes, or a kilometre on.
+ public const double ReflectionsSeldom = 1 / 300.0;
+
/// The eu07.ini keys a level sets.
- public static readonly IReadOnlyList Keys = new[]
- {
- "maxtexturesize", "maxcabtexturesize", "anisotropicfiltering", "multisampling", "dynamiclights",
- "gfx.smoke.fidelity", "shadows", "gfx.shadowmap.enabled", "shadowtune", "gfx.shadow.rank.cutoff",
- "gfx.envmap.enabled", "gfx.reflections.fidelity", "gfx.reflections.framerate", "gfx.extraeffects",
- "splinefidelity", "gfx.drawrange.factor.max", "gfx.shadows.cab.range"
- };
+ public static IReadOnlyList AllKeys =>
+ GraphicsGroup.All.SelectMany(group => group.Keys).Concat(GraphicsGroup.AntiAliasingKeys).ToList();
- /// The last resort: no shadows, no reflections, no effects, no smoke.
- public static readonly GraphicsPreset Minimal = new(
- "PresetMinimal", TextureSize: 512, CabTextureSize: 512, Anisotropy: 1, AntiAliasing: AntiAliasingMode.Off,
- DynamicLights: 1, SmokeFidelity: 1, Shadows: false, ShadowMap: 1024, ShadowRange: 75, ShadowRank: 1,
- EnvMap: false, ReflectionsFidelity: 0, ReflectionsRate: 1, ExtraEffects: false,
- SplineFidelity: 1, DrawRangeFactor: 1, CabShadowsRange: 0,
- Extras: new GraphicsExtras(MotionBlur: false, ChromaticAberration: false, Smoke: false, PythonUpdateMs: 800));
+ private static Dictionary Values(params (string Key, string Value)[] values) =>
+ values.ToDictionary(pair => pair.Key, pair => pair.Value, StringComparer.OrdinalIgnoreCase);
+ /// For a weak or old card, or a laptop on its own graphics: the shadows short, no screen-space effects.
public static readonly GraphicsPreset Low = new(
- "PresetLow", TextureSize: 1024, CabTextureSize: 1024, Anisotropy: 2, AntiAliasing: AntiAliasingMode.Off,
- DynamicLights: 3, SmokeFidelity: 1, Shadows: true, ShadowMap: 1024, ShadowRange: 125, ShadowRank: 2,
- EnvMap: true, ReflectionsFidelity: 0, ReflectionsRate: 1, ExtraEffects: true,
- SplineFidelity: 2, DrawRangeFactor: 1, CabShadowsRange: 0);
+ "PresetLow", TextureSize: 1024, CabTextureSize: 1024, Anisotropy: 4, ExtraEffects: false,
+ AntiAliasing: AntiAliasingMode.Off, ShadowMap: 1024, ShadowRange: 125, ShadowRank: 1,
+ ReflectionsFidelity: 0, ReflectionsRate: ReflectionsSeldom, SplineFidelity: 1, DrawRangeFactor: 1,
+ SmokeFidelity: 1,
+ Values(("gfx.lights.shadows", "low"), ("gfx.contactshadows", "no"), ("gfx.ssr", "no"), ("gfx.cabprobe", "low"),
+ ("gfx.postfx.ao", "no"), ("gfx.fog.quality", "low"), ("gfx.clouds", "low"),
+ ("gfx.grass", "yes"), ("gfx.grass.distance", "40"), ("gfx.grass.fadedistance", "50"),
+ ("gfx.grass.density", "0.5"), ("gfx.precipitation.particles", "16384")));
public static readonly GraphicsPreset Medium = new(
- "PresetMedium", TextureSize: 2048, CabTextureSize: 2048, Anisotropy: 4, AntiAliasing: AntiAliasingMode.Msaa2,
- DynamicLights: 5, SmokeFidelity: 2, Shadows: true, ShadowMap: 1024, ShadowRange: 175, ShadowRank: 2,
- EnvMap: true, ReflectionsFidelity: 1, ReflectionsRate: 1, ExtraEffects: true,
- SplineFidelity: 2, DrawRangeFactor: 2, CabShadowsRange: 20);
+ "PresetMedium", TextureSize: 2048, CabTextureSize: 2048, Anisotropy: 8, ExtraEffects: true,
+ AntiAliasing: AntiAliasingMode.Msaa2, ShadowMap: 2048, ShadowRange: 175, ShadowRank: 2,
+ ReflectionsFidelity: 1, ReflectionsRate: ReflectionsSeldom, SplineFidelity: 2, DrawRangeFactor: 2,
+ SmokeFidelity: 1,
+ Values(("gfx.lights.shadows", "low"), ("gfx.contactshadows", "no"), ("gfx.ssr", "low"), ("gfx.cabprobe", "low"),
+ ("gfx.postfx.ao", "ssao"), ("gfx.fog.quality", "medium"), ("gfx.clouds", "low"),
+ ("gfx.grass", "yes"), ("gfx.grass.distance", "60"), ("gfx.grass.fadedistance", "70"),
+ ("gfx.grass.density", "1"), ("gfx.precipitation.particles", "32768")));
- ///
- /// Where a player with no settings of their own starts. The simulator's own values (Globals.h),
- /// but for smoke, track curves, reflections and cab shadows: theirs are the bottom of a scale
- /// with levels to go under this one, or below what the old starter offered.
- ///
+ /// Where a player with no settings of their own starts: about the simulator's own values.
public static readonly GraphicsPreset High = new(
- "PresetHigh", TextureSize: 4096, CabTextureSize: 4096, Anisotropy: 8, AntiAliasing: AntiAliasingMode.Msaa4,
- DynamicLights: 7, SmokeFidelity: 2, Shadows: true, ShadowMap: 2048, ShadowRange: 250, ShadowRank: 3,
- EnvMap: true, ReflectionsFidelity: 1, ReflectionsRate: 3, ExtraEffects: true,
- SplineFidelity: 2, DrawRangeFactor: 3, CabShadowsRange: 30);
+ "PresetHigh", TextureSize: 4096, CabTextureSize: 4096, Anisotropy: 8, ExtraEffects: true,
+ AntiAliasing: AntiAliasingMode.Msaa4, ShadowMap: 2048, ShadowRange: 250, ShadowRank: 3,
+ ReflectionsFidelity: 2, ReflectionsRate: ReflectionsSeldom, SplineFidelity: 2, DrawRangeFactor: 3,
+ SmokeFidelity: 2,
+ Values(("gfx.lights.shadows", "medium"), ("gfx.contactshadows", "no"), ("gfx.ssr", "medium"),
+ ("gfx.cabprobe", "medium"), ("gfx.postfx.ao", "gtao"), ("gfx.fog.quality", "medium"),
+ ("gfx.clouds", "medium"), ("gfx.grass", "yes"), ("gfx.grass.distance", "60"),
+ ("gfx.grass.fadedistance", "70"), ("gfx.grass.density", "1"), ("gfx.precipitation.particles", "65536")));
///
- /// For a strong card. A map of 4096 doubles the cascades, so the range here reaches 800 m.
- /// Filtering stays as High's, so the textures tell this level from Ultra.
+ /// For a strong card. A map of 4096 doubles the cascades, so the range here reaches 600 m; the textures of the
+ /// cab stay at 4096, the most the starter gives them.
///
public static readonly GraphicsPreset VeryHigh = new(
- "PresetVeryHigh", TextureSize: 8192, CabTextureSize: 4096, Anisotropy: 8, AntiAliasing: AntiAliasingMode.Msaa8,
- DynamicLights: 7, SmokeFidelity: 3, Shadows: true, ShadowMap: 4096, ShadowRange: 400, ShadowRank: 3,
- EnvMap: true, ReflectionsFidelity: 2, ReflectionsRate: 10, ExtraEffects: true,
- SplineFidelity: 3, DrawRangeFactor: 3, CabShadowsRange: 50);
+ "PresetVeryHigh", TextureSize: 8192, CabTextureSize: 4096, Anisotropy: 16, ExtraEffects: true,
+ AntiAliasing: AntiAliasingMode.Msaa4, ShadowMap: 4096, ShadowRange: 300, ShadowRank: 3,
+ ReflectionsFidelity: 2, ReflectionsRate: 1, SplineFidelity: 3, DrawRangeFactor: 3,
+ SmokeFidelity: 3,
+ Values(("gfx.lights.shadows", "high"), ("gfx.contactshadows", "low"), ("gfx.ssr", "high"),
+ ("gfx.cabprobe", "high"), ("gfx.postfx.ao", "gtao"), ("gfx.fog.quality", "high"),
+ ("gfx.clouds", "high"), ("gfx.grass", "yes"), ("gfx.grass.distance", "100"),
+ ("gfx.grass.fadedistance", "120"), ("gfx.grass.density", "1.25"), ("gfx.precipitation.particles", "65536")));
- ///
- /// The top of every slider, which is the most the old starter gave. Not the best picture
- /// throughout: a map of 8192 stretches the cascades fourfold, so shadows reach 1600 m but are
- /// coarser up close than at .
- ///
- public static readonly GraphicsPreset Ultra = new(
- "PresetUltra", TextureSize: 8192, CabTextureSize: 4096, Anisotropy: 16, AntiAliasing: AntiAliasingMode.Msaa8,
- DynamicLights: 7, SmokeFidelity: 4, Shadows: true, ShadowMap: 8192, ShadowRange: 400, ShadowRank: 3,
- EnvMap: true, ReflectionsFidelity: 2, ReflectionsRate: 60, ExtraEffects: true,
- SplineFidelity: 4, DrawRangeFactor: 3, CabShadowsRange: 100,
- Extras: new GraphicsExtras(MotionBlur: true, ChromaticAberration: true, Smoke: true, PythonUpdateMs: 200),
- Top: new GraphicsTop(ShadowAngleLimit: 0.2, Screens: true));
-
- public static readonly IReadOnlyList All = new[] { Minimal, Low, Medium, High, VeryHigh, Ultra };
+ public static readonly IReadOnlyList All = new[] { Low, Medium, High, VeryHigh };
public void ApplyTo(SimulatorSettings s)
{
s.MaxTextureSize = TextureSize;
s.MaxCabTextureSize = CabTextureSize;
s.TextureFiltering = Anisotropy;
+ s.ExtraEffects = ExtraEffects;
s.AntiAliasing = AntiAliasing;
- s.CabShadowsRange = CabShadowsRange;
- s.DynamicLights = DynamicLights;
- s.SmokeFidelity = SmokeFidelity;
- s.RenderShadows = Shadows;
+ s.RenderShadows = true;
s.ShadowMapResolution = ShadowMap;
s.ShadowProjectionRange = ShadowRange;
s.ShadowRankCutoff = ShadowRank;
- s.EnvMap = EnvMap;
+ s.EnvMap = true;
s.ReflectionsFidelity = ReflectionsFidelity;
s.ReflectionsFramerate = ReflectionsRate;
- s.ExtraEffects = ExtraEffects;
s.SplineFidelity = SplineFidelity;
s.DrawRangeFactor = DrawRangeFactor;
- Extras?.ApplyTo(s);
- Top?.ApplyTo(s);
+ s.SmokeFidelity = SmokeFidelity;
+ foreach (var (key, value) in Keys)
+ s.Extra[key] = value;
}
/// Whether is at this level throughout.
public bool Matches(SimulatorSettings s) =>
s.MaxTextureSize == TextureSize && s.MaxCabTextureSize == CabTextureSize &&
- Near(s.TextureFiltering, Anisotropy) && s.AntiAliasing == AntiAliasing &&
- s.DynamicLights == DynamicLights && s.SmokeFidelity == SmokeFidelity &&
- s.RenderShadows == Shadows && s.ShadowMapResolution == ShadowMap &&
+ Near(s.TextureFiltering, Anisotropy) && s.ExtraEffects == ExtraEffects && s.AntiAliasing == AntiAliasing &&
+ s.RenderShadows && s.ShadowMapResolution == ShadowMap &&
s.ShadowProjectionRange == ShadowRange && s.ShadowRankCutoff == ShadowRank &&
- s.EnvMap == EnvMap && s.ReflectionsFidelity == ReflectionsFidelity &&
- Near(s.ReflectionsFramerate, ReflectionsRate) && s.ExtraEffects == ExtraEffects &&
+ s.EnvMap && s.ReflectionsFidelity == ReflectionsFidelity &&
+ Near(s.ReflectionsFramerate, ReflectionsRate) &&
s.SplineFidelity == SplineFidelity && Near(s.DrawRangeFactor, DrawRangeFactor) &&
- s.CabShadowsRange == CabShadowsRange &&
- (Extras is null || GraphicsExtras.Of(s) == Extras) &&
- (Top is null || GraphicsTop.Of(s) == Top);
+ s.SmokeFidelity == SmokeFidelity &&
+ Keys.All(pair => SameValue(SimulatorKeys.Named(pair.Key), pair.Value, s));
/// The level is at throughout, if any.
public static GraphicsPreset? Matching(SimulatorSettings s) => All.FirstOrDefault(preset => preset.Matches(s));
- internal static double NumberOf(SimulatorSettings s, string name)
+ /// Whether gives the key the value means, written its own way.
+ private static bool SameValue(SimulatorKey key, string value, SimulatorSettings s)
{
- var key = SimulatorKeys.Named(name);
- return key.ParseNumber(key.RawIn(s));
+ string raw = key.RawIn(s);
+ return key.Kind switch
+ {
+ SimulatorKeyKind.Toggle => SimulatorKey.ParseToggle(raw) == SimulatorKey.ParseToggle(value),
+ SimulatorKeyKind.Number => Near(key.ParseNumber(raw), key.ParseNumber(value)),
+ SimulatorKeyKind.Choice => key.ChoiceIndex(raw) == key.ChoiceIndex(value),
+ _ => string.Equals(raw.Trim(), value, StringComparison.OrdinalIgnoreCase)
+ };
}
// As the file rounds it.
@@ -215,69 +146,49 @@ public sealed record GraphicsPreset(
}
///
-/// A part of the picture with a level of its own, as its section on the screen has it. The rest
-/// of a level - the anti-aliasing, the post-processing switches, the dynamic lights and the smoke - goes only with the whole.
+/// A part of the picture with a level of its own: one row of the standard mode, which the levels set in one go and
+/// the player can take further up or down. The anti-aliasing has a row of its own.
///
+/// Its row's translation key.
/// The eu07.ini keys it sets.
-public sealed record GraphicsGroup(IReadOnlyList Keys)
+public sealed record GraphicsGroup(string NameKey, IReadOnlyList Keys)
{
- public static readonly GraphicsGroup DrawRange = new(new[] { "splinefidelity", "gfx.drawrange.factor.max" });
+ /// The keys of the anti-aliasing, which a level sets too.
+ public static readonly IReadOnlyList AntiAliasingKeys = new[] { "gfx.antialiasing", "multisampling" };
- public static readonly GraphicsGroup Textures = new(new[]
+ public static readonly GraphicsGroup Textures = new("GroupTextures", new[]
{
- "maxtexturesize", "maxcabtexturesize", "anisotropicfiltering"
+ "maxtexturesize", "maxcabtexturesize", "anisotropicfiltering", "gfx.extraeffects"
});
- public static readonly GraphicsGroup Shadows = new(new[]
+ public static readonly GraphicsGroup Shadows = new("GroupShadows", new[]
{
- "shadows", "gfx.shadowmap.enabled", "shadowtune", "gfx.shadow.rank.cutoff", "gfx.shadow.angle.min", "gfx.shadows.cab.range"
+ "gfx.shadowmap.enabled", "shadowtune", "gfx.shadow.rank.cutoff", "gfx.lights.shadows", "gfx.contactshadows"
});
- public static readonly GraphicsGroup Reflections = new(new[]
+ public static readonly GraphicsGroup Reflections = new("GroupReflections", new[]
{
- "gfx.envmap.enabled", "gfx.reflections.fidelity", "gfx.reflections.framerate"
+ "gfx.envmap.enabled", "gfx.reflections.fidelity", "gfx.reflections.framerate", "gfx.ssr", "gfx.cabprobe"
+ });
+
+ public static readonly GraphicsGroup Lighting = new("GroupLighting", new[]
+ {
+ "gfx.postfx.ao", "gfx.fog.quality", "gfx.clouds"
+ });
+
+ public static readonly GraphicsGroup DrawRange = new("GroupDrawRange", new[]
+ {
+ "splinefidelity", "gfx.drawrange.factor.max", "gfx.grass", "gfx.grass.distance", "gfx.grass.fadedistance",
+ "gfx.grass.density"
+ });
+
+ public static readonly GraphicsGroup Particles = new("GroupParticles", new[]
+ {
+ "gfx.smoke.fidelity", "gfx.precipitation.particles"
});
public static readonly IReadOnlyList All = new[]
{
- DrawRange, Textures, Shadows, Reflections
+ Textures, Shadows, Reflections, Lighting, DrawRange, Particles
};
}
-
-/// What applying a level touched.
-/// The eu07.ini keys it chose as a whole.
-public sealed record PresetApplied(IReadOnlyList ChosenKeys);
-
-///
-/// Remembers what was there before an end of the scale, which comes back with any level
-/// between. Leaving one chosen before this run, what was there earlier is gone, so the
-/// simulator's own values take its place.
-///
-public sealed class GraphicsPresetMemory
-{
- private GraphicsExtras? _beforeExtras;
-
- private GraphicsTop? _beforeTop;
-
- /// Puts in , with what an end of the scale left behind.
- public PresetApplied Apply(GraphicsPreset preset, SimulatorSettings settings)
- {
- var current = GraphicsPreset.Matching(settings);
- var coming = preset.Extras is not null ? null
- : _beforeExtras ?? (current?.Extras is not null ? GraphicsExtras.None : null);
- _beforeExtras = preset.Extras is not null ? _beforeExtras ?? GraphicsExtras.Of(settings) : null;
- var comingTop = preset.Top is not null ? null
- : _beforeTop ?? (current?.Top is not null ? GraphicsTop.None : null);
- _beforeTop = preset.Top is not null ? _beforeTop ?? GraphicsTop.Of(settings) : null;
- coming?.ApplyTo(settings);
- comingTop?.ApplyTo(settings);
- preset.ApplyTo(settings);
-
- var chosen = new List(GraphicsPreset.Keys);
- if (preset.Extras is not null || coming is not null)
- chosen.AddRange(GraphicsExtras.Keys);
- if (preset.Top is not null || comingTop is not null)
- chosen.AddRange(GraphicsTop.Keys);
- return new PresetApplied(chosen);
- }
-}
diff --git a/StarterNG/Domain/Settings/Renderers.cs b/StarterNG/Domain/Settings/Renderers.cs
deleted file mode 100644
index e47ec98..0000000
--- a/StarterNG/Domain/Settings/Renderers.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-namespace StarterNG.Domain.Settings;
-
-/// The renderers a gfxrenderer word picks, as application.cpp tells them apart.
-public enum RendererKind { Modern, Legacy }
-
-public static class Renderers
-{
- /// "legacy", "simple", "simpleshader" and "off" draw with the legacy renderer, any other word with the full one.
- public static RendererKind KindOf(string renderer) => renderer.ToLowerInvariant() switch
- {
- "legacy" or "simple" or "simpleshader" or "off" => RendererKind.Legacy,
- _ => RendererKind.Modern
- };
-}
diff --git a/StarterNG/Domain/Settings/SimulatorKeys.cs b/StarterNG/Domain/Settings/SimulatorKeys.cs
index f0d53c7..15996b9 100644
--- a/StarterNG/Domain/Settings/SimulatorKeys.cs
+++ b/StarterNG/Domain/Settings/SimulatorKeys.cs
@@ -5,13 +5,14 @@ using System.Linq;
namespace StarterNG.Domain.Settings;
-public enum SimulatorKeyKind { Toggle, Number, Text }
+public enum SimulatorKeyKind { Toggle, Number, Text, Choice }
///
/// An eu07.ini key the simulator reads that needs no logic of the starter's own:
-/// a switch, a number or a word, shown as one row of the settings. The default
-/// is the simulator's own, from Globals.h, used while the file does not carry
-/// the key.
+/// a switch, a number, a word or one of a few words, shown as one row of the settings.
+/// The default is the simulator's own, from Globals.h, used while the file does not
+/// carry the key - but for a key the starter , where it is the
+/// starter's own: the faster choice the simulator does not make by itself.
///
public sealed record SimulatorKey(
string Key,
@@ -24,7 +25,9 @@ public sealed record SimulatorKey(
double Step = 1,
string Unit = "",
bool ZeroIsOff = false,
- int Repeat = 1)
+ int Repeat = 1,
+ bool Writes = false,
+ IReadOnlyList? Choices = null)
{
/// The label's translation key; the explanation's adds "Desc".
public string LabelKey => "Ini." + Key;
@@ -36,6 +39,31 @@ public sealed record SimulatorKey(
public static string FormatToggle(bool value) => value ? "yes" : "no";
+ /// The words of a level the simulator takes for 0 to 3 as well.
+ public static readonly IReadOnlyList Levels = new[] { "no", "low", "medium", "high" };
+
+ ///
+ /// Where stands among the : its word, or the number the simulator
+ /// takes for a level (gfx.ssr 2 is medium); -1 for one it is not.
+ ///
+ public int ChoiceIndex(string raw)
+ {
+ if (Choices is null)
+ return -1;
+ string word = FirstToken(raw);
+ for (int i = 0; i < Choices.Count; i++)
+ if (string.Equals(Choices[i], word, StringComparison.OrdinalIgnoreCase))
+ return i;
+ if (ReferenceEquals(Choices, Levels) &&
+ int.TryParse(word, NumberStyles.Integer, CultureInfo.InvariantCulture, out int level) &&
+ level >= 0 && level < Choices.Count)
+ return level;
+ return -1;
+ }
+
+ /// The label's translation key of the word .
+ public static string ChoiceLabelKey(string choice) => "Choice." + choice;
+
/// The key's value in , in the file's words: what is set, or else the default.
public string RawIn(SimulatorSettings s) => s.Extra.TryGetValue(Key, out string? raw) ? raw : Default;
@@ -64,10 +92,13 @@ public sealed record SimulatorKey(
public static class SimulatorKeys
{
///
- /// The keys a player sees in the standard mode, which has what the old starter had. It had
- /// none of these: they are all for the advanced mode.
+ /// The keys a player sees in the standard mode. The rest are the developer tab's, which only the advanced
+ /// mode shows: a player in the standard mode has them at their defaults, the fast choice.
///
- public static readonly IReadOnlySet Standard = new HashSet(StringComparer.OrdinalIgnoreCase);
+ public static readonly IReadOnlySet Standard = new HashSet(StringComparer.OrdinalIgnoreCase)
+ {
+ "ui.scale"
+ };
public const string General = "general";
public const string Graphics = "graphics";
@@ -75,8 +106,13 @@ public static class SimulatorKeys
public const string Physics = "physics";
public const string Advanced = "advanced";
- private static SimulatorKey Toggle(string key, bool value, string category, string section) =>
- new(key, SimulatorKeyKind.Toggle, SimulatorKey.FormatToggle(value), category, section);
+ public const string RendererSection = "IniSectionRenderer";
+ public const string QualitySection = "IniSectionQuality";
+ public const string PerformanceSection = "IniSectionPerformance";
+ public const string LogsSection = "IniSectionLogs";
+
+ private static SimulatorKey Toggle(string key, bool value, string category, string section, bool writes = false) =>
+ new(key, SimulatorKeyKind.Toggle, SimulatorKey.FormatToggle(value), category, section, Writes: writes);
private static SimulatorKey Number(string key, double value, string category, string section,
double min, double max, double step, string unit = "",
@@ -87,47 +123,98 @@ public static class SimulatorKeys
private static SimulatorKey Text(string key, string category, string section) =>
new(key, SimulatorKeyKind.Text, string.Empty, category, section);
+ private static SimulatorKey Choice(string key, string value, string section, IReadOnlyList? choices = null) =>
+ new(key, SimulatorKeyKind.Choice, value, Advanced, section, Choices: choices ?? SimulatorKey.Levels);
+
public static SimulatorKey Named(string key) => All.First(k => k.Key == key);
public static IReadOnlyList All { get; } = new[]
{
Number("ui.scale", 1, General, "IniSectionInterface", 0.5, 3, 0.05, "×"),
- Number("ui.fontsize", 13, General, "IniSectionInterface", 8, 32, 1, " px"),
- Number("ui.bg.opacity", 0.94, General, "IniSectionInterface", 0.1, 1, 0.05),
- Toggle("gui.defaultwindows", true, General, "IniSectionInterface"),
- Toggle("gui.trainingdefault", false, General, "IniSectionInterface"),
- Toggle("gui.showtranscripts", true, General, "IniSectionInterface"),
- Toggle("loadinglog", false, General, "IniSectionInterface"),
- Toggle("captureonstart", true, General, "IniSectionInterface"),
- Toggle("mousecontrol", true, General, "IniSectionInterface"),
- Text("screenshotsdir", General, "IniSectionInterface"),
+ Number("ui.fontsize", 13, Advanced, "IniSectionInterface", 8, 32, 1, " px"),
+ Number("ui.bg.opacity", 0.94, Advanced, "IniSectionInterface", 0.1, 1, 0.05),
+ Toggle("gui.defaultwindows", true, Advanced, "IniSectionInterface"),
+ Toggle("gui.trainingdefault", false, Advanced, "IniSectionInterface"),
+ Toggle("gui.showtranscripts", true, Advanced, "IniSectionInterface"),
+ Toggle("captureonstart", true, Advanced, "IniSectionInterface"),
+ Toggle("mousecontrol", true, Advanced, "IniSectionInterface"),
+ Text("screenshotsdir", Advanced, "IniSectionInterface"),
- Number("basedrawrange", 2500, Graphics, "IniSectionRanges", 500, 10000, 250, " m"),
- Number("heightbase", 1, Graphics, "IniSectionRanges", 0.5, 3, 0.05, "×"),
- Number("targetfps", 0, Graphics, "IniSectionRanges", 0, 240, 5, " FPS", zeroIsOff: true),
- Number("sleeperdistance", 250, Graphics, "IniSectionRanges", 0, 1000, 50, " m", zeroIsOff: true),
- Number("gfx.reflections.range_instances", 750, Graphics, "IniSectionRanges", 0, 3000, 50, " m"),
- Number("gfx.reflections.range_vehicles", 250, Graphics, "IniSectionRanges", 0, 2000, 50, " m"),
- Toggle("gfx.textures.streaming", false, Graphics, "IniSectionRanges"),
- Number("gfx.textures.releasedistance", 0, Graphics, "IniSectionRanges", 0, 10, 0.5, "×", zeroIsOff: true),
- Toggle("skyenabled", true, Graphics, "IniSectionRanges"),
- Toggle("rendercab", true, Graphics, "IniSectionRanges"),
- Number("gfx.postfx.motionblur.shutter", 0.01, Graphics, "IniSectionRanges", 0.001, 0.1, 0.001, " s"),
- Number("python.fpslimit", 100, Graphics, "IniSectionRanges", 5, 200, 5, " FPS"),
- Toggle("python.vsync", true, Graphics, "IniSectionRanges"),
- Toggle("python.displaywindows", false, Graphics, "IniSectionRanges"),
- Toggle("newaircouplers", true, Graphics, "IniSectionRanges"),
- Toggle("smoothtraction", true, Graphics, "IniSectionRanges"),
+ // The renderer: what only Vulkan reads, and the shaders of either.
+ Text("gfx.vulkan.device", Advanced, RendererSection),
+ Toggle("gfx.vulkan.renderthread", true, Advanced, RendererSection),
+ Number("gfx.threads", 0, Advanced, RendererSection, 0, 64, 1, zeroIsOff: true),
+ Toggle("gfx.vulkan.asyncresources", true, Advanced, RendererSection),
+ Toggle("gfx.vulkan.parallelpasses", true, Advanced, RendererSection),
+ Toggle("gfx.vulkan.parallelmodels", true, Advanced, RendererSection),
+ Toggle("gfx.vulkan.asynccompute", false, Advanced, RendererSection),
+ Number("gfx.vulkan.framesinflight", 2, Advanced, RendererSection, 2, 3, 1),
+ Toggle("gfx.shaders.binaries", true, Advanced, RendererSection),
- Number("sound.maxsources", 30, Sound, "IniSectionAudio", 8, 256, 8),
- Toggle("sound.asyncload", false, Sound, "IniSectionAudio"),
+ // The parts of the picture of the OpenGL 4.6 and Vulkan renderers the levels set, one by one.
+ Choice("gfx.lights.shadows", "medium", QualitySection),
+ Choice("gfx.contactshadows", "no", QualitySection),
+ Toggle("gfx.shadow.sdsm", false, Advanced, QualitySection),
+ Choice("gfx.ssr", "medium", QualitySection),
+ Toggle("gfx.raytracing", false, Advanced, QualitySection),
+ Choice("gfx.cabprobe", "medium", QualitySection),
+ Toggle("gfx.water.realistic", false, Advanced, QualitySection),
+ Choice("gfx.postfx.ao", "gtao", QualitySection, new[] { "no", "ssao", "gtao" }),
+ Choice("gfx.fog.quality", "medium", QualitySection, new[] { "low", "medium", "high", "ultra" }),
+ Choice("gfx.clouds", "medium", QualitySection, new[] { "no", "low", "medium", "high", "ultra" }),
+ Toggle("gfx.postfx.bloom", true, Advanced, QualitySection),
+ Toggle("gfx.grass", true, Advanced, QualitySection),
+ Number("gfx.grass.distance", 60, Advanced, QualitySection, 5, 500, 5, " m"),
+ Number("gfx.grass.fadedistance", 70, Advanced, QualitySection, 5, 600, 5, " m"),
+ Number("gfx.grass.density", 1, Advanced, QualitySection, 0, 4, 0.25, "×"),
+ Number("gfx.precipitation.particles", 65536, Advanced, QualitySection, 0, 262144, 4096),
+ Choice("gfx.dlss.preset", "default", QualitySection, new[] { "default", "j", "k", "l", "m" }),
+ Choice("gfx.framegeneration", "off", QualitySection, new[] { "off", "x2", "x3", "x4" }),
+ Choice("gfx.reflex", "off", QualitySection, new[] { "off", "on", "boost" }),
- Toggle("loadtraction", true, Physics, "IniSectionPhysics"),
- Toggle("rollfix", true, Physics, "IniSectionPhysics"),
- Number("shakefactor", 1, Physics, "IniSectionPhysics", 0, 3, 0.1, "×", repeat: 3),
- Toggle("map.manualswitchcontrol", false, Physics, "IniSectionPhysics"),
- Number("map.highlightdistance", 3000, Physics, "IniSectionPhysics", 0, 10000, 250, " m", zeroIsOff: true),
+ Number("basedrawrange", 2500, Advanced, "IniSectionRanges", 500, 10000, 250, " m"),
+ Number("heightbase", 1, Advanced, "IniSectionRanges", 0.5, 3, 0.05, "×"),
+ Number("targetfps", 0, Advanced, "IniSectionRanges", 0, 240, 5, " FPS", zeroIsOff: true),
+ Number("sleeperdistance", 250, Advanced, "IniSectionRanges", 0, 1000, 50, " m", zeroIsOff: true),
+ Number("gfx.reflections.range_instances", 750, Advanced, "IniSectionRanges", 0, 3000, 50, " m"),
+ Number("gfx.reflections.range_vehicles", 250, Advanced, "IniSectionRanges", 0, 2000, 50, " m"),
+ Toggle("rendercab", true, Advanced, "IniSectionRanges"),
+ Number("gfx.postfx.motionblur.shutter", 0.01, Advanced, "IniSectionRanges", 0.001, 0.1, 0.001, " s"),
+ Number("python.fpslimit", 100, Advanced, "IniSectionRanges", 5, 200, 5, " FPS"),
+ Toggle("python.vsync", true, Advanced, "IniSectionRanges"),
+ Toggle("python.displaywindows", false, Advanced, "IniSectionRanges"),
+ Toggle("newaircouplers", true, Advanced, "IniSectionRanges"),
- Toggle("showsystemconsole", false, Advanced, "IniSectionConsole"),
+ // What makes the simulator faster at no cost to the picture. Where the simulator's own default is the
+ // slower one, the starter writes its own: the standard mode keeps them all on.
+ Toggle("gfx.gpucull", true, Advanced, PerformanceSection, writes: true),
+ Toggle("gfx.gpucull.occlusion", true, Advanced, PerformanceSection),
+ Toggle("gfx.depthprepass", true, Advanced, PerformanceSection),
+ Toggle("gfx.textures.streaming", true, Advanced, PerformanceSection, writes: true),
+ Number("gfx.textures.releasedistance", 0, Advanced, PerformanceSection, 0, 10, 0.5, "×", zeroIsOff: true),
+ Toggle("sound.asyncload", true, Advanced, PerformanceSection, writes: true),
+ Toggle("physics.sleepheld", true, Advanced, PerformanceSection, writes: true),
+ Toggle("physics.roadlod", true, Advanced, PerformanceSection, writes: true),
+ Toggle("performance.multithreading", true, Advanced, PerformanceSection),
+ Toggle("file.binary.terrain", true, Advanced, PerformanceSection),
+ Toggle("gfx.smoke.gpu", true, Advanced, PerformanceSection),
+ Toggle("gfx.weather.occlusion", true, Advanced, PerformanceSection),
+ Toggle("gfx.clouds.interleave", true, Advanced, PerformanceSection),
+ Toggle("screens.gpupost", true, Advanced, PerformanceSection),
+ Number("screens.cabframes", 4, Advanced, PerformanceSection, 1, 60, 1),
+ Number("screens.externalframes", 30, Advanced, PerformanceSection, 1, 120, 1),
+
+ Number("sound.maxsources", 30, Advanced, "IniSectionAudio", 8, 256, 8),
+
+ Toggle("loadtraction", true, Advanced, "IniSectionPhysics"),
+ Toggle("rollfix", true, Advanced, "IniSectionPhysics"),
+ Number("shakefactor", 1, Advanced, "IniSectionPhysics", 0, 3, 0.1, "×", repeat: 3),
+ Toggle("map.manualswitchcontrol", false, Advanced, "IniSectionPhysics"),
+ Number("map.highlightdistance", 3000, Advanced, "IniSectionPhysics", 0, 10000, 250, " m", zeroIsOff: true),
+
+ Toggle("loadinglog", false, Advanced, LogsSection),
+ Toggle("showsystemconsole", false, Advanced, LogsSection),
+ Number("debug.perflog", 0, Advanced, LogsSection, 0, 60, 1, " s", zeroIsOff: true),
+ Toggle("crashdump.full", false, Advanced, LogsSection),
};
}
diff --git a/StarterNG/Domain/Settings/SimulatorSettings.cs b/StarterNG/Domain/Settings/SimulatorSettings.cs
index b29c218..49b6cc3 100644
--- a/StarterNG/Domain/Settings/SimulatorSettings.cs
+++ b/StarterNG/Domain/Settings/SimulatorSettings.cs
@@ -8,8 +8,13 @@ public enum ConsistReadyOverride { Scenery = 0, AlwaysCold = 1, AlwaysReady = 2
public enum ExeProblem { None, NotFound, NotExecutable, WrongPlatform, NotAProgram }
-// multisampling: 0 off, then 2, 4 and 8 samples.
-public enum AntiAliasingMode { Off, Msaa2, Msaa4, Msaa8 }
+// gfx.antialiasing (and the older multisampling, 0 off, then 2, 4 and 8 samples). Dlss and Dlaa are the Vulkan
+// renderer's only, on an NVIDIA RTX card with a build that has DLSS; the simulator falls back to TAA elsewhere.
+public enum AntiAliasingMode { Off, Msaa2, Msaa4, Msaa8, Msaa16, Taa, Dlss, Dlaa }
+
+// gfxrenderer: the Vulkan 1.4 renderer, which the simulator leaves for the OpenGL one where it cannot run, or the
+// OpenGL 4.6 one ("default").
+public enum GraphicsBackend { Vulkan, OpenGL }
public sealed class SimulatorSettings
{
@@ -52,16 +57,19 @@ public sealed class SimulatorSettings
public bool VirtualShunting = true;
public bool LogMissingVehicleFiles;
- public int RenderEngine;
+ /// The renderer: Vulkan unless the advanced mode chose OpenGL.
+ public GraphicsBackend Backend = GraphicsBackend.Vulkan;
///
- /// 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.
+ /// The file's gfxrenderer word where it is none the starter knows - "null" of the test runs, or one of a
+ /// newer simulator: written back as it is until another renderer is chosen.
///
public string? RendererWord;
public int Width = 1280;
public int Height = 720;
+
+ /// gfx.buffer.percent, in percent: the part of the window the picture is drawn at, then stretched to it.
public int BufferScalePercent = 100;
public int MaxTextureSize = 4096;
public int MaxCabTextureSize = 4096;
@@ -78,19 +86,13 @@ public sealed class SimulatorSettings
public bool EnvMap = true;
public bool RenderShadows = true;
- // Only the legacy renderer, or only Windows builds, read these.
- public bool UseVbo = true;
- public bool RenderAngleVulkan;
- public bool UseGLES;
- public int CabShadowsRange;
-
/// Updates of the reflections a second; the simulator's own is one in five minutes.
public double ReflectionsFramerate = 1 / 300.0;
public int ShadowMapResolution = 2048;
/// The third number of shadowtune; the second and fourth go unread.
public int ShadowProjectionRange = 250;
public int ShadowRankCutoff = 3;
- public int ReflectionsFidelity;
+ public int ReflectionsFidelity = 2;
public int FieldOfView = 45;
public bool PythonScreens = true;
public bool PythonThreadedUpload = true;
@@ -165,6 +167,16 @@ public sealed class SimulatorSettings
///
public bool MovedToStandard;
+ ///
+ /// starter.settings.revision: the layout of the settings this file was last brought to. Below
+ /// , a player in the standard mode is moved to it once: the renderer and what
+ /// only the developer tab shows at the starter's own values, the fast ones.
+ ///
+ public int Revision;
+
+ /// The layout of this starter: the standard mode on Vulkan, the rest in the developer tab.
+ public const int CurrentRevision = 2;
+
/// Warn at start when the processor cannot run the official simulator builds.
public bool CpuNotice = true;
@@ -197,26 +209,20 @@ public sealed class SimulatorSettings
}
///
- /// The gfxrenderer words the starter offers. "default" is the full renderer, the one to use
- /// wherever it runs; the other two draw with the legacy one. The experimental renderer is
- /// not offered: the simulator a player has is built without it.
- ///
- public static readonly string[] RenderEngines = { "default", "legacy", "simple" };
-
- ///
- /// The words the starter places among : those application.cpp on
- /// master knows, but "experimental". Any other word is kept as .
+ /// The gfxrenderer words the simulator knows (utilities/Globals.cpp): the Vulkan ones, the OpenGL ones and
+ /// those of the renderers it no longer has, which it reads as OpenGL. Any other word is kept as
+ /// .
///
public static bool KnownRendererWord(string? word) =>
- word?.Trim().ToLowerInvariant() is "default" or "legacy" or "simple" or "simpleshader" or "off";
+ word?.Trim().ToLowerInvariant() is "vulkan" or "vulkan14" or "default" or "full" or "opengl" or "gl46"
+ or "legacy" or "simple" or "simpleshader" or "off" or "experimental";
- /// Where stands among , as the simulator reads it.
- public static int RenderEngineOf(string word) => word.Trim().ToLowerInvariant() switch
- {
- "legacy" or "simpleshader" or "off" => 1,
- "simple" => 2,
- _ => 0
- };
+ /// The renderer picks, as the simulator reads it.
+ public static GraphicsBackend BackendOf(string word) =>
+ word.Trim().ToLowerInvariant() is "vulkan" or "vulkan14" ? GraphicsBackend.Vulkan : GraphicsBackend.OpenGL;
+
+ /// The gfxrenderer word of .
+ public static string WordOf(GraphicsBackend backend) => backend == GraphicsBackend.Vulkan ? "vulkan" : "default";
///
/// The least shadow range the simulator keeps for a map size: a map above
@@ -225,14 +231,13 @@ public sealed class SimulatorSettings
public static int ShadowRangeFloor(int mapSize) => mapSize <= 2048 ? 75 : 75 * mapSize / 2048;
///
- /// How far shadows actually reach. The full renderer's cascades stretch with a
- /// map above 2048 px (opengl33renderer.cpp), on top of the floor; the legacy
- /// one draws a single map out to the range itself.
+ /// How far shadows actually reach: the cascades stretch with a map above 2048 px
+ /// (rendering/common/shadowfit.cpp), on top of the floor.
///
- public static int ShadowReach(int range, int mapSize, bool legacyRenderer)
+ public static int ShadowReach(int range, int mapSize)
{
int reach = Math.Max(range, ShadowRangeFloor(mapSize));
- return legacyRenderer || mapSize <= 2048 ? reach : reach * (mapSize / 2048);
+ return mapSize <= 2048 ? reach : reach * (mapSize / 2048);
}
///
diff --git a/StarterNG/Domain/Settings/SliderRanges.cs b/StarterNG/Domain/Settings/SliderRanges.cs
index 2c18853..f4d9aba 100644
--- a/StarterNG/Domain/Settings/SliderRanges.cs
+++ b/StarterNG/Domain/Settings/SliderRanges.cs
@@ -16,15 +16,15 @@ public static class SliderRanges
/// dynamiclights: 1 to 7.
public const int MinDynamicLights = 1;
- /// gfx.reflections.framerate, in updates a second.
- public static readonly double[] ReflectionUpdates = { 1, 3, 10, 25, 60 };
+ ///
+ /// gfx.reflections.framerate, in updates a second: from the simulator's own once in five minutes, which the
+ /// levels below Very high keep, up to every frame.
+ ///
+ public static readonly double[] ReflectionUpdates = { 1 / 300.0, 1 / 60.0, 0.2, 1, 3, 10, 25, 60 };
/// gfx.drawrange.factor.max: normal, high and very high.
public static readonly double[] DrawRangeFactors = { 1, 2, 3 };
- /// gfx.shadows.cab.range, in metres: off, then 10 to 100.
- public static readonly double[] CabShadowRanges = { 0, 10, 20, 30, 50, 100 };
-
/// fpslimit: none, or up to 240, where the fastest usual monitors run.
public static readonly double[] FrameRateLimits =
{ 0, 20, 25, 30, 40, 45, 50, 60, 72, 75, 90, 100, 120, 144, 165, 180, 200, 240 };
diff --git a/StarterNG/Infrastructure/Settings/SettingsSerializer.cs b/StarterNG/Infrastructure/Settings/SettingsSerializer.cs
index 5939b33..4097a34 100644
--- a/StarterNG/Infrastructure/Settings/SettingsSerializer.cs
+++ b/StarterNG/Infrastructure/Settings/SettingsSerializer.cs
@@ -11,15 +11,6 @@ namespace StarterNG.Infrastructure.Settings;
public sealed class SettingsSerializer
{
- private readonly Func? _monitorSize;
-
- ///
- /// The size of the monitor a full screen of the simulator goes to, by what fullscreenmonitor
- /// says; null where it is not known.
- ///
- public SettingsSerializer(Func? monitorSize = null) =>
- _monitorSize = monitorSize;
-
///
/// An ini of before the tapes of the trains, its recording turned on ("blackbox yes", with the physics log of every
/// vehicle, hundreds of files on a big scenery): moved to the tapes of the trains, the log of every vehicle off.
@@ -91,8 +82,9 @@ public sealed class SettingsSerializer
s.VirtualShunting = c.GetBool("ai.trainman", true);
s.LogMissingVehicleFiles = c.GetBool("starter.logmissingvehicles", false);
- string renderer = c.GetString("gfxrenderer", "default").Trim();
- s.RenderEngine = SimulatorSettings.RenderEngineOf(renderer);
+ // Vulkan unless the file says otherwise: the simulator's own is OpenGL, so the starter always writes it.
+ string renderer = c.GetString("gfxrenderer", SimulatorSettings.WordOf(GraphicsBackend.Vulkan)).Trim();
+ s.Backend = SimulatorSettings.BackendOf(renderer);
s.RendererWord = renderer.Length > 0 && !SimulatorSettings.KnownRendererWord(renderer) ? renderer : null;
s.Width = c.GetInt("width", 1280);
s.Height = c.GetInt("height", 720);
@@ -110,8 +102,7 @@ public sealed class SettingsSerializer
s.MotionBlur = c.GetBool("gfx.postfx.motionblur.enabled", true);
s.ExtraEffects = c.GetBool("gfx.extraeffects", true);
s.EnvMap = c.GetBool("gfx.envmap.enabled", true);
- s.UseVbo = c.GetBool("usevbo", true);
- s.RenderShadows = c.GetBool("shadows", true);
+ s.RenderShadows = c.GetBool("gfx.shadowmap.enabled", true);
// A negative rate counts as its size; none at all, as never.
double reflections = Math.Abs(c.GetDouble("gfx.reflections.framerate", 1 / 300.0));
s.ReflectionsFramerate = reflections > 0 ? reflections : 1 / 300.0;
@@ -123,9 +114,9 @@ public sealed class SettingsSerializer
if (shadowTune.Length >= 2) s.ShadowTuneUnused[0] = shadowTune[1];
if (shadowTune.Length >= 4) s.ShadowTuneUnused[1] = shadowTune[3];
- s.CabShadowsRange = (int)Math.Round(c.GetDouble("gfx.shadows.cab.range", 0));
s.ShadowRankCutoff = c.GetInt("gfx.shadow.rank.cutoff", 3);
- s.ReflectionsFidelity = Clamp(c.GetInt("gfx.reflections.fidelity", 0), 0, 2);
+ // the simulator's own: track sections, models and vehicles (Globals.h)
+ s.ReflectionsFidelity = Clamp(c.GetInt("gfx.reflections.fidelity", 2), 0, 2);
s.FieldOfView = Clamp((int)Math.Round(c.GetDouble("fieldofview", 45)), 10, 75);
s.PythonScreens = c.GetBool("python.enabled", true);
s.PythonThreadedUpload = c.GetBool("python.threadedupload", true);
@@ -136,7 +127,6 @@ public sealed class SettingsSerializer
s.ShadowAngleLimit = c.GetDouble("gfx.shadow.angle.min", 0.2);
s.FullscreenWindowed = c.GetBool("fullscreenwindowed", false);
s.FullscreenMonitor = LegacyText.Utf8From1250(c.GetString("fullscreenmonitor", "").Trim());
- s.RenderAngleVulkan = string.Equals(c.GetString("gfx.angleplatform", ""), "vulkan", StringComparison.OrdinalIgnoreCase);
s.SplineFidelity = Clamp(c.GetInt("splinefidelity", 1), 1, 4);
s.FullPhysics = c.GetBool("fullphysics", true);
@@ -172,7 +162,6 @@ public sealed class SettingsSerializer
s.CompressTextures = c.GetBool("compresstex", true);
s.ScaleSpeculars = c.GetBool("scalespeculars", true);
- s.UseGLES = c.GetBool("gfx.usegles", false);
s.ShaderGamma = c.GetBool("gfx.shadergamma", false);
s.ScreenMipmaps = c.GetBool("python.mipmaps", true);
s.ExtendedModelConversion = c.GetInt("convertmodels", 0) != 0;
@@ -186,6 +175,7 @@ public sealed class SettingsSerializer
s.AutoExpandSceneryTree = c.GetBool("starter.expandtree", false);
s.AdvancedSettings = c.GetBool("starter.settings.advanced", false);
s.MovedToStandard = c.GetBool("starter.settings.standard", false);
+ s.Revision = c.GetInt("starter.settings.revision", 0);
s.CpuNotice = c.GetBool("starter.cpunotice", true);
s.Gpu = string.Equals(c.GetString("starter.gpu", "discrete"), "system", StringComparison.OrdinalIgnoreCase)
? GpuPreference.System
@@ -209,6 +199,9 @@ public sealed class SettingsSerializer
foreach (var key in SimulatorKeys.All)
if (c.Has(key.Key))
s.Extra[key.Key] = c.GetRaw(key.Key) ?? string.Empty;
+ // the faster choice the simulator's own default is not: written whether or not the file had it
+ else if (key.Writes)
+ s.Extra[key.Key] = key.Default;
GraphicsRules.Normalize(s);
}
@@ -227,15 +220,29 @@ public sealed class SettingsSerializer
public static readonly string[] RepeatableKeys = { "network.server", "python.viewport", "extraviewport", "test.vehicle" };
/// Keys written only when they say something, besides those of .
- public static readonly string[] OptionalKeys = { "fpslimit", "gfx.angleplatform", "fullscreenmonitor" };
+ public static readonly string[] OptionalKeys = { "fpslimit", "fullscreenmonitor" };
- /// Keys no simulator reads any more, taken out of the file on a save.
+ ///
+ /// Keys the simulator no longer goes by, taken out of the file on a save: those of the renderers it has no more,
+ /// which it logs as unsupported (usevbo, gfx.usegles, gfx.angleplatform, the frame buffer's size in pixels in
+ /// place of gfx.buffer.percent), those it reads and does nothing with, and the starter's own of before.
+ ///
public static readonly string[] ObsoleteKeys =
{
"gfx.postfx.tonemapping",
"starter.developertools",
- // 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.
+ "usevbo",
+ "gfx.usegles",
+ "gfx.angleplatform",
+ "gfx.framebuffer.width",
+ "gfx.framebuffer.height",
+ "starter.bufferscale",
+ "shadows",
+ "gfx.shadows.cab.range",
+ "smoothtraction",
+ "skyenabled",
+ "hideconsole",
+ "slowmotion",
};
///
@@ -289,18 +296,18 @@ public sealed class SettingsSerializer
c.SetBool("ai.trainman", s.VirtualShunting);
c.SetBool("starter.logmissingvehicles", s.LogMissingVehicleFiles);
- c.Set("gfxrenderer", s.RendererWord ?? SimulatorSettings.RenderEngines[Clamp(s.RenderEngine, 0, SimulatorSettings.RenderEngines.Length - 1)]);
+ c.Set("gfxrenderer", s.RendererWord ?? SimulatorSettings.WordOf(s.Backend));
c.SetInt("width", s.Width);
c.SetInt("height", s.Height);
- c.SetInt("starter.bufferscale", s.BufferScalePercent);
- // The simulator draws into a buffer of this size and stretches it to the window.
- var (bufferWidth, bufferHeight) = FramebufferSize(s);
- c.SetInt("gfx.framebuffer.width", bufferWidth);
- c.SetInt("gfx.framebuffer.height", bufferHeight);
+ // The simulator draws at this part of the window and stretches it to the window.
+ c.SetDouble("gfx.buffer.percent", s.BufferScalePercent / 100.0);
c.SetInt("maxtexturesize", s.MaxTextureSize);
c.SetInt("maxcabtexturesize", s.MaxCabTextureSize);
c.SetDouble("anisotropicfiltering", s.TextureFiltering);
+ // The older key for the simulators before gfx.antialiasing; of the two, the simulator heeds the one further
+ // down, which SettingsStore keeps gfx.antialiasing.
c.SetInt("multisampling", MultisamplingLevel(s.AntiAliasing));
+ c.Set("gfx.antialiasing", AntiAliasingWord(s.AntiAliasing));
c.SetInt("dynamiclights", s.DynamicLights);
c.SetDouble("gfx.drawrange.factor.max", s.DrawRangeFactor);
c.SetBool("vsync", s.VSync);
@@ -310,14 +317,11 @@ public sealed class SettingsSerializer
c.SetBool("gfx.postfx.motionblur.enabled", s.MotionBlur);
c.SetBool("gfx.extraeffects", s.ExtraEffects);
c.SetBool("gfx.envmap.enabled", s.EnvMap);
- c.SetBool("usevbo", s.UseVbo);
- c.SetBool("shadows", s.RenderShadows);
c.SetBool("gfx.shadowmap.enabled", s.RenderShadows);
c.Set("gfx.reflections.framerate", s.ReflectionsFramerate.ToString("0.######", CultureInfo.InvariantCulture));
c.Set("shadowtune",
$"{s.ShadowMapResolution} {s.ShadowTuneUnused[0]} " +
$"{s.ShadowProjectionRange} {s.ShadowTuneUnused[1]}");
- c.SetInt("gfx.shadows.cab.range", s.CabShadowsRange);
c.SetInt("gfx.shadow.rank.cutoff", s.ShadowRankCutoff);
c.SetInt("gfx.reflections.fidelity", s.ReflectionsFidelity);
c.SetInt("fieldofview", s.FieldOfView);
@@ -329,7 +333,6 @@ public sealed class SettingsSerializer
// The simulator compares the word with GLFW's name of the monitor, which is UTF-8.
if (!string.IsNullOrWhiteSpace(s.FullscreenMonitor))
c.Set("fullscreenmonitor", LegacyText.Utf8As1250(s.FullscreenMonitor.Trim()));
- if (s.RenderAngleVulkan) c.Set("gfx.angleplatform", "vulkan");
c.SetInt("splinefidelity", s.SplineFidelity);
c.SetBool("fullphysics", s.FullPhysics);
@@ -363,7 +366,6 @@ public sealed class SettingsSerializer
c.SetBool("compresstex", s.CompressTextures);
c.SetBool("scalespeculars", s.ScaleSpeculars);
- c.SetBool("gfx.usegles", s.UseGLES);
c.SetBool("gfx.shadergamma", s.ShaderGamma);
c.SetBool("python.mipmaps", s.ScreenMipmaps);
c.Set("convertmodels", s.ExtendedModelConversion ? "143" : "0");
@@ -377,6 +379,7 @@ public sealed class SettingsSerializer
c.SetBool("starter.expandtree", s.AutoExpandSceneryTree);
c.SetBool("starter.settings.advanced", s.AdvancedSettings);
c.SetBool("starter.settings.standard", s.MovedToStandard);
+ c.SetInt("starter.settings.revision", s.Revision);
c.SetBool("starter.cpunotice", s.CpuNotice);
c.Set("starter.gpu", s.Gpu == GpuPreference.System ? "system" : "discrete");
c.SetInt("starter.batterydefault", (int)s.ReadyOverride);
@@ -395,49 +398,33 @@ public sealed class SettingsSerializer
c.Set(key.Key, value.Trim());
}
- /// The keys of the frame buffer's size.
- public static readonly string[] FramebufferKeys = { "gfx.framebuffer.width", "gfx.framebuffer.height" };
-
- /// What the simulator takes for "as large as the window" (opengl33renderer.cpp), its own default.
- public const int FramebufferOfWindow = -1;
-
///
- /// The frame buffer of : its part of the window. Borderless, the window
- /// is the monitor whatever width and height say (application.cpp), so the buffer is the
- /// window's own, or its part of the monitor's size where that is known.
- ///
- private (int Width, int Height) FramebufferSize(SimulatorSettings s)
- {
- if (!s.FullscreenWindowed)
- return (Part(s.Width, s.BufferScalePercent), Part(s.Height, s.BufferScalePercent));
- if (s.BufferScalePercent < 100 &&
- _monitorSize?.Invoke(s.FullscreenMonitor.Trim()) is { Width: > 0, Height: > 0 } monitor)
- return (Part(monitor.Width, s.BufferScalePercent), Part(monitor.Height, s.BufferScalePercent));
- return (FramebufferOfWindow, FramebufferOfWindow);
- }
-
- private static int Part(int size, int percent) => (int)Math.Round(size * percent / 100.0);
-
- ///
- /// with the keys that say the same setting along with them: the
- /// starter's own percent goes wherever the frame buffer's size does, or it would stand
- /// when the size is put back.
+ /// with the keys that say the same setting along with them: the anti-aliasing is
+ /// written in two keys, the older for the simulators before the newer one.
///
public static IReadOnlyCollection WithCompanions(IReadOnlyCollection keys)
{
- if (!keys.Intersect(FramebufferKeys, StringComparer.OrdinalIgnoreCase).Any())
+ if (!keys.Intersect(GraphicsGroup.AntiAliasingKeys, StringComparer.OrdinalIgnoreCase).Any())
return keys;
- var all = new HashSet(keys, StringComparer.OrdinalIgnoreCase) { "starter.bufferscale" };
- all.UnionWith(FramebufferKeys);
+ var all = new HashSet(keys, StringComparer.OrdinalIgnoreCase);
+ all.UnionWith(GraphicsGroup.AntiAliasingKeys);
return all;
}
private static int ReadBufferScale(ConfigFile c) =>
Clamp(BufferScaleIn(c), 25, GraphicsRules.MaxBufferScale);
- // The starter's own percent, or the framebuffer the file sets against its window.
+ ///
+ /// The render scale in percent: gfx.buffer.percent as the simulator reads it (a fraction, or above 4 a percent),
+ /// else what a starter of before left - its own percent, or the frame buffer the file set against its window.
+ ///
private static int BufferScaleIn(ConfigFile c)
{
+ if (c.Has("gfx.buffer.percent"))
+ {
+ double part = c.GetDouble("gfx.buffer.percent", 1);
+ return (int)Math.Round(part > 4 ? part : part * 100);
+ }
if (c.Has("starter.bufferscale"))
return c.GetInt("starter.bufferscale", 100);
int width = c.GetInt("width", 0);
@@ -458,16 +445,53 @@ public sealed class SettingsSerializer
if (shadowTune.Length >= 3 && ParseDouble(shadowTune[2], 0) > GraphicsRules.MaxShadowRange)
keys.Add("shadowtune");
if (BufferScaleIn(c) > GraphicsRules.MaxBufferScale)
- keys.UnionWith(new[] { "starter.bufferscale", "gfx.framebuffer.width", "gfx.framebuffer.height" });
+ keys.Add("gfx.buffer.percent");
return keys;
}
- private static AntiAliasingMode ReadAntiAliasing(ConfigFile c) => c.GetInt("multisampling", 2) switch
+ ///
+ /// The anti-aliasing as the simulator reads it: of gfx.antialiasing and the older multisampling, the one further
+ /// down the file, and with neither its own MSAA x4.
+ ///
+ private static AntiAliasingMode ReadAntiAliasing(ConfigFile c)
{
- <= 0 => AntiAliasingMode.Off,
- 1 => AntiAliasingMode.Msaa2,
- 2 => AntiAliasingMode.Msaa4,
- _ => AntiAliasingMode.Msaa8
+ if (c.Has("gfx.antialiasing") && c.LineOf("gfx.antialiasing") > c.LineOf("multisampling") &&
+ AntiAliasingOfWord(c.GetString("gfx.antialiasing", "")) is { } mode)
+ return mode;
+ return c.GetInt("multisampling", 2) switch
+ {
+ <= 0 => AntiAliasingMode.Off,
+ 1 => AntiAliasingMode.Msaa2,
+ 2 => AntiAliasingMode.Msaa4,
+ 3 => AntiAliasingMode.Msaa8,
+ _ => AntiAliasingMode.Msaa16
+ };
+ }
+
+ /// The mode of a gfx.antialiasing word; null for one the simulator does not know.
+ private static AntiAliasingMode? AntiAliasingOfWord(string word) => word.Trim().ToLowerInvariant() switch
+ {
+ "off" or "no" or "none" or "0" => AntiAliasingMode.Off,
+ "msaax2" => AntiAliasingMode.Msaa2,
+ "msaax4" => AntiAliasingMode.Msaa4,
+ "msaax8" => AntiAliasingMode.Msaa8,
+ "msaax16" => AntiAliasingMode.Msaa16,
+ "taa" => AntiAliasingMode.Taa,
+ "dlss" => AntiAliasingMode.Dlss,
+ "dlaa" => AntiAliasingMode.Dlaa,
+ _ => null
+ };
+
+ public static string AntiAliasingWord(AntiAliasingMode mode) => mode switch
+ {
+ AntiAliasingMode.Msaa2 => "msaax2",
+ AntiAliasingMode.Msaa4 => "msaax4",
+ AntiAliasingMode.Msaa8 => "msaax8",
+ AntiAliasingMode.Msaa16 => "msaax16",
+ AntiAliasingMode.Taa => "taa",
+ AntiAliasingMode.Dlss => "dlss",
+ AntiAliasingMode.Dlaa => "dlaa",
+ _ => "off"
};
private static int MultisamplingLevel(AntiAliasingMode mode) => mode switch
@@ -475,6 +499,7 @@ public sealed class SettingsSerializer
AntiAliasingMode.Msaa2 => 1,
AntiAliasingMode.Msaa4 => 2,
AntiAliasingMode.Msaa8 => 3,
+ AntiAliasingMode.Msaa16 => 4,
_ => 0
};
diff --git a/StarterNG/Views/SettingTexts.cs b/StarterNG/Views/SettingTexts.cs
index 3a730fe..7017c2c 100644
--- a/StarterNG/Views/SettingTexts.cs
+++ b/StarterNG/Views/SettingTexts.cs
@@ -23,14 +23,6 @@ internal static class SettingTexts
public static string Anisotropy(double value) => "x" + value.ToString("0.#", CultureInfo.CurrentCulture);
- public static string AntiAliasing(AntiAliasingMode mode) => mode switch
- {
- AntiAliasingMode.Msaa2 => "MSAA x2",
- AntiAliasingMode.Msaa4 => "MSAA x4",
- AntiAliasingMode.Msaa8 => "MSAA x8",
- _ => App.Loc["MsaaNone"]
- };
-
public static string TwoDecimals(double value) => value.ToString("0.00", CultureInfo.CurrentCulture);
/// A rate below one a second reads better as the time between updates.
diff --git a/StarterNG/Views/Settings.Graphics.cs b/StarterNG/Views/Settings.Graphics.cs
index fbe9065..54f3226 100644
--- a/StarterNG/Views/Settings.Graphics.cs
+++ b/StarterNG/Views/Settings.Graphics.cs
@@ -8,6 +8,7 @@ using Avalonia.Platform.Storage;
using StarterNG.Application;
using StarterNG.Domain.Settings;
using StarterNG.Infrastructure;
+using StarterNG.Infrastructure.Settings;
namespace StarterNG.Views;
@@ -37,12 +38,11 @@ public partial class Settings
{
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.Backend = SelectedBackend();
s.RendererWord = null;
}
if (!ShowsFileValue(AntiAliasingCb))
@@ -78,7 +78,7 @@ public partial class Settings
RenderEngineCb.SelectedItem = _fileRendererItem;
}
else
- RenderEngineCb.SelectedIndex = s.RenderEngine;
+ SelectTag(RenderEngineCb, SimulatorSettings.WordOf(s.Backend));
}
// ── How the simulator shows: full screen, borderless or in a window ──────
@@ -252,19 +252,18 @@ public partial class Settings
cb.SelectedIndex = index;
}
- private static string AntiAliasingTag(AntiAliasingMode mode) => mode switch
- {
- AntiAliasingMode.Msaa2 => "msaax2",
- AntiAliasingMode.Msaa4 => "msaax4",
- AntiAliasingMode.Msaa8 => "msaax8",
- _ => "off"
- };
+ // The list's tags are the gfx.antialiasing words.
+ private static string AntiAliasingTag(AntiAliasingMode mode) => SettingsSerializer.AntiAliasingWord(mode);
private static AntiAliasingMode AntiAliasingFromTag(string? tag) => tag switch
{
"msaax2" => AntiAliasingMode.Msaa2,
"msaax4" => AntiAliasingMode.Msaa4,
"msaax8" => AntiAliasingMode.Msaa8,
+ "msaax16" => AntiAliasingMode.Msaa16,
+ "taa" => AntiAliasingMode.Taa,
+ "dlss" => AntiAliasingMode.Dlss,
+ "dlaa" => AntiAliasingMode.Dlaa,
_ => AntiAliasingMode.Off
};
}
diff --git a/StarterNG/Views/Settings.axaml b/StarterNG/Views/Settings.axaml
index be974fa..27967b4 100644
--- a/StarterNG/Views/Settings.axaml
+++ b/StarterNG/Views/Settings.axaml
@@ -80,12 +80,11 @@
SelectionChanged="CategoryList_OnSelectionChanged">
-
-
+
@@ -119,30 +118,34 @@
VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -260,31 +207,13 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -301,199 +230,79 @@
Text="{Binding [FpsVSyncNote], Source={x:Static starterNg:App.Loc}}" />
+
+
+
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
+
+
-
-
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
+
-
-
+
+
@@ -544,8 +353,8 @@
Text="{Binding [Physics], Source={x:Static starterNg:App.Loc}}" />
-
-
+
+
@@ -553,36 +362,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -672,29 +462,243 @@
-
+
+
-
+ Text="{Binding [DeveloperTab], Source={x:Static starterNg:App.Loc}}" />
+
+
+
+
+
+
-
-
+
+
+
+
+
-
-
+
+
+
+
+
-
-
+
+
+
+
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -702,20 +706,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/StarterNG/Views/Settings.axaml.cs b/StarterNG/Views/Settings.axaml.cs
index bd218e2..11cdc6a 100644
--- a/StarterNG/Views/Settings.axaml.cs
+++ b/StarterNG/Views/Settings.axaml.cs
@@ -39,7 +39,6 @@ public partial class Settings : UserControl, ISettingsCapture
private readonly SliderSteps _anisotropy;
private readonly SliderSteps _drawRangeFactor;
- private readonly SliderSteps _cabShadows;
// False while the layout loads: the handlers it names fire as it sets their controls'
// values, before the fields of the controls are there, and do nothing until this is set.
@@ -65,7 +64,6 @@ public partial class Settings : UserControl, ISettingsCapture
_reflections = new SliderSteps(reflectionsFramerate, SliderRanges.ReflectionUpdates);
_anisotropy = new SliderSteps(TexFilteringSlider, Steps.Anisotropy);
_drawRangeFactor = new SliderSteps(RenderRangeSlider, SliderRanges.DrawRangeFactors);
- _cabShadows = new SliderSteps(cabShaderSourceRange, SliderRanges.CabShadowRanges);
_built = true;
SettingsPathText.Text = AppServices.Current.SettingsStore.LoadedFrom;
@@ -108,11 +106,8 @@ public partial class Settings : UserControl, ISettingsCapture
App.Loc.LanguageChanged += _keyRows.UpdateTexts;
FeedbackCb.SelectionChanged += FeedbackCb_OnSelectionChanged;
- // What decides whether the simulator starts and draws at all is changed only on purpose.
- AskBeforeChange(RenderAngleVulkanCb);
- AskBeforeChange(AdditionalShadersCb);
+ // What decides whether the simulator draws its picture at all is changed only on purpose.
AskBeforeChange(SkipPipelineCb);
- AskBeforeChange(RenderVBOCb);
// Ignoring the gamepad is the recommended default; reading it has been trouble, so turning it on is asked.
GamepadIgnoreCb.IsCheckedChanged += async (_, _) =>
{
@@ -480,12 +475,10 @@ public partial class Settings : UserControl, ISettingsCapture
MotionBlurCb.IsChecked = s.MotionBlur;
AdditionalShadersCb.IsChecked = s.ExtraEffects;
ReflectionsCubeMapCb.IsChecked = s.EnvMap;
- RenderVBOCb.IsChecked = s.UseVbo;
RenderShadowsCb.IsChecked = s.RenderShadows;
_reflections.Value = s.ReflectionsFramerate;
shaderResolutionSlider.Value = Log2(s.ShadowMapResolution, 12);
shaderRange.Value = s.ShadowProjectionRange;
- _cabShadows.Value = s.CabShadowsRange;
ShadowDisplayCb.SelectedIndex = Math.Clamp(s.ShadowRankCutoff - 1, 0, 2);
ReflectionsDetailsCb.SelectedIndex = s.ReflectionsFidelity;
fovSlider.Value = s.FieldOfView;
@@ -493,7 +486,6 @@ public partial class Settings : UserControl, ISettingsCapture
RenderScreensThreadCb.IsChecked = s.PythonThreadedUpload;
_fpsLimit.Value = s.FpsLimitEnabled ? s.FpsLimit : 0;
ShadowAngleLimitSlider.Value = s.ShadowAngleLimit;
- RenderAngleVulkanCb.IsChecked = s.RenderAngleVulkan;
TrackCurvesSlider.Value = s.SplineFidelity;
PhysicsAccuracyCb.IsChecked = s.FullPhysics;
@@ -528,7 +520,6 @@ public partial class Settings : UserControl, ISettingsCapture
CompressTexCb.IsChecked = s.CompressTextures;
ScaleSpecularsCb.IsChecked = s.ScaleSpeculars;
- UseGlesCb.IsChecked = s.UseGLES;
ShaderGammaCb.IsChecked = s.ShaderGamma;
ScreenMipmapsCb.IsChecked = s.ScreenMipmaps;
ConvertModelsCb.IsChecked = s.ExtendedModelConversion;
@@ -593,20 +584,20 @@ public partial class Settings : UserControl, ISettingsCapture
_presetButtons.Add((preset, button));
}
- foreach (var (section, group) in new[]
+ foreach (var (levels, group) in new[]
{
- (DrawRangeSection, GraphicsGroup.DrawRange), (TexturesSection, GraphicsGroup.Textures),
- (ShadowsSection, GraphicsGroup.Shadows), (ReflectionsSection, GraphicsGroup.Reflections)
+ (GroupTexturesCb, GraphicsGroup.Textures), (GroupShadowsCb, GraphicsGroup.Shadows),
+ (GroupReflectionsCb, GraphicsGroup.Reflections), (GroupLightingCb, GraphicsGroup.Lighting),
+ (GroupDrawRangeCb, GraphicsGroup.DrawRange), (GroupParticlesCb, GraphicsGroup.Particles)
})
{
- var levels = new ComboBox();
- levels.Classes.Add("SectionLevel");
+ // Marks the list as a part's, which applies its level itself rather than as a row of its own.
+ levels.Tag = group;
levels.SelectionChanged += (_, _) =>
{
if (!_markingLevels && levels.SelectedItem is ComboBoxItem { Tag: GraphicsPreset level })
ApplyGroupLevel(group, level);
};
- section.Level = levels;
_groupLevels.Add((group, levels));
}
@@ -634,8 +625,6 @@ public partial class Settings : UserControl, ISettingsCapture
UpdatePresetMarks();
}
- private readonly GraphicsPresetMemory _presetMemory = new();
-
private readonly List<(GraphicsGroup Group, ComboBox Levels)> _groupLevels = new();
private GraphicsGroupLevels? _groups;
@@ -649,11 +638,14 @@ public partial class Settings : UserControl, ISettingsCapture
private void ApplyPreset(GraphicsPreset preset)
{
var trial = Trial();
- var applied = _presetMemory.Apply(preset, trial);
- ShowAsEdits(trial, applied.ChosenKeys.ToList());
+ preset.ApplyTo(trial);
+ var chosen = GraphicsPreset.AllKeys;
+ ShowAsEdits(trial, chosen);
+ foreach (var (key, value) in preset.Keys)
+ _keyRows.Show(key, value);
// Chosen as a whole, its values are choices, not ones the screen could not show.
- ForgetShown(applied.ChosenKeys);
+ ForgetShown(chosen);
UpdatePresetMarks();
Announcer.Say(this, ScreenReaderNames.PickerText(App.Loc["GfxColPresets"], App.Loc[preset.NameKey]));
}
@@ -866,22 +858,31 @@ public partial class Settings : UserControl, ISettingsCapture
}
///
- /// Rows that only matter while another is on: the shutter with motion blur,
- /// and the reflections with their cube map - which only the full renderer can
- /// switch off; the others draw reflections regardless.
+ /// Rows that only matter while another is on: the shutter with motion blur, the reflections with their cube
+ /// map, and what only Vulkan reads with Vulkan.
///
private void UpdateDependentRows()
{
if (_keyRows.RowOf("gfx.postfx.motionblur.shutter") is { } shutter)
shutter.IsEnabled = IsChecked(MotionBlurCb);
- ReflectionRows.IsEnabled = IsChecked(ReflectionsCubeMapCb) ||
- SelectedRendererKind() != RendererKind.Modern;
+ ReflectionRows.IsEnabled = IsChecked(ReflectionsCubeMapCb);
+ bool vulkan = SelectedBackend() == GraphicsBackend.Vulkan;
+ foreach (string key in VulkanOnlyKeys)
+ if (_keyRows.RowOf(key) is { } row)
+ row.IsEnabled = vulkan;
}
- private string SelectedRenderer() =>
- SelectedTag(RenderEngineCb) ?? SimulatorSettings.RenderEngines.ElementAtOrDefault(RenderEngineCb.SelectedIndex) ?? "full";
+ /// The keys only the Vulkan renderer reads (utilities/Globals.cpp).
+ private static readonly string[] VulkanOnlyKeys =
+ {
+ "gfx.vulkan.device", "gfx.vulkan.renderthread", "gfx.threads", "gfx.vulkan.asyncresources",
+ "gfx.vulkan.parallelpasses", "gfx.vulkan.parallelmodels", "gfx.vulkan.asynccompute",
+ "gfx.vulkan.framesinflight", "gfx.raytracing", "gfx.dlss.preset", "gfx.framegeneration", "gfx.reflex",
+ "gfx.weather.occlusion", "gfx.clouds.interleave"
+ };
- private RendererKind SelectedRendererKind() => Renderers.KindOf(SelectedRenderer());
+ private GraphicsBackend SelectedBackend() =>
+ SelectedTag(RenderEngineCb) is { } word ? SimulatorSettings.BackendOf(word) : GraphicsBackend.Vulkan;
///
/// Writes the pending edits on this screen into the settings, so a save from
@@ -934,12 +935,10 @@ public partial class Settings : UserControl, ISettingsCapture
s.MotionBlur = IsChecked(MotionBlurCb);
s.ExtraEffects = IsChecked(AdditionalShadersCb);
s.EnvMap = IsChecked(ReflectionsCubeMapCb);
- s.UseVbo = IsChecked(RenderVBOCb);
s.RenderShadows = IsChecked(RenderShadowsCb);
s.ReflectionsFramerate = _reflections.Value;
s.ShadowMapResolution = 1 << (int)shaderResolutionSlider.Value;
s.ShadowProjectionRange = (int)shaderRange.Value;
- s.CabShadowsRange = (int)_cabShadows.Value;
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);
@@ -951,7 +950,6 @@ public partial class Settings : UserControl, ISettingsCapture
if (fpsLimit > 0)
s.FpsLimit = fpsLimit;
s.ShadowAngleLimit = ShadowAngleLimitSlider.Value;
- s.RenderAngleVulkan = IsChecked(RenderAngleVulkanCb);
s.SplineFidelity = (int)TrackCurvesSlider.Value;
s.FullPhysics = IsChecked(PhysicsAccuracyCb);
@@ -987,7 +985,6 @@ public partial class Settings : UserControl, ISettingsCapture
s.CompressTextures = IsChecked(CompressTexCb);
s.ScaleSpeculars = IsChecked(ScaleSpecularsCb);
- s.UseGLES = IsChecked(UseGlesCb);
s.ShaderGamma = IsChecked(ShaderGammaCb);
s.ScreenMipmaps = IsChecked(ScreenMipmapsCb);
s.ExtendedModelConversion = IsChecked(ConvertModelsCb);
@@ -1422,8 +1419,8 @@ public partial class Settings : UserControl, ISettingsCapture
return;
// Leaving the mode leaves nothing of it behind: what only it shows goes back to the
- // simulator's own values, and the page is saved with them.
- ShowDefaults(AdvancedKeys());
+ // starter's own values, and the page is saved with them.
+ ShowDefaults(DeveloperKeys());
settings.AdvancedSettings = false;
Save();
}
@@ -1434,40 +1431,49 @@ public partial class Settings : UserControl, ISettingsCapture
}
///
- /// Once, on the first start of this starter, for the settings an older one left: the
- /// standard mode, what only the advanced one shows at the simulator's own values, and
- /// every slider's value within its range, saved. eu07.ini is copied aside first.
+ /// Once, on the first start of this starter, for the settings an older one left: the standard mode, what only
+ /// the developer tab shows at the starter's own values - Vulkan, and everything that makes the simulator faster -
+ /// and every slider's value within its range, saved. eu07.ini is copied aside first. A player already in the
+ /// standard mode of an older layout is brought to this one the same way; one in the advanced mode chose what
+ /// the developer tab has, and only the layout's number moves.
///
public void MoveToStandardOnce()
{
var settings = AppServices.Current.Settings;
var store = AppServices.Current.SettingsStore;
- if (settings.MovedToStandard || store.LoadFailed)
+ bool firstTime = !settings.MovedToStandard;
+ if (store.LoadFailed || (!firstTime && settings.Revision >= SimulatorSettings.CurrentRevision))
return;
- 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
- {
- ShowDefaults(moved);
- }
- finally
- {
- _clamping = false;
- }
- // A value moved into its slider is saved as moved, not left as the file had it.
- ForgetShown(SliderKeys());
-
bool wasAdvanced = settings.AdvancedSettings;
- settings.AdvancedSettings = false;
+ if (firstTime || !wasAdvanced)
+ {
+ store.KeepCopy(firstTime ? ".before-standard" : ".before-revision" + SimulatorSettings.CurrentRevision);
+ var moved = DeveloperKeys();
+ // A value the starter does not know, or a control cannot show, is put right too.
+ if (firstTime)
+ moved.UnionWith(FileValues().Keys);
+ moved.ExceptWith(SettingsStore.KeptOnMoveToStandard);
+ _clamping = firstTime;
+ try
+ {
+ ShowDefaults(moved);
+ }
+ finally
+ {
+ _clamping = false;
+ }
+ // A value moved into its slider is saved as moved, not left as the file had it.
+ if (firstTime)
+ ForgetShown(SliderKeys());
+ settings.AdvancedSettings = false;
+ }
+
settings.MovedToStandard = true;
+ settings.Revision = SimulatorSettings.CurrentRevision;
Save();
- if (wasAdvanced)
+ if (wasAdvanced != settings.AdvancedSettings)
AdvancedModeChanged?.Invoke();
UpdateAdvancedModeButton();
ApplyFilter();
@@ -1514,24 +1520,29 @@ public partial class Settings : UserControl, ISettingsCapture
SaveStatus.Text = App.Loc["DefaultsRestored"];
}
- /// The keys of every row only the advanced mode shows.
- private HashSet AdvancedKeys()
+ ///
+ /// The keys only the developer tab sets: those of its rows and switches but the ones a row of the standard mode
+ /// sets too - the details of the picture, which its level of detail holds there.
+ ///
+ private HashSet DeveloperKeys()
{
- var keys = new HashSet(StringComparer.OrdinalIgnoreCase);
+ var developer = new HashSet(StringComparer.OrdinalIgnoreCase);
+ var standard = new HashSet(StringComparer.OrdinalIgnoreCase);
foreach (var section in SettingsStack.GetLogicalDescendants().OfType())
{
- if (section.Advanced && !string.IsNullOrEmpty(section.ToggleKey))
- keys.Add(section.ToggleKey);
+ if (!string.IsNullOrEmpty(section.ToggleKey))
+ (section.Advanced ? developer : standard).Add(section.ToggleKey);
foreach (var row in section.GetLogicalDescendants().OfType())
- if (section.Advanced || row.Advanced)
- foreach (string key in (row.ConfigKey ?? string.Empty)
- .Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries))
- keys.Add(key);
+ (section.Advanced || row.Advanced ? developer : standard).UnionWith(KeysOf(row));
}
- keys.ExceptWith(KeptOnReset);
- return keys;
+ developer.ExceptWith(standard);
+ developer.ExceptWith(KeptOnReset);
+ return developer;
}
+ private static string[] KeysOf(SettingRow row) =>
+ (row.ConfigKey ?? string.Empty).Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
+
private bool Advanced => AppServices.Current.Settings.AdvancedSettings;
/// A value of eu07.ini a list does not offer, listed under the file's own words.
@@ -1542,7 +1553,7 @@ public partial class Settings : UserControl, ISettingsCapture
{
(FeedbackCb, "feedbackmode"), (GpuCb, "starter.gpu"), (ShadowDisplayCb, "gfx.shadow.rank.cutoff"),
(ReflectionsDetailsCb, "gfx.reflections.fidelity"), (PyScreenPriorityCb, "python.updatetime"),
- (ReadyOverrideCb, "starter.batterydefault"), (AntiAliasingCb, "multisampling")
+ (ReadyOverrideCb, "starter.batterydefault"), (AntiAliasingCb, "gfx.antialiasing")
};
private static bool ShowsFileValue(ComboBox list) => list.SelectedItem is ComboBoxItem { Tag: FileValue };
@@ -1689,10 +1700,8 @@ public partial class Settings : UserControl, ISettingsCapture
SettingsScroll.IsVisible = !bindings;
PresetBar.IsVisible = category is "graphics" or "effects" && !searching;
- // The standard mode keeps to what a player needs; a search still finds everything,
- // since whoever types a setting's name is looking for it.
+ // The standard mode keeps to what a player needs, a search too: the developer tab is the advanced mode's.
bool advanced = Advanced;
- bool everything = advanced || searching;
if (bindings)
{
@@ -1711,14 +1720,10 @@ public partial class Settings : UserControl, ISettingsCapture
foreach (var section in panel.GetLogicalDescendants().OfType())
{
bool anyInSection = false;
- if (section.Level is Control level)
- level.IsVisible = advanced;
-
foreach (var row in section.GetLogicalDescendants().OfType())
{
- // A value the starter cannot read is shown in either mode, so it can be put right.
- bool standard = (!section.Advanced && !row.Advanced) || !string.IsNullOrEmpty(row.UnknownValue);
- bool visible = ConditionAllows(row) && (everything || standard) &&
+ bool standard = !section.Advanced && !row.Advanced;
+ bool visible = ConditionAllows(row) && (advanced || standard) &&
(!searching || TextMatch.Contains(RowSearchText(row), query));
row.IsVisible = visible;
row.Classes.Set("HideKey", !advanced);
@@ -1742,7 +1747,8 @@ public partial class Settings : UserControl, ISettingsCapture
{
item.Classes.Set("NoHits", searching && !anyRow);
// A category with nothing for the standard mode leaves the list.
- item.IsVisible = everything || anyRow;
+ // A search lists every category, but the developer tab only in the advanced mode.
+ item.IsVisible = advanced || anyRow || (searching && tag != SimulatorKeys.Advanced);
}
}
@@ -1799,8 +1805,9 @@ public partial class Settings : UserControl, ISettingsCapture
case ComboBox combo when ReferenceEquals(combo, ProfileCb) ||
ReferenceEquals(combo, ChangeLanguageCb):
break;
- // The rows of SimulatorKeyRows report their own changes.
- case { Tag: SimulatorKey }:
+ // The rows of SimulatorKeyRows report their own changes, and the lists of the parts put their
+ // levels on the screen as edits themselves.
+ case { Tag: SimulatorKey or GraphicsGroup }:
break;
case CheckBox cb:
cb.IsCheckedChanged += (_, _) => OnControlChanged(cb);
@@ -1884,7 +1891,7 @@ public partial class Settings : UserControl, ISettingsCapture
DynamicLightsSlider.Minimum = widen
? Math.Min(SliderRanges.MinDynamicLights, s.DynamicLights)
: SliderRanges.MinDynamicLights;
- foreach (var steps in new[] { _fpsLimit, _reflections, _anisotropy, _drawRangeFactor, _cabShadows })
+ foreach (var steps in new[] { _fpsLimit, _reflections, _anisotropy, _drawRangeFactor })
steps.Clamps = _clamping;
}
@@ -1926,14 +1933,9 @@ public partial class Settings : UserControl, ISettingsCapture
};
int metres = (int)shaderRange.Value;
- // Only the full renderer's cascades are known to stretch.
- int reach = SimulatorSettings.ShadowReach(metres, 1 << (int)shaderResolutionSlider.Value,
- SelectedRendererKind() != RendererKind.Modern);
+ int reach = SimulatorSettings.ShadowReach(metres, 1 << (int)shaderResolutionSlider.Value);
ShadowRangeRow.ValueText = reach == metres ? $"{metres} m" : $"{metres} m → {reach} m";
- int cabMetres = (int)_cabShadows.Value;
- CabShadowRangeRow.ValueText = cabMetres <= 0 ? App.Loc["RangeDisabled"] : $"{cabMetres} m";
-
ReflectionsFramerateRow.ValueText = SettingTexts.ReflectionsInterval(_reflections.Value);
FpsLimitRow.ValueText = _fpsLimit.Value <= 0
diff --git a/StarterNG/Views/SimulatorKeyRows.cs b/StarterNG/Views/SimulatorKeyRows.cs
index 917e493..9ffa07d 100644
--- a/StarterNG/Views/SimulatorKeyRows.cs
+++ b/StarterNG/Views/SimulatorKeyRows.cs
@@ -77,6 +77,7 @@ internal sealed class SimulatorKeyRows
TickFrequency = key.Step,
IsSnapToTickEnabled = true
},
+ SimulatorKeyKind.Choice => ChoiceList(key),
_ => new TextBox { MinWidth = 200 }
};
@@ -102,11 +103,33 @@ internal sealed class SimulatorKeyRows
case TextBox text:
text.TextChanged += (_, _) => OnEdited(row);
break;
+ case ComboBox list:
+ list.SelectionChanged += (_, _) => OnEdited(row);
+ break;
}
return setting;
}
+ /// The list of the words of a , each item tagged with its word.
+ private static ComboBox ChoiceList(SimulatorKey key)
+ {
+ var list = new ComboBox { MinWidth = 160 };
+ foreach (string choice in key.Choices ?? Array.Empty())
+ list.Items.Add(new ComboBoxItem { Tag = choice, Content = ChoiceText(choice) });
+ return list;
+ }
+
+ ///
+ /// A word of a list as the player reads it: translated where the language has it (no, low, high...), else in
+ /// English, else as the simulator writes it (DLSS's preset letters).
+ ///
+ private static string ChoiceText(string choice) =>
+ App.Loc.OptOrEnglish(SimulatorKey.ChoiceLabelKey(choice)) is { Length: > 0 } text ? text : choice;
+
+ /// The developer tab's rows are named in the language where it has them, else in English.
+ private static string Text(string key) => App.Loc.OptOrEnglish(key);
+
///
/// Only a value other than the one shown counts: a text box reports the text it
/// was given after the fact, and a slider reports its own clamping.
@@ -147,8 +170,8 @@ internal sealed class SimulatorKeyRows
foreach (var row in _rows)
{
- string label = App.Loc[row.Key.LabelKey];
- row.Setting.Description = App.Loc[row.Key.DescriptionKey];
+ string label = Text(row.Key.LabelKey) is { Length: > 0 } named ? named : row.Key.Key;
+ row.Setting.Description = Text(row.Key.DescriptionKey);
switch (row.Input)
{
@@ -159,6 +182,11 @@ internal sealed class SimulatorKeyRows
row.Setting.Label = label;
text.PlaceholderText = App.Loc["IniDefault"];
break;
+ case ComboBox list:
+ row.Setting.Label = label;
+ foreach (var item in list.Items.OfType())
+ item.Content = ChoiceText(item.Tag as string ?? string.Empty);
+ break;
default:
row.Setting.Label = label;
UpdateValueText(row);
@@ -224,6 +252,10 @@ internal sealed class SimulatorKeyRows
case TextBox text:
text.Text = raw.Trim();
break;
+ case ComboBox list:
+ int at = row.Key.ChoiceIndex(raw);
+ list.SelectedIndex = at >= 0 ? at : row.Key.ChoiceIndex(row.Key.Default);
+ break;
}
}
@@ -232,6 +264,7 @@ internal sealed class SimulatorKeyRows
CheckBox box => SimulatorKey.FormatToggle(box.IsChecked == true),
Slider slider => row.Key.FormatNumber(slider.Value),
TextBox text => (text.Text ?? string.Empty).Trim(),
+ ComboBox { SelectedItem: ComboBoxItem { Tag: string word } } => word,
_ => string.Empty
};
diff --git a/StarterNG/startercfg/lang/cz.xml b/StarterNG/startercfg/lang/cz.xml
index 6e0527e..3cfce24 100644
--- a/StarterNG/startercfg/lang/cz.xml
+++ b/StarterNG/startercfg/lang/cz.xml
@@ -413,7 +413,7 @@
Zaznamenat chybějící soubory vozidel při exportuGrafika
- Vykreslovací engine
+ Grafické APIZměna „{0}“ může způsobit, že se simulátor nespustí nebo bude obraz vypadat špatně. Změnit?Plný je doporučený renderer simulátoru. Starý a Zjednodušený kreslí klasickým rendererem a nejsou doporučeny, pokud Plný funguje – jsou pro grafické karty, se kterými má Plný potíže.Grafická karta (Linux)
@@ -428,7 +428,7 @@
Rozlišení{0} (monitor)
- Rozlišení bufferu
+ Měřítko vykreslováníMaximální rozlišení texturMaximální rozlišení textur kabinyKvalita filtrování textur
@@ -530,9 +530,9 @@
Pokročilý režimPokročilý režim…Vypnout pokročilý režim
- Vypnutí pokročilého režimu vrátí výchozí hodnoty všech nastavení, která jsou dostupná jen v něm, a uloží nastavení z této stránky. Vypnout?
+ Vypnutí pokročilého režimu vrátí vše z karty Vývojář na hodnoty spouštěče – Vulkan a všechny optimalizace zapnuté – a uloží nastavení této stránky. Kvalita grafiky zůstane taková, jak ji ukazuje karta Grafika. Vypnout?Zapnout
- Pokročilý režim zobrazí všechna nastavení simulátoru a starteru, i ta, po jejichž změně se simulátor nemusí spustit, může být nestabilní nebo vypadat špatně. Umožní také měnit obsazení souprav, soupravy AI a dekorace, takže scénář nemusí fungovat tak, jak ho autor zamýšlel.
Tato nastavení měňte, jen když víte, co dělají. Potíže, které způsobí, nejsou chybami simulátoru: než chybu nahlásíte, vypněte pokročilý režim a obnovte výchozí nastavení.
Přečtěte si to pozorně. Tlačítko pro zapnutí bude funkční za 20 sekund.
+ Pokročilý režim je určen vývojářům a testerům. Otevírá kartu Vývojář se všemi nastaveními simulátoru: rendererem (OpenGL místo Vulkanu), podrobnostmi obrazu, přepínači optimalizací, protokoly a diagnostikou. Po změně mnoha z nich se simulátor nemusí spustit, může běžet pomaleji či nestabilně nebo vypadat špatně. Umožňuje také měnit osádky souprav, soupravy AI a dekorace, takže scénář nemusí fungovat tak, jak jej autor zamýšlel.
Potíže způsobené těmito nastaveními nejsou chybami simulátoru: než chybu nahlásíte, vypněte pokročilý režim, což vrátí vše z karty Vývojář na hodnoty spouštěče.
Přečtěte si to pozorně. Tlačítko pro zapnutí bude funkční za 20 sekund.Komprimovat textury TGAŠkálovat odlesky (kompatibilita starých modelů)Zeslabuje lesk modelů dělaných pro starší renderery.
@@ -755,7 +755,7 @@
Otevřít nabídku vozidla
- Prostředky a kompatibilita
+ VýkonProtokol a nástrojeProtokol událostí a nástrojeOtevřít protokol a nástroje…
@@ -833,13 +833,11 @@
Dosah odrazů vozidelNačítat textury na pozadíUvolňovat textury vzdálených vozidel
- Vykreslovat oblohuVykreslovat kabinuDoba závěrky rozmazání pohybuVertikální synchronizace oken obrazovekObrazovky z kabiny v samostatných oknechVzduchové hadice podle spojení vozidel
- Vyhlazení trolejového vedení (klasický renderer)Maximální počet zdrojů zvukuDekódovat zvuky na pozadíNačítat trolejové vedení
@@ -857,7 +855,6 @@
Uložení v eu07.ini nic nezmění.Změněné klávesy se uloží do eu07_input-keyboard.ini.Kvalita grafiky
- MinimálníNízkáStředníVysoká
@@ -865,7 +862,7 @@
Monitor: {0} HzNastavit {0} FPSS VSync nebude víc snímků, než má monitor Hz, takže stejný nebo vyšší limit nic nemění.
- Najetím na úroveň zobrazíte hodnoty.
+ Úroveň nastaví všechny části níže najednou; každou pak lze změnit zvlášť.RRRR-MM-DDStarter nemá překlad: zůstane anglicky. Simulátor dostane tento jazyk.Žádné profily
@@ -899,8 +896,6 @@
Násobitel dosahuZkracuje nebo prodlužuje dohlednost scenérie. Cílové FPS ji přepíše.Velmi vysoká
- Ultra
- Vše na maximum. Může to být moc i pro silnou kartu.Limit snímků oken obrazovekFunguje jen s obrazovkami v samostatných oknech; bez nich nic nemění.Nejdelší
@@ -926,7 +921,7 @@
Rozlišení a vyhlazováníOsvětleníPostprocessing
- Kouř
+ Kouř a srážkyVyhlazování hranSoubor eu07.iniImportovat…
@@ -939,14 +934,24 @@
Soubor se nepodařilo zapsat:
{0}Exportováno do {0}
- Plný
- Starý (nedoporučeno, pokud Plný funguje)
- Zjednodušený (nedoporučeno, pokud Plný funguje)
- Použít renderer ANGLE Vulkan
- Vykreslování VBO
- Dosah zdrojů stínů v kabině
- Použít OpenGL ES
- OpenGL ES místo OpenGL. Nefunguje s rendererem legacy.{0}, {1} GB{0}, sdílená paměť
+ Vývojář
+ Nastavení pro vývojáře a testery. Hráč tu má vše na hodnotách spouštěče, se kterými simulátor běží nejrychleji; vypnutí pokročilého režimu je vrátí.
+ Myš
+ Záznam jízdy
+ Simulace
+ Podrobnosti kvality
+ Textury
+ Stíny
+ Odrazy
+ Osvětlení a obloha
+ Dohled a tráva
+ Kouř, déšť a sníh
+ DLSS (NVIDIA RTX, Vulkan)
+ DLAA (NVIDIA RTX, Vulkan)
+ Vulkan (doporučeno)
+ OpenGL 4.6
+ Renderer
+ Výkon
diff --git a/StarterNG/startercfg/lang/en.xml b/StarterNG/startercfg/lang/en.xml
index afe1ba2..8b643df 100644
--- a/StarterNG/startercfg/lang/en.xml
+++ b/StarterNG/startercfg/lang/en.xml
@@ -420,9 +420,9 @@
When exporting, writes the missing vehicles to the log.Graphics
- Renderer
+ Graphics APIChanging “{0}” can stop the simulator from starting or spoil the picture. Change it?
- Use Full. Old and Simplified are only for cards Full does not work on.
+ Vulkan is faster. Where it does not run, the simulator falls back to OpenGL 4.6 by itself; choose OpenGL only to test it.Graphics cardDedicatedSystem
@@ -435,8 +435,8 @@
Resolution{0} (monitor)
- Buffer resolution
- The resolution the picture is drawn at. Below 100% is faster but less sharp.
+ Render scale
+ The part of the window the picture is drawn at, then stretched to it. Below 100% faster, but less sharp.TexturesCab texturesTexture filtering
@@ -556,9 +556,9 @@
Advanced modeAdvanced mode…Turn off advanced mode
- Turning advanced mode off puts every setting only it shows back to its default and saves the settings of this page. Turn it off?
+ Turning advanced mode off puts everything of the Developer tab back to the starter's own values - Vulkan, and every optimisation on - and saves the settings of this page. The quality of the picture stays as the Graphics tab shows it. Turn it off?Turn it on
- Advanced mode shows every setting of the simulator and the starter, including ones that can stop the simulator from starting, make it unstable or spoil the picture. It also lets you change the crews of consists, AI consists and decorations, so a scenario may not play as its author meant.
Change these settings only if you know what they do. Trouble they cause is not a bug of the simulator: before reporting one, turn advanced mode off and restore the default settings.
Read this carefully. The button to turn it on works in 20 seconds.
+ Advanced mode is meant for developers and testers. It opens the Developer tab with every setting of the simulator: the renderer (OpenGL instead of Vulkan), the details of the picture, the switches of its optimisations, logs and diagnostics. Many of them can stop the simulator from starting, make it slower or unstable, or spoil the picture. It also lets you change the crews of consists, AI consists and decorations, so a scenario may not play as its author meant.
Trouble these settings cause is not a bug of the simulator: before reporting one, turn advanced mode off, which puts everything of the Developer tab back to the starter's own values.
Read this carefully. The button to turn it on works in 20 seconds.Compress TGA texturesSpecular scalingLess shine on older models.
@@ -785,7 +785,7 @@
- Resources
+ PerformanceLog and toolsEvent log and toolsOpen the log and tools…
@@ -863,13 +863,11 @@
Vehicle reflection rangeTextures in backgroundRelease vehicle textures
- SkyCabBlur timeScreen windows VSyncScreens in own windowsHoses by coupling
- Smooth wiresSound sourcesSounds in backgroundOverhead line
@@ -1085,7 +1083,6 @@
Saving would change nothing in eu07.ini.Changed key bindings go to eu07_input-keyboard.ini.Graphics quality
- MinimalLowMediumHigh
@@ -1093,7 +1090,7 @@
Screen: {0} HzSet {0} FPSWith VSync, frames never exceed the monitor's Hz, so a limit at or above it changes nothing.
- Hover over a level to see its values.
+ A level sets every part below in one go; each can then be changed on its own.YYYY-MM-DDNo starter translation: it stays in English. The simulator gets this language.No profiles
@@ -1127,8 +1124,6 @@
Distance factorShortens or stretches the draw range.Very high
- Ultra
- Everything at maximum. It may be too much even for a strong card.Screen windows FPSOnly for screens in their own windows.Longest
@@ -1154,9 +1149,9 @@
PictureLightingPost-processing
- Smoke
- Multisampling
- Smooths edges. A higher level gives a smoother picture and fewer FPS.
+ Smoke and weather
+ Anti-aliasing
+ Smooths jagged edges. TAA costs least; MSAA is sharper and costs more with every step; DLSS and DLAA need an NVIDIA RTX card, Vulkan and a simulator built with DLSS, else TAA is used.eu07.ini fileImport…Import settings from eu07.ini
@@ -1168,17 +1163,93 @@
The file could not be written:
{0}Exported to {0}
- Full
- Old (not recommended)
- Simplified (not recommended)
- ANGLE (Vulkan)
- Draws through ANGLE on Vulkan. Turn on if plain OpenGL gives trouble.
- VBO
- Turn off only if an older card has picture problems.
- Cab shadows
- How far lights cast shadows in the cab. 0 turns cab shadows off.
- OpenGL ES
- OpenGL ES instead of OpenGL. Does not work with the old renderer.{0}, {1} GB{0}, shared memory
+ Developer
+ Settings for developers and testers. A player has everything here at the starter's own values, which keep the simulator as fast as it can be; turning advanced mode off puts them back.
+ Mouse
+ Recording
+ Simulation
+ Quality details
+ Textures
+ Shadows
+ Reflections
+ Lighting and sky
+ Draw distance and grass
+ Smoke, rain and snow
+ DLSS (NVIDIA RTX, Vulkan)
+ DLAA (NVIDIA RTX, Vulkan)
+ Vulkan (recommended)
+ OpenGL 4.6
+ Renderer
+ Performance
+ Texture sharpness, filtering at an angle and surface relief. Costs mostly video memory.
+ Shadows of the sun, of lamps and headlights, contact shadows.
+ Reflections of the surroundings, on screen and in the cab.
+ Ambient occlusion, volumetric fog and clouds.
+ How far the scenery may be drawn, the smoothness of track curves, and the grass.
+ Smoke particles, raindrops and snowflakes.
+ Vulkan GPU
+ A number from the log's list, or part of the card's name. Empty – the best card.
+ Separate submit thread
+ Command recording threads
+ 0 – automatic (cores − 2).
+ Resources built in the background
+ Shadow passes in parallel
+ Models walked in parallel
+ Sky and weather on async compute
+ Experimental, its gain not yet measured.
+ Frames in flight
+ Saved shader binaries
+ Faster start.
+ Lamp shadows
+ Contact shadows
+ Cascades fitted to the view (SDSM)
+ Screen-space reflections
+ Ray-traced reflections
+ Vulkan, on a card with ray queries.
+ Cab light probe
+ Realistic water
+ Ambient occlusion
+ Fog quality
+ Clouds
+ Bloom
+ Grass
+ Grass range
+ Grass fades out by
+ Grass density
+ Rain and snow particles
+ DLSS preset
+ Frame generation (DLSS)
+ NVIDIA Reflex
+ Culling on the GPU
+ Faster with many objects in view. The simulator's own is off; the starter turns it on.
+ Occlusion culling
+ Depth prepass
+ Multithreading
+ Rest braked vehicles
+ The physics of a standing vehicle held by its brakes waits until something moves it.
+ Simpler far road vehicles
+ Beyond 1 km one physics step a frame.
+ Binary terrain cache
+ Smoke simulated on the GPU
+ Skip hidden clouds and fog
+ Clouds drawn interleaved
+ Screen effects on the GPU
+ Cab screens every N frames
+ Outside screens every N frames
+ Renderer timings
+ Written to perf.txt every so many seconds. 0 – off.
+ Full crash dump
+ Off
+ Low
+ Medium
+ High
+ Ultra
+ SSAO
+ GTAO
+ Off
+ On
+ Boost
+ Default
diff --git a/StarterNG/startercfg/lang/hu.xml b/StarterNG/startercfg/lang/hu.xml
index 5b4791b..a881256 100644
--- a/StarterNG/startercfg/lang/hu.xml
+++ b/StarterNG/startercfg/lang/hu.xml
@@ -413,7 +413,7 @@
Hiányzó járműfájlok naplózása exportáláskorGrafika
- Megjelenítő motor
+ Grafikus APIA(z) „{0}” módosítása miatt a szimulátor nem indulhat el, vagy rossz lehet a kép. Módosítja?A Teljes a szimulátor ajánlott renderelője. A Régi és az Egyszerűsített a klasszikus renderelővel rajzol, és nem ajánlott, ha a Teljes működik – azokhoz a videokártyákhoz valók, amelyekkel a Teljesnek gondja van.Videokártya (Linux)
@@ -428,7 +428,7 @@
Felbontás{0} (monitor)
- Puffer felbontása
+ Renderelési léptékTextúrák legnagyobb felbontásaVezetőállás-textúrák legnagyobb felbontásaTextúraszűrés minősége
@@ -530,9 +530,9 @@
Haladó módHaladó mód…Haladó mód kikapcsolása
- A haladó mód kikapcsolása visszaállítja az alapértéket minden csak benne elérhető beállításnál, és menti az oldal beállításait. Kikapcsolja?
+ A haladó mód kikapcsolása a Fejlesztő lap mindenét visszaállítja az indító saját értékeire – Vulkan és minden optimalizálás bekapcsolva –, és menti ennek az oldalnak a beállításait. A grafika minősége olyan marad, ahogy a Grafika lap mutatja. Kikapcsolod?Bekapcsolom
- A haladó mód a szimulátor és az indító minden beállítását megmutatja, azokat is, amelyek módosítása után a szimulátor nem indulhat el, instabil lehet, vagy rossz lehet a kép. A szerelvények személyzetét, az AI-szerelvényeket és a díszleteket is módosíthatja, így a forgatókönyv nem úgy működhet, ahogy a szerzője tervezte.
Csak akkor módosítsa ezeket, ha tudja, mit csinálnak. Az ebből eredő gondok nem a szimulátor hibái: hibabejelentés előtt kapcsolja ki a haladó módot, és állítsa vissza az alapbeállításokat.
Olvassa el figyelmesen. A bekapcsoló gomb 20 másodperc múlva működik.
+ A haladó mód fejlesztőknek és tesztelőknek készült. Megnyitja a Fejlesztő lapot a szimulátor összes beállításával: a renderelővel (OpenGL a Vulkan helyett), a kép részleteivel, az optimalizálások kapcsolóival, a naplókkal és a diagnosztikával. Sokuk módosítása után a szimulátor nem indulhat el, lassabb vagy instabil lehet, vagy rosszul nézhet ki. Lehetővé teszi a szerelvények személyzetének, az AI-szerelvényeknek és a díszleteknek a módosítását is, így a forgatókönyv nem úgy működhet, ahogy a szerzője tervezte.
Az ezekből a beállításokból eredő gondok nem a szimulátor hibái: hibabejelentés előtt kapcsold ki a haladó módot, ami a Fejlesztő lap mindenét visszaállítja az indító saját értékeire.
Olvasd el figyelmesen. A bekapcsoló gomb 20 másodperc múlva működik.TGA textúrák tömörítéseCsillanások skálázása (régi modellek kompatibilitása)Csökkenti a régebbi megjelenítőkhöz készült modellek csillogását.
@@ -755,7 +755,7 @@
Jármű menüjének megnyitása
- Erőforrások és kompatibilitás
+ TeljesítményNapló és eszközökEseménynapló és eszközökNapló és eszközök megnyitása…
@@ -833,13 +833,11 @@
Járművek tükröződési távolságaTextúrák betöltése a háttérbenTávoli járművek textúráinak felszabadítása
- Égbolt megjelenítéseVezetőfülke megjelenítéseMozgási elmosódás záridőKijelzőablakok függőleges szinkronizálásaVezetőfülke-kijelzők külön ablakokbanLégvezetékek megjelenítése a kapcsolás szerint
- Felsővezeték simítása (klasszikus megjelenítő)Hangforrások maximális számaHangok dekódolása a háttérbenFelsővezeték betöltése
@@ -857,7 +855,6 @@
A mentés semmit sem változtat az eu07.ini-ben.A módosított billentyűk az eu07_input-keyboard.ini-be kerülnek.Grafikai minőség
- MinimálisAlacsonyKözepesMagas
@@ -865,7 +862,7 @@
Monitor: {0} Hz{0} FPS beállításaVSync mellett nem lesz több képkocka, mint a monitor Hz-e, így ennyi vagy nagyobb korlát semmit sem változtat.
- Vidd az egeret a szintre az értékekhez.
+ A szint egyszerre állítja be az alábbi részeket; utána mindegyik külön is módosítható.ÉÉÉÉ-HH-NNNincs fordítás az indítóhoz: angol marad. A szimulátor ezt a nyelvet kapja.Nincs profil
@@ -899,8 +896,6 @@
TávolságszorzóRövidíti vagy nyújtja a színtér rajzolási távolságát. A cél FPS felülírja.Nagyon magas
- Ultra
- Minden a maximumon. Erős kártyának is sok lehet.Kijelzőablakok képkockakorlátjaCsak a külön ablakban lévő kijelzőknél működik; nélkülük nem változtat semmit.Leghosszabb
@@ -926,7 +921,7 @@
Felbontás és élsimításVilágításUtófeldolgozás
- Füst
+ Füst és csapadékÉlsimításeu07.ini fájlImportálás…
@@ -939,14 +934,24 @@
A fájl nem írható:
{0}Exportálva ide: {0}
- Teljes
- Régi (nem ajánlott, ha a Teljes működik)
- Egyszerűsített (nem ajánlott, ha a Teljes működik)
- ANGLE Vulkan megjelenítő használata
- VBO megjelenítés
- Vezetőállás árnyékforrásainak hatótávolsága
- OpenGL ES használata
- OpenGL ES az OpenGL helyett. A legacy megjelenítővel nem működik.{0}, {1} GB{0}, megosztott memória
+ Fejlesztő
+ Beállítások fejlesztőknek és tesztelőknek. A játékosnál itt minden az indító saját értékén áll, amellyel a szimulátor a leggyorsabb; a haladó mód kikapcsolása visszaállítja őket.
+ Egér
+ Menetrögzítés
+ Szimuláció
+ Minőség részletei
+ Textúrák
+ Árnyékok
+ Tükröződések
+ Megvilágítás és égbolt
+ Látótávolság és fű
+ Füst, eső és hó
+ DLSS (NVIDIA RTX, Vulkan)
+ DLAA (NVIDIA RTX, Vulkan)
+ Vulkan (ajánlott)
+ OpenGL 4.6
+ Renderelő
+ Teljesítmény
diff --git a/StarterNG/startercfg/lang/pl.xml b/StarterNG/startercfg/lang/pl.xml
index f9d2e04..1abf2ac 100644
--- a/StarterNG/startercfg/lang/pl.xml
+++ b/StarterNG/startercfg/lang/pl.xml
@@ -420,9 +420,9 @@
Przy eksporcie zapisuje w logu pojazdy, których brakuje.Grafika
- Renderer
+ Interfejs graficzny (API)Zmiana „{0}” może sprawić, że symulator się nie uruchomi albo obraz będzie wyglądał źle. Zmienić?
- Używaj Pełnego. Stary i Uproszczony są tylko dla kart, na których Pełny nie działa.
+ Vulkan jest szybszy. Tam, gdzie nie działa, symulator sam przełącza się na OpenGL 4.6; wybieraj OpenGL tylko do testów.Karta graficznaDedykowanaSystemowa
@@ -435,8 +435,8 @@
Rozdzielczość{0} (monitor)
- Rozdzielczość bufora
- W jakiej rozdzielczości rysowany jest obraz. Poniżej 100% szybciej, ale mniej ostro.
+ Skala renderowania
+ Przy jakiej części rozdzielczości okna rysowany jest obraz, potem rozciągany do okna. Poniżej 100% szybciej, ale mniej ostro.TeksturyTekstury kabinyFiltrowanie tekstur
@@ -556,9 +556,9 @@
Tryb zaawansowanyTryb zaawansowany…Wyłącz tryb zaawansowany
- Wyłączenie trybu zaawansowanego przywróci domyślne wartości wszystkich ustawień, które są dostępne tylko w nim, i zapisze ustawienia z tej strony. Wyłączyć?
+ Wyłączenie trybu zaawansowanego przywróci wszystko z zakładki Deweloper do wartości startera – Vulkan i wszystkie optymalizacje włączone – i zapisze ustawienia z tej strony. Jakość grafiki zostanie taka, jak pokazuje ją zakładka Grafika. Wyłączyć?Włączam
- Tryb zaawansowany pokazuje wszystkie ustawienia symulatora i startera, także te, po których zmianie symulator może się nie uruchomić, działać niestabilnie albo wyglądać źle. Pozwala też zmieniać obsadę składów, składy AI i dekoracje, przez co scenariusz może nie działać tak, jak zaplanował autor.
Zmieniaj te ustawienia tylko wtedy, gdy wiesz, co robią. Kłopoty, które z nich wynikną, nie są błędami symulatora: zanim zgłosisz błąd, wyłącz tryb zaawansowany i przywróć ustawienia domyślne.
Przeczytaj to uważnie. Przycisk włączenia zadziała za 20 sekund.
+ Tryb zaawansowany jest przeznaczony dla deweloperów i testerów. Otwiera zakładkę Deweloper ze wszystkimi ustawieniami symulatora: rendererem (OpenGL zamiast Vulkana), szczegółami obrazu, przełącznikami optymalizacji, logami i diagnostyką. Po zmianie wielu z nich symulator może się nie uruchomić, działać wolniej lub niestabilnie albo wyglądać źle. Pozwala też zmieniać obsadę składów, składy AI i dekoracje, przez co scenariusz może nie działać tak, jak zaplanował autor.
Kłopoty wynikające z tych ustawień nie są błędami symulatora: zanim zgłosisz błąd, wyłącz tryb zaawansowany, co przywraca wszystko z zakładki Deweloper do wartości startera.
Przeczytaj to uważnie. Przycisk włączenia zadziała za 20 sekund.Kompresja tekstur TGASkalowanie specularSłabszy połysk starszych modeli.
@@ -782,7 +782,7 @@
Otwórz menu pojazdu
- Zasoby
+ WydajnośćDziennik i narzędziaDziennik zdarzeń i narzędziaOtwórz dziennik i narzędzia…
@@ -860,13 +860,11 @@
Zasięg odbić pojazdówTekstury w tleZwalnianie tekstur pojazdów
- NieboKabinaCzas rozmyciaVSync okien ekranówEkrany w osobnych oknachWęże wg sprzęgnięcia
- Wygładzanie sieciŹródła dźwiękuDźwięki w tleSieć trakcyjna
@@ -907,7 +905,6 @@
Zapis niczego w eu07.ini nie zmieni.Zmienione klawisze trafią do eu07_input-keyboard.ini.Jakość grafiki
- MinimalnaNiskaŚredniaWysoka
@@ -915,7 +912,7 @@
Monitor: {0} HzUstaw {0} FPSZ VSync nie będzie więcej klatek niż Hz monitora, więc limit równy lub wyższy nic nie zmienia.
- Najedź na zestaw, żeby zobaczyć wartości.
+ Poziom ustawia naraz wszystkie części poniżej; każdą możesz potem zmienić osobno.RRRR-MM-DDBrak tłumaczenia Startera: zostaje angielski. Symulator dostanie ten język.Brak profili
@@ -949,8 +946,6 @@
Mnożnik zasięguSkraca albo wydłuża zasięg rysowania.Bardzo wysoka
- Ultra
- Wszystko na maksimum. Może być za ciężkie nawet dla mocnej karty.FPS okien ekranówTylko dla ekranów w osobnych oknach.Najdłuższe
@@ -976,9 +971,9 @@
ObrazOświetleniePostprocessing
- Dym
- Multisampling
- Wygładza krawędzie. Wyższy poziom to gładszy obraz i mniej FPS.
+ Dym i opady
+ Wygładzanie krawędzi
+ Wygładza poszarpane krawędzie. TAA kosztuje najmniej; MSAA jest ostrzejsze i każdy poziom kosztuje więcej; DLSS i DLAA wymagają karty NVIDIA RTX, Vulkana i symulatora zbudowanego z DLSS, w innym razie działa TAA.Plik eu07.iniImportuj…Importuj ustawienia z eu07.ini
@@ -990,17 +985,93 @@
Nie udało się zapisać pliku:
{0}Wyeksportowano do {0}
- Pełny
- Stary (niezalecany)
- Uproszczony (niezalecany)
- ANGLE (Vulkan)
- Rysuje przez ANGLE na Vulkanie. Włącz, jeśli zwykły OpenGL sprawia problemy.
- VBO
- Wyłącz tylko, gdy starsza karta ma problemy z obrazem.
- Cienie w kabinie
- Do jakiej odległości światła rzucają cień w kabinie. 0 wyłącza cienie w kabinie.
- OpenGL ES
- OpenGL ES zamiast OpenGL. Nie działa ze starym rendererem.{0}, {1} GB{0}, pamięć wspólna
+ Deweloper
+ Ustawienia dla deweloperów i testerów. Gracz ma tu wszystko na wartościach startera, przy których symulator działa najszybciej; wyłączenie trybu zaawansowanego je przywraca.
+ Mysz
+ Rejestracja jazdy
+ Symulacja
+ Szczegóły jakości
+ Tekstury
+ Cienie
+ Odbicia
+ Oświetlenie i niebo
+ Zasięg widzenia i trawa
+ Dym, deszcz i śnieg
+ DLSS (NVIDIA RTX, Vulkan)
+ DLAA (NVIDIA RTX, Vulkan)
+ Vulkan (zalecany)
+ OpenGL 4.6
+ Renderer
+ Wydajność
+ Ostrość tekstur, filtrowanie pod kątem i rzeźba powierzchni. Kosztuje głównie pamięć karty.
+ Cienie od słońca, od lamp i reflektorów, cienie kontaktowe.
+ Odbicia otoczenia, na ekranie i w kabinie.
+ Okluzja otoczenia, mgła wolumetryczna i chmury.
+ Jak daleko może być rysowana sceneria, gładkość łuków toru i trawa.
+ Cząsteczki dymu, krople deszczu i płatki śniegu.
+ Karta dla Vulkana
+ Numer z listy w logu albo część nazwy karty. Puste – najlepsza karta.
+ Osobny wątek wysyłania klatek
+ Wątki nagrywania poleceń
+ 0 – automatycznie (rdzenie − 2).
+ Zasoby budowane w tle
+ Przebiegi cieni równolegle
+ Modele przetwarzane równolegle
+ Niebo i pogoda w async compute
+ Eksperymentalne, zysk jeszcze niezmierzony.
+ Klatki w locie
+ Zapisane binaria shaderów
+ Szybszy start.
+ Cienie lamp
+ Cienie kontaktowe
+ Kaskady dopasowane do widoku (SDSM)
+ Odbicia w przestrzeni ekranu
+ Odbicia ray tracing
+ Vulkan, na karcie z obsługą ray query.
+ Sonda światła kabiny
+ Realistyczna woda
+ Okluzja otoczenia
+ Jakość mgły
+ Chmury
+ Poświata (bloom)
+ Trawa
+ Zasięg trawy
+ Trawa znika do
+ Gęstość trawy
+ Cząsteczki deszczu i śniegu
+ Profil DLSS
+ Generowanie klatek (DLSS)
+ NVIDIA Reflex
+ Odrzucanie obiektów na GPU
+ Szybciej przy wielu obiektach w kadrze. Symulator sam tego nie włącza; starter tak.
+ Odrzucanie zasłoniętych obiektów
+ Wstępny przebieg głębi
+ Wielowątkowość
+ Usypiaj zahamowane pojazdy
+ Fizyka stojącego, zahamowanego pojazdu czeka, aż coś go ruszy.
+ Uproszczone dalekie pojazdy drogowe
+ Dalej niż 1 km jeden krok fizyki na klatkę.
+ Binarna pamięć terenu
+ Dym liczony na GPU
+ Pomijaj zasłonięte chmury i mgłę
+ Chmury rysowane z przeplotem
+ Efekty ekranów na GPU
+ Ekrany w kabinie co N klatek
+ Ekrany zewnętrzne co N klatek
+ Czasy renderera
+ Zapisywane do perf.txt co tyle sekund. 0 – wyłączone.
+ Pełny zrzut po awarii
+ Wyłączone
+ Niska
+ Średnia
+ Wysoka
+ Ultra
+ SSAO
+ GTAO
+ Wyłączone
+ Włączone
+ Boost
+ Domyślny
diff --git a/StarterNG/startercfg/lang/ru.xml b/StarterNG/startercfg/lang/ru.xml
index a4426b3..48123fe 100644
--- a/StarterNG/startercfg/lang/ru.xml
+++ b/StarterNG/startercfg/lang/ru.xml
@@ -413,7 +413,7 @@
Записывать в журнал отсутствующие файлы состава при экспортеГрафика
- Движок отрисовки
+ Графический APIИзменение «{0}» может помешать запуску симулятора или испортить изображение. Изменить?Полный — рекомендуемый рендерер симулятора. Старый и Упрощённый рисуют классическим рендерером и не рекомендуются, если Полный работает, — они для видеокарт, с которыми у Полного проблемы.Видеокарта (Linux)
@@ -428,7 +428,7 @@
Разрешение{0} (монитор)
- Разрешение буфера
+ Масштаб рендерингаМаксимальное разрешение текстурМаксимальное разрешение текстур кабиныКачество фильтрации текстур
@@ -530,9 +530,9 @@
Расширенный режимРасширенный режим…Выключить расширенный режим
- Выключение расширенного режима вернёт значения по умолчанию для всех настроек, доступных только в нём, и сохранит настройки этой страницы. Выключить?
+ Выключение расширенного режима вернёт всё на вкладке «Разработчик» к значениям лаунчера — Vulkan и все оптимизации включены — и сохранит настройки этой страницы. Качество графики останется таким, как показывает вкладка «Графика». Выключить?Включить
- Расширенный режим показывает все настройки симулятора и стартера, в том числе те, после изменения которых симулятор может не запуститься, работать нестабильно или показывать плохую картинку. Он также позволяет менять экипажи составов, составы ИИ и декорации, поэтому сценарий может работать не так, как задумал автор.
Меняйте эти настройки, только если знаете, что они делают. Проблемы из-за них — не ошибки симулятора: прежде чем сообщить об ошибке, выключите расширенный режим и восстановите настройки по умолчанию.
Прочитайте внимательно. Кнопка включения заработает через 20 секунд.
+ Расширенный режим предназначен для разработчиков и тестировщиков. Он открывает вкладку «Разработчик» со всеми настройками симулятора: рендерером (OpenGL вместо Vulkan), деталями изображения, переключателями оптимизаций, журналами и диагностикой. После изменения многих из них симулятор может не запуститься, работать медленнее или нестабильно либо выглядеть плохо. Он также позволяет менять экипажи составов, составы ИИ и декорации, поэтому сценарий может работать не так, как задумал автор.
Проблемы, вызванные этими настройками, не являются ошибками симулятора: прежде чем сообщить об ошибке, выключите расширенный режим — это вернёт всё на вкладке «Разработчик» к значениям лаунчера.
Прочитайте это внимательно. Кнопка включения заработает через 20 секунд.Сжимать текстуры TGAМасштабировать блики (совместимость со старыми моделями)Ослабляет блеск моделей, сделанных для старых рендереров.
@@ -755,7 +755,7 @@
Открыть меню вагона
- Ресурсы и совместимость
+ ПроизводительностьЖурнал и инструментыЖурнал событий и инструментыОткрыть журнал и инструменты…
@@ -833,13 +833,11 @@
Дальность отражений подвижного составаЗагружать текстуры в фонеВыгружать текстуры удалённых составов
- Отображать небоОтображать кабинуВыдержка размытия движенияВертикальная синхронизация окон экрановЭкраны кабины в отдельных окнахОтображать воздушные рукава по сцепке
- Сглаживание контактной сети (классический рендерер)Максимум источников звукаДекодировать звуки в фонеЗагружать контактную сеть
@@ -857,7 +855,6 @@
Сохранение ничего не изменит в eu07.ini.Изменённые клавиши будут записаны в eu07_input-keyboard.ini.Качество графики
- МинимальноеНизкоеСреднееВысокое
@@ -865,7 +862,7 @@
Монитор: {0} ГцЗадать {0} FPSС VSync кадров не будет больше, чем Гц монитора, поэтому ограничение на этом уровне или выше ничего не меняет.
- Наведите на уровень, чтобы увидеть значения.
+ Уровень задаёт все части ниже сразу; затем каждую можно изменить отдельно.ГГГГ-ММ-ДДНет перевода стартера: останется английский. Симулятор получит этот язык.Нет профилей
@@ -899,8 +896,6 @@
Множитель дальностиСокращает или удлиняет дальность отрисовки сценария. Целевой FPS её перекрывает.Очень высокое
- Ультра
- Всё на максимуме. Может быть слишком тяжело даже для мощной карты.Ограничение кадров окон экрановРаботает только с экранами в отдельных окнах; без них ничего не меняет.Самые длинные
@@ -926,7 +921,7 @@
Разрешение и сглаживаниеОсвещениеПостобработка
- Дым
+ Дым и осадкиСглаживаниеФайл eu07.iniИмпорт…
@@ -939,14 +934,24 @@
Не удалось записать файл:
{0}Экспортировано в {0}
- Полный
- Старый (не рекомендуется, если Полный работает)
- Упрощённый (не рекомендуется, если Полный работает)
- Использовать рендерер ANGLE Vulkan
- Отрисовка VBO
- Дальность источников теней в кабине
- Использовать OpenGL ES
- OpenGL ES вместо OpenGL. Не работает с рендерером legacy.{0}, {1} ГБ{0}, общая память
+ Разработчик
+ Настройки для разработчиков и тестировщиков. У игрока здесь всё на значениях лаунчера, при которых симулятор работает быстрее всего; выключение расширенного режима возвращает их.
+ Мышь
+ Запись поездки
+ Симуляция
+ Детали качества
+ Текстуры
+ Тени
+ Отражения
+ Освещение и небо
+ Дальность прорисовки и трава
+ Дым, дождь и снег
+ DLSS (NVIDIA RTX, Vulkan)
+ DLAA (NVIDIA RTX, Vulkan)
+ Vulkan (рекомендуется)
+ OpenGL 4.6
+ Рендерер
+ Производительность
diff --git a/StarterNG/startercfg/lang/zh.xml b/StarterNG/startercfg/lang/zh.xml
index b0fa53a..fb7918d 100644
--- a/StarterNG/startercfg/lang/zh.xml
+++ b/StarterNG/startercfg/lang/zh.xml
@@ -412,7 +412,7 @@
将启动器找不到的车辆写入日志。图形
- 渲染引擎
+ 图形 API完整引擎适用于所有 exe。旧版、简化版和实验版仅适用于旧版 exe;新版 exe 会改用完整引擎启动。注意:实验性渲染器可能不稳定、缺少部分场景,或在某些显卡上无法启动。如果模拟器无法启动或画面异常,请回到「完整」渲染器。显卡(Linux)
@@ -434,7 +434,7 @@
分辨率{0}(显示器)使用自动分辨率时无效。
- 缓冲分辨率
+ 渲染比例相对于窗口分辨率缩放内部渲染缓冲。最大纹理分辨率最大驾驶室纹理分辨率
@@ -717,7 +717,7 @@
打开车辆菜单
- 资源与兼容性
+ 性能日志与工具事件日志与工具打开日志与工具…
@@ -796,13 +796,11 @@
车辆反射范围在后台流式加载纹理释放远处车辆的纹理
- 绘制天空绘制驾驶室动态模糊快门时间屏幕窗口的垂直同步驾驶室屏幕放在独立窗口按车辆连挂方式绘制风管
- 平滑接触网(经典渲染器)最大声源数在后台解码声音加载接触网
@@ -1022,7 +1020,6 @@
保存不会对 eu07.ini 做任何更改。更改过的按键绑定会写入 eu07_input-keyboard.ini。图形质量
- 最低低中高
@@ -1030,7 +1027,7 @@
屏幕:{0} Hz屏幕 {0}:最高 {1} Hz设为 {0} FPS
- 将鼠标悬停在某一档上可查看其数值。
+ 预设会一次设置下面的所有项目,之后可以单独调整每一项。YYYY-MM-DD启动器没有该语言的翻译:启动器保持英文,模拟器会使用该语言。没有配置文件
@@ -1064,8 +1061,6 @@
距离系数缩短或加长线路的绘制距离。目标帧率会覆盖它。非常高
- 极致
- 全部设为最高。即使是性能强劲的显卡也可能承受不住。屏幕窗口帧率限制仅在驾驶室屏幕位于独立窗口时生效;否则不起作用。最长
@@ -1087,7 +1082,7 @@
在仓库中:{0}请选择含有车辆的编组仅针对该图形部分的级别
- Vulkan 1.4
+ Vulkan(推荐)仅在 Vulkan 下有效。DLSS 预设DLSS 重建图像所用的模型。DLSS 模式跟随缓冲缩放:约 67% 为质量,50% 为性能,33% 为超级性能。
@@ -1141,8 +1136,8 @@
开启开启 + 加速TAA
- DLSS(超分辨率)
- DLAA(原生分辨率)
+ DLSS (NVIDIA RTX, Vulkan)
+ DLAA (NVIDIA RTX, Vulkan)自动K:最佳质量J:拖影更少
@@ -1152,7 +1147,7 @@
分辨率与抗锯齿光照后处理
- 烟雾
+ 烟雾与降水抗锯齿MSAA 平滑物体边缘,TAA 平滑整个画面但略有模糊。DLSS 和 DLAA 需要 Vulkan 和 NVIDIA RTX 显卡,否则模拟器使用 TAA。体积雾
@@ -1185,21 +1180,27 @@
无法写入文件:
{0}已导出到 {0}
- 完整
- 旧版
- 简化实验性
- 使用 ANGLE Vulkan 渲染器
- 在 Vulkan 而非默认后端上运行 ANGLE 渲染器。适用于 OpenGL 表现异常的情况。
- 渲染 VBO
- 将几何数据保留在 GPU 缓冲中(更快)。仅在旧显卡出现问题时才禁用。
- 驾驶室阴影源范围
- 光源在驾驶室内仍能投射阴影的距离。0 表示关闭驾驶室阴影。
- 使用 OpenGL ES
- 使用 OpenGL ES 而非 OpenGL。与旧版渲染器不兼容。{0},{1} GB{0},共享内存OpenGL 4.6 / Vulkan 新增这些仅在新版 exe 中有效。旧版 exe 会跳过它们。
+ 开发者
+ 供开发者和测试人员使用的设置。玩家在此处的所有选项都使用启动器自带的值,使模拟器尽可能快;关闭高级模式会恢复这些值。
+ 鼠标
+ 行车记录
+ 模拟
+ 画质细节
+ 纹理
+ 阴影
+ 反射
+ 光照与天空
+ 视距与草地
+ 烟雾、雨和雪
+ OpenGL 4.6
+ 渲染器
+ 性能
+ 高级模式面向开发者和测试人员。它会打开“开发者”选项卡,其中包含模拟器的全部设置:渲染器(用 OpenGL 代替 Vulkan)、画面细节、各项优化开关、日志和诊断。修改其中许多设置后,模拟器可能无法启动、变慢或不稳定,或者画面变差。它还允许更改编组的乘务人员、AI 编组和装饰物,因此场景可能无法按作者的设计运行。
这些设置引起的问题不是模拟器的错误:报告错误之前,请关闭高级模式,这会把“开发者”选项卡中的所有内容恢复为启动器自带的值。
请仔细阅读。开启按钮将在 20 秒后可用。
+ 关闭高级模式会把“开发者”选项卡中的所有内容恢复为启动器自带的值(Vulkan,所有优化开启),并保存本页的设置。画质保持“图形”选项卡中显示的样子。要关闭吗?