ConfigurationFileFormat.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. using System.Collections.Generic;
  2. using System.IO;
  3. using Ryujinx.Common.Configuration;
  4. using Ryujinx.Common.Configuration.Hid;
  5. using Ryujinx.Common.Logging;
  6. using Ryujinx.Common.Utilities;
  7. using Ryujinx.Configuration.System;
  8. using Ryujinx.Configuration.Ui;
  9. namespace Ryujinx.Configuration
  10. {
  11. public class ConfigurationFileFormat
  12. {
  13. /// <summary>
  14. /// The current version of the file format
  15. /// </summary>
  16. public const int CurrentVersion = 15;
  17. public int Version { get; set; }
  18. /// <summary>
  19. /// Resolution Scale. An integer scale applied to applicable render targets. Values 1-4, or -1 to use a custom floating point scale instead.
  20. /// </summary>
  21. public int ResScale { get; set; }
  22. /// <summary>
  23. /// Custom Resolution Scale. A custom floating point scale applied to applicable render targets. Only active when Resolution Scale is -1.
  24. /// </summary>
  25. public float ResScaleCustom { get; set; }
  26. /// <summary>
  27. /// Max Anisotropy. Values range from 0 - 16. Set to -1 to let the game decide.
  28. /// </summary>
  29. public float MaxAnisotropy { get; set; }
  30. /// <summary>
  31. /// Dumps shaders in this local directory
  32. /// </summary>
  33. public string GraphicsShadersDumpPath { get; set; }
  34. /// <summary>
  35. /// Enables printing debug log messages
  36. /// </summary>
  37. public bool LoggingEnableDebug { get; set; }
  38. /// <summary>
  39. /// Enables printing stub log messages
  40. /// </summary>
  41. public bool LoggingEnableStub { get; set; }
  42. /// <summary>
  43. /// Enables printing info log messages
  44. /// </summary>
  45. public bool LoggingEnableInfo { get; set; }
  46. /// <summary>
  47. /// Enables printing warning log messages
  48. /// </summary>
  49. public bool LoggingEnableWarn { get; set; }
  50. /// <summary>
  51. /// Enables printing error log messages
  52. /// </summary>
  53. public bool LoggingEnableError { get; set; }
  54. /// <summary>
  55. /// Enables printing guest log messages
  56. /// </summary>
  57. public bool LoggingEnableGuest { get; set; }
  58. /// <summary>
  59. /// Enables printing FS access log messages
  60. /// </summary>
  61. public bool LoggingEnableFsAccessLog { get; set; }
  62. /// <summary>
  63. /// Controls which log messages are written to the log targets
  64. /// </summary>
  65. public LogClass[] LoggingFilteredClasses { get; set; }
  66. /// <summary>
  67. /// Change Graphics API debug log level
  68. /// </summary>
  69. public GraphicsDebugLevel LoggingGraphicsDebugLevel { get; set; }
  70. /// <summary>
  71. /// Enables or disables logging to a file on disk
  72. /// </summary>
  73. public bool EnableFileLog { get; set; }
  74. /// <summary>
  75. /// Change System Language
  76. /// </summary>
  77. public Language SystemLanguage { get; set; }
  78. /// <summary>
  79. /// Change System Region
  80. /// </summary>
  81. public Region SystemRegion { get; set; }
  82. /// <summary>
  83. /// Change System TimeZone
  84. /// </summary>
  85. public string SystemTimeZone { get; set; }
  86. /// <summary>
  87. /// Change System Time Offset in seconds
  88. /// </summary>
  89. public long SystemTimeOffset { get; set; }
  90. /// <summary>
  91. /// Enables or disables Docked Mode
  92. /// </summary>
  93. public bool DockedMode { get; set; }
  94. /// <summary>
  95. /// Enables or disables Discord Rich Presence
  96. /// </summary>
  97. public bool EnableDiscordIntegration { get; set; }
  98. /// <summary>
  99. /// Checks for updates when Ryujinx starts when enabled
  100. /// </summary>
  101. public bool CheckUpdatesOnStart { get; set; }
  102. /// <summary>
  103. /// Enables or disables Vertical Sync
  104. /// </summary>
  105. public bool EnableVsync { get; set; }
  106. /// <summary>
  107. /// Enables or disables multi-core scheduling of threads
  108. /// </summary>
  109. public bool EnableMulticoreScheduling { get; set; }
  110. /// <summary>
  111. /// Enables or disables profiled translation cache persistency
  112. /// </summary>
  113. public bool EnablePtc { get; set; }
  114. /// <summary>
  115. /// Enables integrity checks on Game content files
  116. /// </summary>
  117. public bool EnableFsIntegrityChecks { get; set; }
  118. /// <summary>
  119. /// Enables FS access log output to the console. Possible modes are 0-3
  120. /// </summary>
  121. public int FsGlobalAccessLogMode { get; set; }
  122. /// <summary>
  123. /// The selected audio backend
  124. /// </summary>
  125. public AudioBackend AudioBackend { get; set; }
  126. /// <summary>
  127. /// Enable or disable ignoring missing services
  128. /// </summary>
  129. public bool IgnoreMissingServices { get; set; }
  130. /// <summary>
  131. /// Used to toggle columns in the GUI
  132. /// </summary>
  133. public GuiColumns GuiColumns { get; set; }
  134. /// <summary>
  135. /// Used to configure column sort settings in the GUI
  136. /// </summary>
  137. public ColumnSort ColumnSort { get; set; }
  138. /// <summary>
  139. /// A list of directories containing games to be used to load games into the games list
  140. /// </summary>
  141. public List<string> GameDirs { get; set; }
  142. /// <summary>
  143. /// Enable or disable custom themes in the GUI
  144. /// </summary>
  145. public bool EnableCustomTheme { get; set; }
  146. /// <summary>
  147. /// Path to custom GUI theme
  148. /// </summary>
  149. public string CustomThemePath { get; set; }
  150. /// <summary>
  151. /// Enable or disable keyboard support (Independent from controllers binding)
  152. /// </summary>
  153. public bool EnableKeyboard { get; set; }
  154. /// <summary>
  155. /// Hotkey Keyboard Bindings
  156. /// </summary>
  157. public KeyboardHotkeys Hotkeys { get; set; }
  158. /// <summary>
  159. /// Keyboard control bindings
  160. /// </summary>
  161. public List<KeyboardConfig> KeyboardConfig { get; set; }
  162. /// <summary>
  163. /// Controller control bindings
  164. /// </summary>
  165. public List<ControllerConfig> ControllerConfig { get; set; }
  166. /// <summary>
  167. /// Loads a configuration file from disk
  168. /// </summary>
  169. /// <param name="path">The path to the JSON configuration file</param>
  170. public static ConfigurationFileFormat Load(string path)
  171. {
  172. return JsonHelper.DeserializeFromFile<ConfigurationFileFormat>(path);
  173. }
  174. /// <summary>
  175. /// Save a configuration file to disk
  176. /// </summary>
  177. /// <param name="path">The path to the JSON configuration file</param>
  178. public void SaveConfig(string path)
  179. {
  180. File.WriteAllText(path, JsonHelper.Serialize(this, true));
  181. }
  182. }
  183. }