ConfigurationState.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. using Ryujinx.Common;
  2. using Ryujinx.Common.Configuration.Hid;
  3. using Ryujinx.Common.Logging;
  4. using Ryujinx.Configuration.Hid;
  5. using Ryujinx.Configuration.System;
  6. using Ryujinx.Configuration.Ui;
  7. using System;
  8. using System.Collections.Generic;
  9. namespace Ryujinx.Configuration
  10. {
  11. public class ConfigurationState
  12. {
  13. /// <summary>
  14. /// UI configuration section
  15. /// </summary>
  16. public class UiSection
  17. {
  18. public class Columns
  19. {
  20. public ReactiveObject<bool> FavColumn { get; private set; }
  21. public ReactiveObject<bool> IconColumn { get; private set; }
  22. public ReactiveObject<bool> AppColumn { get; private set; }
  23. public ReactiveObject<bool> DevColumn { get; private set; }
  24. public ReactiveObject<bool> VersionColumn { get; private set; }
  25. public ReactiveObject<bool> TimePlayedColumn { get; private set; }
  26. public ReactiveObject<bool> LastPlayedColumn { get; private set; }
  27. public ReactiveObject<bool> FileExtColumn { get; private set; }
  28. public ReactiveObject<bool> FileSizeColumn { get; private set; }
  29. public ReactiveObject<bool> PathColumn { get; private set; }
  30. public Columns()
  31. {
  32. FavColumn = new ReactiveObject<bool>();
  33. IconColumn = new ReactiveObject<bool>();
  34. AppColumn = new ReactiveObject<bool>();
  35. DevColumn = new ReactiveObject<bool>();
  36. VersionColumn = new ReactiveObject<bool>();
  37. TimePlayedColumn = new ReactiveObject<bool>();
  38. LastPlayedColumn = new ReactiveObject<bool>();
  39. FileExtColumn = new ReactiveObject<bool>();
  40. FileSizeColumn = new ReactiveObject<bool>();
  41. PathColumn = new ReactiveObject<bool>();
  42. }
  43. }
  44. /// <summary>
  45. /// Used to toggle columns in the GUI
  46. /// </summary>
  47. public Columns GuiColumns { get; private set; }
  48. /// <summary>
  49. /// A list of directories containing games to be used to load games into the games list
  50. /// </summary>
  51. public ReactiveObject<List<string>> GameDirs { get; private set; }
  52. /// <summary>
  53. /// Enable or disable custom themes in the GUI
  54. /// </summary>
  55. public ReactiveObject<bool> EnableCustomTheme { get; private set; }
  56. /// <summary>
  57. /// Path to custom GUI theme
  58. /// </summary>
  59. public ReactiveObject<string> CustomThemePath { get; private set; }
  60. public UiSection()
  61. {
  62. GuiColumns = new Columns();
  63. GameDirs = new ReactiveObject<List<string>>();
  64. EnableCustomTheme = new ReactiveObject<bool>();
  65. CustomThemePath = new ReactiveObject<string>();
  66. }
  67. }
  68. /// <summary>
  69. /// Logger configuration section
  70. /// </summary>
  71. public class LoggerSection
  72. {
  73. /// <summary>
  74. /// Enables printing debug log messages
  75. /// </summary>
  76. public ReactiveObject<bool> EnableDebug { get; private set; }
  77. /// <summary>
  78. /// Enables printing stub log messages
  79. /// </summary>
  80. public ReactiveObject<bool> EnableStub { get; private set; }
  81. /// <summary>
  82. /// Enables printing info log messages
  83. /// </summary>
  84. public ReactiveObject<bool> EnableInfo { get; private set; }
  85. /// <summary>
  86. /// Enables printing warning log messages
  87. /// </summary>
  88. public ReactiveObject<bool> EnableWarn { get; private set; }
  89. /// <summary>
  90. /// Enables printing error log messages
  91. /// </summary>
  92. public ReactiveObject<bool> EnableError { get; private set; }
  93. /// <summary>
  94. /// Enables printing guest log messages
  95. /// </summary>
  96. public ReactiveObject<bool> EnableGuest { get; private set; }
  97. /// <summary>
  98. /// Enables printing FS access log messages
  99. /// </summary>
  100. public ReactiveObject<bool> EnableFsAccessLog { get; private set; }
  101. /// <summary>
  102. /// Controls which log messages are written to the log targets
  103. /// </summary>
  104. public ReactiveObject<LogClass[]> FilteredClasses { get; private set; }
  105. /// <summary>
  106. /// Enables or disables logging to a file on disk
  107. /// </summary>
  108. public ReactiveObject<bool> EnableFileLog { get; private set; }
  109. public LoggerSection()
  110. {
  111. EnableDebug = new ReactiveObject<bool>();
  112. EnableStub = new ReactiveObject<bool>();
  113. EnableInfo = new ReactiveObject<bool>();
  114. EnableWarn = new ReactiveObject<bool>();
  115. EnableError = new ReactiveObject<bool>();
  116. EnableGuest = new ReactiveObject<bool>();
  117. EnableFsAccessLog = new ReactiveObject<bool>();
  118. FilteredClasses = new ReactiveObject<LogClass[]>();
  119. EnableFileLog = new ReactiveObject<bool>();
  120. }
  121. }
  122. /// <summary>
  123. /// System configuration section
  124. /// </summary>
  125. public class SystemSection
  126. {
  127. /// <summary>
  128. /// Change System Language
  129. /// </summary>
  130. public ReactiveObject<Language> Language { get; private set; }
  131. /// <summary>
  132. /// Change System Region
  133. /// </summary>
  134. public ReactiveObject<Region> Region { get; private set; }
  135. /// <summary>
  136. /// Change System TimeZone
  137. /// </summary>
  138. public ReactiveObject<string> TimeZone { get; private set; }
  139. /// <summary>
  140. /// System Time Offset in Seconds
  141. /// </summary>
  142. public ReactiveObject<long> SystemTimeOffset { get; private set; }
  143. /// <summary>
  144. /// Enables or disables Docked Mode
  145. /// </summary>
  146. public ReactiveObject<bool> EnableDockedMode { get; private set; }
  147. /// <summary>
  148. /// Enables or disables multi-core scheduling of threads
  149. /// </summary>
  150. public ReactiveObject<bool> EnableMulticoreScheduling { get; private set; }
  151. /// <summary>
  152. /// Enables integrity checks on Game content files
  153. /// </summary>
  154. public ReactiveObject<bool> EnableFsIntegrityChecks { get; private set; }
  155. /// <summary>
  156. /// Enables FS access log output to the console. Possible modes are 0-3
  157. /// </summary>
  158. public ReactiveObject<int> FsGlobalAccessLogMode { get; private set; }
  159. /// <summary>
  160. /// Enable or disable ignoring missing services
  161. /// </summary>
  162. public ReactiveObject<bool> IgnoreMissingServices { get; private set; }
  163. public SystemSection()
  164. {
  165. Language = new ReactiveObject<Language>();
  166. Region = new ReactiveObject<Region>();
  167. TimeZone = new ReactiveObject<string>();
  168. SystemTimeOffset = new ReactiveObject<long>();
  169. EnableDockedMode = new ReactiveObject<bool>();
  170. EnableMulticoreScheduling = new ReactiveObject<bool>();
  171. EnableFsIntegrityChecks = new ReactiveObject<bool>();
  172. FsGlobalAccessLogMode = new ReactiveObject<int>();
  173. IgnoreMissingServices = new ReactiveObject<bool>();
  174. }
  175. }
  176. /// <summary>
  177. /// Hid configuration section
  178. /// </summary>
  179. public class HidSection
  180. {
  181. /// <summary>
  182. /// Enable or disable keyboard support (Independent from controllers binding)
  183. /// </summary>
  184. public ReactiveObject<bool> EnableKeyboard { get; private set; }
  185. /// <summary>
  186. /// Input device configuration.
  187. /// NOTE: This ReactiveObject won't issue an event when the List has elements added or removed.
  188. /// TODO: Implement a ReactiveList class.
  189. /// </summary>
  190. public ReactiveObject<List<InputConfig>> InputConfig { get; private set; }
  191. public HidSection()
  192. {
  193. EnableKeyboard = new ReactiveObject<bool>();
  194. InputConfig = new ReactiveObject<List<InputConfig>>();
  195. }
  196. }
  197. /// <summary>
  198. /// Graphics configuration section
  199. /// </summary>
  200. public class GraphicsSection
  201. {
  202. /// <summary>
  203. /// Max Anisotropy. Values range from 0 - 16. Set to -1 to let the game decide.
  204. /// </summary>
  205. public ReactiveObject<float> MaxAnisotropy { get; private set; }
  206. /// <summary>
  207. /// Dumps shaders in this local directory
  208. /// </summary>
  209. public ReactiveObject<string> ShadersDumpPath { get; private set; }
  210. /// <summary>
  211. /// Enables or disables Vertical Sync
  212. /// </summary>
  213. public ReactiveObject<bool> EnableVsync { get; private set; }
  214. public GraphicsSection()
  215. {
  216. MaxAnisotropy = new ReactiveObject<float>();
  217. ShadersDumpPath = new ReactiveObject<string>();
  218. EnableVsync = new ReactiveObject<bool>();
  219. }
  220. }
  221. /// <summary>
  222. /// The default configuration instance
  223. /// </summary>
  224. public static ConfigurationState Instance { get; private set; }
  225. /// <summary>
  226. /// The Ui section
  227. /// </summary>
  228. public UiSection Ui { get; private set; }
  229. /// <summary>
  230. /// The Logger section
  231. /// </summary>
  232. public LoggerSection Logger { get; private set; }
  233. /// <summary>
  234. /// The System section
  235. /// </summary>
  236. public SystemSection System { get; private set; }
  237. /// <summary>
  238. /// The Graphics section
  239. /// </summary>
  240. public GraphicsSection Graphics { get; private set; }
  241. /// <summary>
  242. /// The Hid section
  243. /// </summary>
  244. public HidSection Hid { get; private set; }
  245. /// <summary>
  246. /// Enables or disables Discord Rich Presence
  247. /// </summary>
  248. public ReactiveObject<bool> EnableDiscordIntegration { get; private set; }
  249. private ConfigurationState()
  250. {
  251. Ui = new UiSection();
  252. Logger = new LoggerSection();
  253. System = new SystemSection();
  254. Graphics = new GraphicsSection();
  255. Hid = new HidSection();
  256. EnableDiscordIntegration = new ReactiveObject<bool>();
  257. }
  258. public ConfigurationFileFormat ToFileFormat()
  259. {
  260. List<ControllerConfig> controllerConfigList = new List<ControllerConfig>();
  261. List<KeyboardConfig> keyboardConfigList = new List<KeyboardConfig>();
  262. foreach (InputConfig inputConfig in Hid.InputConfig.Value)
  263. {
  264. if (inputConfig is ControllerConfig controllerConfig)
  265. {
  266. controllerConfigList.Add(controllerConfig);
  267. }
  268. else if (inputConfig is KeyboardConfig keyboardConfig)
  269. {
  270. keyboardConfigList.Add(keyboardConfig);
  271. }
  272. }
  273. ConfigurationFileFormat configurationFile = new ConfigurationFileFormat
  274. {
  275. Version = ConfigurationFileFormat.CurrentVersion,
  276. MaxAnisotropy = Graphics.MaxAnisotropy,
  277. GraphicsShadersDumpPath = Graphics.ShadersDumpPath,
  278. LoggingEnableDebug = Logger.EnableDebug,
  279. LoggingEnableStub = Logger.EnableStub,
  280. LoggingEnableInfo = Logger.EnableInfo,
  281. LoggingEnableWarn = Logger.EnableWarn,
  282. LoggingEnableError = Logger.EnableError,
  283. LoggingEnableGuest = Logger.EnableGuest,
  284. LoggingEnableFsAccessLog = Logger.EnableFsAccessLog,
  285. LoggingFilteredClasses = Logger.FilteredClasses,
  286. EnableFileLog = Logger.EnableFileLog,
  287. SystemLanguage = System.Language,
  288. SystemRegion = System.Region,
  289. SystemTimeZone = System.TimeZone,
  290. SystemTimeOffset = System.SystemTimeOffset,
  291. DockedMode = System.EnableDockedMode,
  292. EnableDiscordIntegration = EnableDiscordIntegration,
  293. EnableVsync = Graphics.EnableVsync,
  294. EnableMulticoreScheduling = System.EnableMulticoreScheduling,
  295. EnableFsIntegrityChecks = System.EnableFsIntegrityChecks,
  296. FsGlobalAccessLogMode = System.FsGlobalAccessLogMode,
  297. IgnoreMissingServices = System.IgnoreMissingServices,
  298. GuiColumns = new GuiColumns()
  299. {
  300. FavColumn = Ui.GuiColumns.FavColumn,
  301. IconColumn = Ui.GuiColumns.IconColumn,
  302. AppColumn = Ui.GuiColumns.AppColumn,
  303. DevColumn = Ui.GuiColumns.DevColumn,
  304. VersionColumn = Ui.GuiColumns.VersionColumn,
  305. TimePlayedColumn = Ui.GuiColumns.TimePlayedColumn,
  306. LastPlayedColumn = Ui.GuiColumns.LastPlayedColumn,
  307. FileExtColumn = Ui.GuiColumns.FileExtColumn,
  308. FileSizeColumn = Ui.GuiColumns.FileSizeColumn,
  309. PathColumn = Ui.GuiColumns.PathColumn,
  310. },
  311. GameDirs = Ui.GameDirs,
  312. EnableCustomTheme = Ui.EnableCustomTheme,
  313. CustomThemePath = Ui.CustomThemePath,
  314. EnableKeyboard = Hid.EnableKeyboard,
  315. KeyboardConfig = keyboardConfigList,
  316. ControllerConfig = controllerConfigList
  317. };
  318. return configurationFile;
  319. }
  320. public void LoadDefault()
  321. {
  322. Graphics.MaxAnisotropy.Value = -1;
  323. Graphics.ShadersDumpPath.Value = "";
  324. Logger.EnableDebug.Value = false;
  325. Logger.EnableStub.Value = true;
  326. Logger.EnableInfo.Value = true;
  327. Logger.EnableWarn.Value = true;
  328. Logger.EnableError.Value = true;
  329. Logger.EnableGuest.Value = true;
  330. Logger.EnableFsAccessLog.Value = false;
  331. Logger.FilteredClasses.Value = new LogClass[] { };
  332. Logger.EnableFileLog.Value = true;
  333. System.Language.Value = Language.AmericanEnglish;
  334. System.Region.Value = Region.USA;
  335. System.TimeZone.Value = "UTC";
  336. System.SystemTimeOffset.Value = 0;
  337. System.EnableDockedMode.Value = false;
  338. EnableDiscordIntegration.Value = true;
  339. Graphics.EnableVsync.Value = true;
  340. System.EnableMulticoreScheduling.Value = true;
  341. System.EnableFsIntegrityChecks.Value = true;
  342. System.FsGlobalAccessLogMode.Value = 0;
  343. System.IgnoreMissingServices.Value = false;
  344. Ui.GuiColumns.FavColumn.Value = true;
  345. Ui.GuiColumns.IconColumn.Value = true;
  346. Ui.GuiColumns.AppColumn.Value = true;
  347. Ui.GuiColumns.DevColumn.Value = true;
  348. Ui.GuiColumns.VersionColumn.Value = true;
  349. Ui.GuiColumns.TimePlayedColumn.Value = true;
  350. Ui.GuiColumns.LastPlayedColumn.Value = true;
  351. Ui.GuiColumns.FileExtColumn.Value = true;
  352. Ui.GuiColumns.FileSizeColumn.Value = true;
  353. Ui.GuiColumns.PathColumn.Value = true;
  354. Ui.GameDirs.Value = new List<string>();
  355. Ui.EnableCustomTheme.Value = false;
  356. Ui.CustomThemePath.Value = "";
  357. Hid.EnableKeyboard.Value = false;
  358. Hid.InputConfig.Value = new List<InputConfig>
  359. {
  360. new KeyboardConfig
  361. {
  362. Index = 0,
  363. ControllerType = ControllerType.JoyconPair,
  364. PlayerIndex = PlayerIndex.Player1,
  365. LeftJoycon = new NpadKeyboardLeft
  366. {
  367. StickUp = Key.W,
  368. StickDown = Key.S,
  369. StickLeft = Key.A,
  370. StickRight = Key.D,
  371. StickButton = Key.F,
  372. DPadUp = Key.Up,
  373. DPadDown = Key.Down,
  374. DPadLeft = Key.Left,
  375. DPadRight = Key.Right,
  376. ButtonMinus = Key.Minus,
  377. ButtonL = Key.E,
  378. ButtonZl = Key.Q,
  379. ButtonSl = Key.Home,
  380. ButtonSr = Key.End
  381. },
  382. RightJoycon = new NpadKeyboardRight
  383. {
  384. StickUp = Key.I,
  385. StickDown = Key.K,
  386. StickLeft = Key.J,
  387. StickRight = Key.L,
  388. StickButton = Key.H,
  389. ButtonA = Key.Z,
  390. ButtonB = Key.X,
  391. ButtonX = Key.C,
  392. ButtonY = Key.V,
  393. ButtonPlus = Key.Plus,
  394. ButtonR = Key.U,
  395. ButtonZr = Key.O,
  396. ButtonSl = Key.PageUp,
  397. ButtonSr = Key.PageDown
  398. },
  399. Hotkeys = new KeyboardHotkeys
  400. {
  401. ToggleVsync = Key.Tab
  402. }
  403. }
  404. };
  405. }
  406. public void Load(ConfigurationFileFormat configurationFileFormat, string configurationFilePath)
  407. {
  408. bool configurationFileUpdated = false;
  409. if (configurationFileFormat.Version < 0 || configurationFileFormat.Version > ConfigurationFileFormat.CurrentVersion)
  410. {
  411. Common.Logging.Logger.PrintWarning(LogClass.Application, $"Unsupported configuration version {configurationFileFormat.Version}, loading default.");
  412. LoadDefault();
  413. return;
  414. }
  415. if (configurationFileFormat.Version < 2)
  416. {
  417. Common.Logging.Logger.PrintWarning(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 2.");
  418. configurationFileFormat.SystemRegion = Region.USA;
  419. configurationFileUpdated = true;
  420. }
  421. if (configurationFileFormat.Version < 3)
  422. {
  423. Common.Logging.Logger.PrintWarning(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 3.");
  424. configurationFileFormat.SystemTimeZone = "UTC";
  425. configurationFileUpdated = true;
  426. }
  427. if (configurationFileFormat.Version < 4)
  428. {
  429. Common.Logging.Logger.PrintWarning(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 4.");
  430. configurationFileFormat.MaxAnisotropy = -1;
  431. configurationFileUpdated = true;
  432. }
  433. if (configurationFileFormat.Version < 5)
  434. {
  435. Common.Logging.Logger.PrintWarning(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 5.");
  436. configurationFileFormat.SystemTimeOffset = 0;
  437. configurationFileUpdated = true;
  438. }
  439. if (configurationFileFormat.Version < 6)
  440. {
  441. Common.Logging.Logger.PrintWarning(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 6.");
  442. configurationFileFormat.ControllerConfig = new List<ControllerConfig>();
  443. configurationFileFormat.KeyboardConfig = new List<KeyboardConfig>{
  444. new KeyboardConfig
  445. {
  446. Index = 0,
  447. ControllerType = ControllerType.JoyconPair,
  448. PlayerIndex = PlayerIndex.Player1,
  449. LeftJoycon = new NpadKeyboardLeft
  450. {
  451. StickUp = Key.W,
  452. StickDown = Key.S,
  453. StickLeft = Key.A,
  454. StickRight = Key.D,
  455. StickButton = Key.F,
  456. DPadUp = Key.Up,
  457. DPadDown = Key.Down,
  458. DPadLeft = Key.Left,
  459. DPadRight = Key.Right,
  460. ButtonMinus = Key.Minus,
  461. ButtonL = Key.E,
  462. ButtonZl = Key.Q,
  463. ButtonSl = Key.Unbound,
  464. ButtonSr = Key.Unbound
  465. },
  466. RightJoycon = new NpadKeyboardRight
  467. {
  468. StickUp = Key.I,
  469. StickDown = Key.K,
  470. StickLeft = Key.J,
  471. StickRight = Key.L,
  472. StickButton = Key.H,
  473. ButtonA = Key.Z,
  474. ButtonB = Key.X,
  475. ButtonX = Key.C,
  476. ButtonY = Key.V,
  477. ButtonPlus = Key.Plus,
  478. ButtonR = Key.U,
  479. ButtonZr = Key.O,
  480. ButtonSl = Key.Unbound,
  481. ButtonSr = Key.Unbound
  482. },
  483. Hotkeys = new KeyboardHotkeys
  484. {
  485. ToggleVsync = Key.Tab
  486. }
  487. }
  488. };
  489. configurationFileUpdated = true;
  490. }
  491. // Only needed for version 6 configurations.
  492. if (configurationFileFormat.Version == 6)
  493. {
  494. Common.Logging.Logger.PrintWarning(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 7.");
  495. for (int i = 0; i < configurationFileFormat.KeyboardConfig.Count; i++)
  496. {
  497. if (configurationFileFormat.KeyboardConfig[i].Index != KeyboardConfig.AllKeyboardsIndex)
  498. {
  499. configurationFileFormat.KeyboardConfig[i].Index++;
  500. }
  501. }
  502. }
  503. List<InputConfig> inputConfig = new List<InputConfig>();
  504. foreach (ControllerConfig controllerConfig in configurationFileFormat.ControllerConfig)
  505. {
  506. inputConfig.Add(controllerConfig);
  507. }
  508. foreach (KeyboardConfig keyboardConfig in configurationFileFormat.KeyboardConfig)
  509. {
  510. inputConfig.Add(keyboardConfig);
  511. }
  512. Graphics.MaxAnisotropy.Value = configurationFileFormat.MaxAnisotropy;
  513. Graphics.ShadersDumpPath.Value = configurationFileFormat.GraphicsShadersDumpPath;
  514. Logger.EnableDebug.Value = configurationFileFormat.LoggingEnableDebug;
  515. Logger.EnableStub.Value = configurationFileFormat.LoggingEnableStub;
  516. Logger.EnableInfo.Value = configurationFileFormat.LoggingEnableInfo;
  517. Logger.EnableWarn.Value = configurationFileFormat.LoggingEnableWarn;
  518. Logger.EnableError.Value = configurationFileFormat.LoggingEnableError;
  519. Logger.EnableGuest.Value = configurationFileFormat.LoggingEnableGuest;
  520. Logger.EnableFsAccessLog.Value = configurationFileFormat.LoggingEnableFsAccessLog;
  521. Logger.FilteredClasses.Value = configurationFileFormat.LoggingFilteredClasses;
  522. Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog;
  523. System.Language.Value = configurationFileFormat.SystemLanguage;
  524. System.Region.Value = configurationFileFormat.SystemRegion;
  525. System.TimeZone.Value = configurationFileFormat.SystemTimeZone;
  526. System.SystemTimeOffset.Value = configurationFileFormat.SystemTimeOffset;
  527. System.EnableDockedMode.Value = configurationFileFormat.DockedMode;
  528. System.EnableDockedMode.Value = configurationFileFormat.DockedMode;
  529. EnableDiscordIntegration.Value = configurationFileFormat.EnableDiscordIntegration;
  530. Graphics.EnableVsync.Value = configurationFileFormat.EnableVsync;
  531. System.EnableMulticoreScheduling.Value = configurationFileFormat.EnableMulticoreScheduling;
  532. System.EnableFsIntegrityChecks.Value = configurationFileFormat.EnableFsIntegrityChecks;
  533. System.FsGlobalAccessLogMode.Value = configurationFileFormat.FsGlobalAccessLogMode;
  534. System.IgnoreMissingServices.Value = configurationFileFormat.IgnoreMissingServices;
  535. Ui.GuiColumns.FavColumn.Value = configurationFileFormat.GuiColumns.FavColumn;
  536. Ui.GuiColumns.IconColumn.Value = configurationFileFormat.GuiColumns.IconColumn;
  537. Ui.GuiColumns.AppColumn.Value = configurationFileFormat.GuiColumns.AppColumn;
  538. Ui.GuiColumns.DevColumn.Value = configurationFileFormat.GuiColumns.DevColumn;
  539. Ui.GuiColumns.VersionColumn.Value = configurationFileFormat.GuiColumns.VersionColumn;
  540. Ui.GuiColumns.TimePlayedColumn.Value = configurationFileFormat.GuiColumns.TimePlayedColumn;
  541. Ui.GuiColumns.LastPlayedColumn.Value = configurationFileFormat.GuiColumns.LastPlayedColumn;
  542. Ui.GuiColumns.FileExtColumn.Value = configurationFileFormat.GuiColumns.FileExtColumn;
  543. Ui.GuiColumns.FileSizeColumn.Value = configurationFileFormat.GuiColumns.FileSizeColumn;
  544. Ui.GuiColumns.PathColumn.Value = configurationFileFormat.GuiColumns.PathColumn;
  545. Ui.GameDirs.Value = configurationFileFormat.GameDirs;
  546. Ui.EnableCustomTheme.Value = configurationFileFormat.EnableCustomTheme;
  547. Ui.CustomThemePath.Value = configurationFileFormat.CustomThemePath;
  548. Hid.EnableKeyboard.Value = configurationFileFormat.EnableKeyboard;
  549. Hid.InputConfig.Value = inputConfig;
  550. if (configurationFileUpdated)
  551. {
  552. ToFileFormat().SaveConfig(configurationFilePath);
  553. Common.Logging.Logger.PrintWarning(LogClass.Application, "Configuration file has been updated!");
  554. }
  555. }
  556. public static void Initialize()
  557. {
  558. if (Instance != null)
  559. {
  560. throw new InvalidOperationException("Configuration is already initialized");
  561. }
  562. Instance = new ConfigurationState();
  563. }
  564. }
  565. }