ConfigurationState.Model.cs 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764
  1. using ARMeilleure;
  2. using Gommon;
  3. using Ryujinx.Ava.Utilities.Configuration.System;
  4. using Ryujinx.Common;
  5. using Ryujinx.Common.Configuration;
  6. using Ryujinx.Common.Configuration.Hid;
  7. using Ryujinx.Common.Configuration.Multiplayer;
  8. using Ryujinx.Common.Helper;
  9. using Ryujinx.Common.Logging;
  10. using Ryujinx.HLE;
  11. using System.Collections.Generic;
  12. namespace Ryujinx.Ava.Utilities.Configuration
  13. {
  14. public partial 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> LdnInfoColumn { get; private set; }
  29. public ReactiveObject<bool> TimePlayedColumn { get; private set; }
  30. public ReactiveObject<bool> LastPlayedColumn { get; private set; }
  31. public ReactiveObject<bool> FileExtColumn { get; private set; }
  32. public ReactiveObject<bool> FileSizeColumn { get; private set; }
  33. public ReactiveObject<bool> PathColumn { get; private set; }
  34. public Columns()
  35. {
  36. FavColumn = new ReactiveObject<bool>();
  37. IconColumn = new ReactiveObject<bool>();
  38. AppColumn = new ReactiveObject<bool>();
  39. DevColumn = new ReactiveObject<bool>();
  40. VersionColumn = new ReactiveObject<bool>();
  41. LdnInfoColumn = new ReactiveObject<bool>();
  42. TimePlayedColumn = new ReactiveObject<bool>();
  43. LastPlayedColumn = new ReactiveObject<bool>();
  44. FileExtColumn = new ReactiveObject<bool>();
  45. FileSizeColumn = new ReactiveObject<bool>();
  46. PathColumn = new ReactiveObject<bool>();
  47. }
  48. }
  49. public class ColumnSortSettings
  50. {
  51. public ReactiveObject<int> SortColumnId { get; private set; }
  52. public ReactiveObject<bool> SortAscending { get; private set; }
  53. public ColumnSortSettings()
  54. {
  55. SortColumnId = new ReactiveObject<int>();
  56. SortAscending = new ReactiveObject<bool>();
  57. }
  58. }
  59. /// <summary>
  60. /// Used to toggle which file types are shown in the UI
  61. /// </summary>
  62. public class ShownFileTypeSettings
  63. {
  64. public ReactiveObject<bool> NSP { get; private set; }
  65. public ReactiveObject<bool> PFS0 { get; private set; }
  66. public ReactiveObject<bool> XCI { get; private set; }
  67. public ReactiveObject<bool> NCA { get; private set; }
  68. public ReactiveObject<bool> NRO { get; private set; }
  69. public ReactiveObject<bool> NSO { get; private set; }
  70. public ShownFileTypeSettings()
  71. {
  72. NSP = new ReactiveObject<bool>();
  73. PFS0 = new ReactiveObject<bool>();
  74. XCI = new ReactiveObject<bool>();
  75. NCA = new ReactiveObject<bool>();
  76. NRO = new ReactiveObject<bool>();
  77. NSO = new ReactiveObject<bool>();
  78. }
  79. }
  80. // <summary>
  81. /// Determines main window start-up position, size and state
  82. ///<summary>
  83. public class WindowStartupSettings
  84. {
  85. public ReactiveObject<int> WindowSizeWidth { get; private set; }
  86. public ReactiveObject<int> WindowSizeHeight { get; private set; }
  87. public ReactiveObject<int> WindowPositionX { get; private set; }
  88. public ReactiveObject<int> WindowPositionY { get; private set; }
  89. public ReactiveObject<bool> WindowMaximized { get; private set; }
  90. public WindowStartupSettings()
  91. {
  92. WindowSizeWidth = new ReactiveObject<int>();
  93. WindowSizeHeight = new ReactiveObject<int>();
  94. WindowPositionX = new ReactiveObject<int>();
  95. WindowPositionY = new ReactiveObject<int>();
  96. WindowMaximized = new ReactiveObject<bool>();
  97. }
  98. }
  99. /// <summary>
  100. /// Used to toggle columns in the GUI
  101. /// </summary>
  102. public Columns GuiColumns { get; private set; }
  103. /// <summary>
  104. /// Used to configure column sort settings in the GUI
  105. /// </summary>
  106. public ColumnSortSettings ColumnSort { get; private set; }
  107. /// <summary>
  108. /// A list of directories containing games to be used to load games into the games list
  109. /// </summary>
  110. public ReactiveObject<List<string>> GameDirs { get; private set; }
  111. /// <summary>
  112. /// A list of directories containing DLC/updates the user wants to autoload during library refreshes
  113. /// </summary>
  114. public ReactiveObject<List<string>> AutoloadDirs { get; private set; }
  115. /// <summary>
  116. /// A list of file types to be hidden in the games List
  117. /// </summary>
  118. public ShownFileTypeSettings ShownFileTypes { get; private set; }
  119. /// <summary>
  120. /// Determines main window start-up position, size and state
  121. /// </summary>
  122. public WindowStartupSettings WindowStartup { get; private set; }
  123. /// <summary>
  124. /// Language Code for the UI
  125. /// </summary>
  126. public ReactiveObject<string> LanguageCode { get; private set; }
  127. /// <summary>
  128. /// Selects the base style
  129. /// </summary>
  130. public ReactiveObject<string> BaseStyle { get; private set; }
  131. /// <summary>
  132. /// Start games in fullscreen mode
  133. /// </summary>
  134. public ReactiveObject<bool> StartFullscreen { get; private set; }
  135. /// <summary>
  136. /// Hide / Show Console Window
  137. /// </summary>
  138. public ReactiveObject<bool> ShowConsole { get; private set; }
  139. /// <summary>
  140. /// View Mode of the Game list
  141. /// </summary>
  142. public ReactiveObject<int> GameListViewMode { get; private set; }
  143. /// <summary>
  144. /// Show application name in Grid Mode
  145. /// </summary>
  146. public ReactiveObject<bool> ShowNames { get; private set; }
  147. /// <summary>
  148. /// Sets App Icon Size in Grid Mode
  149. /// </summary>
  150. public ReactiveObject<int> GridSize { get; private set; }
  151. /// <summary>
  152. /// Sorts Apps in Grid Mode
  153. /// </summary>
  154. public ReactiveObject<int> ApplicationSort { get; private set; }
  155. /// <summary>
  156. /// Sets if Grid is ordered in Ascending Order
  157. /// </summary>
  158. public ReactiveObject<bool> IsAscendingOrder { get; private set; }
  159. public UISection()
  160. {
  161. GuiColumns = new Columns();
  162. ColumnSort = new ColumnSortSettings();
  163. GameDirs = new ReactiveObject<List<string>>();
  164. AutoloadDirs = new ReactiveObject<List<string>>();
  165. ShownFileTypes = new ShownFileTypeSettings();
  166. WindowStartup = new WindowStartupSettings();
  167. BaseStyle = new ReactiveObject<string>();
  168. StartFullscreen = new ReactiveObject<bool>();
  169. GameListViewMode = new ReactiveObject<int>();
  170. ShowNames = new ReactiveObject<bool>();
  171. GridSize = new ReactiveObject<int>();
  172. ApplicationSort = new ReactiveObject<int>();
  173. IsAscendingOrder = new ReactiveObject<bool>();
  174. LanguageCode = new ReactiveObject<string>();
  175. ShowConsole = new ReactiveObject<bool>();
  176. ShowConsole.Event += static (_, e) => ConsoleHelper.SetConsoleWindowState(e.NewValue);
  177. }
  178. }
  179. /// <summary>
  180. /// Logger configuration section
  181. /// </summary>
  182. public class LoggerSection
  183. {
  184. /// <summary>
  185. /// Enables printing debug log messages
  186. /// </summary>
  187. public ReactiveObject<bool> EnableDebug { get; private set; }
  188. /// <summary>
  189. /// Enables printing stub log messages
  190. /// </summary>
  191. public ReactiveObject<bool> EnableStub { get; private set; }
  192. /// <summary>
  193. /// Enables printing info log messages
  194. /// </summary>
  195. public ReactiveObject<bool> EnableInfo { get; private set; }
  196. /// <summary>
  197. /// Enables printing warning log messages
  198. /// </summary>
  199. public ReactiveObject<bool> EnableWarn { get; private set; }
  200. /// <summary>
  201. /// Enables printing error log messages
  202. /// </summary>
  203. public ReactiveObject<bool> EnableError { get; private set; }
  204. /// <summary>
  205. /// Enables printing trace log messages
  206. /// </summary>
  207. public ReactiveObject<bool> EnableTrace { get; private set; }
  208. /// <summary>
  209. /// Enables printing guest log messages
  210. /// </summary>
  211. public ReactiveObject<bool> EnableGuest { get; private set; }
  212. /// <summary>
  213. /// Enables printing FS access log messages
  214. /// </summary>
  215. public ReactiveObject<bool> EnableFsAccessLog { get; private set; }
  216. /// <summary>
  217. /// Controls which log messages are written to the log targets
  218. /// </summary>
  219. public ReactiveObject<LogClass[]> FilteredClasses { get; private set; }
  220. /// <summary>
  221. /// Enables or disables logging to a file on disk
  222. /// </summary>
  223. public ReactiveObject<bool> EnableFileLog { get; private set; }
  224. /// <summary>
  225. /// Controls which OpenGL log messages are recorded in the log
  226. /// </summary>
  227. public ReactiveObject<GraphicsDebugLevel> GraphicsDebugLevel { get; private set; }
  228. public LoggerSection()
  229. {
  230. EnableDebug = new ReactiveObject<bool>();
  231. EnableDebug.LogChangesToValue(nameof(EnableDebug));
  232. EnableStub = new ReactiveObject<bool>();
  233. EnableInfo = new ReactiveObject<bool>();
  234. EnableWarn = new ReactiveObject<bool>();
  235. EnableError = new ReactiveObject<bool>();
  236. EnableTrace = new ReactiveObject<bool>();
  237. EnableGuest = new ReactiveObject<bool>();
  238. EnableFsAccessLog = new ReactiveObject<bool>();
  239. FilteredClasses = new ReactiveObject<LogClass[]>();
  240. EnableFileLog = new ReactiveObject<bool>();
  241. EnableFileLog.LogChangesToValue(nameof(EnableFileLog));
  242. GraphicsDebugLevel = new ReactiveObject<GraphicsDebugLevel>();
  243. }
  244. }
  245. /// <summary>
  246. /// System configuration section
  247. /// </summary>
  248. public class SystemSection
  249. {
  250. /// <summary>
  251. /// Change System Language
  252. /// </summary>
  253. public ReactiveObject<Language> Language { get; private set; }
  254. /// <summary>
  255. /// Change System Region
  256. /// </summary>
  257. public ReactiveObject<Region> Region { get; private set; }
  258. /// <summary>
  259. /// Change System TimeZone
  260. /// </summary>
  261. public ReactiveObject<string> TimeZone { get; private set; }
  262. /// <summary>
  263. /// System Time Offset in Seconds
  264. /// </summary>
  265. public ReactiveObject<long> SystemTimeOffset { get; private set; }
  266. /// <summary>
  267. /// Enables or disables Docked Mode
  268. /// </summary>
  269. public ReactiveObject<bool> EnableDockedMode { get; private set; }
  270. /// <summary>
  271. /// Enables or disables persistent profiled translation cache
  272. /// </summary>
  273. public ReactiveObject<bool> EnablePtc { get; private set; }
  274. /// <summary>
  275. /// Enables or disables low-power persistent profiled translation cache loading
  276. /// </summary>
  277. public ReactiveObject<bool> EnableLowPowerPtc { get; private set; }
  278. /// <summary>
  279. /// Enables or disables guest Internet access
  280. /// </summary>
  281. public ReactiveObject<bool> EnableInternetAccess { get; private set; }
  282. /// <summary>
  283. /// Enables integrity checks on Game content files
  284. /// </summary>
  285. public ReactiveObject<bool> EnableFsIntegrityChecks { get; private set; }
  286. /// <summary>
  287. /// Enables FS access log output to the console. Possible modes are 0-3
  288. /// </summary>
  289. public ReactiveObject<int> FsGlobalAccessLogMode { get; private set; }
  290. /// <summary>
  291. /// The selected audio backend
  292. /// </summary>
  293. public ReactiveObject<AudioBackend> AudioBackend { get; private set; }
  294. /// <summary>
  295. /// The audio backend volume
  296. /// </summary>
  297. public ReactiveObject<float> AudioVolume { get; private set; }
  298. /// <summary>
  299. /// The selected memory manager mode
  300. /// </summary>
  301. public ReactiveObject<MemoryManagerMode> MemoryManagerMode { get; private set; }
  302. /// <summary>
  303. /// Defines the amount of RAM available on the emulated system, and how it is distributed
  304. /// </summary>
  305. public ReactiveObject<MemoryConfiguration> DramSize { get; private set; }
  306. /// <summary>
  307. /// Enable or disable ignoring missing services
  308. /// </summary>
  309. public ReactiveObject<bool> IgnoreMissingServices { get; private set; }
  310. /// <summary>
  311. /// Uses Hypervisor over JIT if available
  312. /// </summary>
  313. public ReactiveObject<bool> UseHypervisor { get; private set; }
  314. public SystemSection()
  315. {
  316. Language = new ReactiveObject<Language>();
  317. Language.LogChangesToValue(nameof(Language));
  318. Region = new ReactiveObject<Region>();
  319. Region.LogChangesToValue(nameof(Region));
  320. TimeZone = new ReactiveObject<string>();
  321. TimeZone.LogChangesToValue(nameof(TimeZone));
  322. SystemTimeOffset = new ReactiveObject<long>();
  323. SystemTimeOffset.LogChangesToValue(nameof(SystemTimeOffset));
  324. EnableDockedMode = new ReactiveObject<bool>();
  325. EnableDockedMode.LogChangesToValue(nameof(EnableDockedMode));
  326. EnablePtc = new ReactiveObject<bool>();
  327. EnablePtc.LogChangesToValue(nameof(EnablePtc));
  328. EnableLowPowerPtc = new ReactiveObject<bool>();
  329. EnableLowPowerPtc.LogChangesToValue(nameof(EnableLowPowerPtc));
  330. EnableLowPowerPtc.Event += (_, evnt)
  331. => Optimizations.LowPower = evnt.NewValue;
  332. EnableInternetAccess = new ReactiveObject<bool>();
  333. EnableInternetAccess.LogChangesToValue(nameof(EnableInternetAccess));
  334. EnableFsIntegrityChecks = new ReactiveObject<bool>();
  335. EnableFsIntegrityChecks.LogChangesToValue(nameof(EnableFsIntegrityChecks));
  336. FsGlobalAccessLogMode = new ReactiveObject<int>();
  337. FsGlobalAccessLogMode.LogChangesToValue(nameof(FsGlobalAccessLogMode));
  338. AudioBackend = new ReactiveObject<AudioBackend>();
  339. AudioBackend.LogChangesToValue(nameof(AudioBackend));
  340. MemoryManagerMode = new ReactiveObject<MemoryManagerMode>();
  341. MemoryManagerMode.LogChangesToValue(nameof(MemoryManagerMode));
  342. DramSize = new ReactiveObject<MemoryConfiguration>();
  343. DramSize.LogChangesToValue(nameof(DramSize));
  344. IgnoreMissingServices = new ReactiveObject<bool>();
  345. IgnoreMissingServices.LogChangesToValue(nameof(IgnoreMissingServices));
  346. AudioVolume = new ReactiveObject<float>();
  347. AudioVolume.LogChangesToValue(nameof(AudioVolume));
  348. UseHypervisor = new ReactiveObject<bool>();
  349. UseHypervisor.LogChangesToValue(nameof(UseHypervisor));
  350. }
  351. }
  352. /// <summary>
  353. /// Hid configuration section
  354. /// </summary>
  355. public class HidSection
  356. {
  357. /// <summary>
  358. /// Enable or disable keyboard support (Independent from controllers binding)
  359. /// </summary>
  360. public ReactiveObject<bool> EnableKeyboard { get; private set; }
  361. /// <summary>
  362. /// Enable or disable mouse support (Independent from controllers binding)
  363. /// </summary>
  364. public ReactiveObject<bool> EnableMouse { get; private set; }
  365. /// <summary>
  366. /// Hotkey Keyboard Bindings
  367. /// </summary>
  368. public ReactiveObject<KeyboardHotkeys> Hotkeys { get; private set; }
  369. /// <summary>
  370. /// Input device configuration.
  371. /// NOTE: This ReactiveObject won't issue an event when the List has elements added or removed.
  372. /// TODO: Implement a ReactiveList class.
  373. /// </summary>
  374. public ReactiveObject<List<InputConfig>> InputConfig { get; private set; }
  375. public HidSection()
  376. {
  377. EnableKeyboard = new ReactiveObject<bool>();
  378. EnableMouse = new ReactiveObject<bool>();
  379. Hotkeys = new ReactiveObject<KeyboardHotkeys>();
  380. InputConfig = new ReactiveObject<List<InputConfig>>();
  381. }
  382. }
  383. /// <summary>
  384. /// Graphics configuration section
  385. /// </summary>
  386. public class GraphicsSection
  387. {
  388. /// <summary>
  389. /// Whether or not backend threading is enabled. The "Auto" setting will determine whether threading should be enabled at runtime.
  390. /// </summary>
  391. public ReactiveObject<BackendThreading> BackendThreading { get; private set; }
  392. /// <summary>
  393. /// Max Anisotropy. Values range from 0 - 16. Set to -1 to let the game decide.
  394. /// </summary>
  395. public ReactiveObject<float> MaxAnisotropy { get; private set; }
  396. /// <summary>
  397. /// Aspect Ratio applied to the renderer window.
  398. /// </summary>
  399. public ReactiveObject<AspectRatio> AspectRatio { get; private set; }
  400. /// <summary>
  401. /// Resolution Scale. An integer scale applied to applicable render targets. Values 1-4, or -1 to use a custom floating point scale instead.
  402. /// </summary>
  403. public ReactiveObject<int> ResScale { get; private set; }
  404. /// <summary>
  405. /// Custom Resolution Scale. A custom floating point scale applied to applicable render targets. Only active when Resolution Scale is -1.
  406. /// </summary>
  407. public ReactiveObject<float> ResScaleCustom { get; private set; }
  408. /// <summary>
  409. /// Dumps shaders in this local directory
  410. /// </summary>
  411. public ReactiveObject<string> ShadersDumpPath { get; private set; }
  412. /// <summary>
  413. /// Toggles the present interval mode. Options are Switch (60Hz), Unbounded (previously Vsync off), and Custom, if enabled.
  414. /// </summary>
  415. public ReactiveObject<VSyncMode> VSyncMode { get; private set; }
  416. /// <summary>
  417. /// Enables or disables the custom present interval mode.
  418. /// </summary>
  419. public ReactiveObject<bool> EnableCustomVSyncInterval { get; private set; }
  420. /// <summary>
  421. /// Changes the custom present interval.
  422. /// </summary>
  423. public ReactiveObject<int> CustomVSyncInterval { get; private set; }
  424. /// <summary>
  425. /// Enables or disables Shader cache
  426. /// </summary>
  427. public ReactiveObject<bool> EnableShaderCache { get; private set; }
  428. /// <summary>
  429. /// Enables or disables texture recompression
  430. /// </summary>
  431. public ReactiveObject<bool> EnableTextureRecompression { get; private set; }
  432. /// <summary>
  433. /// Enables or disables Macro high-level emulation
  434. /// </summary>
  435. public ReactiveObject<bool> EnableMacroHLE { get; private set; }
  436. /// <summary>
  437. /// Enables or disables color space passthrough, if available.
  438. /// </summary>
  439. public ReactiveObject<bool> EnableColorSpacePassthrough { get; private set; }
  440. /// <summary>
  441. /// Graphics backend
  442. /// </summary>
  443. public ReactiveObject<GraphicsBackend> GraphicsBackend { get; private set; }
  444. /// <summary>
  445. /// Applies anti-aliasing to the renderer.
  446. /// </summary>
  447. public ReactiveObject<AntiAliasing> AntiAliasing { get; private set; }
  448. /// <summary>
  449. /// Sets the framebuffer upscaling type.
  450. /// </summary>
  451. public ReactiveObject<ScalingFilter> ScalingFilter { get; private set; }
  452. /// <summary>
  453. /// Sets the framebuffer upscaling level.
  454. /// </summary>
  455. public ReactiveObject<int> ScalingFilterLevel { get; private set; }
  456. /// <summary>
  457. /// Preferred GPU
  458. /// </summary>
  459. public ReactiveObject<string> PreferredGpu { get; private set; }
  460. public GraphicsSection()
  461. {
  462. BackendThreading = new ReactiveObject<BackendThreading>();
  463. BackendThreading.LogChangesToValue(nameof(BackendThreading));
  464. ResScale = new ReactiveObject<int>();
  465. ResScale.LogChangesToValue(nameof(ResScale));
  466. ResScaleCustom = new ReactiveObject<float>();
  467. ResScaleCustom.LogChangesToValue(nameof(ResScaleCustom));
  468. MaxAnisotropy = new ReactiveObject<float>();
  469. MaxAnisotropy.LogChangesToValue(nameof(MaxAnisotropy));
  470. AspectRatio = new ReactiveObject<AspectRatio>();
  471. AspectRatio.LogChangesToValue(nameof(AspectRatio));
  472. ShadersDumpPath = new ReactiveObject<string>();
  473. VSyncMode = new ReactiveObject<VSyncMode>();
  474. VSyncMode.LogChangesToValue(nameof(VSyncMode));
  475. EnableCustomVSyncInterval = new ReactiveObject<bool>();
  476. EnableCustomVSyncInterval.LogChangesToValue(nameof(EnableCustomVSyncInterval));
  477. CustomVSyncInterval = new ReactiveObject<int>();
  478. CustomVSyncInterval.LogChangesToValue(nameof(CustomVSyncInterval));
  479. EnableShaderCache = new ReactiveObject<bool>();
  480. EnableShaderCache.LogChangesToValue(nameof(EnableShaderCache));
  481. EnableTextureRecompression = new ReactiveObject<bool>();
  482. EnableTextureRecompression.LogChangesToValue(nameof(EnableTextureRecompression));
  483. GraphicsBackend = new ReactiveObject<GraphicsBackend>();
  484. GraphicsBackend.LogChangesToValue(nameof(GraphicsBackend));
  485. PreferredGpu = new ReactiveObject<string>();
  486. PreferredGpu.LogChangesToValue(nameof(PreferredGpu));
  487. EnableMacroHLE = new ReactiveObject<bool>();
  488. EnableMacroHLE.LogChangesToValue(nameof(EnableMacroHLE));
  489. EnableColorSpacePassthrough = new ReactiveObject<bool>();
  490. EnableColorSpacePassthrough.LogChangesToValue(nameof(EnableColorSpacePassthrough));
  491. AntiAliasing = new ReactiveObject<AntiAliasing>();
  492. AntiAliasing.LogChangesToValue(nameof(AntiAliasing));
  493. ScalingFilter = new ReactiveObject<ScalingFilter>();
  494. ScalingFilter.LogChangesToValue(nameof(ScalingFilter));
  495. ScalingFilterLevel = new ReactiveObject<int>();
  496. ScalingFilterLevel.LogChangesToValue(nameof(ScalingFilterLevel));
  497. }
  498. }
  499. /// <summary>
  500. /// Multiplayer configuration section
  501. /// </summary>
  502. public class MultiplayerSection
  503. {
  504. /// <summary>
  505. /// GUID for the network interface used by LAN (or 0 for default)
  506. /// </summary>
  507. public ReactiveObject<string> LanInterfaceId { get; private set; }
  508. /// <summary>
  509. /// Multiplayer Mode
  510. /// </summary>
  511. public ReactiveObject<MultiplayerMode> Mode { get; private set; }
  512. /// <summary>
  513. /// Disable P2P
  514. /// </summary>
  515. public ReactiveObject<bool> DisableP2p { get; private set; }
  516. /// <summary>
  517. /// LDN PassPhrase
  518. /// </summary>
  519. public ReactiveObject<string> LdnPassphrase { get; private set; }
  520. /// <summary>
  521. /// LDN Server
  522. /// </summary>
  523. public ReactiveObject<string> LdnServer { get; private set; }
  524. public MultiplayerSection()
  525. {
  526. LanInterfaceId = new ReactiveObject<string>();
  527. Mode = new ReactiveObject<MultiplayerMode>();
  528. Mode.LogChangesToValue(nameof(MultiplayerMode));
  529. DisableP2p = new ReactiveObject<bool>();
  530. DisableP2p.LogChangesToValue(nameof(DisableP2p));
  531. LdnPassphrase = new ReactiveObject<string>();
  532. LdnPassphrase.LogChangesToValue(nameof(LdnPassphrase));
  533. LdnServer = new ReactiveObject<string>();
  534. LdnServer.LogChangesToValue(nameof(LdnServer));
  535. }
  536. }
  537. public class HacksSection
  538. {
  539. /// <summary>
  540. /// Show toggles for dirty hacks in the UI.
  541. /// </summary>
  542. public ReactiveObject<bool> ShowDirtyHacks { get; private set; }
  543. public ReactiveObject<bool> Xc2MenuSoftlockFix { get; private set; }
  544. public HacksSection()
  545. {
  546. ShowDirtyHacks = new ReactiveObject<bool>();
  547. Xc2MenuSoftlockFix = new ReactiveObject<bool>();
  548. Xc2MenuSoftlockFix.Event += HackChanged;
  549. }
  550. private void HackChanged(object sender, ReactiveEventArgs<bool> rxe)
  551. {
  552. Ryujinx.Common.Logging.Logger.Info?.Print(LogClass.Configuration, $"EnabledDirtyHacks set to: {EnabledHacks}", "LogValueChange");
  553. }
  554. public DirtyHacks EnabledHacks
  555. {
  556. get
  557. {
  558. DirtyHacks dirtyHacks = DirtyHacks.None;
  559. if (Xc2MenuSoftlockFix)
  560. Apply(DirtyHacks.Xc2MenuSoftlockFix);
  561. return dirtyHacks;
  562. void Apply(DirtyHacks hack)
  563. {
  564. if (dirtyHacks is not DirtyHacks.None)
  565. dirtyHacks |= hack;
  566. else
  567. dirtyHacks = hack;
  568. }
  569. }
  570. }
  571. }
  572. /// <summary>
  573. /// The default configuration instance
  574. /// </summary>
  575. public static ConfigurationState Instance { get; private set; }
  576. /// <summary>
  577. /// The UI section
  578. /// </summary>
  579. public UISection UI { get; private set; }
  580. /// <summary>
  581. /// The Logger section
  582. /// </summary>
  583. public LoggerSection Logger { get; private set; }
  584. /// <summary>
  585. /// The System section
  586. /// </summary>
  587. public SystemSection System { get; private set; }
  588. /// <summary>
  589. /// The Graphics section
  590. /// </summary>
  591. public GraphicsSection Graphics { get; private set; }
  592. /// <summary>
  593. /// The Hid section
  594. /// </summary>
  595. public HidSection Hid { get; private set; }
  596. /// <summary>
  597. /// The Multiplayer section
  598. /// </summary>
  599. public MultiplayerSection Multiplayer { get; private set; }
  600. /// <summary>
  601. /// The Dirty Hacks section
  602. /// </summary>
  603. public HacksSection Hacks { get; private set; }
  604. /// <summary>
  605. /// Enables or disables Discord Rich Presence
  606. /// </summary>
  607. public ReactiveObject<bool> EnableDiscordIntegration { get; private set; }
  608. /// <summary>
  609. /// Checks for updates when Ryujinx starts when enabled
  610. /// </summary>
  611. public ReactiveObject<bool> CheckUpdatesOnStart { get; private set; }
  612. /// <summary>
  613. /// Show "Confirm Exit" Dialog
  614. /// </summary>
  615. public ReactiveObject<bool> ShowConfirmExit { get; private set; }
  616. /// <summary>
  617. /// Ignore Applet
  618. /// </summary>
  619. public ReactiveObject<bool> IgnoreApplet { get; private set; }
  620. /// <summary>
  621. /// Enables or disables save window size, position and state on close.
  622. /// </summary>
  623. public ReactiveObject<bool> RememberWindowState { get; private set; }
  624. /// <summary>
  625. /// Enables or disables the redesigned title bar
  626. /// </summary>
  627. public ReactiveObject<bool> ShowTitleBar { get; private set; }
  628. /// <summary>
  629. /// Enables hardware-accelerated rendering for Avalonia
  630. /// </summary>
  631. public ReactiveObject<bool> EnableHardwareAcceleration { get; private set; }
  632. /// <summary>
  633. /// Hide Cursor on Idle
  634. /// </summary>
  635. public ReactiveObject<HideCursorMode> HideCursor { get; private set; }
  636. private ConfigurationState()
  637. {
  638. UI = new UISection();
  639. Logger = new LoggerSection();
  640. System = new SystemSection();
  641. Graphics = new GraphicsSection();
  642. Hid = new HidSection();
  643. Multiplayer = new MultiplayerSection();
  644. Hacks = new HacksSection();
  645. EnableDiscordIntegration = new ReactiveObject<bool>();
  646. CheckUpdatesOnStart = new ReactiveObject<bool>();
  647. ShowConfirmExit = new ReactiveObject<bool>();
  648. IgnoreApplet = new ReactiveObject<bool>();
  649. IgnoreApplet.LogChangesToValue(nameof(IgnoreApplet));
  650. RememberWindowState = new ReactiveObject<bool>();
  651. ShowTitleBar = new ReactiveObject<bool>();
  652. EnableHardwareAcceleration = new ReactiveObject<bool>();
  653. HideCursor = new ReactiveObject<HideCursorMode>();
  654. }
  655. }
  656. }