settings.h 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. // Modified by palfaiate on <2024/03/07>
  4. // Reverted palfaiate's changes on <2024/03/25> -Nine-Ball
  5. #pragma once
  6. #include <algorithm>
  7. #include <array>
  8. #include <map>
  9. #include <memory>
  10. #include <stdexcept>
  11. #include <string>
  12. #include <utility>
  13. #include <vector>
  14. #include "common/common_types.h"
  15. #include "common/settings_common.h"
  16. #include "common/settings_enums.h"
  17. #include "common/settings_input.h"
  18. #include "common/settings_setting.h"
  19. namespace Settings {
  20. const char* TranslateCategory(Settings::Category category);
  21. struct ResolutionScalingInfo {
  22. u32 up_scale{1};
  23. u32 down_shift{0};
  24. f32 up_factor{1.0f};
  25. f32 down_factor{1.0f};
  26. bool active{};
  27. bool downscale{};
  28. s32 ScaleUp(s32 value) const {
  29. if (value == 0) {
  30. return 0;
  31. }
  32. return std::max((value * static_cast<s32>(up_scale)) >> static_cast<s32>(down_shift), 1);
  33. }
  34. u32 ScaleUp(u32 value) const {
  35. if (value == 0U) {
  36. return 0U;
  37. }
  38. return std::max((value * up_scale) >> down_shift, 1U);
  39. }
  40. };
  41. #ifndef CANNOT_EXPLICITLY_INSTANTIATE
  42. // Instantiate the classes elsewhere (settings.cpp) to reduce compiler/linker work
  43. #define SETTING(TYPE, RANGED) extern template class Setting<TYPE, RANGED>
  44. #define SWITCHABLE(TYPE, RANGED) extern template class SwitchableSetting<TYPE, RANGED>
  45. SETTING(AudioEngine, false);
  46. SETTING(bool, false);
  47. SETTING(int, false);
  48. SETTING(s32, false);
  49. SETTING(std::string, false);
  50. SETTING(std::string, false);
  51. SETTING(u16, false);
  52. SWITCHABLE(AnisotropyMode, true);
  53. SWITCHABLE(AntiAliasing, false);
  54. SWITCHABLE(AspectRatio, true);
  55. SWITCHABLE(AstcDecodeMode, true);
  56. SWITCHABLE(AstcRecompression, true);
  57. SWITCHABLE(AudioMode, true);
  58. SWITCHABLE(CpuBackend, true);
  59. SWITCHABLE(CpuAccuracy, true);
  60. SWITCHABLE(FullscreenMode, true);
  61. SWITCHABLE(GpuAccuracy, true);
  62. SWITCHABLE(Language, true);
  63. SWITCHABLE(MemoryLayout, true);
  64. SWITCHABLE(NvdecEmulation, false);
  65. SWITCHABLE(Region, true);
  66. SWITCHABLE(RendererBackend, true);
  67. SWITCHABLE(ScalingFilter, false);
  68. SWITCHABLE(ShaderBackend, true);
  69. SWITCHABLE(TimeZone, true);
  70. SETTING(VSyncMode, true);
  71. SWITCHABLE(bool, false);
  72. SWITCHABLE(int, false);
  73. SWITCHABLE(int, true);
  74. SWITCHABLE(s64, false);
  75. SWITCHABLE(u16, true);
  76. SWITCHABLE(u32, false);
  77. SWITCHABLE(u8, false);
  78. SWITCHABLE(u8, true);
  79. // Used in UISettings
  80. // TODO see if we can move this to uisettings.h
  81. SWITCHABLE(ConfirmStop, true);
  82. SWITCHABLE(DarkModeState, true);
  83. #undef SETTING
  84. #undef SWITCHABLE
  85. #endif
  86. /**
  87. * The InputSetting class allows for getting a reference to either the global or custom members.
  88. * This is required as we cannot easily modify the values of user-defined types within containers
  89. * using the SetValue() member function found in the Setting class. The primary purpose of this
  90. * class is to store an array of 10 PlayerInput structs for both the global and custom setting and
  91. * allows for easily accessing and modifying both settings.
  92. */
  93. template <typename Type>
  94. class InputSetting final {
  95. public:
  96. InputSetting() = default;
  97. explicit InputSetting(Type val) : Setting<Type>(val) {}
  98. ~InputSetting() = default;
  99. void SetGlobal(bool to_global) {
  100. use_global = to_global;
  101. }
  102. [[nodiscard]] bool UsingGlobal() const {
  103. return use_global;
  104. }
  105. [[nodiscard]] Type& GetValue(bool need_global = false) {
  106. if (use_global || need_global) {
  107. return global;
  108. }
  109. return custom;
  110. }
  111. private:
  112. bool use_global{true}; ///< The setting's global state
  113. Type global{}; ///< The setting
  114. Type custom{}; ///< The custom setting value
  115. };
  116. struct TouchFromButtonMap {
  117. std::string name;
  118. std::vector<std::string> buttons;
  119. };
  120. struct Values {
  121. Linkage linkage{};
  122. // Applet
  123. Setting<AppletMode> cabinet_applet_mode{linkage, AppletMode::LLE, "cabinet_applet_mode",
  124. Category::LibraryApplet};
  125. Setting<AppletMode> controller_applet_mode{linkage, AppletMode::HLE, "controller_applet_mode",
  126. Category::LibraryApplet};
  127. Setting<AppletMode> data_erase_applet_mode{linkage, AppletMode::HLE, "data_erase_applet_mode",
  128. Category::LibraryApplet};
  129. Setting<AppletMode> error_applet_mode{linkage, AppletMode::LLE, "error_applet_mode",
  130. Category::LibraryApplet};
  131. Setting<AppletMode> net_connect_applet_mode{linkage, AppletMode::HLE, "net_connect_applet_mode",
  132. Category::LibraryApplet};
  133. Setting<AppletMode> player_select_applet_mode{
  134. linkage, AppletMode::HLE, "player_select_applet_mode", Category::LibraryApplet};
  135. Setting<AppletMode> swkbd_applet_mode{linkage, AppletMode::LLE, "swkbd_applet_mode",
  136. Category::LibraryApplet};
  137. Setting<AppletMode> mii_edit_applet_mode{linkage, AppletMode::LLE, "mii_edit_applet_mode",
  138. Category::LibraryApplet};
  139. Setting<AppletMode> web_applet_mode{linkage, AppletMode::HLE, "web_applet_mode",
  140. Category::LibraryApplet};
  141. Setting<AppletMode> shop_applet_mode{linkage, AppletMode::HLE, "shop_applet_mode",
  142. Category::LibraryApplet};
  143. Setting<AppletMode> photo_viewer_applet_mode{
  144. linkage, AppletMode::LLE, "photo_viewer_applet_mode", Category::LibraryApplet};
  145. Setting<AppletMode> offline_web_applet_mode{linkage, AppletMode::LLE, "offline_web_applet_mode",
  146. Category::LibraryApplet};
  147. Setting<AppletMode> login_share_applet_mode{linkage, AppletMode::HLE, "login_share_applet_mode",
  148. Category::LibraryApplet};
  149. Setting<AppletMode> wifi_web_auth_applet_mode{
  150. linkage, AppletMode::HLE, "wifi_web_auth_applet_mode", Category::LibraryApplet};
  151. Setting<AppletMode> my_page_applet_mode{linkage, AppletMode::LLE, "my_page_applet_mode",
  152. Category::LibraryApplet};
  153. // Audio
  154. SwitchableSetting<AudioEngine> sink_id{linkage, AudioEngine::Auto, "output_engine",
  155. Category::Audio, Specialization::RuntimeList};
  156. SwitchableSetting<std::string> audio_output_device_id{
  157. linkage, "auto", "output_device", Category::Audio, Specialization::RuntimeList};
  158. SwitchableSetting<std::string> audio_input_device_id{
  159. linkage, "auto", "input_device", Category::Audio, Specialization::RuntimeList};
  160. SwitchableSetting<AudioMode, true> sound_index{
  161. linkage, AudioMode::Stereo, AudioMode::Mono, AudioMode::Surround,
  162. "sound_index", Category::SystemAudio, Specialization::Default, true,
  163. true};
  164. SwitchableSetting<u8, true> volume{linkage,
  165. 100,
  166. 0,
  167. 200,
  168. "volume",
  169. Category::Audio,
  170. Specialization::Scalar | Specialization::Percentage,
  171. true,
  172. true};
  173. Setting<bool, false> audio_muted{
  174. linkage, false, "audio_muted", Category::Audio, Specialization::Default, true, true};
  175. Setting<bool, false> dump_audio_commands{
  176. linkage, false, "dump_audio_commands", Category::Audio, Specialization::Default, false};
  177. // Core
  178. SwitchableSetting<bool> use_multi_core{linkage, true, "use_multi_core", Category::Core};
  179. SwitchableSetting<MemoryLayout, true> memory_layout_mode{linkage,
  180. MemoryLayout::Memory_4Gb,
  181. MemoryLayout::Memory_4Gb,
  182. MemoryLayout::Memory_8Gb,
  183. "memory_layout_mode",
  184. Category::Core};
  185. SwitchableSetting<bool> use_speed_limit{
  186. linkage, true, "use_speed_limit", Category::Core, Specialization::Paired, false, true};
  187. SwitchableSetting<u16, true> speed_limit{linkage,
  188. 100,
  189. 0,
  190. 9999,
  191. "speed_limit",
  192. Category::Core,
  193. Specialization::Countable | Specialization::Percentage,
  194. true,
  195. true,
  196. &use_speed_limit};
  197. // Cpu
  198. SwitchableSetting<CpuBackend, true> cpu_backend{linkage,
  199. #ifdef HAS_NCE
  200. CpuBackend::Nce,
  201. #else
  202. CpuBackend::Dynarmic,
  203. #endif
  204. CpuBackend::Dynarmic,
  205. #ifdef HAS_NCE
  206. CpuBackend::Nce,
  207. #else
  208. CpuBackend::Dynarmic,
  209. #endif
  210. "cpu_backend",
  211. Category::Cpu};
  212. SwitchableSetting<CpuAccuracy, true> cpu_accuracy{linkage, CpuAccuracy::Auto,
  213. CpuAccuracy::Auto, CpuAccuracy::Paranoid,
  214. "cpu_accuracy", Category::Cpu};
  215. SwitchableSetting<bool> cpu_debug_mode{linkage, false, "cpu_debug_mode", Category::CpuDebug};
  216. Setting<bool> cpuopt_page_tables{linkage, true, "cpuopt_page_tables", Category::CpuDebug};
  217. Setting<bool> cpuopt_block_linking{linkage, true, "cpuopt_block_linking", Category::CpuDebug};
  218. Setting<bool> cpuopt_return_stack_buffer{linkage, true, "cpuopt_return_stack_buffer",
  219. Category::CpuDebug};
  220. Setting<bool> cpuopt_fast_dispatcher{linkage, true, "cpuopt_fast_dispatcher",
  221. Category::CpuDebug};
  222. Setting<bool> cpuopt_context_elimination{linkage, true, "cpuopt_context_elimination",
  223. Category::CpuDebug};
  224. Setting<bool> cpuopt_const_prop{linkage, true, "cpuopt_const_prop", Category::CpuDebug};
  225. Setting<bool> cpuopt_misc_ir{linkage, true, "cpuopt_misc_ir", Category::CpuDebug};
  226. Setting<bool> cpuopt_reduce_misalign_checks{linkage, true, "cpuopt_reduce_misalign_checks",
  227. Category::CpuDebug};
  228. SwitchableSetting<bool> cpuopt_fastmem{linkage, true, "cpuopt_fastmem", Category::CpuDebug};
  229. SwitchableSetting<bool> cpuopt_fastmem_exclusives{linkage, true, "cpuopt_fastmem_exclusives",
  230. Category::CpuDebug};
  231. Setting<bool> cpuopt_recompile_exclusives{linkage, true, "cpuopt_recompile_exclusives",
  232. Category::CpuDebug};
  233. Setting<bool> cpuopt_ignore_memory_aborts{linkage, true, "cpuopt_ignore_memory_aborts",
  234. Category::CpuDebug};
  235. SwitchableSetting<bool> cpuopt_unsafe_unfuse_fma{linkage, true, "cpuopt_unsafe_unfuse_fma",
  236. Category::CpuUnsafe};
  237. SwitchableSetting<bool> cpuopt_unsafe_reduce_fp_error{
  238. linkage, true, "cpuopt_unsafe_reduce_fp_error", Category::CpuUnsafe};
  239. SwitchableSetting<bool> cpuopt_unsafe_ignore_standard_fpcr{
  240. linkage, true, "cpuopt_unsafe_ignore_standard_fpcr", Category::CpuUnsafe};
  241. SwitchableSetting<bool> cpuopt_unsafe_inaccurate_nan{
  242. linkage, true, "cpuopt_unsafe_inaccurate_nan", Category::CpuUnsafe};
  243. SwitchableSetting<bool> cpuopt_unsafe_fastmem_check{
  244. linkage, true, "cpuopt_unsafe_fastmem_check", Category::CpuUnsafe};
  245. SwitchableSetting<bool> cpuopt_unsafe_ignore_global_monitor{
  246. linkage, true, "cpuopt_unsafe_ignore_global_monitor", Category::CpuUnsafe};
  247. // Renderer
  248. SwitchableSetting<RendererBackend, true> renderer_backend{
  249. linkage, RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Null,
  250. "backend", Category::Renderer};
  251. SwitchableSetting<ShaderBackend, true> shader_backend{
  252. linkage, ShaderBackend::Glsl, ShaderBackend::Glsl, ShaderBackend::SpirV,
  253. "shader_backend", Category::Renderer, Specialization::RuntimeList};
  254. SwitchableSetting<int> vulkan_device{linkage, 0, "vulkan_device", Category::Renderer,
  255. Specialization::RuntimeList};
  256. SwitchableSetting<bool> use_disk_shader_cache{linkage, true, "use_disk_shader_cache",
  257. Category::Renderer};
  258. SwitchableSetting<bool> use_asynchronous_gpu_emulation{
  259. linkage, true, "use_asynchronous_gpu_emulation", Category::Renderer};
  260. SwitchableSetting<AstcDecodeMode, true> accelerate_astc{linkage,
  261. #ifdef ANDROID
  262. AstcDecodeMode::Cpu,
  263. #else
  264. AstcDecodeMode::Gpu,
  265. #endif
  266. AstcDecodeMode::Cpu,
  267. AstcDecodeMode::CpuAsynchronous,
  268. "accelerate_astc",
  269. Category::Renderer};
  270. SwitchableSetting<VSyncMode, true> vsync_mode{
  271. linkage, VSyncMode::Fifo, VSyncMode::Immediate, VSyncMode::FifoRelaxed,
  272. "use_vsync", Category::Renderer, Specialization::RuntimeList, true,
  273. true};
  274. SwitchableSetting<NvdecEmulation> nvdec_emulation{linkage, NvdecEmulation::Gpu,
  275. "nvdec_emulation", Category::Renderer};
  276. // *nix platforms may have issues with the borderless windowed fullscreen mode.
  277. // Default to exclusive fullscreen on these platforms for now.
  278. SwitchableSetting<FullscreenMode, true> fullscreen_mode{linkage,
  279. #ifdef _WIN32
  280. FullscreenMode::Borderless,
  281. #else
  282. FullscreenMode::Exclusive,
  283. #endif
  284. FullscreenMode::Borderless,
  285. FullscreenMode::Exclusive,
  286. "fullscreen_mode",
  287. Category::Renderer,
  288. Specialization::Default,
  289. true,
  290. true};
  291. SwitchableSetting<AspectRatio, true> aspect_ratio{linkage,
  292. AspectRatio::R16_9,
  293. AspectRatio::R16_9,
  294. AspectRatio::Stretch,
  295. "aspect_ratio",
  296. Category::Renderer,
  297. Specialization::Default,
  298. true,
  299. true};
  300. ResolutionScalingInfo resolution_info{};
  301. SwitchableSetting<ResolutionSetup> resolution_setup{linkage, ResolutionSetup::Res1X,
  302. "resolution_setup", Category::Renderer};
  303. SwitchableSetting<ScalingFilter> scaling_filter{linkage,
  304. ScalingFilter::Bilinear,
  305. "scaling_filter",
  306. Category::Renderer,
  307. Specialization::Default,
  308. true,
  309. true};
  310. SwitchableSetting<AntiAliasing> anti_aliasing{linkage,
  311. AntiAliasing::None,
  312. "anti_aliasing",
  313. Category::Renderer,
  314. Specialization::Default,
  315. true,
  316. true};
  317. SwitchableSetting<int, true> fsr_sharpening_slider{linkage,
  318. 25,
  319. 0,
  320. 200,
  321. "fsr_sharpening_slider",
  322. Category::Renderer,
  323. Specialization::Scalar |
  324. Specialization::Percentage,
  325. true,
  326. true};
  327. SwitchableSetting<u8, false> bg_red{
  328. linkage, 0, "bg_red", Category::Renderer, Specialization::Default, true, true};
  329. SwitchableSetting<u8, false> bg_green{
  330. linkage, 0, "bg_green", Category::Renderer, Specialization::Default, true, true};
  331. SwitchableSetting<u8, false> bg_blue{
  332. linkage, 0, "bg_blue", Category::Renderer, Specialization::Default, true, true};
  333. SwitchableSetting<GpuAccuracy, true> gpu_accuracy{linkage,
  334. #ifdef ANDROID
  335. GpuAccuracy::Normal,
  336. #else
  337. GpuAccuracy::High,
  338. #endif
  339. GpuAccuracy::Normal,
  340. GpuAccuracy::Extreme,
  341. "gpu_accuracy",
  342. Category::RendererAdvanced,
  343. Specialization::Default,
  344. true,
  345. true};
  346. GpuAccuracy current_gpu_accuracy{GpuAccuracy::High};
  347. SwitchableSetting<AnisotropyMode, true> max_anisotropy{linkage,
  348. #ifdef ANDROID
  349. AnisotropyMode::Default,
  350. #else
  351. AnisotropyMode::Automatic,
  352. #endif
  353. AnisotropyMode::Automatic,
  354. AnisotropyMode::X16,
  355. "max_anisotropy",
  356. Category::RendererAdvanced};
  357. SwitchableSetting<AstcRecompression, true> astc_recompression{linkage,
  358. AstcRecompression::Uncompressed,
  359. AstcRecompression::Uncompressed,
  360. AstcRecompression::Bc3,
  361. "astc_recompression",
  362. Category::RendererAdvanced};
  363. SwitchableSetting<VramUsageMode, true> vram_usage_mode{linkage,
  364. VramUsageMode::Conservative,
  365. VramUsageMode::Conservative,
  366. VramUsageMode::Aggressive,
  367. "vram_usage_mode",
  368. Category::RendererAdvanced};
  369. SwitchableSetting<bool> async_presentation{linkage,
  370. #ifdef ANDROID
  371. true,
  372. #else
  373. false,
  374. #endif
  375. "async_presentation", Category::RendererAdvanced};
  376. SwitchableSetting<bool> renderer_force_max_clock{linkage, false, "force_max_clock",
  377. Category::RendererAdvanced};
  378. SwitchableSetting<bool> use_reactive_flushing{linkage,
  379. #ifdef ANDROID
  380. false,
  381. #else
  382. true,
  383. #endif
  384. "use_reactive_flushing",
  385. Category::RendererAdvanced};
  386. SwitchableSetting<bool> use_asynchronous_shaders{linkage, false, "use_asynchronous_shaders",
  387. Category::RendererAdvanced};
  388. SwitchableSetting<bool> use_fast_gpu_time{
  389. linkage, true, "use_fast_gpu_time", Category::RendererAdvanced, Specialization::Default,
  390. true, true};
  391. SwitchableSetting<bool> use_vulkan_driver_pipeline_cache{linkage,
  392. true,
  393. "use_vulkan_driver_pipeline_cache",
  394. Category::RendererAdvanced,
  395. Specialization::Default,
  396. true,
  397. true};
  398. SwitchableSetting<bool> enable_compute_pipelines{linkage, false, "enable_compute_pipelines",
  399. Category::RendererAdvanced};
  400. SwitchableSetting<bool> use_video_framerate{linkage, false, "use_video_framerate",
  401. Category::RendererAdvanced};
  402. SwitchableSetting<bool> barrier_feedback_loops{linkage, true, "barrier_feedback_loops",
  403. Category::RendererAdvanced};
  404. Setting<bool> renderer_debug{linkage, false, "debug", Category::RendererDebug};
  405. Setting<bool> renderer_shader_feedback{linkage, false, "shader_feedback",
  406. Category::RendererDebug};
  407. Setting<bool> enable_nsight_aftermath{linkage, false, "nsight_aftermath",
  408. Category::RendererDebug};
  409. Setting<bool> disable_shader_loop_safety_checks{
  410. linkage, false, "disable_shader_loop_safety_checks", Category::RendererDebug};
  411. Setting<bool> enable_renderdoc_hotkey{linkage, false, "renderdoc_hotkey",
  412. Category::RendererDebug};
  413. Setting<bool> disable_buffer_reorder{linkage, false, "disable_buffer_reorder",
  414. Category::RendererDebug};
  415. // System
  416. SwitchableSetting<Language, true> language_index{linkage,
  417. Language::EnglishAmerican,
  418. Language::Japanese,
  419. Language::PortugueseBrazilian,
  420. "language_index",
  421. Category::System};
  422. SwitchableSetting<Region, true> region_index{linkage, Region::Usa, Region::Japan,
  423. Region::Taiwan, "region_index", Category::System};
  424. SwitchableSetting<TimeZone, true> time_zone_index{linkage, TimeZone::Auto,
  425. TimeZone::Auto, TimeZone::Zulu,
  426. "time_zone_index", Category::System};
  427. // Measured in seconds since epoch
  428. SwitchableSetting<bool> custom_rtc_enabled{
  429. linkage, false, "custom_rtc_enabled", Category::System, Specialization::Paired, true, true};
  430. SwitchableSetting<s64> custom_rtc{
  431. linkage, 0, "custom_rtc", Category::System, Specialization::Time,
  432. false, true, &custom_rtc_enabled};
  433. SwitchableSetting<s64, true> custom_rtc_offset{linkage,
  434. 0,
  435. std::numeric_limits<int>::min(),
  436. std::numeric_limits<int>::max(),
  437. "custom_rtc_offset",
  438. Category::System,
  439. Specialization::Countable,
  440. true,
  441. true};
  442. SwitchableSetting<bool> rng_seed_enabled{
  443. linkage, false, "rng_seed_enabled", Category::System, Specialization::Paired, true, true};
  444. SwitchableSetting<u32> rng_seed{
  445. linkage, 0, "rng_seed", Category::System, Specialization::Hex,
  446. true, true, &rng_seed_enabled};
  447. Setting<std::string> device_name{
  448. linkage, "suyu", "device_name", Category::System, Specialization::Default, true, true};
  449. Setting<s32> current_user{linkage, 0, "current_user", Category::System};
  450. SwitchableSetting<ConsoleMode> use_docked_mode{linkage,
  451. #ifdef ANDROID
  452. ConsoleMode::Handheld,
  453. #else
  454. ConsoleMode::Docked,
  455. #endif
  456. "use_docked_mode",
  457. Category::System,
  458. Specialization::Radio,
  459. true,
  460. true};
  461. // Linux
  462. SwitchableSetting<bool> enable_gamemode{linkage, true, "enable_gamemode", Category::Linux};
  463. // Controls
  464. InputSetting<std::array<PlayerInput, 10>> players;
  465. Setting<bool> enable_raw_input{
  466. linkage, false, "enable_raw_input", Category::Controls, Specialization::Default,
  467. // Only read/write enable_raw_input on Windows platforms
  468. #ifdef _WIN32
  469. true
  470. #else
  471. false
  472. #endif
  473. };
  474. Setting<bool> controller_navigation{linkage, true, "controller_navigation", Category::Controls};
  475. Setting<bool> enable_joycon_driver{linkage, true, "enable_joycon_driver", Category::Controls};
  476. Setting<bool> enable_procon_driver{linkage, false, "enable_procon_driver", Category::Controls};
  477. SwitchableSetting<bool> vibration_enabled{linkage, true, "vibration_enabled",
  478. Category::Controls};
  479. SwitchableSetting<bool> enable_accurate_vibrations{linkage, false, "enable_accurate_vibrations",
  480. Category::Controls};
  481. SwitchableSetting<bool> motion_enabled{linkage, true, "motion_enabled", Category::Controls};
  482. Setting<std::string> udp_input_servers{linkage, "127.0.0.1:26760", "udp_input_servers",
  483. Category::Controls};
  484. Setting<bool> enable_udp_controller{linkage, false, "enable_udp_controller",
  485. Category::Controls};
  486. Setting<bool> pause_tas_on_load{linkage, true, "pause_tas_on_load", Category::Controls};
  487. Setting<bool> tas_enable{linkage, false, "tas_enable", Category::Controls};
  488. Setting<bool> tas_loop{linkage, false, "tas_loop", Category::Controls};
  489. Setting<bool> mouse_panning{
  490. linkage, false, "mouse_panning", Category::Controls, Specialization::Default, false};
  491. Setting<u8, true> mouse_panning_sensitivity{
  492. linkage, 50, 1, 100, "mouse_panning_sensitivity", Category::Controls};
  493. Setting<bool> mouse_enabled{linkage, false, "mouse_enabled", Category::Controls};
  494. Setting<u8, true> mouse_panning_x_sensitivity{
  495. linkage, 50, 1, 200, "mouse_panning_x_sensitivity", Category::Controls};
  496. Setting<u8, true> mouse_panning_y_sensitivity{
  497. linkage, 50, 1, 200, "mouse_panning_y_sensitivity", Category::Controls};
  498. Setting<u8, true> mouse_panning_deadzone_counterweight{
  499. linkage, 20, 0, 100, "mouse_panning_deadzone_counterweight", Category::Controls};
  500. Setting<u8, true> mouse_panning_decay_strength{
  501. linkage, 18, 0, 100, "mouse_panning_decay_strength", Category::Controls};
  502. Setting<u8, true> mouse_panning_min_decay{
  503. linkage, 6, 0, 100, "mouse_panning_min_decay", Category::Controls};
  504. Setting<bool> emulate_analog_keyboard{linkage, false, "emulate_analog_keyboard",
  505. Category::Controls};
  506. Setting<bool> keyboard_enabled{linkage, false, "keyboard_enabled", Category::Controls};
  507. Setting<bool> debug_pad_enabled{linkage, false, "debug_pad_enabled", Category::Controls};
  508. ButtonsRaw debug_pad_buttons;
  509. AnalogsRaw debug_pad_analogs;
  510. TouchscreenInput touchscreen;
  511. Setting<std::string> touch_device{linkage, "min_x:100,min_y:50,max_x:1800,max_y:850",
  512. "touch_device", Category::Controls};
  513. Setting<int> touch_from_button_map_index{linkage, 0, "touch_from_button_map",
  514. Category::Controls};
  515. std::vector<TouchFromButtonMap> touch_from_button_maps;
  516. Setting<bool> enable_ring_controller{linkage, true, "enable_ring_controller",
  517. Category::Controls};
  518. RingconRaw ringcon_analogs;
  519. Setting<bool> enable_ir_sensor{linkage, false, "enable_ir_sensor", Category::Controls};
  520. Setting<std::string> ir_sensor_device{linkage, "auto", "ir_sensor_device", Category::Controls};
  521. Setting<bool> random_amiibo_id{linkage, false, "random_amiibo_id", Category::Controls};
  522. // Data Storage
  523. Setting<bool> use_virtual_sd{linkage, true, "use_virtual_sd", Category::DataStorage};
  524. Setting<bool> gamecard_inserted{linkage, false, "gamecard_inserted", Category::DataStorage};
  525. Setting<bool> gamecard_current_game{linkage, false, "gamecard_current_game",
  526. Category::DataStorage};
  527. Setting<std::string> gamecard_path{linkage, std::string(), "gamecard_path",
  528. Category::DataStorage};
  529. // Debugging
  530. bool record_frame_times;
  531. Setting<bool> use_gdbstub{linkage, false, "use_gdbstub", Category::Debugging};
  532. Setting<u16> gdbstub_port{linkage, 6543, "gdbstub_port", Category::Debugging};
  533. Setting<std::string> program_args{linkage, std::string(), "program_args", Category::Debugging};
  534. Setting<bool> dump_exefs{linkage, false, "dump_exefs", Category::Debugging};
  535. Setting<bool> dump_nso{linkage, false, "dump_nso", Category::Debugging};
  536. Setting<bool> dump_shaders{
  537. linkage, false, "dump_shaders", Category::DebuggingGraphics, Specialization::Default,
  538. false};
  539. Setting<bool> dump_macros{
  540. linkage, false, "dump_macros", Category::DebuggingGraphics, Specialization::Default, false};
  541. Setting<bool> enable_fs_access_log{linkage, false, "enable_fs_access_log", Category::Debugging};
  542. Setting<bool> reporting_services{
  543. linkage, false, "reporting_services", Category::Debugging, Specialization::Default, false};
  544. Setting<bool> quest_flag{linkage, false, "quest_flag", Category::Debugging};
  545. Setting<bool> disable_macro_jit{linkage, false, "disable_macro_jit",
  546. Category::DebuggingGraphics};
  547. Setting<bool> disable_macro_hle{linkage, false, "disable_macro_hle",
  548. Category::DebuggingGraphics};
  549. Setting<bool> extended_logging{
  550. linkage, false, "extended_logging", Category::Debugging, Specialization::Default, false};
  551. Setting<bool> use_debug_asserts{linkage, false, "use_debug_asserts", Category::Debugging};
  552. Setting<bool> use_auto_stub{
  553. linkage, false, "use_auto_stub", Category::Debugging, Specialization::Default, false};
  554. Setting<bool> enable_all_controllers{linkage, false, "enable_all_controllers",
  555. Category::Debugging};
  556. Setting<bool> perform_vulkan_check{linkage, true, "perform_vulkan_check", Category::Debugging};
  557. // Miscellaneous
  558. Setting<std::string> log_filter{linkage, "*:Info", "log_filter", Category::Miscellaneous};
  559. Setting<bool> log_async{linkage, true, "log_async", Category::Miscellaneous};
  560. Setting<bool> use_dev_keys{linkage, false, "use_dev_keys", Category::Miscellaneous};
  561. // Network
  562. Setting<std::string> network_interface{linkage, std::string(), "network_interface",
  563. Category::Network};
  564. // WebService
  565. Setting<std::string> web_api_url{linkage, "https://suyu.dev", "web_api_url",
  566. Category::WebService};
  567. Setting<std::string> suyu_username{linkage, std::string(), "suyu_username",
  568. Category::WebService};
  569. Setting<std::string> suyu_token{linkage, std::string(), "suyu_token", Category::WebService};
  570. // Add-Ons
  571. std::map<u64, std::vector<std::string>> disabled_addons;
  572. };
  573. extern Values values;
  574. void UpdateGPUAccuracy();
  575. bool IsGPULevelExtreme();
  576. bool IsGPULevelHigh();
  577. bool IsFastmemEnabled();
  578. void SetNceEnabled(bool is_64bit);
  579. bool IsNceEnabled();
  580. bool IsDockedMode();
  581. float Volume();
  582. std::string GetTimeZoneString(TimeZone time_zone);
  583. void LogSettings();
  584. void TranslateResolutionInfo(ResolutionSetup setup, ResolutionScalingInfo& info);
  585. void UpdateRescalingInfo();
  586. // Restore the global state of all applicable settings in the Values struct
  587. void RestoreGlobalState(bool is_powered_on);
  588. bool IsConfiguringGlobal();
  589. void SetConfiguringGlobal(bool is_global);
  590. } // namespace Settings