Files
EonaCat.XSBox/launcher/windows/LauncherConfiguration.cs
T
EonaCat 0f7377a1b5
Rust validation / Windows x64 build and tests (push) Waiting to run
Rust validation / Formatting (push) Failing after 27s
EonaCat/ci-workflows: SonarQube / sonar (push) Successful in 45s
Initial
2026-12-04 21:08:34 +01:00

245 lines
27 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Text;
namespace EonaCat.XSBOX.Launcher;
internal sealed partial class LauncherForm
{
static readonly Setting[] Settings =
[
new("Graphics", "Console profile", "EONACAT_XS_MENU_CONSOLE", "series-x", ["series-x", "series-s"], "Series X gives higher detail and larger textures. Series S is lighter on GPU, RAM and VRAM; useful on lower-memory cards."),
new("Graphics", "Output resolution", "EONACAT_XS_MENU_RES", "4k", ["1440", "1080to1440", "4k"], "Output target: 2560×1440, 1920×1080 rendered then upscaled to 1440p, or native 3840×2160. 4K costs substantially more GPU time."),
new("Advanced", "Experimental native ultrawide output", "EONACAT_XS_NATIVE_WIDE", "", ["", "1"], "EXPERIMENTAL ONLY. The current native-wide path is known to show a seam/ghosting beyond 2560 pixels because the title's upscaler/window remain 2560 wide. Leave OFF for stable play; a complete game-image patch is still needed for clean 3440×1440."),
new("Graphics", "Series S internal resolution", "EONACAT_XS_MENU_S_RES", "720", ["720", "626", "540", "360"], "Internal scene height for the Series S profile. Lower values improve performance but reduce detail. This is used only when Series S is selected."),
new("Graphics", "DLSS upscaling", "EONACAT_XS_MENU_DLSS", "balanced", ["off", "quality", "balanced", "performance", "ultraperformance", "dlaa"], "Quality preserves detail; Balanced and Performance trade some detail for more speed. Requires NVIDIA Streamline/DLSS runtime files."),
new("Graphics", "Ray tracing", "EONACAT_XS_MENU_RT", "off", ["off", "software", "hardware"], "OFF is fastest. Software uses shader-based ray tracing. Hardware uses RT cores but is experimental and can consume substantial VRAM."),
new("Graphics", "DLSS model override", "EONACAT_XS_DLSS_PRESET", "", ["", "auto", "k", "j", "m", "l"], "Selects the DLSS model. Blank uses the game's default; AUTO follows NVIDIA's recommendation for the selected mode. This requires the NVIDIA DLSS runtime."),
new("Graphics", "GPU adapter", "EONACAT_XS_ADAPTER", "", [""], "AUTO lets DXGI choose the adapter. To select a specific GPU, use the in-game F9 menu, which enumerates the actual adapters in this PC."),
new("Graphics", "Frame rate cap", "EONACAT_XS_MENU_FPS", "120", ["1000", "120", "60", "30"], "The default is 120 FPS to match the reported 120 Hz refresh. Set NONE for an uncapped frame rate, or choose 60 or 30 for a lower cap."),
new("Display & Stats", "Console refresh rate", "EONACAT_XS_DISPLAY_REFRESH", "120", ["60", "120", "165"], "Refresh rate exposed to the emulated game. The default is 120 Hz. This does not change the Windows monitor refresh rate."),
new("Display & Stats", "FPS line at top", "EONACAT_XS_FPS_LINE", "0", ["1", "0"], "Shows the live FPS/frame-time line at the top of the game. Negligible performance cost."),
new("Display & Stats", "FPS bottleneck advisor (F10)", "EONACAT_XS_ADVISOR", "0", ["0", "1"], "Shows whether CPU, GPU or shader compilation is limiting performance, with a suggestion. F10 toggles it in-game."),
new("Display & Stats", "In-game console / stats panel (F11)", "EONACAT_XS_PANEL", "0", ["0", "1"], "Hidden by default. Press F11 while the game is focused to show or hide the diagnostic overlay."),
new("Display & Stats", "Stats panel transparency", "EONACAT_XS_PANEL_SEE", "", ["", "25", "50", "75"], "How much of the game shows through the panel background. The text remains solid."),
new("Display & Stats", "Panel: FPS and frame time", "EONACAT_XS_PANEL_FPS", "", ["", "0"], "Shows or hides FPS, frame time and longest recent frame in the stats panel."),
new("Display & Stats", "Panel: console and build", "EONACAT_XS_PANEL_GAME", "", ["", "0"], "Shows or hides the emulated console and runtime build information."),
new("Display & Stats", "Panel: resolution / DLSS / rays", "EONACAT_XS_PANEL_PICTURE", "", ["", "0"], "Shows or hides render/output resolution, DLSS, frame generation and ray tracing information."),
new("Display & Stats", "Panel: GPU time and draws", "EONACAT_XS_PANEL_GPU", "", ["", "0"], "Shows or hides GPU time, GPU wait time, draw counts and skipped draws."),
new("Display & Stats", "Panel: game RAM and VRAM", "EONACAT_XS_PANEL_MEMORY", "", ["", "0"], "Shows or hides process RAM, dedicated VRAM and shared GPU memory."),
new("Display & Stats", "Panel: CPU and free RAM", "EONACAT_XS_PANEL_CPU", "", ["", "0"], "Shows or hides CPU utilisation, free system RAM and commit headroom."),
new("Display & Stats", "Panel: PC specifications", "EONACAT_XS_PANEL_SPECS", "", ["", "0"], "Shows or hides CPU, memory and GPU specifications for diagnostics."),
new("Display & Stats", "Panel: graphs", "EONACAT_XS_PANEL_GRAPHS", "", ["", "0"], "Shows or hides recent FPS, CPU, RAM and VRAM graphs."),
new("Display & Stats", "Panel: panel overhead", "EONACAT_XS_PANEL_COST", "", ["", "1"], "Displays the microseconds spent drawing the stats panel itself. Intended for diagnostics."),
new("Display & Stats", "Borderless fullscreen", "EONACAT_XS_FULLSCREEN", "stretch", ["", "1", "stretch"], "ON starts borderless fullscreen at the active display resolution. Turn OFF for a window; Stretch fills the display without preserving aspect ratio."),
new("Graphics", "Lighting estimate", "EONACAT_XS_AMBIENT", "0.8", ["0.8", "1", "0.5", "0"], "Approximate lighting for areas that would normally use ray-traced lighting. Higher values brighten interiors and shaded areas; 0 disables it."),
new("Graphics", "Fog brightness cap", "EONACAT_XS_AMBIENT_AIR", "1", ["1", "1.5", "2", ""], "Limits the brightest fog and haze. Lower values prevent glowing fog; blank removes the cap and leaves the game's fog brightness unchanged."),
new("Graphics", "Reflection estimate", "EONACAT_XS_AMBIENT_SPECULAR", "0", ["0", "1"], "Uses an approximation for reflections instead of showing only the sky. Enable only if the result looks correct in your scenes."),
new("Graphics", "Water lighting", "EONACAT_XS_WATER_LIGHT", "0", ["0", "1"], "Lights water according to depth. It can cause dark underwater blocks on some GPUs, so it is off by default."),
new("Graphics", "Neutral probe light", "EONACAT_XS_PROBE_NEUTRAL", "0.3", ["0.3", "0"], "Uses neutral grey light where the lighting estimate has no probe result. No effect with ray tracing on or the lighting estimate disabled."),
new("Graphics", "Decal defrag / heat haze", "EONACAT_XS_LEAVE_OUT", "", ["", "731a39171b568298", "02384a60fda6f2d0,731a39171b568298"], "Normally runs both passes. The first non-empty value leaves out heat haze; the second leaves out both decal defragmentation and heat haze. Use only if you see smearing or rendering artifacts."),
new("Graphics", "Early depth test", "EONACAT_XS_EARLY_DEPTH", "1", ["1", ""], "Enables an early depth optimisation. It can reduce pixel work; disable only if investigating missing or incorrectly occluded geometry."),
new("Graphics", "Gray shadow lift", "EONACAT_XS_SHADOW_LIFT", "0", ["0", "0.03", "0.06", "0.09", "0.12", "0.15", "0.18", "0.21", "0.24", "0.27", "0.3"], "Brightens the darkest pixels before the HUD. This is a visual adjustment and has negligible performance cost."),
new("Frame Generation", "Frame generation multiplier", "EONACAT_XS_MENU_FRAMEGEN", "0", ["0", "2", "3", "4", "5", "6"], "Generates additional displayed frames between rendered frames. Raises displayed FPS, not the game's simulation/render rate, and adds latency and VRAM use. 2x DLSS FG requires RTX 40+; higher multipliers generally require RTX 50."),
new("Frame Generation", "Frame generation provider", "EONACAT_XS_MENU_FG_TYPE", "auto", ["auto", "dlss", "fsr", "fsr4"], "AUTO selects DLSS FG on supported NVIDIA cards and FSR 3 where appropriate. FSR uses AMD FidelityFX runtime files. FSR4 is experimental."),
new("Frame Generation", "Pause frame generation in movies", "EONACAT_XS_MOVIE_GATE", "", ["", "1"], "Pauses generated frames while the title plays a movie. The game may present video very frequently, so enabling this can leave frame generation paused for long periods."),
new("Memory", "Memory range memoization", "EONACAT_XS_RANGE_MEMO", "1", ["1", "0"], "Caches recently refreshed memory ranges so unchanged ranges can skip repeated write-watch checks. Uses a small amount of extra metadata memory."),
new("Advanced", "Fast-core submission placement", "EONACAT_XS_FAST_CORES", "1", ["1", "0"], "Keeps the GPU submission thread on the faster CPU cores when Windows exposes hybrid-core information."),
new("Memory", "Card pools", "EONACAT_XS_CARD_POOLS", "185:38:47", ["185:38:47", "0"], "Reserves title memory regions as GPU-visible upload heaps. Requires supported Windows 11 24H2+, ReBAR and compatible GPU/driver. Set 0 to disable the card-pool model."),
new("Memory", "Heap write hooks", "EONACAT_XS_HEAP_HOOKS", "1", ["1", "0"], "Tracks CPU writes to selected heaps so GPU mirrors can be refreshed accurately. Disable only for diagnosing memory corruption or hook conflicts."),
new("Memory", "Card-side constant-buffer fills", "EONACAT_XS_CARD_FILLS", "1", ["1", "0"], "Copies constant-buffer data on the GPU rather than reading it back through the CPU. Intended to reduce CPU stalls."),
new("Memory", "Arena upload notifications", "EONACAT_XS_ARENA_UPLOAD", "1", ["1", "0"], "Uses tracked writer notifications to upload changed arena regions instead of refreshing broad ranges."),
new("Memory", "Land in place mode", "EONACAT_XS_LAND_IN_PLACE", "2", ["0", "1", "2"], "Controls eligible GPU writes directly into mapped title memory. Higher modes are more aggressive and depend on supported memory placement/coherence."),
new("Memory", "Pool mirror size (MiB)", "EONACAT_XS_POOL_MIRROR", "2199", ["0", "1277", "2199"], "Size of the GPU-side mirror for the title's write-combined pool. 2199 MiB is the Series X pool; 1277 MiB is Series S. 0 disables the mirror."),
new("Memory", "Video memory budget (MiB)", "EONACAT_XS_VRAM_BUDGET_MB", "", ["", "4096", "6144", "8192", "10240", "12288"], "Maximum VRAM budget the game should target. Blank is AUTO (Windows' budget). Lower values leave room for other applications but can delay texture loading."),
new("Memory", "Maximum game card-memory arena (MiB)", "EONACAT_XS_MEMORY_CARD_MB", "", ["", "1536", "2048", "3072", "4096", "6144"], "Caps the amount of the title's memory arena backed by card memory. Blank uses the engine's default (up to 4 GiB). Lower values can help cards with less VRAM but may move more data to system memory."),
new("Memory", "Keep at least this much game RAM (GiB)", "EONACAT_XS_KEEP_RAM_GB", "", ["", "8", "12", "16", "24", "32"], "Keeps a hard minimum amount of the game's memory resident in system RAM. Blank disables the minimum. Use only if paging or memory pressure is causing instability."),
new("Memory", "Soft views", "EONACAT_XS_SOFT_VIEWS", "copies", ["copies", ""], "Uses copied mappings for title memory that is mapped at multiple addresses. This avoids known cutscene freezes at the cost of some extra RAM."),
new("Memory", "Card reads title memory in place", "EONACAT_XS_INPLACE_VIEW", "", ["", "1", "2"], "Lets the GPU read eligible title memory directly instead of reading a separate copy. Can reduce host memory traffic but depends on adapter support and may be slower on some systems."),
new("Memory", "Skip large GPU-to-CPU copy-backs", "EONACAT_XS_WC_NO_BACK", "1", ["1", ""], "Keeps eligible shader-written large buffers on the GPU rather than copying them back every frame. Faster, but disable if game-visible data appears stale or missing."),
new("Memory", "Mirror texture resources", "EONACAT_XS_POOL_MIRROR_TEXTURES", "1", ["1", "0"], "Allows texture detiling and reads to use the mirrored pool. Disable only when investigating incorrect texture contents."),
new("Memory", "Pool copy-back", "EONACAT_XS_POOL_BACK", "0", ["0", "1"], "Copies GPU-written mirrored data back to CPU memory. Off is faster, but relies on the coherent-set tracking to preserve CPU-visible data."),
new("Memory", "Coherent pool tracking", "EONACAT_XS_POOL_COHERENT", "1", ["1", "0"], "Tracks 64 KiB regions where CPU and GPU writes overlap, preserving coherent data. Disabling may cause stale or frozen game data."),
new("Memory", "Coherent differential sweep", "EONACAT_XS_POOL_COHERENT_DIFF", "1", ["1", "0"], "Uses differential comparisons during coherent-pool sweeps to avoid unnecessary copies."),
new("Memory", "Narrow coherent tracking", "EONACAT_XS_POOL_COHERENT_NARROW", "1", ["1", "0"], "Only joins regions after the CPU has written them, reducing the tracked coherent set."),
new("Memory", "Coherent-set maximum (MiB)", "EONACAT_XS_POOL_COHERENT_MAX_MB", "256", ["128", "256", "512", "1024"], "Upper bound for CPU/GPU-overlapping 64 KiB regions tracked as coherent. A higher cap preserves more overlapping data but consumes more host memory."),
new("Memory", "Pull earlier CPU data when joining", "EONACAT_XS_POOL_COHERENT_PULL", "", ["", "1"], "When a region joins the coherent set, merges its earlier CPU-written data. This is a correctness-sensitive option; leave off unless testing a known stale-data issue."),
new("Memory", "Wait for in-flight writes on join", "EONACAT_XS_POOL_COHERENT_JOIN_WAIT", "", ["", "1"], "Waits for GPU work already in flight before adding a region to the coherent set. Improves ordering safety but can add stalls."),
new("Memory", "Quiet coherent blocks after (seconds)", "EONACAT_XS_POOL_COHERENT_QUIET_S", "0", ["0", "1", "2", "5", "10"], "A block not written by the CPU for this many seconds can be treated as quiet. 0 disables quieting. This is an advanced memory-traffic trade-off."),
new("Memory", "Check arena upload notifications", "EONACAT_XS_ARENA_UPLOAD_CHECK", "", ["", "1"], "Diagnostic verification that writer notifications cover changed arena data. Can add overhead; enable only when investigating missed uploads."),
new("Memory", "Disable guard regions", "EONACAT_XS_NO_GUARDS", "1", ["1", "0"], "Removes selected memory guard overhead for the memory model. Keep the default unless diagnosing address-space or memory corruption issues."),
new("Memory", "Submit overlap", "EONACAT_XS_COMING_AT_SUBMIT", "1", ["1", "0"], "Allows eligible memory work to be prepared around submission. Turning it off can reduce overlap and throughput."),
new("Memory", "Frames in flight", "EONACAT_XS_SUBMIT_FRAMES", "2", ["1", "2"], "Number of frames allowed ahead in submission. More overlap can improve GPU utilisation but can increase latency and memory pressure."),
new("Memory", "Submission queue depth", "EONACAT_XS_SUBMIT_DEPTH", "128", ["64", "128"], "Maximum queued submission depth. Lower values constrain queued work; higher values can help throughput but increase queueing."),
new("Memory", "Memory window size (KiB)", "EONACAT_XS_WINDOW_KB", "256", ["64", "128", "256", "512"], "Granularity used by the title-memory window allocator. Changing it can affect address placement and memory overhead."),
new("Memory", "Optimise window tails", "EONACAT_XS_WINDOW_TAILS", "1", ["1", "0"], "Uses smaller tail handling for memory windows to reduce wasted mapped space."),
new("Memory", "Bound streaming reads", "EONACAT_XS_STREAM_BOUND", "1", ["1", "0"], "Bounds streaming reads to avoid oversized reads and memory spikes."),
new("Textures & Streaming", "Texture no-wait", "EONACAT_XS_TEXTURE_NO_WAIT", "1", ["1", "0"], "Displays available texture data instead of blocking for a texture that is still loading. May briefly show lower-detail texture data."),
new("Textures & Streaming", "Texture catch-up", "EONACAT_XS_TEXTURE_CATCHUP", "1", ["1", "0"], "Allows late texture data to catch up after the initial non-blocking upload."),
new("Textures & Streaming", "Texture stage budget (ms)", "EONACAT_XS_TEXTURE_STAGE_MS", "24", ["8", "16", "24", "32"], "Time budget for texture staging work per scheduling window. Larger values may reduce backlog but consume more CPU time."),
new("Textures & Streaming", "Painted texture refresh interval", "EONACAT_XS_PAINTED_EVERY", "0", ["0", "1", "4"], "Checks textures redrawn without explicit notifications. 1 checks every frame and costs the most CPU; 4 checks every four frames; 0 leaves this extra polling off."),
new("Textures & Streaming", "Texture pool", "EONACAT_XS_TEXTURE_POOL", "1", ["1", "0"], "Enables pooled texture allocations to reduce repeated allocation overhead."),
new("Controls", "Controller mode", "EONACAT_XS_CONTROLS", "", ["", "keyboard", "gamepad", "dualsense"], "AUTO follows detected input. KEYBOARD forces keyboard/mouse; GAMEPAD uses controllers; DUALSENSE reads a PlayStation controller natively."),
new("Controls", "Mouse capture", "EONACAT_XS_MOUSE_CAPTURE", "1", ["", "1"], "ON by default: captures and hides the pointer while the game is focused, regardless of controller mode; releases it when focus is lost. Set OFF for a free pointer."),
new("Controls", "Mouse and keyboard", "EONACAT_XS_MNK", "", ["", "1"], "Enables the native mouse/keyboard input path. It replaces the title's controller input path; configure key bindings in the in-game menu."),
new("Controls", "Vehicle camera auto-center", "EONACAT_XS_VEHICLE_AUTO_CENTER", "", ["", "1"], "Automatically returns the camera behind the vehicle while driving. This setting can be changed live."),
new("Controls", "English keyboard layout", "EONACAT_XS_IME_ENGLISH", "", ["", "1"], "Uses an English keyboard layout in the game window to avoid other input-method layouts changing key interpretation."),
new("Advanced", "Heap sync at submit", "EONACAT_XS_HEAP_SYNC_AT_SUBMIT", "1", ["1", "0"], "Performs descriptor/heap synchronisation at submission. Disabling may expose stale descriptors or GPU races; leave enabled unless diagnosing."),
new("Advanced", "Shader exact wave64 handling", "EONACAT_XS_EXACT64", "1", ["1", "0"], "Enables exact wave64 shader handling where supported by the translator. Disabling can change shader correctness."),
];
static string PageSubtitle(string page) => page switch
{
"Graphics" => "Display quality, upscaling and rendering options",
"Display & Stats" => "Refresh rate, FPS counters and the in-game diagnostic panel",
"Frame Generation" => "Generated frames, provider selection and latency trade-offs",
"Textures & Streaming" => "Texture upload scheduling and streaming behavior",
"Memory" => "System RAM, VRAM and GPU-visible memory behavior",
"Controls" => "Input device and mouse behavior",
_ => "Advanced engine and diagnostic options"
};
void BuildPage(string page)
{
// "&" is the mnemonic marker in tab captions, so it must be doubled to be shown ("Display & Stats").
var tab = new TabPage(page.Replace("&", "&&")) { Name = page, BackColor = BackColor, ForeColor = ForeColor };
var stack = new StackPanel { Dock = DockStyle.Fill, BackColor = BackColor, Padding = new Padding(Ui.S(14), Ui.S(12), Ui.S(14), Ui.S(12)) };
stack.SuspendLayout();
foreach (var setting in Settings.Where(item => item.Page == page))
{
var card = new SettingCard(setting);
editors[setting.Key] = card.Editor;
stack.Controls.Add(card);
}
stack.ResumeLayout(false);
tab.Controls.Add(stack);
tab.Controls.Add(CreatePageHeader(page, PageSubtitle(page)));
tabs.TabPages.Add(tab);
}
void BuildToolsPage()
{
var tab = new TabPage("Tools") { Name = "Tools", BackColor = BackColor, ForeColor = ForeColor };
var stack = new StackPanel { Dock = DockStyle.Fill, BackColor = BackColor, Padding = new Padding(Ui.S(22)), MaxContentWidth = Ui.S(900) };
var preload = MakeButton("Preload shaders", 180); preload.Click += async (_, _) => { SaveSettings(); await RunEngineCommand("preload", Directory.Exists(Path.GetDirectoryName(gamePath.Text)) ? Path.GetDirectoryName(gamePath.Text) : null); };
var clear = MakeButton("Clear shader cache", 180); clear.Click += async (_, _) =>
{
if (MessageBox.Show(this, "This deletes translated shaders and cached pipelines. They must be rebuilt and the next game start may stutter. Continue?", "Clear shader cache", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
await RunEngineCommand("clear-shaders");
};
stack.Controls.Add(new WrapLabel { Text = "Shader maintenance", Font = Ui.Font(14, FontStyle.Bold), ForeColor = Color.White, Margin = new Padding(0, 0, 0, Ui.S(12)) });
stack.Controls.Add(new WrapLabel { Text = "Preload translates shaders and builds known host pipelines before gameplay. It can take several minutes, but reduces first-run shader stutter.", ForeColor = Color.Gainsboro, Margin = new Padding(0, 0, 0, Ui.S(12)) });
preload.Margin = new Padding(0, 0, 0, Ui.S(24));
stack.Controls.Add(preload);
stack.Controls.Add(new WrapLabel { Text = "Clear the shader cache only after a translator/driver change or when shader cache corruption is suspected. Game saves and settings are kept.", ForeColor = Color.Gainsboro, Margin = new Padding(0, 0, 0, Ui.S(12)) });
stack.Controls.Add(clear);
tab.Controls.Add(stack);
tab.Controls.Add(CreatePageHeader("Tools", "Shader preparation, cache maintenance and runtime utilities"));
tabs.TabPages.Add(tab);
}
void LoadSettings()
{
var values = File.Exists(settingsPath) ? File.ReadAllLines(settingsPath).Where(x => x.Contains('=')).Select(x => x.Split('=', 2)).GroupBy(x => x[0].Trim()).ToDictionary(g => g.Key, g => g.Last()[1].Trim()) : new Dictionary<string, string>();
var previousDefaults = new Dictionary<string, (string Old, string New)>(StringComparer.Ordinal)
{
["EONACAT_XS_MENU_RES"] = ("1440", "4k"),
["EONACAT_XS_MENU_DLSS"] = ("quality", "balanced"),
["EONACAT_XS_MENU_FPS"] = ("1000", "120"),
["EONACAT_XS_DISPLAY_REFRESH"] = ("60", "120"),
["EONACAT_XS_FPS_LINE"] = ("1", "0"),
["EONACAT_XS_FULLSCREEN"] = ("1", "stretch")
};
foreach (var s in Settings)
{
if (!editors.TryGetValue(s.Key, out var editor) || editor is not ComboBox c) continue;
var value = values.TryGetValue(s.Key, out var saved) ? saved : s.Default;
if (previousDefaults.TryGetValue(s.Key, out var migration) && value == migration.Old)
value = migration.New;
if (s.Values.Contains(value)) c.SelectedItem = value;
}
var savedGame = Path.Combine(Path.GetDirectoryName(settingsPath)!, "launcher-game.txt");
if (File.Exists(savedGame)) gamePath.Text = File.ReadAllText(savedGame).Trim();
}
void ApplyRtx4090Profile()
{
var profile = new Dictionary<string, string>(StringComparer.Ordinal)
{
["EONACAT_XS_MENU_CONSOLE"] = "series-x",
["EONACAT_XS_MENU_RES"] = "4k",
["EONACAT_XS_MENU_S_RES"] = "720",
["EONACAT_XS_MENU_DLSS"] = "balanced",
["EONACAT_XS_MENU_RT"] = "off",
["EONACAT_XS_MENU_FRAMEGEN"] = "0",
["EONACAT_XS_MENU_FG_TYPE"] = "auto",
["EONACAT_XS_MENU_FPS"] = "120",
["EONACAT_XS_DISPLAY_REFRESH"] = "120",
["EONACAT_XS_FULLSCREEN"] = "stretch",
["EONACAT_XS_NATIVE_WIDE"] = "",
["EONACAT_XS_ADVISOR"] = "0",
["EONACAT_XS_FPS_LINE"] = "0",
["EONACAT_XS_LAND_IN_PLACE"] = "2",
["EONACAT_XS_POOL_MIRROR"] = "2199",
["EONACAT_XS_POOL_MIRROR_TEXTURES"] = "1",
["EONACAT_XS_POOL_BACK"] = "0",
["EONACAT_XS_POOL_COHERENT"] = "1",
["EONACAT_XS_POOL_COHERENT_DIFF"] = "1",
["EONACAT_XS_POOL_COHERENT_NARROW"] = "1",
["EONACAT_XS_POOL_COHERENT_MAX_MB"] = "256",
["EONACAT_XS_SUBMIT_FRAMES"] = "2",
["EONACAT_XS_SUBMIT_DEPTH"] = "128",
["EONACAT_XS_WINDOW_KB"] = "256",
["EONACAT_XS_WINDOW_TAILS"] = "1",
["EONACAT_XS_TEXTURE_STAGE_MS"] = "24",
["EONACAT_XS_TEXTURE_NO_WAIT"] = "1",
["EONACAT_XS_TEXTURE_CATCHUP"] = "1",
["EONACAT_XS_TEXTURE_POOL"] = "1",
["EONACAT_XS_PAINTED_EVERY"] = "0",
["EONACAT_XS_CARD_POOLS"] = "185:38:47",
["EONACAT_XS_RANGE_MEMO"] = "1",
["EONACAT_XS_FAST_CORES"] = "1",
["EONACAT_XS_HEAP_HOOKS"] = "1",
["EONACAT_XS_CARD_FILLS"] = "1",
["EONACAT_XS_ARENA_UPLOAD"] = "1",
["EONACAT_XS_WC_NO_BACK"] = "1",
["EONACAT_XS_NO_GUARDS"] = "1",
["EONACAT_XS_COMING_AT_SUBMIT"] = "1",
["EONACAT_XS_STREAM_BOUND"] = "1",
};
foreach (var (key, value) in profile)
{
if (editors.TryGetValue(key, out var control) && control is ComboBox combo && combo.Items.Contains(value))
combo.SelectedItem = value;
}
SaveSettings();
status.Text = "Saved. 4K output is stretched to fill 3440x1440; native 21:9 rendering remains experimental. Install NVIDIA runtime for DLSS; restart.";
}
void SaveSettings()
{
Directory.CreateDirectory(Path.GetDirectoryName(settingsPath)!);
var existing = File.Exists(settingsPath) ? File.ReadAllLines(settingsPath).ToList() : new List<string>();
var managed = Settings.Select(s => s.Key).Concat(["EONACAT_XS_MENU_PRESET", "EONACAT_XS_MENU_ULTRA"]).ToHashSet(StringComparer.Ordinal);
existing.RemoveAll(line => line.Contains('=') && managed.Contains(line.Split('=', 2)[0].Trim()));
var sb = new StringBuilder(); sb.AppendLine("# EonaCat XS launcher settings. Generated by EonaCat XS Launcher.");
foreach (var line in existing) if (!line.StartsWith("# EonaCat XS launcher settings")) sb.AppendLine(line);
foreach (var s in Settings)
{
var value = editors.TryGetValue(s.Key, out var editor) && editor is ComboBox combo
? combo.SelectedItem?.ToString() ?? s.Default
: s.Default;
sb.AppendLine($"{s.Key}={value}");
}
var temp = settingsPath + ".tmp";
File.WriteAllText(temp, sb.ToString());
File.Move(temp, settingsPath, true);
if (selectedGame != null) gamePath.Text = selectedGame.Executable;
File.WriteAllText(Path.Combine(Path.GetDirectoryName(settingsPath)!, "launcher-game.txt"), gamePath.Text.Trim());
SaveGameLibrary();
status.Text = "Settings saved.";
}
}