ConfigurationState.cs 57 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211
  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. ResScaleUp = Key.Unbound,
  579. ResScaleDown = Key.Unbound
  580. };
  581. Hid.InputConfig.Value = new List<InputConfig>
  582. {
  583. new StandardKeyboardInputConfig
  584. {
  585. Version = InputConfig.CurrentVersion,
  586. Backend = InputBackendType.WindowKeyboard,
  587. Id = "0",
  588. PlayerIndex = PlayerIndex.Player1,
  589. ControllerType = ControllerType.JoyconPair,
  590. LeftJoycon = new LeftJoyconCommonConfig<Key>
  591. {
  592. DpadUp = Key.Up,
  593. DpadDown = Key.Down,
  594. DpadLeft = Key.Left,
  595. DpadRight = Key.Right,
  596. ButtonMinus = Key.Minus,
  597. ButtonL = Key.E,
  598. ButtonZl = Key.Q,
  599. ButtonSl = Key.Unbound,
  600. ButtonSr = Key.Unbound
  601. },
  602. LeftJoyconStick = new JoyconConfigKeyboardStick<Key>
  603. {
  604. StickUp = Key.W,
  605. StickDown = Key.S,
  606. StickLeft = Key.A,
  607. StickRight = Key.D,
  608. StickButton = Key.F,
  609. },
  610. RightJoycon = new RightJoyconCommonConfig<Key>
  611. {
  612. ButtonA = Key.Z,
  613. ButtonB = Key.X,
  614. ButtonX = Key.C,
  615. ButtonY = Key.V,
  616. ButtonPlus = Key.Plus,
  617. ButtonR = Key.U,
  618. ButtonZr = Key.O,
  619. ButtonSl = Key.Unbound,
  620. ButtonSr = Key.Unbound
  621. },
  622. RightJoyconStick = new JoyconConfigKeyboardStick<Key>
  623. {
  624. StickUp = Key.I,
  625. StickDown = Key.K,
  626. StickLeft = Key.J,
  627. StickRight = Key.L,
  628. StickButton = Key.H,
  629. }
  630. }
  631. };
  632. }
  633. public void Load(ConfigurationFileFormat configurationFileFormat, string configurationFilePath)
  634. {
  635. bool configurationFileUpdated = false;
  636. if (configurationFileFormat.Version < 0 || configurationFileFormat.Version > ConfigurationFileFormat.CurrentVersion)
  637. {
  638. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Unsupported configuration version {configurationFileFormat.Version}, loading default.");
  639. LoadDefault();
  640. return;
  641. }
  642. if (configurationFileFormat.Version < 2)
  643. {
  644. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 2.");
  645. configurationFileFormat.SystemRegion = Region.USA;
  646. configurationFileUpdated = true;
  647. }
  648. if (configurationFileFormat.Version < 3)
  649. {
  650. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 3.");
  651. configurationFileFormat.SystemTimeZone = "UTC";
  652. configurationFileUpdated = true;
  653. }
  654. if (configurationFileFormat.Version < 4)
  655. {
  656. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 4.");
  657. configurationFileFormat.MaxAnisotropy = -1;
  658. configurationFileUpdated = true;
  659. }
  660. if (configurationFileFormat.Version < 5)
  661. {
  662. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 5.");
  663. configurationFileFormat.SystemTimeOffset = 0;
  664. configurationFileUpdated = true;
  665. }
  666. if (configurationFileFormat.Version < 8)
  667. {
  668. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 8.");
  669. configurationFileFormat.EnablePtc = true;
  670. configurationFileUpdated = true;
  671. }
  672. if (configurationFileFormat.Version < 9)
  673. {
  674. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 9.");
  675. configurationFileFormat.ColumnSort = new ColumnSort
  676. {
  677. SortColumnId = 0,
  678. SortAscending = false
  679. };
  680. configurationFileFormat.Hotkeys = new KeyboardHotkeys
  681. {
  682. ToggleVsync = Key.Tab
  683. };
  684. configurationFileUpdated = true;
  685. }
  686. if (configurationFileFormat.Version < 10)
  687. {
  688. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 10.");
  689. configurationFileFormat.AudioBackend = AudioBackend.OpenAl;
  690. configurationFileUpdated = true;
  691. }
  692. if (configurationFileFormat.Version < 11)
  693. {
  694. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 11.");
  695. configurationFileFormat.ResScale = 1;
  696. configurationFileFormat.ResScaleCustom = 1.0f;
  697. configurationFileUpdated = true;
  698. }
  699. if (configurationFileFormat.Version < 12)
  700. {
  701. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 12.");
  702. configurationFileFormat.LoggingGraphicsDebugLevel = GraphicsDebugLevel.None;
  703. configurationFileUpdated = true;
  704. }
  705. if (configurationFileFormat.Version < 14)
  706. {
  707. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 14.");
  708. configurationFileFormat.CheckUpdatesOnStart = true;
  709. configurationFileUpdated = true;
  710. }
  711. if (configurationFileFormat.Version < 16)
  712. {
  713. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 16.");
  714. configurationFileFormat.EnableShaderCache = true;
  715. configurationFileUpdated = true;
  716. }
  717. if (configurationFileFormat.Version < 17)
  718. {
  719. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 17.");
  720. configurationFileFormat.StartFullscreen = false;
  721. configurationFileUpdated = true;
  722. }
  723. if (configurationFileFormat.Version < 18)
  724. {
  725. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 18.");
  726. configurationFileFormat.AspectRatio = AspectRatio.Fixed16x9;
  727. configurationFileUpdated = true;
  728. }
  729. if (configurationFileFormat.Version < 20)
  730. {
  731. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 20.");
  732. configurationFileFormat.ShowConfirmExit = true;
  733. configurationFileUpdated = true;
  734. }
  735. if (configurationFileFormat.Version < 22)
  736. {
  737. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 22.");
  738. configurationFileFormat.HideCursorOnIdle = false;
  739. configurationFileUpdated = true;
  740. }
  741. if (configurationFileFormat.Version < 24)
  742. {
  743. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 24.");
  744. configurationFileFormat.InputConfig = new List<InputConfig>
  745. {
  746. new StandardKeyboardInputConfig
  747. {
  748. Version = InputConfig.CurrentVersion,
  749. Backend = InputBackendType.WindowKeyboard,
  750. Id = "0",
  751. PlayerIndex = PlayerIndex.Player1,
  752. ControllerType = ControllerType.JoyconPair,
  753. LeftJoycon = new LeftJoyconCommonConfig<Key>
  754. {
  755. DpadUp = Key.Up,
  756. DpadDown = Key.Down,
  757. DpadLeft = Key.Left,
  758. DpadRight = Key.Right,
  759. ButtonMinus = Key.Minus,
  760. ButtonL = Key.E,
  761. ButtonZl = Key.Q,
  762. ButtonSl = Key.Unbound,
  763. ButtonSr = Key.Unbound
  764. },
  765. LeftJoyconStick = new JoyconConfigKeyboardStick<Key>
  766. {
  767. StickUp = Key.W,
  768. StickDown = Key.S,
  769. StickLeft = Key.A,
  770. StickRight = Key.D,
  771. StickButton = Key.F,
  772. },
  773. RightJoycon = new RightJoyconCommonConfig<Key>
  774. {
  775. ButtonA = Key.Z,
  776. ButtonB = Key.X,
  777. ButtonX = Key.C,
  778. ButtonY = Key.V,
  779. ButtonPlus = Key.Plus,
  780. ButtonR = Key.U,
  781. ButtonZr = Key.O,
  782. ButtonSl = Key.Unbound,
  783. ButtonSr = Key.Unbound
  784. },
  785. RightJoyconStick = new JoyconConfigKeyboardStick<Key>
  786. {
  787. StickUp = Key.I,
  788. StickDown = Key.K,
  789. StickLeft = Key.J,
  790. StickRight = Key.L,
  791. StickButton = Key.H,
  792. }
  793. }
  794. };
  795. configurationFileUpdated = true;
  796. }
  797. if (configurationFileFormat.Version < 25)
  798. {
  799. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 25.");
  800. configurationFileUpdated = true;
  801. }
  802. if (configurationFileFormat.Version < 26)
  803. {
  804. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 26.");
  805. configurationFileFormat.MemoryManagerMode = MemoryManagerMode.HostMappedUnsafe;
  806. configurationFileUpdated = true;
  807. }
  808. if (configurationFileFormat.Version < 27)
  809. {
  810. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 27.");
  811. configurationFileFormat.EnableMouse = false;
  812. configurationFileUpdated = true;
  813. }
  814. if (configurationFileFormat.Version < 28)
  815. {
  816. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 28.");
  817. configurationFileFormat.Hotkeys = new KeyboardHotkeys
  818. {
  819. ToggleVsync = Key.Tab,
  820. Screenshot = Key.F8
  821. };
  822. configurationFileUpdated = true;
  823. }
  824. if (configurationFileFormat.Version < 29)
  825. {
  826. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 29.");
  827. configurationFileFormat.Hotkeys = new KeyboardHotkeys
  828. {
  829. ToggleVsync = Key.Tab,
  830. Screenshot = Key.F8,
  831. ShowUi = Key.F4
  832. };
  833. configurationFileUpdated = true;
  834. }
  835. if (configurationFileFormat.Version < 30)
  836. {
  837. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 30.");
  838. foreach(InputConfig config in configurationFileFormat.InputConfig)
  839. {
  840. if (config is StandardControllerInputConfig controllerConfig)
  841. {
  842. controllerConfig.Rumble = new RumbleConfigController
  843. {
  844. EnableRumble = false,
  845. StrongRumble = 1f,
  846. WeakRumble = 1f
  847. };
  848. }
  849. }
  850. configurationFileUpdated = true;
  851. }
  852. if (configurationFileFormat.Version < 31)
  853. {
  854. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 31.");
  855. configurationFileFormat.BackendThreading = BackendThreading.Auto;
  856. configurationFileUpdated = true;
  857. }
  858. if (configurationFileFormat.Version < 32)
  859. {
  860. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 32.");
  861. configurationFileFormat.Hotkeys = new KeyboardHotkeys
  862. {
  863. ToggleVsync = configurationFileFormat.Hotkeys.ToggleVsync,
  864. Screenshot = configurationFileFormat.Hotkeys.Screenshot,
  865. ShowUi = configurationFileFormat.Hotkeys.ShowUi,
  866. Pause = Key.F5
  867. };
  868. configurationFileUpdated = true;
  869. }
  870. if (configurationFileFormat.Version < 33)
  871. {
  872. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 33.");
  873. configurationFileFormat.Hotkeys = new KeyboardHotkeys
  874. {
  875. ToggleVsync = configurationFileFormat.Hotkeys.ToggleVsync,
  876. Screenshot = configurationFileFormat.Hotkeys.Screenshot,
  877. ShowUi = configurationFileFormat.Hotkeys.ShowUi,
  878. Pause = configurationFileFormat.Hotkeys.Pause,
  879. ToggleMute = Key.F2
  880. };
  881. configurationFileFormat.AudioVolume = 1;
  882. configurationFileUpdated = true;
  883. }
  884. if (configurationFileFormat.Version < 34)
  885. {
  886. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 34.");
  887. configurationFileFormat.EnableInternetAccess = false;
  888. configurationFileUpdated = true;
  889. }
  890. if (configurationFileFormat.Version < 35)
  891. {
  892. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 35.");
  893. foreach (InputConfig config in configurationFileFormat.InputConfig)
  894. {
  895. if (config is StandardControllerInputConfig controllerConfig)
  896. {
  897. controllerConfig.RangeLeft = 1.0f;
  898. controllerConfig.RangeRight = 1.0f;
  899. }
  900. }
  901. configurationFileUpdated = true;
  902. }
  903. if (configurationFileFormat.Version < 36)
  904. {
  905. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 36.");
  906. configurationFileFormat.LoggingEnableTrace = false;
  907. configurationFileUpdated = true;
  908. }
  909. if (configurationFileFormat.Version < 37)
  910. {
  911. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 37.");
  912. configurationFileFormat.ShowConsole = true;
  913. configurationFileUpdated = true;
  914. }
  915. if (configurationFileFormat.Version < 38)
  916. {
  917. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 38.");
  918. configurationFileFormat.BaseStyle = "Dark";
  919. configurationFileFormat.GameListViewMode = 0;
  920. configurationFileFormat.ShowNames = true;
  921. configurationFileFormat.GridSize = 2;
  922. configurationFileFormat.LanguageCode = "en_US";
  923. configurationFileUpdated = true;
  924. }
  925. if (configurationFileFormat.Version < 39)
  926. {
  927. Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 39.");
  928. configurationFileFormat.Hotkeys = new KeyboardHotkeys
  929. {
  930. ToggleVsync = configurationFileFormat.Hotkeys.ToggleVsync,
  931. Screenshot = configurationFileFormat.Hotkeys.Screenshot,
  932. ShowUi = configurationFileFormat.Hotkeys.ShowUi,
  933. Pause = configurationFileFormat.Hotkeys.Pause,
  934. ToggleMute = configurationFileFormat.Hotkeys.ToggleMute,
  935. ResScaleUp = Key.Unbound,
  936. ResScaleDown = Key.Unbound
  937. };
  938. }
  939. Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog;
  940. Graphics.ResScale.Value = configurationFileFormat.ResScale;
  941. Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom;
  942. Graphics.MaxAnisotropy.Value = configurationFileFormat.MaxAnisotropy;
  943. Graphics.AspectRatio.Value = configurationFileFormat.AspectRatio;
  944. Graphics.ShadersDumpPath.Value = configurationFileFormat.GraphicsShadersDumpPath;
  945. Graphics.BackendThreading.Value = configurationFileFormat.BackendThreading;
  946. Logger.EnableDebug.Value = configurationFileFormat.LoggingEnableDebug;
  947. Logger.EnableStub.Value = configurationFileFormat.LoggingEnableStub;
  948. Logger.EnableInfo.Value = configurationFileFormat.LoggingEnableInfo;
  949. Logger.EnableWarn.Value = configurationFileFormat.LoggingEnableWarn;
  950. Logger.EnableError.Value = configurationFileFormat.LoggingEnableError;
  951. Logger.EnableTrace.Value = configurationFileFormat.LoggingEnableTrace;
  952. Logger.EnableGuest.Value = configurationFileFormat.LoggingEnableGuest;
  953. Logger.EnableFsAccessLog.Value = configurationFileFormat.LoggingEnableFsAccessLog;
  954. Logger.FilteredClasses.Value = configurationFileFormat.LoggingFilteredClasses;
  955. Logger.GraphicsDebugLevel.Value = configurationFileFormat.LoggingGraphicsDebugLevel;
  956. System.Language.Value = configurationFileFormat.SystemLanguage;
  957. System.Region.Value = configurationFileFormat.SystemRegion;
  958. System.TimeZone.Value = configurationFileFormat.SystemTimeZone;
  959. System.SystemTimeOffset.Value = configurationFileFormat.SystemTimeOffset;
  960. System.EnableDockedMode.Value = configurationFileFormat.DockedMode;
  961. EnableDiscordIntegration.Value = configurationFileFormat.EnableDiscordIntegration;
  962. CheckUpdatesOnStart.Value = configurationFileFormat.CheckUpdatesOnStart;
  963. ShowConfirmExit.Value = configurationFileFormat.ShowConfirmExit;
  964. HideCursorOnIdle.Value = configurationFileFormat.HideCursorOnIdle;
  965. Graphics.EnableVsync.Value = configurationFileFormat.EnableVsync;
  966. Graphics.EnableShaderCache.Value = configurationFileFormat.EnableShaderCache;
  967. System.EnablePtc.Value = configurationFileFormat.EnablePtc;
  968. System.EnableInternetAccess.Value = configurationFileFormat.EnableInternetAccess;
  969. System.EnableFsIntegrityChecks.Value = configurationFileFormat.EnableFsIntegrityChecks;
  970. System.FsGlobalAccessLogMode.Value = configurationFileFormat.FsGlobalAccessLogMode;
  971. System.AudioBackend.Value = configurationFileFormat.AudioBackend;
  972. System.AudioVolume.Value = configurationFileFormat.AudioVolume;
  973. System.MemoryManagerMode.Value = configurationFileFormat.MemoryManagerMode;
  974. System.ExpandRam.Value = configurationFileFormat.ExpandRam;
  975. System.IgnoreMissingServices.Value = configurationFileFormat.IgnoreMissingServices;
  976. Ui.GuiColumns.FavColumn.Value = configurationFileFormat.GuiColumns.FavColumn;
  977. Ui.GuiColumns.IconColumn.Value = configurationFileFormat.GuiColumns.IconColumn;
  978. Ui.GuiColumns.AppColumn.Value = configurationFileFormat.GuiColumns.AppColumn;
  979. Ui.GuiColumns.DevColumn.Value = configurationFileFormat.GuiColumns.DevColumn;
  980. Ui.GuiColumns.VersionColumn.Value = configurationFileFormat.GuiColumns.VersionColumn;
  981. Ui.GuiColumns.TimePlayedColumn.Value = configurationFileFormat.GuiColumns.TimePlayedColumn;
  982. Ui.GuiColumns.LastPlayedColumn.Value = configurationFileFormat.GuiColumns.LastPlayedColumn;
  983. Ui.GuiColumns.FileExtColumn.Value = configurationFileFormat.GuiColumns.FileExtColumn;
  984. Ui.GuiColumns.FileSizeColumn.Value = configurationFileFormat.GuiColumns.FileSizeColumn;
  985. Ui.GuiColumns.PathColumn.Value = configurationFileFormat.GuiColumns.PathColumn;
  986. Ui.ColumnSort.SortColumnId.Value = configurationFileFormat.ColumnSort.SortColumnId;
  987. Ui.ColumnSort.SortAscending.Value = configurationFileFormat.ColumnSort.SortAscending;
  988. Ui.GameDirs.Value = configurationFileFormat.GameDirs;
  989. Ui.EnableCustomTheme.Value = configurationFileFormat.EnableCustomTheme;
  990. Ui.LanguageCode.Value = configurationFileFormat.LanguageCode;
  991. Ui.CustomThemePath.Value = configurationFileFormat.CustomThemePath;
  992. Ui.BaseStyle.Value = configurationFileFormat.BaseStyle;
  993. Ui.GameListViewMode.Value = configurationFileFormat.GameListViewMode;
  994. Ui.ShowNames.Value = configurationFileFormat.ShowNames;
  995. Ui.IsAscendingOrder.Value = configurationFileFormat.IsAscendingOrder;
  996. Ui.GridSize.Value = configurationFileFormat.GridSize;
  997. Ui.ApplicationSort.Value = configurationFileFormat.ApplicationSort;
  998. Ui.StartFullscreen.Value = configurationFileFormat.StartFullscreen;
  999. Ui.ShowConsole.Value = configurationFileFormat.ShowConsole;
  1000. Hid.EnableKeyboard.Value = configurationFileFormat.EnableKeyboard;
  1001. Hid.EnableMouse.Value = configurationFileFormat.EnableMouse;
  1002. Hid.Hotkeys.Value = configurationFileFormat.Hotkeys;
  1003. Hid.InputConfig.Value = configurationFileFormat.InputConfig;
  1004. if (Hid.InputConfig.Value == null)
  1005. {
  1006. Hid.InputConfig.Value = new List<InputConfig>();
  1007. }
  1008. if (configurationFileUpdated)
  1009. {
  1010. ToFileFormat().SaveConfig(configurationFilePath);
  1011. Ryujinx.Common.Logging.Logger.Notice.Print(LogClass.Application, $"Configuration file updated to version {ConfigurationFileFormat.CurrentVersion}");
  1012. }
  1013. }
  1014. private static void LogValueChange<T>(object sender, ReactiveEventArgs<T> eventArgs, string valueName)
  1015. {
  1016. Ryujinx.Common.Logging.Logger.Info?.Print(LogClass.Configuration, $"{valueName} set to: {eventArgs.NewValue}");
  1017. }
  1018. public static void Initialize()
  1019. {
  1020. if (Instance != null)
  1021. {
  1022. throw new InvalidOperationException("Configuration is already initialized");
  1023. }
  1024. Instance = new ConfigurationState();
  1025. }
  1026. }
  1027. }