SettingsWindow.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. using Gtk;
  2. using Ryujinx.Audio;
  3. using Ryujinx.Configuration;
  4. using Ryujinx.Common.Configuration.Hid;
  5. using Ryujinx.Configuration.System;
  6. using Ryujinx.HLE.HOS.Services.Time.TimeZone;
  7. using Ryujinx.HLE.FileSystem;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Diagnostics;
  11. using System.IO;
  12. using System.Reflection;
  13. using System.Threading.Tasks;
  14. using GUI = Gtk.Builder.ObjectAttribute;
  15. namespace Ryujinx.Ui
  16. {
  17. public class SettingsWindow : Window
  18. {
  19. private static ListStore _gameDirsBoxStore;
  20. private static VirtualFileSystem _virtualFileSystem;
  21. private TimeZoneContentManager _timeZoneContentManager;
  22. private HashSet<string> _validTzRegions;
  23. private long _systemTimeOffset;
  24. #pragma warning disable CS0649, IDE0044
  25. [GUI] CheckButton _errorLogToggle;
  26. [GUI] CheckButton _warningLogToggle;
  27. [GUI] CheckButton _infoLogToggle;
  28. [GUI] CheckButton _stubLogToggle;
  29. [GUI] CheckButton _debugLogToggle;
  30. [GUI] CheckButton _fileLogToggle;
  31. [GUI] CheckButton _guestLogToggle;
  32. [GUI] CheckButton _fsAccessLogToggle;
  33. [GUI] Adjustment _fsLogSpinAdjustment;
  34. [GUI] CheckButton _dockedModeToggle;
  35. [GUI] CheckButton _discordToggle;
  36. [GUI] CheckButton _vSyncToggle;
  37. [GUI] CheckButton _multiSchedToggle;
  38. [GUI] CheckButton _ptcToggle;
  39. [GUI] CheckButton _fsicToggle;
  40. [GUI] CheckButton _ignoreToggle;
  41. [GUI] CheckButton _directKeyboardAccess;
  42. [GUI] ComboBoxText _systemLanguageSelect;
  43. [GUI] ComboBoxText _systemRegionSelect;
  44. [GUI] Entry _systemTimeZoneEntry;
  45. [GUI] EntryCompletion _systemTimeZoneCompletion;
  46. [GUI] ComboBoxText _audioBackendSelect;
  47. [GUI] SpinButton _systemTimeYearSpin;
  48. [GUI] SpinButton _systemTimeMonthSpin;
  49. [GUI] SpinButton _systemTimeDaySpin;
  50. [GUI] SpinButton _systemTimeHourSpin;
  51. [GUI] SpinButton _systemTimeMinuteSpin;
  52. [GUI] Adjustment _systemTimeYearSpinAdjustment;
  53. [GUI] Adjustment _systemTimeMonthSpinAdjustment;
  54. [GUI] Adjustment _systemTimeDaySpinAdjustment;
  55. [GUI] Adjustment _systemTimeHourSpinAdjustment;
  56. [GUI] Adjustment _systemTimeMinuteSpinAdjustment;
  57. [GUI] CheckButton _custThemeToggle;
  58. [GUI] Entry _custThemePath;
  59. [GUI] ToggleButton _browseThemePath;
  60. [GUI] Label _custThemePathLabel;
  61. [GUI] TreeView _gameDirsBox;
  62. [GUI] Entry _addGameDirBox;
  63. [GUI] Entry _graphicsShadersDumpPath;
  64. [GUI] ComboBoxText _anisotropy;
  65. [GUI] ComboBoxText _resScaleCombo;
  66. [GUI] Entry _resScaleText;
  67. [GUI] ToggleButton _configureController1;
  68. [GUI] ToggleButton _configureController2;
  69. [GUI] ToggleButton _configureController3;
  70. [GUI] ToggleButton _configureController4;
  71. [GUI] ToggleButton _configureController5;
  72. [GUI] ToggleButton _configureController6;
  73. [GUI] ToggleButton _configureController7;
  74. [GUI] ToggleButton _configureController8;
  75. [GUI] ToggleButton _configureControllerH;
  76. #pragma warning restore CS0649, IDE0044
  77. public SettingsWindow(VirtualFileSystem virtualFileSystem, HLE.FileSystem.Content.ContentManager contentManager) : this(new Builder("Ryujinx.Ui.SettingsWindow.glade"), virtualFileSystem, contentManager) { }
  78. private SettingsWindow(Builder builder, VirtualFileSystem virtualFileSystem, HLE.FileSystem.Content.ContentManager contentManager) : base(builder.GetObject("_settingsWin").Handle)
  79. {
  80. builder.Autoconnect(this);
  81. this.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png");
  82. _virtualFileSystem = virtualFileSystem;
  83. _timeZoneContentManager = new TimeZoneContentManager();
  84. _timeZoneContentManager.InitializeInstance(virtualFileSystem, contentManager, LibHac.FsSystem.IntegrityCheckLevel.None);
  85. _validTzRegions = new HashSet<string>(_timeZoneContentManager.LocationNameCache.Length, StringComparer.Ordinal); // Zone regions are identifiers. Must match exactly.
  86. //Bind Events
  87. _configureController1.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player1);
  88. _configureController2.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player2);
  89. _configureController3.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player3);
  90. _configureController4.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player4);
  91. _configureController5.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player5);
  92. _configureController6.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player6);
  93. _configureController7.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player7);
  94. _configureController8.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player8);
  95. _configureControllerH.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Handheld);
  96. _systemTimeZoneEntry.FocusOutEvent += TimeZoneEntry_FocusOut;
  97. _resScaleCombo.Changed += (sender, args) => _resScaleText.Visible = _resScaleCombo.ActiveId == "-1";
  98. //Setup Currents
  99. if (ConfigurationState.Instance.Logger.EnableFileLog)
  100. {
  101. _fileLogToggle.Click();
  102. }
  103. if (ConfigurationState.Instance.Logger.EnableError)
  104. {
  105. _errorLogToggle.Click();
  106. }
  107. if (ConfigurationState.Instance.Logger.EnableWarn)
  108. {
  109. _warningLogToggle.Click();
  110. }
  111. if (ConfigurationState.Instance.Logger.EnableInfo)
  112. {
  113. _infoLogToggle.Click();
  114. }
  115. if (ConfigurationState.Instance.Logger.EnableStub)
  116. {
  117. _stubLogToggle.Click();
  118. }
  119. if (ConfigurationState.Instance.Logger.EnableDebug)
  120. {
  121. _debugLogToggle.Click();
  122. }
  123. if (ConfigurationState.Instance.Logger.EnableGuest)
  124. {
  125. _guestLogToggle.Click();
  126. }
  127. if (ConfigurationState.Instance.Logger.EnableFsAccessLog)
  128. {
  129. _fsAccessLogToggle.Click();
  130. }
  131. if (ConfigurationState.Instance.System.EnableDockedMode)
  132. {
  133. _dockedModeToggle.Click();
  134. }
  135. if (ConfigurationState.Instance.EnableDiscordIntegration)
  136. {
  137. _discordToggle.Click();
  138. }
  139. if (ConfigurationState.Instance.Graphics.EnableVsync)
  140. {
  141. _vSyncToggle.Click();
  142. }
  143. if (ConfigurationState.Instance.System.EnableMulticoreScheduling)
  144. {
  145. _multiSchedToggle.Click();
  146. }
  147. if (ConfigurationState.Instance.System.EnablePtc)
  148. {
  149. _ptcToggle.Click();
  150. }
  151. if (ConfigurationState.Instance.System.EnableFsIntegrityChecks)
  152. {
  153. _fsicToggle.Click();
  154. }
  155. if (ConfigurationState.Instance.System.IgnoreMissingServices)
  156. {
  157. _ignoreToggle.Click();
  158. }
  159. if (ConfigurationState.Instance.Hid.EnableKeyboard)
  160. {
  161. _directKeyboardAccess.Click();
  162. }
  163. if (ConfigurationState.Instance.Ui.EnableCustomTheme)
  164. {
  165. _custThemeToggle.Click();
  166. }
  167. Task.Run(() =>
  168. {
  169. if (SoundIoAudioOut.IsSupported)
  170. {
  171. Application.Invoke(delegate
  172. {
  173. _audioBackendSelect.Append(AudioBackend.SoundIo.ToString(), "SoundIO");
  174. });
  175. }
  176. if (OpenALAudioOut.IsSupported)
  177. {
  178. Application.Invoke(delegate
  179. {
  180. _audioBackendSelect.Append(AudioBackend.OpenAl.ToString(), "OpenAL");
  181. });
  182. }
  183. Application.Invoke(delegate
  184. {
  185. _audioBackendSelect.SetActiveId(ConfigurationState.Instance.System.AudioBackend.Value.ToString());
  186. });
  187. });
  188. // Custom EntryCompletion Columns. If added to glade, need to override more signals
  189. ListStore tzList = new ListStore(typeof(string), typeof(string), typeof(string));
  190. _systemTimeZoneCompletion.Model = tzList;
  191. CellRendererText offsetCol = new CellRendererText();
  192. CellRendererText abbrevCol = new CellRendererText();
  193. _systemTimeZoneCompletion.PackStart(offsetCol, false);
  194. _systemTimeZoneCompletion.AddAttribute(offsetCol, "text", 0);
  195. _systemTimeZoneCompletion.TextColumn = 1; // Regions Column
  196. _systemTimeZoneCompletion.PackStart(abbrevCol, false);
  197. _systemTimeZoneCompletion.AddAttribute(abbrevCol, "text", 2);
  198. int maxLocationLength = 0;
  199. foreach (var (offset, location, abbr) in _timeZoneContentManager.ParseTzOffsets())
  200. {
  201. var hours = Math.DivRem(offset, 3600, out int seconds);
  202. var minutes = Math.Abs(seconds) / 60;
  203. var abbr2 = (abbr.StartsWith('+') || abbr.StartsWith('-')) ? string.Empty : abbr;
  204. tzList.AppendValues($"UTC{hours:+0#;-0#;+00}:{minutes:D2} ", location, abbr2);
  205. _validTzRegions.Add(location);
  206. maxLocationLength = Math.Max(maxLocationLength, location.Length);
  207. }
  208. _systemTimeZoneEntry.WidthChars = Math.Max(20, maxLocationLength + 1); // Ensure minimum Entry width
  209. _systemTimeZoneEntry.Text = _timeZoneContentManager.SanityCheckDeviceLocationName();
  210. _systemTimeZoneCompletion.MatchFunc = TimeZoneMatchFunc;
  211. _systemLanguageSelect.SetActiveId(ConfigurationState.Instance.System.Language.Value.ToString());
  212. _systemRegionSelect.SetActiveId(ConfigurationState.Instance.System.Region.Value.ToString());
  213. _resScaleCombo.SetActiveId(ConfigurationState.Instance.Graphics.ResScale.Value.ToString());
  214. _anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.Value.ToString());
  215. _custThemePath.Buffer.Text = ConfigurationState.Instance.Ui.CustomThemePath;
  216. _resScaleText.Buffer.Text = ConfigurationState.Instance.Graphics.ResScaleCustom.Value.ToString();
  217. _resScaleText.Visible = _resScaleCombo.ActiveId == "-1";
  218. _graphicsShadersDumpPath.Buffer.Text = ConfigurationState.Instance.Graphics.ShadersDumpPath;
  219. _fsLogSpinAdjustment.Value = ConfigurationState.Instance.System.FsGlobalAccessLogMode;
  220. _systemTimeOffset = ConfigurationState.Instance.System.SystemTimeOffset;
  221. _gameDirsBox.AppendColumn("", new CellRendererText(), "text", 0);
  222. _gameDirsBoxStore = new ListStore(typeof(string));
  223. _gameDirsBox.Model = _gameDirsBoxStore;
  224. foreach (string gameDir in ConfigurationState.Instance.Ui.GameDirs.Value)
  225. {
  226. _gameDirsBoxStore.AppendValues(gameDir);
  227. }
  228. if (_custThemeToggle.Active == false)
  229. {
  230. _custThemePath.Sensitive = false;
  231. _custThemePathLabel.Sensitive = false;
  232. _browseThemePath.Sensitive = false;
  233. }
  234. //Setup system time spinners
  235. UpdateSystemTimeSpinners();
  236. }
  237. private void UpdateSystemTimeSpinners()
  238. {
  239. //Bind system time events
  240. _systemTimeYearSpin.ValueChanged -= SystemTimeSpin_ValueChanged;
  241. _systemTimeMonthSpin.ValueChanged -= SystemTimeSpin_ValueChanged;
  242. _systemTimeDaySpin.ValueChanged -= SystemTimeSpin_ValueChanged;
  243. _systemTimeHourSpin.ValueChanged -= SystemTimeSpin_ValueChanged;
  244. _systemTimeMinuteSpin.ValueChanged -= SystemTimeSpin_ValueChanged;
  245. //Apply actual system time + SystemTimeOffset to system time spin buttons
  246. DateTime systemTime = DateTime.Now.AddSeconds(_systemTimeOffset);
  247. _systemTimeYearSpinAdjustment.Value = systemTime.Year;
  248. _systemTimeMonthSpinAdjustment.Value = systemTime.Month;
  249. _systemTimeDaySpinAdjustment.Value = systemTime.Day;
  250. _systemTimeHourSpinAdjustment.Value = systemTime.Hour;
  251. _systemTimeMinuteSpinAdjustment.Value = systemTime.Minute;
  252. //Format spin buttons text to include leading zeros
  253. _systemTimeYearSpin.Text = systemTime.Year.ToString("0000");
  254. _systemTimeMonthSpin.Text = systemTime.Month.ToString("00");
  255. _systemTimeDaySpin.Text = systemTime.Day.ToString("00");
  256. _systemTimeHourSpin.Text = systemTime.Hour.ToString("00");
  257. _systemTimeMinuteSpin.Text = systemTime.Minute.ToString("00");
  258. //Bind system time events
  259. _systemTimeYearSpin.ValueChanged += SystemTimeSpin_ValueChanged;
  260. _systemTimeMonthSpin.ValueChanged += SystemTimeSpin_ValueChanged;
  261. _systemTimeDaySpin.ValueChanged += SystemTimeSpin_ValueChanged;
  262. _systemTimeHourSpin.ValueChanged += SystemTimeSpin_ValueChanged;
  263. _systemTimeMinuteSpin.ValueChanged += SystemTimeSpin_ValueChanged;
  264. }
  265. //Events
  266. private void TimeZoneEntry_FocusOut(Object sender, FocusOutEventArgs e)
  267. {
  268. if (!_validTzRegions.Contains(_systemTimeZoneEntry.Text))
  269. {
  270. _systemTimeZoneEntry.Text = _timeZoneContentManager.SanityCheckDeviceLocationName();
  271. }
  272. }
  273. private bool TimeZoneMatchFunc(EntryCompletion compl, string key, TreeIter iter)
  274. {
  275. key = key.Trim().Replace(' ', '_');
  276. return ((string)compl.Model.GetValue(iter, 1)).Contains(key, StringComparison.OrdinalIgnoreCase) || // region
  277. ((string)compl.Model.GetValue(iter, 2)).StartsWith(key, StringComparison.OrdinalIgnoreCase) || // abbr
  278. ((string)compl.Model.GetValue(iter, 0)).Substring(3).StartsWith(key); // offset
  279. }
  280. private void SystemTimeSpin_ValueChanged(Object sender, EventArgs e)
  281. {
  282. int year = _systemTimeYearSpin.ValueAsInt;
  283. int month = _systemTimeMonthSpin.ValueAsInt;
  284. int day = _systemTimeDaySpin.ValueAsInt;
  285. int hour = _systemTimeHourSpin.ValueAsInt;
  286. int minute = _systemTimeMinuteSpin.ValueAsInt;
  287. if (!DateTime.TryParse(year + "-" + month + "-" + day + " " + hour + ":" + minute, out DateTime newTime))
  288. {
  289. UpdateSystemTimeSpinners();
  290. return;
  291. }
  292. newTime = newTime.AddSeconds(DateTime.Now.Second).AddMilliseconds(DateTime.Now.Millisecond);
  293. long systemTimeOffset = (long)Math.Ceiling((newTime - DateTime.Now).TotalMinutes) * 60L;
  294. if (_systemTimeOffset != systemTimeOffset)
  295. {
  296. _systemTimeOffset = systemTimeOffset;
  297. UpdateSystemTimeSpinners();
  298. }
  299. }
  300. private void AddDir_Pressed(object sender, EventArgs args)
  301. {
  302. if (Directory.Exists(_addGameDirBox.Buffer.Text))
  303. {
  304. _gameDirsBoxStore.AppendValues(_addGameDirBox.Buffer.Text);
  305. }
  306. else
  307. {
  308. FileChooserDialog fileChooser = new FileChooserDialog("Choose the game directory to add to the list", this, FileChooserAction.SelectFolder, "Cancel", ResponseType.Cancel, "Add", ResponseType.Accept)
  309. {
  310. SelectMultiple = true
  311. };
  312. if (fileChooser.Run() == (int)ResponseType.Accept)
  313. {
  314. foreach (string directory in fileChooser.Filenames)
  315. {
  316. bool directoryAdded = false;
  317. if (_gameDirsBoxStore.GetIterFirst(out TreeIter treeIter))
  318. {
  319. do
  320. {
  321. if (directory.Equals((string)_gameDirsBoxStore.GetValue(treeIter, 0)))
  322. {
  323. directoryAdded = true;
  324. break;
  325. }
  326. } while(_gameDirsBoxStore.IterNext(ref treeIter));
  327. }
  328. if (!directoryAdded)
  329. {
  330. _gameDirsBoxStore.AppendValues(directory);
  331. }
  332. }
  333. }
  334. fileChooser.Dispose();
  335. }
  336. _addGameDirBox.Buffer.Text = "";
  337. ((ToggleButton)sender).SetStateFlags(0, true);
  338. }
  339. private void RemoveDir_Pressed(object sender, EventArgs args)
  340. {
  341. TreeSelection selection = _gameDirsBox.Selection;
  342. if (selection.GetSelected(out TreeIter treeIter))
  343. {
  344. _gameDirsBoxStore.Remove(ref treeIter);
  345. }
  346. ((ToggleButton)sender).SetStateFlags(0, true);
  347. }
  348. private void CustThemeToggle_Activated(object sender, EventArgs args)
  349. {
  350. _custThemePath.Sensitive = _custThemeToggle.Active;
  351. _custThemePathLabel.Sensitive = _custThemeToggle.Active;
  352. _browseThemePath.Sensitive = _custThemeToggle.Active;
  353. }
  354. private void BrowseThemeDir_Pressed(object sender, EventArgs args)
  355. {
  356. FileChooserDialog fileChooser = new FileChooserDialog("Choose the theme to load", this, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Select", ResponseType.Accept);
  357. fileChooser.Filter = new FileFilter();
  358. fileChooser.Filter.AddPattern("*.css");
  359. if (fileChooser.Run() == (int)ResponseType.Accept)
  360. {
  361. _custThemePath.Buffer.Text = fileChooser.Filename;
  362. }
  363. fileChooser.Dispose();
  364. _browseThemePath.SetStateFlags(0, true);
  365. }
  366. private void OpenLogsFolder_Pressed(object sender, EventArgs args)
  367. {
  368. string logPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs");
  369. DirectoryInfo directory = new DirectoryInfo(logPath);
  370. directory.Create();
  371. Process.Start(new ProcessStartInfo()
  372. {
  373. FileName = logPath,
  374. UseShellExecute = true,
  375. Verb = "open"
  376. });
  377. }
  378. private void ConfigureController_Pressed(object sender, EventArgs args, PlayerIndex playerIndex)
  379. {
  380. ((ToggleButton)sender).SetStateFlags(0, true);
  381. ControllerWindow controllerWin = new ControllerWindow(playerIndex, _virtualFileSystem);
  382. controllerWin.Show();
  383. }
  384. private void SaveToggle_Activated(object sender, EventArgs args)
  385. {
  386. List<string> gameDirs = new List<string>();
  387. _gameDirsBoxStore.GetIterFirst(out TreeIter treeIter);
  388. for (int i = 0; i < _gameDirsBoxStore.IterNChildren(); i++)
  389. {
  390. gameDirs.Add((string)_gameDirsBoxStore.GetValue(treeIter, 0));
  391. _gameDirsBoxStore.IterNext(ref treeIter);
  392. }
  393. float resScaleCustom;
  394. if (!float.TryParse(_resScaleText.Buffer.Text, out resScaleCustom) || resScaleCustom <= 0.0f)
  395. {
  396. resScaleCustom = 1.0f;
  397. }
  398. if (_validTzRegions.Contains(_systemTimeZoneEntry.Text))
  399. {
  400. ConfigurationState.Instance.System.TimeZone.Value = _systemTimeZoneEntry.Text;
  401. }
  402. ConfigurationState.Instance.Logger.EnableError.Value = _errorLogToggle.Active;
  403. ConfigurationState.Instance.Logger.EnableWarn.Value = _warningLogToggle.Active;
  404. ConfigurationState.Instance.Logger.EnableInfo.Value = _infoLogToggle.Active;
  405. ConfigurationState.Instance.Logger.EnableStub.Value = _stubLogToggle.Active;
  406. ConfigurationState.Instance.Logger.EnableDebug.Value = _debugLogToggle.Active;
  407. ConfigurationState.Instance.Logger.EnableGuest.Value = _guestLogToggle.Active;
  408. ConfigurationState.Instance.Logger.EnableFsAccessLog.Value = _fsAccessLogToggle.Active;
  409. ConfigurationState.Instance.Logger.EnableFileLog.Value = _fileLogToggle.Active;
  410. ConfigurationState.Instance.System.EnableDockedMode.Value = _dockedModeToggle.Active;
  411. ConfigurationState.Instance.EnableDiscordIntegration.Value = _discordToggle.Active;
  412. ConfigurationState.Instance.Graphics.EnableVsync.Value = _vSyncToggle.Active;
  413. ConfigurationState.Instance.System.EnableMulticoreScheduling.Value = _multiSchedToggle.Active;
  414. ConfigurationState.Instance.System.EnablePtc.Value = _ptcToggle.Active;
  415. ConfigurationState.Instance.System.EnableFsIntegrityChecks.Value = _fsicToggle.Active;
  416. ConfigurationState.Instance.System.IgnoreMissingServices.Value = _ignoreToggle.Active;
  417. ConfigurationState.Instance.Hid.EnableKeyboard.Value = _directKeyboardAccess.Active;
  418. ConfigurationState.Instance.Ui.EnableCustomTheme.Value = _custThemeToggle.Active;
  419. ConfigurationState.Instance.System.Language.Value = Enum.Parse<Language>(_systemLanguageSelect.ActiveId);
  420. ConfigurationState.Instance.System.Region.Value = Enum.Parse<Configuration.System.Region>(_systemRegionSelect.ActiveId);
  421. ConfigurationState.Instance.System.AudioBackend.Value = Enum.Parse<AudioBackend>(_audioBackendSelect.ActiveId);
  422. ConfigurationState.Instance.System.SystemTimeOffset.Value = _systemTimeOffset;
  423. ConfigurationState.Instance.Ui.CustomThemePath.Value = _custThemePath.Buffer.Text;
  424. ConfigurationState.Instance.Graphics.ShadersDumpPath.Value = _graphicsShadersDumpPath.Buffer.Text;
  425. ConfigurationState.Instance.Ui.GameDirs.Value = gameDirs;
  426. ConfigurationState.Instance.System.FsGlobalAccessLogMode.Value = (int)_fsLogSpinAdjustment.Value;
  427. ConfigurationState.Instance.Graphics.MaxAnisotropy.Value = float.Parse(_anisotropy.ActiveId);
  428. ConfigurationState.Instance.Graphics.ResScale.Value = int.Parse(_resScaleCombo.ActiveId);
  429. ConfigurationState.Instance.Graphics.ResScaleCustom.Value = resScaleCustom;
  430. MainWindow.SaveConfig();
  431. MainWindow.UpdateGraphicsConfig();
  432. MainWindow.ApplyTheme();
  433. Dispose();
  434. }
  435. private void CloseToggle_Activated(object sender, EventArgs args)
  436. {
  437. Dispose();
  438. }
  439. }
  440. }