mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-24 00:49:11 +01:00
Add graphics levels, screen choices and the rest of the simulator's keys
Six levels of detail climbing in even steps, High being where a player with no settings of their own starts. Five parts of the picture can also take a level of their own. Resolutions start from the monitors in the computer. uartfeature with nothing selected writes "no no no no"; uart and uarttune are written whole or not at all. On Linux the file's contents tell a Windows build, a native one and a script from a note that merely has the execute bit.
This commit is contained in:
@@ -1,16 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace StarterNG.Domain.Settings;
|
||||
|
||||
// Values match the key eu07.ini has carried since the old starter.
|
||||
public enum ConsistReadyOverride { Scenery = 0, AlwaysCold = 1, AlwaysReady = 2 }
|
||||
|
||||
public enum ExeProblem { None, NotFound, NotExecutable, WrongPlatform }
|
||||
public enum ExeProblem { None, NotFound, NotExecutable, WrongPlatform, NotAProgram }
|
||||
|
||||
public sealed class SimulatorSettings
|
||||
{
|
||||
public bool LanguageWasSet { get; internal set; }
|
||||
|
||||
/// <summary>eu07.ini starts a network.server, which the starter leaves to the file.</summary>
|
||||
public bool NetworkServer { get; internal set; }
|
||||
|
||||
/// <summary>fpsaverage: the older regulator's frame rate target, which the starter leaves as it is.</summary>
|
||||
public double FpsAverage { get; internal set; }
|
||||
|
||||
public string Language = "English";
|
||||
|
||||
public string LanguageCode = "";
|
||||
@@ -26,16 +33,20 @@ public sealed class SimulatorSettings
|
||||
public int FeedbackPort = 888;
|
||||
public bool UartEnabled;
|
||||
public string UartPort = "";
|
||||
public int UartBaud = Uart.DefaultBaud;
|
||||
public double UartUpdateTime = Uart.DefaultUpdateTime;
|
||||
public string UartTune = "";
|
||||
public bool UartDebug;
|
||||
public bool UartMain, UartScnd, UartTrain, UartLocal, UartRadioVolume, UartRadioChannel;
|
||||
|
||||
/// <summary>The simulator's dynamicbrake feature, which has no box in the starter: kept as the file has it.</summary>
|
||||
public bool UartDynamicBrake;
|
||||
|
||||
public bool SelectExeAutomatically = true;
|
||||
public string ExecutablePath = "eu07.exe";
|
||||
public bool DebugMode;
|
||||
public bool VirtualShunting = true;
|
||||
public bool LogMissingVehicleFiles;
|
||||
public bool DeveloperTools;
|
||||
|
||||
public int RenderEngine;
|
||||
public int Width = 1280;
|
||||
@@ -43,7 +54,7 @@ public sealed class SimulatorSettings
|
||||
public int BufferScalePercent = 100;
|
||||
public int MaxTextureSize = 4096;
|
||||
public int MaxCabTextureSize = 4096;
|
||||
public int TextureFiltering = 8;
|
||||
public double TextureFiltering = 8;
|
||||
public int Multisampling = 2;
|
||||
public int DynamicLights = 7;
|
||||
public double DrawRangeFactor = 3.0;
|
||||
@@ -56,8 +67,10 @@ public sealed class SimulatorSettings
|
||||
public bool EnvMap = true;
|
||||
public bool UseVbo = true;
|
||||
public bool RenderShadows = true;
|
||||
public int ReflectionsFramerate = 60;
|
||||
/// <summary>Updates of the reflections a second; the simulator's own is one in five minutes.</summary>
|
||||
public double ReflectionsFramerate = 1 / 300.0;
|
||||
public int ShadowMapResolution = 2048;
|
||||
/// <summary>The third number of shadowtune; the second and fourth go unread.</summary>
|
||||
public int ShadowProjectionRange = 250;
|
||||
public int CabShadowsRange;
|
||||
public int ShadowRankCutoff = 3;
|
||||
@@ -66,7 +79,7 @@ public sealed class SimulatorSettings
|
||||
public bool PythonScreens = true;
|
||||
public bool PythonThreadedUpload = true;
|
||||
public bool FpsLimitEnabled;
|
||||
public int FpsLimit = 30;
|
||||
public double FpsLimit = 30;
|
||||
public double ShadowAngleLimit = 0.2;
|
||||
public bool FullscreenWindowed;
|
||||
public bool RenderAngleVulkan;
|
||||
@@ -110,6 +123,12 @@ public sealed class SimulatorSettings
|
||||
public bool LargeThumbnails;
|
||||
public bool AutoExpandSceneryTree;
|
||||
|
||||
/// <summary>Warn at start when the processor cannot run the official simulator builds.</summary>
|
||||
public bool CpuNotice = true;
|
||||
|
||||
/// <summary>The card a native Linux simulator is started on, on a machine with two.</summary>
|
||||
public GpuPreference Gpu = GpuPreference.Discrete;
|
||||
|
||||
public ConsistReadyOverride ReadyOverride = ConsistReadyOverride.Scenery;
|
||||
|
||||
public bool ShowAiVehicles = true;
|
||||
@@ -120,12 +139,62 @@ public sealed class SimulatorSettings
|
||||
|
||||
public bool WindowMaximized;
|
||||
|
||||
public static readonly string[] RenderEngines =
|
||||
{ "full", "legacy", "simpleshader", "simple", "off", "experimental" };
|
||||
/// <summary>
|
||||
/// The <see cref="SimulatorKeys"/> as eu07.ini carries them, by key. One the
|
||||
/// file does not set is absent, and stays out of the file until changed.
|
||||
/// </summary>
|
||||
public Dictionary<string, string> Extra { get; private set; } = new(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
public static readonly int[] AnisotropySteps = { 1, 2, 4, 8, 16 };
|
||||
/// <summary>A copy to try changes on, apart from these settings.</summary>
|
||||
public SimulatorSettings Copy()
|
||||
{
|
||||
var copy = (SimulatorSettings)MemberwiseClone();
|
||||
copy.Extra = new Dictionary<string, string>(Extra, StringComparer.OrdinalIgnoreCase);
|
||||
copy.ShadowTuneUnused = (string[])ShadowTuneUnused.Clone();
|
||||
return copy;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The gfxrenderer words the simulator tells apart (application.cpp): every
|
||||
/// other word - the "simpleshader" and "off" older starters offered among them -
|
||||
/// gets the legacy renderer.
|
||||
/// </summary>
|
||||
public static readonly string[] RenderEngines = { "full", "legacy", "simple", "experimental" };
|
||||
|
||||
/// <summary>Where <paramref name="word"/> stands among <see cref="RenderEngines"/>, as the simulator reads it.</summary>
|
||||
public static int RenderEngineOf(string word) => word.Trim().ToLowerInvariant() switch
|
||||
{
|
||||
"full" or "default" => 0,
|
||||
"simple" => 2,
|
||||
"experimental" => 3,
|
||||
_ => 1
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The least shadow range the simulator keeps for a map size: a map above
|
||||
/// 2048 px stretches over proportionally more ground.
|
||||
/// </summary>
|
||||
public static int ShadowRangeFloor(int mapSize) => mapSize <= 2048 ? 75 : 75 * mapSize / 2048;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public static int ShadowReach(int range, int mapSize, bool legacyRenderer)
|
||||
{
|
||||
int reach = Math.Max(range, ShadowRangeFloor(mapSize));
|
||||
return legacyRenderer || mapSize <= 2048 ? reach : reach * (mapSize / 2048);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The file's own first mousescale number. The slider takes whole steps: this
|
||||
/// stands for as long as <see cref="CursorSensitivity"/> is the step nearest it.
|
||||
/// </summary>
|
||||
internal double MouseScaleXMagnitude { get; set; } = 2;
|
||||
|
||||
internal double MouseScaleYMagnitude { get; set; } = 0.2;
|
||||
|
||||
internal string[] ShadowTuneExtra { get; set; } = { "400", "300" };
|
||||
/// <summary>The numbers of shadowtune the simulator skips, kept as the file has them.</summary>
|
||||
internal string[] ShadowTuneUnused { get; set; } = { "250", "300" };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user