settings.h 34 KB

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