From 63990b6b5b4a75010d873e66b49c14e498b61969 Mon Sep 17 00:00:00 2001 From: snouz Date: Sat, 27 Jan 2024 13:29:58 +0100 Subject: [PATCH] Launcher resolution list: sorted and defaults to highest (#290) --- Memoria.Launcher/Memoria/GameSettingsControl.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Memoria.Launcher/Memoria/GameSettingsControl.cs b/Memoria.Launcher/Memoria/GameSettingsControl.cs index fe5fcae1c..c6d251f40 100644 --- a/Memoria.Launcher/Memoria/GameSettingsControl.cs +++ b/Memoria.Launcher/Memoria/GameSettingsControl.cs @@ -68,7 +68,7 @@ public GameSettingsControl() AddUiElement(UiTextBlockFactory.Create(Lang.Settings.Resolution), row: 10, col: 0, rowSpan: 3, colSpan: 3).Margin = rowMargin; UiComboBox resolution = AddUiElement(UiComboBoxFactory.Create(), row: 10, col: 3, rowSpan: 3, colSpan: 5); - resolution.ItemsSource = EnumerateDisplaySettings().ToArray().Reverse(); + resolution.ItemsSource = EnumerateDisplaySettings().OrderByDescending(x => Convert.ToInt32(x.Split('x')[0])).ToArray(); resolution.SetBinding(Selector.SelectedItemProperty, new Binding(nameof(ScreenResolution)) {Mode = BindingMode.TwoWay}); resolution.Margin = rowMargin; @@ -403,11 +403,11 @@ private void LoadSettings() try { IniFile iniFile = new IniFile(IniPath); + String resolutionBest = EnumerateDisplaySettings().OrderByDescending(x => Convert.ToInt32(x.Split('x')[0])).ToArray()[0]; String value = iniFile.ReadValue("Settings", nameof(ScreenResolution)); if (String.IsNullOrEmpty(value)) - value = "1280x960"; - _resolution = value; + _resolution = resolutionBest ?? "1280x960"; value = iniFile.ReadValue("Settings", nameof(ActiveMonitor)); if (!String.IsNullOrEmpty(value))