SettingsWindow.cs 24 KB

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