settings.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  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. // Audio
  120. SwitchableSetting<AudioEngine> sink_id{linkage, AudioEngine::Auto, "output_engine",
  121. Category::Audio, Specialization::RuntimeList};
  122. SwitchableSetting<std::string> audio_output_device_id{
  123. linkage, "auto", "output_device", Category::Audio, Specialization::RuntimeList};
  124. SwitchableSetting<std::string> audio_input_device_id{
  125. linkage, "auto", "input_device", Category::Audio, Specialization::RuntimeList};
  126. SwitchableSetting<AudioMode, true> sound_index{
  127. linkage, AudioMode::Stereo, AudioMode::Mono, AudioMode::Surround,
  128. "sound_index", Category::SystemAudio, Specialization::Default, true,
  129. true};
  130. SwitchableSetting<u8, true> volume{linkage,
  131. 100,
  132. 0,
  133. 200,
  134. "volume",
  135. Category::Audio,
  136. Specialization::Scalar | Specialization::Percentage,
  137. true,
  138. true};
  139. Setting<bool, false> audio_muted{
  140. linkage, false, "audio_muted", Category::Audio, Specialization::Default, true, true};
  141. Setting<bool, false> dump_audio_commands{
  142. linkage, false, "dump_audio_commands", Category::Audio, Specialization::Default, false};
  143. // Core
  144. SwitchableSetting<bool> use_multi_core{linkage, true, "use_multi_core", Category::Core};
  145. SwitchableSetting<MemoryLayout, true> memory_layout_mode{linkage,
  146. MemoryLayout::Memory_4Gb,
  147. MemoryLayout::Memory_4Gb,
  148. MemoryLayout::Memory_8Gb,
  149. "memory_layout_mode",
  150. Category::Core};
  151. SwitchableSetting<bool> use_speed_limit{
  152. linkage, true, "use_speed_limit", Category::Core, Specialization::Paired, false, true};
  153. SwitchableSetting<u16, true> speed_limit{linkage,
  154. 100,
  155. 0,
  156. 9999,
  157. "speed_limit",
  158. Category::Core,
  159. Specialization::Countable | Specialization::Percentage,
  160. true,
  161. true,
  162. &use_speed_limit};
  163. // Cpu
  164. SwitchableSetting<CpuBackend, true> cpu_backend{linkage,
  165. #ifdef HAS_NCE
  166. CpuBackend::Nce,
  167. #else
  168. CpuBackend::Dynarmic,
  169. #endif
  170. CpuBackend::Dynarmic,
  171. #ifdef HAS_NCE
  172. CpuBackend::Nce,
  173. #else
  174. CpuBackend::Dynarmic,
  175. #endif
  176. "cpu_backend",
  177. Category::Cpu};
  178. SwitchableSetting<CpuAccuracy, true> cpu_accuracy{linkage, CpuAccuracy::Auto,
  179. CpuAccuracy::Auto, CpuAccuracy::Paranoid,
  180. "cpu_accuracy", Category::Cpu};
  181. SwitchableSetting<bool> cpu_debug_mode{linkage, false, "cpu_debug_mode", Category::CpuDebug};
  182. Setting<bool> cpuopt_page_tables{linkage, true, "cpuopt_page_tables", Category::CpuDebug};
  183. Setting<bool> cpuopt_block_linking{linkage, true, "cpuopt_block_linking", Category::CpuDebug};
  184. Setting<bool> cpuopt_return_stack_buffer{linkage, true, "cpuopt_return_stack_buffer",
  185. Category::CpuDebug};
  186. Setting<bool> cpuopt_fast_dispatcher{linkage, true, "cpuopt_fast_dispatcher",
  187. Category::CpuDebug};
  188. Setting<bool> cpuopt_context_elimination{linkage, true, "cpuopt_context_elimination",
  189. Category::CpuDebug};
  190. Setting<bool> cpuopt_const_prop{linkage, true, "cpuopt_const_prop", Category::CpuDebug};
  191. Setting<bool> cpuopt_misc_ir{linkage, true, "cpuopt_misc_ir", Category::CpuDebug};
  192. Setting<bool> cpuopt_reduce_misalign_checks{linkage, true, "cpuopt_reduce_misalign_checks",
  193. Category::CpuDebug};
  194. SwitchableSetting<bool> cpuopt_fastmem{linkage, true, "cpuopt_fastmem", Category::CpuDebug};
  195. SwitchableSetting<bool> cpuopt_fastmem_exclusives{linkage, true, "cpuopt_fastmem_exclusives",
  196. Category::CpuDebug};
  197. Setting<bool> cpuopt_recompile_exclusives{linkage, true, "cpuopt_recompile_exclusives",
  198. Category::CpuDebug};
  199. Setting<bool> cpuopt_ignore_memory_aborts{linkage, true, "cpuopt_ignore_memory_aborts",
  200. Category::CpuDebug};
  201. SwitchableSetting<bool> cpuopt_unsafe_unfuse_fma{linkage, true, "cpuopt_unsafe_unfuse_fma",
  202. Category::CpuUnsafe};
  203. SwitchableSetting<bool> cpuopt_unsafe_reduce_fp_error{
  204. linkage, true, "cpuopt_unsafe_reduce_fp_error", Category::CpuUnsafe};
  205. SwitchableSetting<bool> cpuopt_unsafe_ignore_standard_fpcr{
  206. linkage, true, "cpuopt_unsafe_ignore_standard_fpcr", Category::CpuUnsafe};
  207. SwitchableSetting<bool> cpuopt_unsafe_inaccurate_nan{
  208. linkage, true, "cpuopt_unsafe_inaccurate_nan", Category::CpuUnsafe};
  209. SwitchableSetting<bool> cpuopt_unsafe_fastmem_check{
  210. linkage, true, "cpuopt_unsafe_fastmem_check", Category::CpuUnsafe};
  211. SwitchableSetting<bool> cpuopt_unsafe_ignore_global_monitor{
  212. linkage, true, "cpuopt_unsafe_ignore_global_monitor", Category::CpuUnsafe};
  213. // Renderer
  214. SwitchableSetting<RendererBackend, true> renderer_backend{
  215. linkage, RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Null,
  216. "backend", Category::Renderer};
  217. SwitchableSetting<ShaderBackend, true> shader_backend{
  218. linkage, ShaderBackend::Glsl, ShaderBackend::Glsl, ShaderBackend::SpirV,
  219. "shader_backend", Category::Renderer, Specialization::RuntimeList};
  220. SwitchableSetting<int> vulkan_device{linkage, 0, "vulkan_device", Category::Renderer,
  221. Specialization::RuntimeList};
  222. SwitchableSetting<bool> use_disk_shader_cache{linkage, true, "use_disk_shader_cache",
  223. Category::Renderer};
  224. SwitchableSetting<bool> use_asynchronous_gpu_emulation{
  225. linkage, true, "use_asynchronous_gpu_emulation", Category::Renderer};
  226. SwitchableSetting<AstcDecodeMode, true> accelerate_astc{linkage,
  227. #ifdef ANDROID
  228. AstcDecodeMode::Cpu,
  229. #else
  230. AstcDecodeMode::Gpu,
  231. #endif
  232. AstcDecodeMode::Cpu,
  233. AstcDecodeMode::CpuAsynchronous,
  234. "accelerate_astc",
  235. Category::Renderer};
  236. SwitchableSetting<VSyncMode, true> vsync_mode{
  237. linkage, VSyncMode::Fifo, VSyncMode::Immediate, VSyncMode::FifoRelaxed,
  238. "use_vsync", Category::Renderer, Specialization::RuntimeList, true,
  239. true};
  240. SwitchableSetting<NvdecEmulation> nvdec_emulation{linkage, NvdecEmulation::Gpu,
  241. "nvdec_emulation", Category::Renderer};
  242. // *nix platforms may have issues with the borderless windowed fullscreen mode.
  243. // Default to exclusive fullscreen on these platforms for now.
  244. SwitchableSetting<FullscreenMode, true> fullscreen_mode{linkage,
  245. #ifdef _WIN32
  246. FullscreenMode::Borderless,
  247. #else
  248. FullscreenMode::Exclusive,
  249. #endif
  250. FullscreenMode::Borderless,
  251. FullscreenMode::Exclusive,
  252. "fullscreen_mode",
  253. Category::Renderer,
  254. Specialization::Default,
  255. true,
  256. true};
  257. SwitchableSetting<AspectRatio, true> aspect_ratio{linkage,
  258. AspectRatio::R16_9,
  259. AspectRatio::R16_9,
  260. AspectRatio::Stretch,
  261. "aspect_ratio",
  262. Category::Renderer,
  263. Specialization::Default,
  264. true,
  265. true};
  266. ResolutionScalingInfo resolution_info{};
  267. SwitchableSetting<ResolutionSetup> resolution_setup{linkage, ResolutionSetup::Res1X,
  268. "resolution_setup", Category::Renderer};
  269. SwitchableSetting<ScalingFilter> scaling_filter{linkage,
  270. ScalingFilter::Bilinear,
  271. "scaling_filter",
  272. Category::Renderer,
  273. Specialization::Default,
  274. true,
  275. true};
  276. SwitchableSetting<AntiAliasing> anti_aliasing{linkage,
  277. AntiAliasing::None,
  278. "anti_aliasing",
  279. Category::Renderer,
  280. Specialization::Default,
  281. true,
  282. true};
  283. SwitchableSetting<int, true> fsr_sharpening_slider{linkage,
  284. 25,
  285. 0,
  286. 200,
  287. "fsr_sharpening_slider",
  288. Category::Renderer,
  289. Specialization::Scalar |
  290. Specialization::Percentage,
  291. true,
  292. true};
  293. SwitchableSetting<u8, false> bg_red{
  294. linkage, 0, "bg_red", Category::Renderer, Specialization::Default, true, true};
  295. SwitchableSetting<u8, false> bg_green{
  296. linkage, 0, "bg_green", Category::Renderer, Specialization::Default, true, true};
  297. SwitchableSetting<u8, false> bg_blue{
  298. linkage, 0, "bg_blue", Category::Renderer, Specialization::Default, true, true};
  299. SwitchableSetting<GpuAccuracy, true> gpu_accuracy{linkage,
  300. #ifdef ANDROID
  301. GpuAccuracy::Normal,
  302. #else
  303. GpuAccuracy::High,
  304. #endif
  305. GpuAccuracy::Normal,
  306. GpuAccuracy::Extreme,
  307. "gpu_accuracy",
  308. Category::RendererAdvanced,
  309. Specialization::Default,
  310. true,
  311. true};
  312. GpuAccuracy current_gpu_accuracy{GpuAccuracy::High};
  313. SwitchableSetting<AnisotropyMode, true> max_anisotropy{linkage,
  314. #ifdef ANDROID
  315. AnisotropyMode::Default,
  316. #else
  317. AnisotropyMode::Automatic,
  318. #endif
  319. AnisotropyMode::Automatic,
  320. AnisotropyMode::X16,
  321. "max_anisotropy",
  322. Category::RendererAdvanced};
  323. SwitchableSetting<AstcRecompression, true> astc_recompression{linkage,
  324. AstcRecompression::Uncompressed,
  325. AstcRecompression::Uncompressed,
  326. AstcRecompression::Bc3,
  327. "astc_recompression",
  328. Category::RendererAdvanced};
  329. SwitchableSetting<bool> async_presentation{linkage,
  330. #ifdef ANDROID
  331. true,
  332. #else
  333. false,
  334. #endif
  335. "async_presentation", Category::RendererAdvanced};
  336. SwitchableSetting<bool> renderer_force_max_clock{linkage, false, "force_max_clock",
  337. Category::RendererAdvanced};
  338. SwitchableSetting<bool> use_reactive_flushing{linkage,
  339. #ifdef ANDROID
  340. false,
  341. #else
  342. true,
  343. #endif
  344. "use_reactive_flushing",
  345. Category::RendererAdvanced};
  346. SwitchableSetting<bool> use_asynchronous_shaders{linkage, false, "use_asynchronous_shaders",
  347. Category::RendererAdvanced};
  348. SwitchableSetting<bool> use_fast_gpu_time{
  349. linkage, true, "use_fast_gpu_time", Category::RendererAdvanced, Specialization::Default,
  350. true, true};
  351. SwitchableSetting<bool> use_vulkan_driver_pipeline_cache{linkage,
  352. true,
  353. "use_vulkan_driver_pipeline_cache",
  354. Category::RendererAdvanced,
  355. Specialization::Default,
  356. true,
  357. true};
  358. SwitchableSetting<bool> enable_compute_pipelines{linkage, false, "enable_compute_pipelines",
  359. Category::RendererAdvanced};
  360. SwitchableSetting<bool> use_video_framerate{linkage, false, "use_video_framerate",
  361. Category::RendererAdvanced};
  362. SwitchableSetting<bool> barrier_feedback_loops{linkage, true, "barrier_feedback_loops",
  363. Category::RendererAdvanced};
  364. Setting<bool> renderer_debug{linkage, false, "debug", Category::RendererDebug};
  365. Setting<bool> renderer_shader_feedback{linkage, false, "shader_feedback",
  366. Category::RendererDebug};
  367. Setting<bool> enable_nsight_aftermath{linkage, false, "nsight_aftermath",
  368. Category::RendererDebug};
  369. Setting<bool> disable_shader_loop_safety_checks{
  370. linkage, false, "disable_shader_loop_safety_checks", Category::RendererDebug};
  371. Setting<bool> enable_renderdoc_hotkey{linkage, false, "renderdoc_hotkey",
  372. Category::RendererDebug};
  373. // TODO: remove this once AMDVLK supports VK_EXT_depth_bias_control
  374. bool renderer_amdvlk_depth_bias_workaround{};
  375. Setting<bool> disable_buffer_reorder{linkage, false, "disable_buffer_reorder",
  376. Category::RendererDebug};
  377. // System
  378. SwitchableSetting<Language, true> language_index{linkage,
  379. Language::EnglishAmerican,
  380. Language::Japanese,
  381. Language::PortugueseBrazilian,
  382. "language_index",
  383. Category::System};
  384. SwitchableSetting<Region, true> region_index{linkage, Region::Usa, Region::Japan,
  385. Region::Taiwan, "region_index", Category::System};
  386. SwitchableSetting<TimeZone, true> time_zone_index{linkage, TimeZone::Auto,
  387. TimeZone::Auto, TimeZone::Zulu,
  388. "time_zone_index", Category::System};
  389. // Measured in seconds since epoch
  390. SwitchableSetting<bool> custom_rtc_enabled{
  391. linkage, false, "custom_rtc_enabled", Category::System, Specialization::Paired, true, true};
  392. SwitchableSetting<s64> custom_rtc{
  393. linkage, 0, "custom_rtc", Category::System, Specialization::Time,
  394. false, true, &custom_rtc_enabled};
  395. SwitchableSetting<s64, true> custom_rtc_offset{linkage,
  396. 0,
  397. std::numeric_limits<int>::min(),
  398. std::numeric_limits<int>::max(),
  399. "custom_rtc_offset",
  400. Category::System,
  401. Specialization::Countable,
  402. true,
  403. true};
  404. SwitchableSetting<bool> rng_seed_enabled{
  405. linkage, false, "rng_seed_enabled", Category::System, Specialization::Paired, true, true};
  406. SwitchableSetting<u32> rng_seed{
  407. linkage, 0, "rng_seed", Category::System, Specialization::Hex,
  408. true, true, &rng_seed_enabled};
  409. Setting<std::string> device_name{
  410. linkage, "yuzu", "device_name", Category::System, Specialization::Default, true, true};
  411. Setting<s32> current_user{linkage, 0, "current_user", Category::System};
  412. SwitchableSetting<ConsoleMode> use_docked_mode{linkage,
  413. #ifdef ANDROID
  414. ConsoleMode::Handheld,
  415. #else
  416. ConsoleMode::Docked,
  417. #endif
  418. "use_docked_mode",
  419. Category::System,
  420. Specialization::Radio,
  421. true,
  422. true};
  423. // Linux
  424. SwitchableSetting<bool> enable_gamemode{linkage, true, "enable_gamemode", Category::Linux};
  425. // Controls
  426. InputSetting<std::array<PlayerInput, 10>> players;
  427. Setting<bool> enable_raw_input{
  428. linkage, false, "enable_raw_input", Category::Controls, Specialization::Default,
  429. // Only read/write enable_raw_input on Windows platforms
  430. #ifdef _WIN32
  431. true
  432. #else
  433. false
  434. #endif
  435. };
  436. Setting<bool> controller_navigation{linkage, true, "controller_navigation", Category::Controls};
  437. Setting<bool> enable_joycon_driver{linkage, true, "enable_joycon_driver", Category::Controls};
  438. Setting<bool> enable_procon_driver{linkage, false, "enable_procon_driver", Category::Controls};
  439. SwitchableSetting<bool> vibration_enabled{linkage, true, "vibration_enabled",
  440. Category::Controls};
  441. SwitchableSetting<bool> enable_accurate_vibrations{linkage, false, "enable_accurate_vibrations",
  442. Category::Controls};
  443. SwitchableSetting<bool> motion_enabled{linkage, true, "motion_enabled", Category::Controls};
  444. Setting<std::string> udp_input_servers{linkage, "127.0.0.1:26760", "udp_input_servers",
  445. Category::Controls};
  446. Setting<bool> enable_udp_controller{linkage, false, "enable_udp_controller",
  447. Category::Controls};
  448. Setting<bool> pause_tas_on_load{linkage, true, "pause_tas_on_load", Category::Controls};
  449. Setting<bool> tas_enable{linkage, false, "tas_enable", Category::Controls};
  450. Setting<bool> tas_loop{linkage, false, "tas_loop", Category::Controls};
  451. Setting<bool> mouse_panning{
  452. linkage, false, "mouse_panning", Category::Controls, Specialization::Default, false};
  453. Setting<u8, true> mouse_panning_sensitivity{
  454. linkage, 50, 1, 100, "mouse_panning_sensitivity", Category::Controls};
  455. Setting<bool> mouse_enabled{linkage, false, "mouse_enabled", Category::Controls};
  456. Setting<u8, true> mouse_panning_x_sensitivity{
  457. linkage, 50, 1, 100, "mouse_panning_x_sensitivity", Category::Controls};
  458. Setting<u8, true> mouse_panning_y_sensitivity{
  459. linkage, 50, 1, 100, "mouse_panning_y_sensitivity", Category::Controls};
  460. Setting<u8, true> mouse_panning_deadzone_counterweight{
  461. linkage, 20, 0, 100, "mouse_panning_deadzone_counterweight", Category::Controls};
  462. Setting<u8, true> mouse_panning_decay_strength{
  463. linkage, 18, 0, 100, "mouse_panning_decay_strength", Category::Controls};
  464. Setting<u8, true> mouse_panning_min_decay{
  465. linkage, 6, 0, 100, "mouse_panning_min_decay", Category::Controls};
  466. Setting<bool> emulate_analog_keyboard{linkage, false, "emulate_analog_keyboard",
  467. Category::Controls};
  468. Setting<bool> keyboard_enabled{linkage, false, "keyboard_enabled", Category::Controls};
  469. Setting<bool> debug_pad_enabled{linkage, false, "debug_pad_enabled", Category::Controls};
  470. ButtonsRaw debug_pad_buttons;
  471. AnalogsRaw debug_pad_analogs;
  472. TouchscreenInput touchscreen;
  473. Setting<std::string> touch_device{linkage, "min_x:100,min_y:50,max_x:1800,max_y:850",
  474. "touch_device", Category::Controls};
  475. Setting<int> touch_from_button_map_index{linkage, 0, "touch_from_button_map",
  476. Category::Controls};
  477. std::vector<TouchFromButtonMap> touch_from_button_maps;
  478. Setting<bool> enable_ring_controller{linkage, true, "enable_ring_controller",
  479. Category::Controls};
  480. RingconRaw ringcon_analogs;
  481. Setting<bool> enable_ir_sensor{linkage, false, "enable_ir_sensor", Category::Controls};
  482. Setting<std::string> ir_sensor_device{linkage, "auto", "ir_sensor_device", Category::Controls};
  483. Setting<bool> random_amiibo_id{linkage, false, "random_amiibo_id", Category::Controls};
  484. // Data Storage
  485. Setting<bool> use_virtual_sd{linkage, true, "use_virtual_sd", Category::DataStorage};
  486. Setting<bool> gamecard_inserted{linkage, false, "gamecard_inserted", Category::DataStorage};
  487. Setting<bool> gamecard_current_game{linkage, false, "gamecard_current_game",
  488. Category::DataStorage};
  489. Setting<std::string> gamecard_path{linkage, std::string(), "gamecard_path",
  490. Category::DataStorage};
  491. // Debugging
  492. bool record_frame_times;
  493. Setting<bool> use_gdbstub{linkage, false, "use_gdbstub", Category::Debugging};
  494. Setting<u16> gdbstub_port{linkage, 6543, "gdbstub_port", Category::Debugging};
  495. Setting<std::string> program_args{linkage, std::string(), "program_args", Category::Debugging};
  496. Setting<bool> dump_exefs{linkage, false, "dump_exefs", Category::Debugging};
  497. Setting<bool> dump_nso{linkage, false, "dump_nso", Category::Debugging};
  498. Setting<bool> dump_shaders{
  499. linkage, false, "dump_shaders", Category::DebuggingGraphics, Specialization::Default,
  500. false};
  501. Setting<bool> dump_macros{
  502. linkage, false, "dump_macros", Category::DebuggingGraphics, Specialization::Default, false};
  503. Setting<bool> enable_fs_access_log{linkage, false, "enable_fs_access_log", Category::Debugging};
  504. Setting<bool> reporting_services{
  505. linkage, false, "reporting_services", Category::Debugging, Specialization::Default, false};
  506. Setting<bool> quest_flag{linkage, false, "quest_flag", Category::Debugging};
  507. Setting<bool> disable_macro_jit{linkage, false, "disable_macro_jit",
  508. Category::DebuggingGraphics};
  509. Setting<bool> disable_macro_hle{linkage, false, "disable_macro_hle",
  510. Category::DebuggingGraphics};
  511. Setting<bool> extended_logging{
  512. linkage, false, "extended_logging", Category::Debugging, Specialization::Default, false};
  513. Setting<bool> use_debug_asserts{linkage, false, "use_debug_asserts", Category::Debugging};
  514. Setting<bool> use_auto_stub{
  515. linkage, false, "use_auto_stub", Category::Debugging, Specialization::Default, false};
  516. Setting<bool> enable_all_controllers{linkage, false, "enable_all_controllers",
  517. Category::Debugging};
  518. Setting<bool> perform_vulkan_check{linkage, true, "perform_vulkan_check", Category::Debugging};
  519. // Miscellaneous
  520. Setting<std::string> log_filter{linkage, "*:Info", "log_filter", Category::Miscellaneous};
  521. Setting<bool> use_dev_keys{linkage, false, "use_dev_keys", Category::Miscellaneous};
  522. // Network
  523. Setting<std::string> network_interface{linkage, std::string(), "network_interface",
  524. Category::Network};
  525. // WebService
  526. Setting<bool> enable_telemetry{linkage, true, "enable_telemetry", Category::WebService};
  527. Setting<std::string> web_api_url{linkage, "https://api.yuzu-emu.org", "web_api_url",
  528. Category::WebService};
  529. Setting<std::string> yuzu_username{linkage, std::string(), "yuzu_username",
  530. Category::WebService};
  531. Setting<std::string> yuzu_token{linkage, std::string(), "yuzu_token", Category::WebService};
  532. // Add-Ons
  533. std::map<u64, std::vector<std::string>> disabled_addons;
  534. };
  535. extern Values values;
  536. void UpdateGPUAccuracy();
  537. bool IsGPULevelExtreme();
  538. bool IsGPULevelHigh();
  539. bool IsFastmemEnabled();
  540. void SetNceEnabled(bool is_64bit);
  541. bool IsNceEnabled();
  542. bool IsDockedMode();
  543. float Volume();
  544. std::string GetTimeZoneString(TimeZone time_zone);
  545. void LogSettings();
  546. void TranslateResolutionInfo(ResolutionSetup setup, ResolutionScalingInfo& info);
  547. void UpdateRescalingInfo();
  548. // Restore the global state of all applicable settings in the Values struct
  549. void RestoreGlobalState(bool is_powered_on);
  550. bool IsConfiguringGlobal();
  551. void SetConfiguringGlobal(bool is_global);
  552. } // namespace Settings