ConfigurationState.cs 56 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193
  1. using Ryujinx.Common;
  2. using Ryujinx.Common.Configuration;
  3. using Ryujinx.Common.Configuration.Hid;
  4. using Ryujinx.Common.Configuration.Hid.Controller;
  5. using Ryujinx.Common.Configuration.Hid.Keyboard;
  6. using Ryujinx.Common.Logging;
  7. using Ryujinx.Ui.Common.Configuration.System;
  8. using Ryujinx.Ui.Common.Configuration.Ui;
  9. using Ryujinx.Ui.Common.Helper;
  10. using System;
  11. using System.Collections.Generic;
  12. namespace Ryujinx.Ui.Common.Configuration
  13. {
  14. public class ConfigurationState
  15. {
  16. /// <summary>
  17. /// UI configuration section
  18. /// </summary>
  19. public class UiSection
  20. {
  21. public class Columns
  22. {
  23. public ReactiveObject<bool> FavColumn { get; private set; }
  24. public ReactiveObject<bool> IconColumn { get; private set; }
  25. public ReactiveObject<bool> AppColumn { get; private set; }
  26. public ReactiveObject<bool> DevColumn { get; private set; }
  27. public ReactiveObject<bool> VersionColumn { get; private set; }
  28. public ReactiveObject<bool> TimePlayedColumn { get; private set; }
  29. public ReactiveObject<bool> LastPlayedColumn { get; private set; }
  30. public ReactiveObject<bool> FileExtColumn { get; private set; }
  31. public ReactiveObject<bool> FileSizeColumn { get; private set; }
  32. public ReactiveObject<bool> PathColumn { get; private set; }
  33. public Columns()
  34. {
  35. FavColumn = new ReactiveObject<bool>();
  36. IconColumn = new ReactiveObject<bool>();
  37. AppColumn = new ReactiveObject<bool>();
  38. DevColumn = new ReactiveObject<bool>();
  39. VersionColumn = new ReactiveObject<bool>();
  40. TimePlayedColumn = new ReactiveObject<bool>();
  41. LastPlayedColumn = new ReactiveObject<bool>();
  42. FileExtColumn = new ReactiveObject<bool>();
  43. FileSizeColumn = new ReactiveObject<bool>();
  44. PathColumn = new ReactiveObject<bool>();
  45. }
  46. }
  47. public class ColumnSortSettings
  48. {
  49. public ReactiveObject<int> SortColumnId { get; private set; }
  50. public ReactiveObject<bool> SortAscending { get; private set; }
  51. public ColumnSortSettings()
  52. {
  53. SortColumnId = new ReactiveObject<int>();
  54. SortAscending = new ReactiveObject<bool>();
  55. }
  56. }
  57. /// <summary>
  58. /// Used to toggle columns in the GUI
  59. /// </summary>
  60. public Columns GuiColumns { get; private set; }
  61. /// <summary>
  62. /// Used to configure column sort settings in the GUI
  63. /// </summary>
  64. public ColumnSortSettings ColumnSort { get; private set; }
  65. /// <summary>
  66. /// A list of directories containing games to be used to load games into the games list
  67. /// </summary>
  68. public ReactiveObject<List<string>> GameDirs { get; private set; }
  69. /// <summary>
  70. /// Language Code for the UI
  71. /// </summary>
  72. public ReactiveObject<string> LanguageCode { get; private set; }
  73. /// <summary>
  74. /// Enable or disable custom themes in the GUI
  75. /// </summary>
  76. public ReactiveObject<bool> EnableCustomTheme { get; private set; }
  77. /// <summary>
  78. /// Path to custom GUI theme
  79. /// </summary>
  80. public ReactiveObject<string> CustomThemePath { get; private set; }
  81. /// <summary>
  82. /// Selects the base style
  83. /// </summary>
  84. public ReactiveObject<string> BaseStyle { get; private set; }
  85. /// <summary>
  86. /// Start games in fullscreen mode
  87. /// </summary>
  88. public ReactiveObject<bool> StartFullscreen { get; private set; }
  89. /// <summary>
  90. /// Hide / Show Console Window
  91. /// </summary>
  92. public ReactiveObject<bool> ShowConsole { get; private set; }
  93. /// <summary>
  94. /// View Mode of the Game list
  95. /// </summary>
  96. public ReactiveObject<int> GameListViewMode { get; private set; }
  97. /// <summary>
  98. /// Show application name in Grid Mode
  99. /// </summary>
  100. public ReactiveObject<bool> ShowNames { get; private set; }
  101. /// <summary>
  102. /// Sets App Icon Size in Grid Mode
  103. /// </summary>
  104. public ReactiveObject<int> GridSize { get; private set; }
  105. /// <summary>
  106. /// Sorts Apps in Grid Mode
  107. /// </summary>
  108. public ReactiveObject<int> ApplicationSort { get; private set; }
  109. /// <summary>
  110. /// Sets if Grid is ordered in Ascending Order
  111. /// </summary>
  112. public ReactiveObject<bool> IsAscendingOrder { get; private set; }
  113. public UiSection()
  114. {
  115. GuiColumns = new Columns();
  116. ColumnSort = new ColumnSortSettings();
  117. GameDirs = new ReactiveObject<List<string>>();
  118. EnableCustomTheme = new ReactiveObject<bool>();
  119. CustomThemePath = new ReactiveObject<string>();
  120. BaseStyle = new ReactiveObject<string>();
  121. StartFullscreen = new ReactiveObject<bool>();
  122. GameListViewMode = new ReactiveObject<int>();
  123. ShowNames = new ReactiveObject<bool>();
  124. GridSize = new ReactiveObject<int>();
  125. ApplicationSort = new ReactiveObject<int>();
  126. IsAscendingOrder = new ReactiveObject<bool>();
  127. LanguageCode = new ReactiveObject<string>();
  128. ShowConsole = new ReactiveObject<bool>();
  129. ShowConsole.Event += static (s, e) => { ConsoleHelper.SetConsoleWindowState(e.NewValue); };
  130. }
  131. }
  132. /// <summary>
  133. /// Logger configuration section
  134. /// </summary>
  135. public class LoggerSection
  136. {
  137. /// <summary>
  138. /// Enables printing debug log messages
  139. /// </summary>
  140. public ReactiveObject<bool> EnableDebug { get; private set; }
  141. /// <summary>
  142. /// Enables printing stub log messages
  143. /// </summary>
  144. public ReactiveObject<bool> EnableStub { get; private set; }
  145. /// <summary>
  146. /// Enables printing info log messages
  147. /// </summary>
  148. public ReactiveObject<bool> EnableInfo { get; private set; }
  149. /// <summary>
  150. /// Enables printing warning log messages
  151. /// </summary>
  152. public ReactiveObject<bool> EnableWarn { get; private set; }
  153. /// <summary>
  154. /// Enables printing error log messages
  155. /// </summary>
  156. public ReactiveObject<bool> EnableError { get; private set; }
  157. /// <summary>
  158. /// Enables printing trace log messages
  159. /// </summary>
  160. public ReactiveObject<bool> EnableTrace { get; private set; }
  161. /// <summary>
  162. /// Enables printing guest log messages
  163. /// </summary>
  164. public ReactiveObject<bool> EnableGuest { get; private set; }
  165. /// <summary>
  166. /// Enables printing FS access log messages
  167. /// </summary>
  168. public ReactiveObject<bool> EnableFsAccessLog { get; private set; }
  169. /// <summary>
  170. /// Controls which log messages are written to the log targets
  171. /// </summary>
  172. public ReactiveObject<LogClass[]> FilteredClasses { get; private set; }
  173. /// <summary>
  174. /// Enables or disables logging to a file on disk
  175. /// </summary>
  176. public ReactiveObject<bool> EnableFileLog { get; private set; }
  177. /// <summary>
  178. /// Controls which OpenGL log messages are recorded in the log
  179. /// </summary>
  180. public ReactiveObject<GraphicsDebugLevel> GraphicsDebugLevel { get; private set; }
  181. public LoggerSection()
  182. {
  183. EnableDebug = new ReactiveObject<bool>();
  184. EnableStub = new ReactiveObject<bool>();
  185. EnableInfo = new ReactiveObject<bool>();
  186. EnableWarn = new ReactiveObject<bool>();
  187. EnableError = new ReactiveObject<bool>();
  188. EnableTrace = new ReactiveObject<bool>();
  189. EnableGuest = new ReactiveObject<bool>();
  190. EnableFsAccessLog = new ReactiveObject<bool>();
  191. FilteredClasses = new ReactiveObject<LogClass[]>();
  192. EnableFileLog = new ReactiveObject<bool>();
  193. EnableFileLog.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableFileLog));
  194. GraphicsDebugLevel = new ReactiveObject<GraphicsDebugLevel>();
  195. }
  196. }
  197. /// <summary>
  198. /// System configuration section
  199. /// </summary>
  200. public class SystemSection
  201. {
  202. /// <summary>
  203. /// Change System Language
  204. /// </summary>
  205. public ReactiveObject<Language> Language { get; private set; }
  206. /// <summary>
  207. /// Change System Region
  208. /// </summary>
  209. public ReactiveObject<Region> Region { get; private set; }
  210. /// <summary>
  211. /// Change System TimeZone
  212. /// </summary>
  213. public ReactiveObject<string> TimeZone { get; private set; }
  214. /// <summary>
  215. /// System Time Offset in Seconds
  216. /// </summary>
  217. public ReactiveObject<long> SystemTimeOffset { get; private set; }
  218. /// <summary>
  219. /// Enables or disables Docked Mode
  220. /// </summary>
  221. public ReactiveObject<bool> EnableDockedMode { get; private set; }
  222. /// <summary>
  223. /// Enables or disables profiled translation cache persistency
  224. /// </summary>
  225. public ReactiveObject<bool> EnablePtc { get; private set; }
  226. /// <summary>
  227. /// Enables or disables guest Internet access
  228. /// </summary>
  229. public ReactiveObject<bool> EnableInternetAccess { get; private set; }
  230. /// <summary>
  231. /// Enables integrity checks on Game content files
  232. /// </summary>
  233. public ReactiveObject<bool> EnableFsIntegrityChecks { get; private set; }
  234. /// <summary>
  235. /// Enables FS access log output to the console. Possible modes are 0-3
  236. /// </summary>
  237. public ReactiveObject<int> FsGlobalAccessLogMode { get; private set; }
  238. /// <summary>
  239. /// The selected audio backend
  240. /// </summary>
  241. public ReactiveObject<AudioBackend> AudioBackend { get; private set; }
  242. /// <summary>
  243. /// The audio backend volume
  244. /// </summary>
  245. public ReactiveObject<float> AudioVolume { get; private set; }
  246. /// <summary>
  247. /// The selected memory manager mode
  248. /// </summary>
  249. public ReactiveObject<MemoryManagerMode> MemoryManagerMode { get; private set; }
  250. /// <summary>
  251. /// Defines the amount of RAM available on the emulated system, and how it is distributed
  252. /// </summary>
  253. public ReactiveObject<bool> ExpandRam { get; private set; }
  254. /// <summary>
  255. /// Enable or disable ignoring missing services
  256. /// </summary>
  257. public ReactiveObject<bool> IgnoreMissingServices { get; private set; }
  258. public SystemSection()
  259. {
  260. Language = new ReactiveObject<Language>();
  261. Region = new ReactiveObject<Region>();
  262. TimeZone = new ReactiveObject<string>();
  263. SystemTimeOffset = new ReactiveObject<long>();
  264. EnableDockedMode = new ReactiveObject<bool>();
  265. EnableDockedMode.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableDockedMode));
  266. EnablePtc = new ReactiveObject<bool>();
  267. EnablePtc.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnablePtc));
  268. EnableInternetAccess = new ReactiveObject<bool>();
  269. EnableInternetAccess.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableInternetAccess));
  270. EnableFsIntegrityChecks = new ReactiveObject<bool>();
  271. EnableFsIntegrityChecks.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableFsIntegrityChecks));
  272. FsGlobalAccessLogMode = new ReactiveObject<int>();
  273. FsGlobalAccessLogMode.Event += static (sender, e) => LogValueChange(sender, e, nameof(FsGlobalAccessLogMode));
  274. AudioBackend = new ReactiveObject<AudioBackend>();
  275. AudioBackend.Event += static (sender, e) => LogValueChange(sender, e, nameof(AudioBackend));
  276. MemoryManagerMode = new ReactiveObject<MemoryManagerMode>();
  277. MemoryManagerMode.Event += static (sender, e) => LogValueChange(sender, e, nameof(MemoryManagerMode));
  278. ExpandRam = new ReactiveObject<bool>();
  279. ExpandRam.Event += static (sender, e) => LogValueChange(sender, e, nameof(ExpandRam));
  280. IgnoreMissingServices = new ReactiveObject<bool>();
  281. IgnoreMissingServices.Event += static (sender, e) => LogValueChange(sender, e, nameof(IgnoreMissingServices));
  282. AudioVolume = new ReactiveObject<float>();
  283. AudioVolume.Event += static (sender, e) => LogValueChange(sender, e, nameof(AudioVolume));
  284. }
  285. }
  286. /// <summary>
  287. /// Hid configuration section
  288. /// </summary>
  289. public class HidSection
  290. {
  291. /// <summary>
  292. /// Enable or disable keyboard support (Independent from controllers binding)
  293. /// </summary>
  294. public ReactiveObject<bool> EnableKeyboard { get; private set; }
  295. /// <summary>
  296. /// Enable or disable mouse support (Independent from controllers binding)
  297. /// </summary>
  298. public ReactiveObject<bool> EnableMouse { get; private set; }
  299. /// <summary>
  300. /// Hotkey Keyboard Bindings
  301. /// </summary>
  302. public ReactiveObject<KeyboardHotkeys> Hotkeys { get; private set; }
  303. /// <summary>
  304. /// Input device configuration.
  305. /// NOTE: This ReactiveObject won't issue an event when the List has elements added or removed.
  306. /// TODO: Implement a ReactiveList class.
  307. /// </summary>
  308. public ReactiveObject<List<InputConfig>> InputConfig { get; private set; }
  309. public HidSection()
  310. {
  311. EnableKeyboard = new ReactiveObject<bool>();
  312. EnableMouse = new ReactiveObject<bool>();
  313. Hotkeys = new ReactiveObject<KeyboardHotkeys>();
  314. InputConfig = new ReactiveObject<List<InputConfig>>();
  315. }
  316. }
  317. /// <summary>
  318. /// Graphics configuration section
  319. /// </summary>
  320. public class GraphicsSection
  321. {
  322. /// <summary>
  323. /// Whether or not backend threading is enabled. The "Auto" setting will determine whether threading should be enabled at runtime.
  324. /// </summary>
  325. public ReactiveObject<BackendThreading> BackendThreading { get; private set; }
  326. /// <summary>
  327. /// Max Anisotropy. Values range from 0 - 16. Set to -1 to let the game decide.
  328. /// </summary>
  329. public ReactiveObject<float> MaxAnisotropy { get; private set; }
  330. /// <summary>
  331. /// Aspect Ratio applied to the renderer window.
  332. /// </summary>
  333. public ReactiveObject<AspectRatio> AspectRatio { get; private set; }
  334. /// <summary>
  335. /// Resolution Scale. An integer scale applied to applicable render targets. Values 1-4, or -1 to use a custom floating point scale instead.
  336. /// </summary>
  337. public ReactiveObject<int> ResScale { get; private set; }
  338. /// <summary>
  339. /// Custom Resolution Scale. A custom floating point scale applied to applicable render targets. Only active when Resolution Scale is -1.
  340. /// </summary>
  341. public ReactiveObject<float> ResScaleCustom { get; private set; }
  342. /// <summary>
  343. /// Dumps shaders in this local directory
  344. /// </summary>
  345. public ReactiveObject<string> ShadersDumpPath { get; private set; }
  346. /// <summary>
  347. /// Enables or disables Vertical Sync
  348. /// </summary>
  349. public ReactiveObject<bool> EnableVsync { get; private set; }
  350. /// <summary>
  351. /// Enables or disables Shader cache
  352. /// </summary>
  353. public ReactiveObject<bool> EnableShaderCache { get; private set; }
  354. public GraphicsSection()
  355. {
  356. BackendThreading = new ReactiveObject<BackendThreading>();
  357. BackendThreading.Event += static (sender, e) => LogValueChange(sender, e, nameof(BackendThreading));
  358. ResScale = new ReactiveObject<int>();
  359. ResScale.Event += static (sender, e) => LogValueChange(sender, e, nameof(ResScale));
  360. ResScaleCustom = new ReactiveObject<float>();
  361. ResScaleCustom.Event += static (sender, e) => LogValueChange(sender, e, nameof(ResScaleCustom));
  362. MaxAnisotropy = new ReactiveObject<float>();
  363. MaxAnisotropy.Event += static (sender, e) => LogValueChange(sender, e, nameof(MaxAnisotropy));
  364. AspectRatio = new ReactiveObject<AspectRatio>();
  365. AspectRatio.Event += static (sender, e) => LogValueChange(sender, e, nameof(AspectRatio));
  366. ShadersDumpPath = new ReactiveObject<string>();
  367. EnableVsync = new ReactiveObject<bool>();
  368. EnableVsync.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableVsync));
  369. EnableShaderCache = new ReactiveObject<bool>();
  370. EnableShaderCache.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableShaderCache));
  371. }
  372. }
  373. /// <summary>
  374. /// The default configuration instance
  375. /// </summary>
  376. public static ConfigurationState Instance { get; private set; }
  377. /// <summary>
  378. /// The Ui section
  379. /// </summary>
  380. public UiSection Ui { get; private set; }
  381. /// <summary>
  382. /// The Logger section
  383. /// </summary>
  384. public LoggerSection Logger { get; private set; }
  385. /// <summary>
  386. /// The System section
  387. /// </summary>
  388. public SystemSection System { get; private set; }
  389. /// <summary>
  390. /// The Graphics section
  391. /// </summary>
  392. public GraphicsSection Graphics { get; private set; }
  393. /// <summary>
  394. /// The Hid section
  395. /// </summary>
  396. public HidSection Hid { get; private set; }
  397. /// <summary>
  398. /// Enables or disables Discord Rich Presence
  399. /// </summary>
  400. public ReactiveObject<bool> EnableDiscordIntegration { get; private set; }
  401. /// <summary>
  402. /// Checks for updates when Ryujinx starts when enabled
  403. /// </summary>
  404. public ReactiveObject<bool> CheckUpdatesOnStart { get; private set; }
  405. /// <summary>
  406. /// Show "Confirm Exit" Dialog
  407. /// </summary>
  408. public ReactiveObject<bool> ShowConfirmExit { get; private set; }
  409. /// <summary>
  410. /// Hide Cursor on Idle
  411. /// </summary>
  412. public ReactiveObject<bool> HideCursorOnIdle { get; private set; }
  413. private ConfigurationState()
  414. {
  415. Ui = new UiSection();
  416. Logger = new LoggerSection();
  417. System = new SystemSection();
  418. Graphics = new GraphicsSection();
  419. Hid = new HidSection();
  420. EnableDiscordIntegration = new ReactiveObject<bool>();
  421. CheckUpdatesOnStart = new ReactiveObject<bool>();
  422. ShowConfirmExit = new ReactiveObject<bool>();
  423. HideCursorOnIdle = new ReactiveObject<bool>();
  424. }
  425. public ConfigurationFileFormat ToFileFormat()
  426. {
  427. ConfigurationFileFormat configurationFile = new ConfigurationFileFormat
  428. {
  429. Version = ConfigurationFileFormat.CurrentVersion,
  430. BackendThreading = Graphics.BackendThreading,
  431. EnableFileLog = Logger.EnableFileLog,
  432. ResScale = Graphics.ResScale,
  433. ResScaleCustom = Graphics.ResScaleCustom,
  434. MaxAnisotropy = Graphics.MaxAnisotropy,
  435. AspectRatio = Graphics.AspectRatio,
  436. GraphicsShadersDumpPath = Graphics.ShadersDumpPath,
  437. LoggingEnableDebug = Logger.EnableDebug,
  438. LoggingEnableStub = Logger.EnableStub,
  439. LoggingEnableInfo = Logger.EnableInfo,
  440. LoggingEnableWarn = Logger.EnableWarn,
  441. LoggingEnableError = Logger.EnableError,
  442. LoggingEnableTrace = Logger.EnableTrace,
  443. LoggingEnableGuest = Logger.EnableGuest,
  444. LoggingEnableFsAccessLog = Logger.EnableFsAccessLog,
  445. LoggingFilteredClasses = Logger.FilteredClasses,
  446. LoggingGraphicsDebugLevel = Logger.GraphicsDebugLevel,
  447. SystemLanguage = System.Language,
  448. SystemRegion = System.Region,
  449. SystemTimeZone = System.TimeZone,
  450. SystemTimeOffset = System.SystemTimeOffset,
  451. DockedMode = System.EnableDockedMode,
  452. EnableDiscordIntegration = EnableDiscordIntegration,
  453. CheckUpdatesOnStart = CheckUpdatesOnStart,
  454. ShowConfirmExit = ShowConfirmExit,
  455. HideCursorOnIdle = HideCursorOnIdle,
  456. EnableVsync = Graphics.EnableVsync,
  457. EnableShaderCache = Graphics.EnableShaderCache,
  458. EnablePtc = System.EnablePtc,
  459. EnableInternetAccess = System.EnableInternetAccess,
  460. EnableFsIntegrityChecks = System.EnableFsIntegrityChecks,
  461. FsGlobalAccessLogMode = System.FsGlobalAccessLogMode,
  462. AudioBackend = System.AudioBackend,
  463. AudioVolume = System.AudioVolume,
  464. MemoryManagerMode = System.MemoryManagerMode,
  465. ExpandRam = System.ExpandRam,
  466. IgnoreMissingServices = System.IgnoreMissingServices,
  467. GuiColumns = new GuiColumns
  468. {
  469. FavColumn = Ui.GuiColumns.FavColumn,
  470. IconColumn = Ui.GuiColumns.IconColumn,
  471. AppColumn = Ui.GuiColumns.AppColumn,
  472. DevColumn = Ui.GuiColumns.DevColumn,
  473. VersionColumn = Ui.GuiColumns.VersionColumn,
  474. TimePlayedColumn = Ui.GuiColumns.TimePlayedColumn,
  475. LastPlayedColumn = Ui.GuiColumns.LastPlayedColumn,
  476. FileExtColumn = Ui.GuiColumns.FileExtColumn,
  477. FileSizeColumn = Ui.GuiColumns.FileSizeColumn,
  478. PathColumn = Ui.GuiColumns.PathColumn,
  479. },
  480. ColumnSort = new ColumnSort
  481. {
  482. SortColumnId = Ui.ColumnSort.SortColumnId,
  483. SortAscending = Ui.ColumnSort.SortAscending
  484. },
  485. GameDirs = Ui.GameDirs,
  486. LanguageCode = Ui.LanguageCode,
  487. EnableCustomTheme = Ui.EnableCustomTheme,
  488. CustomThemePath = Ui.CustomThemePath,
  489. BaseStyle = Ui.BaseStyle,
  490. GameListViewMode = Ui.GameListViewMode,
  491. ShowNames = Ui.ShowNames,
  492. GridSize = Ui.GridSize,
  493. ApplicationSort = Ui.ApplicationSort,
  494. IsAscendingOrder = Ui.IsAscendingOrder,
  495. StartFullscreen = Ui.StartFullscreen,
  496. ShowConsole = Ui.ShowConsole,
  497. EnableKeyboard = Hid.EnableKeyboard,
  498. EnableMouse = Hid.EnableMouse,
  499. Hotkeys = Hid.Hotkeys,
  500. KeyboardConfig = new List<object>(),
  501. ControllerConfig = new List<object>(),
  502. InputConfig = Hid.InputConfig,
  503. };
  504. return configurationFile;
  505. }
  506. public void LoadDefault()
  507. {
  508. Logger.EnableFileLog.Value = true;
  509. Graphics.BackendThreading.Value = BackendThreading.Auto;
  510. Graphics.ResScale.Value = 1;
  511. Graphics.ResScaleCustom.Value = 1.0f;
  512. Graphics.MaxAnisotropy.Value = -1.0f;
  513. Graphics.AspectRatio.Value = AspectRatio.Fixed16x9;
  514. Graphics.ShadersDumpPath.Value = "";
  515. Logger.EnableDebug.Value = false;
  516. Logger.EnableStub.Value = true;
  517. Logger.EnableInfo.Value = true;
  518. Logger.EnableWarn.Value = true;
  519. Logger.EnableError.Value = true;
  520. Logger.EnableTrace.Value = false;
  521. Logger.EnableGuest.Value = true;
  522. Logger.EnableFsAccessLog.Value = false;
  523. Logger.FilteredClasses.Value = Array.Empty<LogClass>();
  524. Logger.GraphicsDebugLevel.Value = GraphicsDebugLevel.None;
  525. System.Language.Value = Language.AmericanEnglish;
  526. System.Region.Value = Region.USA;
  527. System.TimeZone.Value = "UTC";
  528. System.SystemTimeOffset.Value = 0;
  529. System.EnableDockedMode.Value = true;
  530. EnableDiscordIntegration.Value = true;
  531. CheckUpdatesOnStart.Value = true;
  532. ShowConfirmExit.Value = true;
  533. HideCursorOnIdle.Value = false;
  534. Graphics.EnableVsync.Value = true;
  535. Graphics.EnableShaderCache.Value = true;
  536. System.EnablePtc.Value = true;
  537. System.EnableInternetAccess.Value = false;
  538. System.EnableFsIntegrityChecks.Value = true;
  539. System.FsGlobalAccessLogMode.Value = 0;
  540. System.AudioBackend.Value = AudioBackend.SDL2;
  541. System.AudioVolume.Value = 1;
  542. System.MemoryManagerMode.Value = MemoryManagerMode.HostMappedUnsafe;
  543. System.ExpandRam.Value = false;
  544. System.IgnoreMissingServices.Value = false;
  545. Ui.GuiColumns.FavColumn.Value = true;
  546. Ui.GuiColumns.IconColumn.Value = true;
  547. Ui.GuiColumns.AppColumn.Value = true;
  548. Ui.GuiColumns.DevColumn.Value = true;
  549. Ui.GuiColumns.VersionColumn.Value = true;
  550. Ui.GuiColumns.TimePlayedColumn.Value = true;
  551. Ui.GuiColumns.LastPlayedColumn.Value = true;
  552. Ui.GuiColumns.FileExtColumn.Value = true;
  553. Ui.GuiColumns.FileSizeColumn.Value = true;
  554. Ui.GuiColumns.PathColumn.Value = true;
  555. Ui.ColumnSort.SortColumnId.Value = 0;
  556. Ui.ColumnSort.SortAscending.Value = false;
  557. Ui.GameDirs.Value = new List<string>();
  558. Ui.EnableCustomTheme.Value = false;
  559. Ui.LanguageCode.Value = "en_US";
  560. Ui.CustomThemePath.Value = "";
  561. Ui.BaseStyle.Value = "Dark";
  562. Ui.GameListViewMode.Value = 0;
  563. Ui.ShowNames.Value = true;
  564. Ui.GridSize.Value = 2;
  565. Ui.ApplicationSort.Value = 0;
  566. Ui.IsAscendingOrder.Value = true;
  567. Ui.StartFullscreen.Value = false;
  568. Ui.ShowConsole.Value = true;
  569. Hid.EnableKeyboard.Value = false;
  570. Hid.EnableMouse.Value = false;
  571. Hid.Hotkeys.Value = new KeyboardHotkeys
  572. {
  573. ToggleVsync = Key.Tab,
  574. ToggleMute = Key.F2,
  575. Screenshot = Key.F8,
  576. ShowUi = Key.F4,
  577. Pause = Key.F5
  578. };
  579. Hid.InputConfig.Value = new List<InputConfig>
  580. {
  581. new StandardKeyboardInputConfig
  582. {
  583. Version = InputConfig.CurrentVersion,
  584. Backend = InputBackendType.WindowKeyboard,
  585. Id = "0",
  586. PlayerIndex = PlayerIndex.Player1,
  587. ControllerType = ControllerType.JoyconPair,
  588. LeftJoycon = new LeftJoyconCommonConfig<Key>
  589. {
  590. DpadUp = Key.Up,
  591. DpadDown = Key.Down,
  592. DpadLeft = Key.Left,
  593. DpadRight = Key.Right,
  594. ButtonMinus = Key.Minus,
  595. ButtonL = Key.E,
  596. ButtonZl = Key.Q,
  597. ButtonSl = Key.Unbound,
  598. ButtonSr = Key.Unbound
  599. },
  600. LeftJoyconStick = new JoyconConfigKeyboardStick<Key>
  601. {
  602. StickUp = Key.W,
  603. StickDown = Key.S,
  604. StickLeft = Key.A,
  605. StickRight = Key.D,
  606. StickButton = Key.F,
  607. },
  608. RightJoycon = new RightJoyconCommonConfig<Key>
  609. {
  610. ButtonA = Key.Z,
  611. ButtonB = Key.X,
  612. ButtonX = Key.C,
  613. ButtonY = Key.V,
  614. ButtonPlus = Key.Plus,
  615. ButtonR = Key.U,
  616. ButtonZr = Key.O,
  617. ButtonSl = Key.Unbound,
  618. ButtonSr = Key.Unbound
  619. },
  620. RightJoyconStick = new JoyconConfigKeyboardStick<Key>
  621. {
  622. StickUp = Key.I,
  623. StickDown = Key.K,
  624. StickLeft = Key.J,
  625. StickRight = Key.L,
  626. StickButton = Key.H,
  627. }
  628. }
  629. };
  630. }
  631. public void Load(ConfigurationFileFormat configurationFileFormat, string configurationFilePath)
  632. {
  633. bool configurationFileUpdated = false;
  634. if (configurationFileFormat.Version < 0 || configurationFileFormat.Version > ConfigurationFileFormat.CurrentVersion)
  635. {
  636. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Unsupported configuration version {configurationFileFormat.Version}, loading default.");
  637. LoadDefault();
  638. return;
  639. }
  640. if (configurationFileFormat.Version < 2)
  641. {
  642. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 2.");
  643. configurationFileFormat.SystemRegion = Region.USA;
  644. configurationFileUpdated = true;
  645. }
  646. if (configurationFileFormat.Version < 3)
  647. {
  648. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 3.");
  649. configurationFileFormat.SystemTimeZone = "UTC";
  650. configurationFileUpdated = true;
  651. }
  652. if (configurationFileFormat.Version < 4)
  653. {
  654. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 4.");
  655. configurationFileFormat.MaxAnisotropy = -1;
  656. configurationFileUpdated = true;
  657. }
  658. if (configurationFileFormat.Version < 5)
  659. {
  660. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 5.");
  661. configurationFileFormat.SystemTimeOffset = 0;
  662. configurationFileUpdated = true;
  663. }
  664. if (configurationFileFormat.Version < 8)
  665. {
  666. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 8.");
  667. configurationFileFormat.EnablePtc = true;
  668. configurationFileUpdated = true;
  669. }
  670. if (configurationFileFormat.Version < 9)
  671. {
  672. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 9.");
  673. configurationFileFormat.ColumnSort = new ColumnSort
  674. {
  675. SortColumnId = 0,
  676. SortAscending = false
  677. };
  678. configurationFileFormat.Hotkeys = new KeyboardHotkeys
  679. {
  680. ToggleVsync = Key.Tab
  681. };
  682. configurationFileUpdated = true;
  683. }
  684. if (configurationFileFormat.Version < 10)
  685. {
  686. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 10.");
  687. configurationFileFormat.AudioBackend = AudioBackend.OpenAl;
  688. configurationFileUpdated = true;
  689. }
  690. if (configurationFileFormat.Version < 11)
  691. {
  692. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 11.");
  693. configurationFileFormat.ResScale = 1;
  694. configurationFileFormat.ResScaleCustom = 1.0f;
  695. configurationFileUpdated = true;
  696. }
  697. if (configurationFileFormat.Version < 12)
  698. {
  699. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 12.");
  700. configurationFileFormat.LoggingGraphicsDebugLevel = GraphicsDebugLevel.None;
  701. configurationFileUpdated = true;
  702. }
  703. if (configurationFileFormat.Version < 14)
  704. {
  705. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 14.");
  706. configurationFileFormat.CheckUpdatesOnStart = true;
  707. configurationFileUpdated = true;
  708. }
  709. if (configurationFileFormat.Version < 16)
  710. {
  711. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 16.");
  712. configurationFileFormat.EnableShaderCache = true;
  713. configurationFileUpdated = true;
  714. }
  715. if (configurationFileFormat.Version < 17)
  716. {
  717. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 17.");
  718. configurationFileFormat.StartFullscreen = false;
  719. configurationFileUpdated = true;
  720. }
  721. if (configurationFileFormat.Version < 18)
  722. {
  723. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 18.");
  724. configurationFileFormat.AspectRatio = AspectRatio.Fixed16x9;
  725. configurationFileUpdated = true;
  726. }
  727. if (configurationFileFormat.Version < 20)
  728. {
  729. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 20.");
  730. configurationFileFormat.ShowConfirmExit = true;
  731. configurationFileUpdated = true;
  732. }
  733. if (configurationFileFormat.Version < 22)
  734. {
  735. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 22.");
  736. configurationFileFormat.HideCursorOnIdle = false;
  737. configurationFileUpdated = true;
  738. }
  739. if (configurationFileFormat.Version < 24)
  740. {
  741. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 24.");
  742. configurationFileFormat.InputConfig = new List<InputConfig>
  743. {
  744. new StandardKeyboardInputConfig
  745. {
  746. Version = InputConfig.CurrentVersion,
  747. Backend = InputBackendType.WindowKeyboard,
  748. Id = "0",
  749. PlayerIndex = PlayerIndex.Player1,
  750. ControllerType = ControllerType.JoyconPair,
  751. LeftJoycon = new LeftJoyconCommonConfig<Key>
  752. {
  753. DpadUp = Key.Up,
  754. DpadDown = Key.Down,
  755. DpadLeft = Key.Left,
  756. DpadRight = Key.Right,
  757. ButtonMinus = Key.Minus,
  758. ButtonL = Key.E,
  759. ButtonZl = Key.Q,
  760. ButtonSl = Key.Unbound,
  761. ButtonSr = Key.Unbound
  762. },
  763. LeftJoyconStick = new JoyconConfigKeyboardStick<Key>
  764. {
  765. StickUp = Key.W,
  766. StickDown = Key.S,
  767. StickLeft = Key.A,
  768. StickRight = Key.D,
  769. StickButton = Key.F,
  770. },
  771. RightJoycon = new RightJoyconCommonConfig<Key>
  772. {
  773. ButtonA = Key.Z,
  774. ButtonB = Key.X,
  775. ButtonX = Key.C,
  776. ButtonY = Key.V,
  777. ButtonPlus = Key.Plus,
  778. ButtonR = Key.U,
  779. ButtonZr = Key.O,
  780. ButtonSl = Key.Unbound,
  781. ButtonSr = Key.Unbound
  782. },
  783. RightJoyconStick = new JoyconConfigKeyboardStick<Key>
  784. {
  785. StickUp = Key.I,
  786. StickDown = Key.K,
  787. StickLeft = Key.J,
  788. StickRight = Key.L,
  789. StickButton = Key.H,
  790. }
  791. }
  792. };
  793. configurationFileUpdated = true;
  794. }
  795. if (configurationFileFormat.Version < 25)
  796. {
  797. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 25.");
  798. configurationFileUpdated = true;
  799. }
  800. if (configurationFileFormat.Version < 26)
  801. {
  802. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 26.");
  803. configurationFileFormat.MemoryManagerMode = MemoryManagerMode.HostMappedUnsafe;
  804. configurationFileUpdated = true;
  805. }
  806. if (configurationFileFormat.Version < 27)
  807. {
  808. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 27.");
  809. configurationFileFormat.EnableMouse = false;
  810. configurationFileUpdated = true;
  811. }
  812. if (configurationFileFormat.Version < 28)
  813. {
  814. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 28.");
  815. configurationFileFormat.Hotkeys = new KeyboardHotkeys
  816. {
  817. ToggleVsync = Key.Tab,
  818. Screenshot = Key.F8
  819. };
  820. configurationFileUpdated = true;
  821. }
  822. if (configurationFileFormat.Version < 29)
  823. {
  824. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 29.");
  825. configurationFileFormat.Hotkeys = new KeyboardHotkeys
  826. {
  827. ToggleVsync = Key.Tab,
  828. Screenshot = Key.F8,
  829. ShowUi = Key.F4
  830. };
  831. configurationFileUpdated = true;
  832. }
  833. if (configurationFileFormat.Version < 30)
  834. {
  835. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 30.");
  836. foreach(InputConfig config in configurationFileFormat.InputConfig)
  837. {
  838. if (config is StandardControllerInputConfig controllerConfig)
  839. {
  840. controllerConfig.Rumble = new RumbleConfigController
  841. {
  842. EnableRumble = false,
  843. StrongRumble = 1f,
  844. WeakRumble = 1f
  845. };
  846. }
  847. }
  848. configurationFileUpdated = true;
  849. }
  850. if (configurationFileFormat.Version < 31)
  851. {
  852. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 31.");
  853. configurationFileFormat.BackendThreading = BackendThreading.Auto;
  854. configurationFileUpdated = true;
  855. }
  856. if (configurationFileFormat.Version < 32)
  857. {
  858. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 32.");
  859. configurationFileFormat.Hotkeys = new KeyboardHotkeys
  860. {
  861. ToggleVsync = configurationFileFormat.Hotkeys.ToggleVsync,
  862. Screenshot = configurationFileFormat.Hotkeys.Screenshot,
  863. ShowUi = configurationFileFormat.Hotkeys.ShowUi,
  864. Pause = Key.F5
  865. };
  866. configurationFileUpdated = true;
  867. }
  868. if (configurationFileFormat.Version < 33)
  869. {
  870. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 33.");
  871. configurationFileFormat.Hotkeys = new KeyboardHotkeys
  872. {
  873. ToggleVsync = configurationFileFormat.Hotkeys.ToggleVsync,
  874. Screenshot = configurationFileFormat.Hotkeys.Screenshot,
  875. ShowUi = configurationFileFormat.Hotkeys.ShowUi,
  876. Pause = configurationFileFormat.Hotkeys.Pause,
  877. ToggleMute = Key.F2
  878. };
  879. configurationFileFormat.AudioVolume = 1;
  880. configurationFileUpdated = true;
  881. }
  882. if (configurationFileFormat.Version < 34)
  883. {
  884. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 34.");
  885. configurationFileFormat.EnableInternetAccess = false;
  886. configurationFileUpdated = true;
  887. }
  888. if (configurationFileFormat.Version < 35)
  889. {
  890. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 35.");
  891. foreach (InputConfig config in configurationFileFormat.InputConfig)
  892. {
  893. if (config is StandardControllerInputConfig controllerConfig)
  894. {
  895. controllerConfig.RangeLeft = 1.0f;
  896. controllerConfig.RangeRight = 1.0f;
  897. }
  898. }
  899. configurationFileUpdated = true;
  900. }
  901. if (configurationFileFormat.Version < 36)
  902. {
  903. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 36.");
  904. configurationFileFormat.LoggingEnableTrace = false;
  905. configurationFileUpdated = true;
  906. }
  907. if (configurationFileFormat.Version < 37)
  908. {
  909. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 37.");
  910. configurationFileFormat.ShowConsole = true;
  911. configurationFileUpdated = true;
  912. }
  913. if (configurationFileFormat.Version < 38)
  914. {
  915. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 38.");
  916. configurationFileFormat.BaseStyle = "Dark";
  917. configurationFileFormat.GameListViewMode = 0;
  918. configurationFileFormat.ShowNames = true;
  919. configurationFileFormat.GridSize = 2;
  920. configurationFileFormat.LanguageCode = "en_US";
  921. configurationFileUpdated = true;
  922. }
  923. Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog;
  924. Graphics.ResScale.Value = configurationFileFormat.ResScale;
  925. Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom;
  926. Graphics.MaxAnisotropy.Value = configurationFileFormat.MaxAnisotropy;
  927. Graphics.AspectRatio.Value = configurationFileFormat.AspectRatio;
  928. Graphics.ShadersDumpPath.Value = configurationFileFormat.GraphicsShadersDumpPath;
  929. Graphics.BackendThreading.Value = configurationFileFormat.BackendThreading;
  930. Logger.EnableDebug.Value = configurationFileFormat.LoggingEnableDebug;
  931. Logger.EnableStub.Value = configurationFileFormat.LoggingEnableStub;
  932. Logger.EnableInfo.Value = configurationFileFormat.LoggingEnableInfo;
  933. Logger.EnableWarn.Value = configurationFileFormat.LoggingEnableWarn;
  934. Logger.EnableError.Value = configurationFileFormat.LoggingEnableError;
  935. Logger.EnableTrace.Value = configurationFileFormat.LoggingEnableTrace;
  936. Logger.EnableGuest.Value = configurationFileFormat.LoggingEnableGuest;
  937. Logger.EnableFsAccessLog.Value = configurationFileFormat.LoggingEnableFsAccessLog;
  938. Logger.FilteredClasses.Value = configurationFileFormat.LoggingFilteredClasses;
  939. Logger.GraphicsDebugLevel.Value = configurationFileFormat.LoggingGraphicsDebugLevel;
  940. System.Language.Value = configurationFileFormat.SystemLanguage;
  941. System.Region.Value = configurationFileFormat.SystemRegion;
  942. System.TimeZone.Value = configurationFileFormat.SystemTimeZone;
  943. System.SystemTimeOffset.Value = configurationFileFormat.SystemTimeOffset;
  944. System.EnableDockedMode.Value = configurationFileFormat.DockedMode;
  945. EnableDiscordIntegration.Value = configurationFileFormat.EnableDiscordIntegration;
  946. CheckUpdatesOnStart.Value = configurationFileFormat.CheckUpdatesOnStart;
  947. ShowConfirmExit.Value = configurationFileFormat.ShowConfirmExit;
  948. HideCursorOnIdle.Value = configurationFileFormat.HideCursorOnIdle;
  949. Graphics.EnableVsync.Value = configurationFileFormat.EnableVsync;
  950. Graphics.EnableShaderCache.Value = configurationFileFormat.EnableShaderCache;
  951. System.EnablePtc.Value = configurationFileFormat.EnablePtc;
  952. System.EnableInternetAccess.Value = configurationFileFormat.EnableInternetAccess;
  953. System.EnableFsIntegrityChecks.Value = configurationFileFormat.EnableFsIntegrityChecks;
  954. System.FsGlobalAccessLogMode.Value = configurationFileFormat.FsGlobalAccessLogMode;
  955. System.AudioBackend.Value = configurationFileFormat.AudioBackend;
  956. System.AudioVolume.Value = configurationFileFormat.AudioVolume;
  957. System.MemoryManagerMode.Value = configurationFileFormat.MemoryManagerMode;
  958. System.ExpandRam.Value = configurationFileFormat.ExpandRam;
  959. System.IgnoreMissingServices.Value = configurationFileFormat.IgnoreMissingServices;
  960. Ui.GuiColumns.FavColumn.Value = configurationFileFormat.GuiColumns.FavColumn;
  961. Ui.GuiColumns.IconColumn.Value = configurationFileFormat.GuiColumns.IconColumn;
  962. Ui.GuiColumns.AppColumn.Value = configurationFileFormat.GuiColumns.AppColumn;
  963. Ui.GuiColumns.DevColumn.Value = configurationFileFormat.GuiColumns.DevColumn;
  964. Ui.GuiColumns.VersionColumn.Value = configurationFileFormat.GuiColumns.VersionColumn;
  965. Ui.GuiColumns.TimePlayedColumn.Value = configurationFileFormat.GuiColumns.TimePlayedColumn;
  966. Ui.GuiColumns.LastPlayedColumn.Value = configurationFileFormat.GuiColumns.LastPlayedColumn;
  967. Ui.GuiColumns.FileExtColumn.Value = configurationFileFormat.GuiColumns.FileExtColumn;
  968. Ui.GuiColumns.FileSizeColumn.Value = configurationFileFormat.GuiColumns.FileSizeColumn;
  969. Ui.GuiColumns.PathColumn.Value = configurationFileFormat.GuiColumns.PathColumn;
  970. Ui.ColumnSort.SortColumnId.Value = configurationFileFormat.ColumnSort.SortColumnId;
  971. Ui.ColumnSort.SortAscending.Value = configurationFileFormat.ColumnSort.SortAscending;
  972. Ui.GameDirs.Value = configurationFileFormat.GameDirs;
  973. Ui.EnableCustomTheme.Value = configurationFileFormat.EnableCustomTheme;
  974. Ui.LanguageCode.Value = configurationFileFormat.LanguageCode;
  975. Ui.CustomThemePath.Value = configurationFileFormat.CustomThemePath;
  976. Ui.BaseStyle.Value = configurationFileFormat.BaseStyle;
  977. Ui.GameListViewMode.Value = configurationFileFormat.GameListViewMode;
  978. Ui.ShowNames.Value = configurationFileFormat.ShowNames;
  979. Ui.IsAscendingOrder.Value = configurationFileFormat.IsAscendingOrder;
  980. Ui.GridSize.Value = configurationFileFormat.GridSize;
  981. Ui.ApplicationSort.Value = configurationFileFormat.ApplicationSort;
  982. Ui.StartFullscreen.Value = configurationFileFormat.StartFullscreen;
  983. Ui.ShowConsole.Value = configurationFileFormat.ShowConsole;
  984. Hid.EnableKeyboard.Value = configurationFileFormat.EnableKeyboard;
  985. Hid.EnableMouse.Value = configurationFileFormat.EnableMouse;
  986. Hid.Hotkeys.Value = configurationFileFormat.Hotkeys;
  987. Hid.InputConfig.Value = configurationFileFormat.InputConfig;
  988. if (Hid.InputConfig.Value == null)
  989. {
  990. Hid.InputConfig.Value = new List<InputConfig>();
  991. }
  992. if (configurationFileUpdated)
  993. {
  994. ToFileFormat().SaveConfig(configurationFilePath);
  995. Ryujinx.Common.Logging.Logger.Notice.Print(LogClass.Application, $"Configuration file updated to version {ConfigurationFileFormat.CurrentVersion}");
  996. }
  997. }
  998. private static void LogValueChange<T>(object sender, ReactiveEventArgs<T> eventArgs, string valueName)
  999. {
  1000. Ryujinx.Common.Logging.Logger.Info?.Print(LogClass.Configuration, $"{valueName} set to: {eventArgs.NewValue}");
  1001. }
  1002. public static void Initialize()
  1003. {
  1004. if (Instance != null)
  1005. {
  1006. throw new InvalidOperationException("Configuration is already initialized");
  1007. }
  1008. Instance = new ConfigurationState();
  1009. }
  1010. }
  1011. }