diff options
Diffstat (limited to 'src/common/settings.cpp')
| -rw-r--r-- | src/common/settings.cpp | 58 |
1 files changed, 43 insertions, 15 deletions
diff --git a/src/common/settings.cpp b/src/common/settings.cpp index b1a2aa8b2..66dffc9bf 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp | |||
| @@ -1,12 +1,16 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #if __cpp_lib_chrono >= 201907L | ||
| 5 | #include <chrono> | ||
| 6 | #endif | ||
| 4 | #include <string_view> | 7 | #include <string_view> |
| 5 | 8 | ||
| 6 | #include "common/assert.h" | 9 | #include "common/assert.h" |
| 7 | #include "common/fs/path_util.h" | 10 | #include "common/fs/path_util.h" |
| 8 | #include "common/logging/log.h" | 11 | #include "common/logging/log.h" |
| 9 | #include "common/settings.h" | 12 | #include "common/settings.h" |
| 13 | #include "common/time_zone.h" | ||
| 10 | 14 | ||
| 11 | namespace Settings { | 15 | namespace Settings { |
| 12 | 16 | ||
| @@ -14,18 +18,23 @@ Values values; | |||
| 14 | static bool configuring_global = true; | 18 | static bool configuring_global = true; |
| 15 | 19 | ||
| 16 | std::string GetTimeZoneString() { | 20 | std::string GetTimeZoneString() { |
| 17 | static constexpr std::array timezones{ | ||
| 18 | "auto", "default", "CET", "CST6CDT", "Cuba", "EET", "Egypt", "Eire", | ||
| 19 | "EST", "EST5EDT", "GB", "GB-Eire", "GMT", "GMT+0", "GMT-0", "GMT0", | ||
| 20 | "Greenwich", "Hongkong", "HST", "Iceland", "Iran", "Israel", "Jamaica", "Japan", | ||
| 21 | "Kwajalein", "Libya", "MET", "MST", "MST7MDT", "Navajo", "NZ", "NZ-CHAT", | ||
| 22 | "Poland", "Portugal", "PRC", "PST8PDT", "ROC", "ROK", "Singapore", "Turkey", | ||
| 23 | "UCT", "Universal", "UTC", "W-SU", "WET", "Zulu", | ||
| 24 | }; | ||
| 25 | |||
| 26 | const auto time_zone_index = static_cast<std::size_t>(values.time_zone_index.GetValue()); | 21 | const auto time_zone_index = static_cast<std::size_t>(values.time_zone_index.GetValue()); |
| 27 | ASSERT(time_zone_index < timezones.size()); | 22 | ASSERT(time_zone_index < Common::TimeZone::GetTimeZoneStrings().size()); |
| 28 | return timezones[time_zone_index]; | 23 | |
| 24 | std::string location_name; | ||
| 25 | if (time_zone_index == 0) { // Auto | ||
| 26 | #if __cpp_lib_chrono >= 201907L | ||
| 27 | const struct std::chrono::tzdb& time_zone_data = std::chrono::get_tzdb(); | ||
| 28 | const std::chrono::time_zone* current_zone = time_zone_data.current_zone(); | ||
| 29 | std::string_view current_zone_name = current_zone->name(); | ||
| 30 | location_name = current_zone_name; | ||
| 31 | #else | ||
| 32 | location_name = Common::TimeZone::FindSystemTimeZone(); | ||
| 33 | #endif | ||
| 34 | } else { | ||
| 35 | location_name = Common::TimeZone::GetTimeZoneStrings()[time_zone_index]; | ||
| 36 | } | ||
| 37 | return location_name; | ||
| 29 | } | 38 | } |
| 30 | 39 | ||
| 31 | void LogSettings() { | 40 | void LogSettings() { |
| @@ -45,6 +54,7 @@ void LogSettings() { | |||
| 45 | log_setting("System_LanguageIndex", values.language_index.GetValue()); | 54 | log_setting("System_LanguageIndex", values.language_index.GetValue()); |
| 46 | log_setting("System_RegionIndex", values.region_index.GetValue()); | 55 | log_setting("System_RegionIndex", values.region_index.GetValue()); |
| 47 | log_setting("System_TimeZoneIndex", values.time_zone_index.GetValue()); | 56 | log_setting("System_TimeZoneIndex", values.time_zone_index.GetValue()); |
| 57 | log_setting("System_UnsafeMemoryLayout", values.use_unsafe_extended_memory_layout.GetValue()); | ||
| 48 | log_setting("Core_UseMultiCore", values.use_multi_core.GetValue()); | 58 | log_setting("Core_UseMultiCore", values.use_multi_core.GetValue()); |
| 49 | log_setting("CPU_Accuracy", values.cpu_accuracy.GetValue()); | 59 | log_setting("CPU_Accuracy", values.cpu_accuracy.GetValue()); |
| 50 | log_setting("Renderer_UseResolutionScaling", values.resolution_setup.GetValue()); | 60 | log_setting("Renderer_UseResolutionScaling", values.resolution_setup.GetValue()); |
| @@ -59,7 +69,10 @@ void LogSettings() { | |||
| 59 | values.use_asynchronous_gpu_emulation.GetValue()); | 69 | values.use_asynchronous_gpu_emulation.GetValue()); |
| 60 | log_setting("Renderer_NvdecEmulation", values.nvdec_emulation.GetValue()); | 70 | log_setting("Renderer_NvdecEmulation", values.nvdec_emulation.GetValue()); |
| 61 | log_setting("Renderer_AccelerateASTC", values.accelerate_astc.GetValue()); | 71 | log_setting("Renderer_AccelerateASTC", values.accelerate_astc.GetValue()); |
| 62 | log_setting("Renderer_UseVsync", values.use_vsync.GetValue()); | 72 | log_setting("Renderer_AsyncASTC", values.async_astc.GetValue()); |
| 73 | log_setting("Renderer_AstcRecompression", values.astc_recompression.GetValue()); | ||
| 74 | log_setting("Renderer_UseVsync", values.vsync_mode.GetValue()); | ||
| 75 | log_setting("Renderer_UseReactiveFlushing", values.use_reactive_flushing.GetValue()); | ||
| 63 | log_setting("Renderer_ShaderBackend", values.shader_backend.GetValue()); | 76 | log_setting("Renderer_ShaderBackend", values.shader_backend.GetValue()); |
| 64 | log_setting("Renderer_UseAsynchronousShaders", values.use_asynchronous_shaders.GetValue()); | 77 | log_setting("Renderer_UseAsynchronousShaders", values.use_asynchronous_shaders.GetValue()); |
| 65 | log_setting("Renderer_AnisotropicFilteringLevel", values.max_anisotropy.GetValue()); | 78 | log_setting("Renderer_AnisotropicFilteringLevel", values.max_anisotropy.GetValue()); |
| @@ -76,6 +89,13 @@ void LogSettings() { | |||
| 76 | log_setting("Debugging_GDBStub", values.use_gdbstub.GetValue()); | 89 | log_setting("Debugging_GDBStub", values.use_gdbstub.GetValue()); |
| 77 | log_setting("Input_EnableMotion", values.motion_enabled.GetValue()); | 90 | log_setting("Input_EnableMotion", values.motion_enabled.GetValue()); |
| 78 | log_setting("Input_EnableVibration", values.vibration_enabled.GetValue()); | 91 | log_setting("Input_EnableVibration", values.vibration_enabled.GetValue()); |
| 92 | log_setting("Input_EnableTouch", values.touchscreen.enabled); | ||
| 93 | log_setting("Input_EnableMouse", values.mouse_enabled.GetValue()); | ||
| 94 | log_setting("Input_EnableKeyboard", values.keyboard_enabled.GetValue()); | ||
| 95 | log_setting("Input_EnableRingController", values.enable_ring_controller.GetValue()); | ||
| 96 | log_setting("Input_EnableIrSensor", values.enable_ir_sensor.GetValue()); | ||
| 97 | log_setting("Input_EnableCustomJoycon", values.enable_joycon_driver.GetValue()); | ||
| 98 | log_setting("Input_EnableCustomProController", values.enable_procon_driver.GetValue()); | ||
| 79 | log_setting("Input_EnableRawInput", values.enable_raw_input.GetValue()); | 99 | log_setting("Input_EnableRawInput", values.enable_raw_input.GetValue()); |
| 80 | } | 100 | } |
| 81 | 101 | ||
| @@ -183,7 +203,7 @@ void RestoreGlobalState(bool is_powered_on) { | |||
| 183 | 203 | ||
| 184 | // Core | 204 | // Core |
| 185 | values.use_multi_core.SetGlobal(true); | 205 | values.use_multi_core.SetGlobal(true); |
| 186 | values.use_extended_memory_layout.SetGlobal(true); | 206 | values.use_unsafe_extended_memory_layout.SetGlobal(true); |
| 187 | 207 | ||
| 188 | // CPU | 208 | // CPU |
| 189 | values.cpu_accuracy.SetGlobal(true); | 209 | values.cpu_accuracy.SetGlobal(true); |
| @@ -197,9 +217,14 @@ void RestoreGlobalState(bool is_powered_on) { | |||
| 197 | // Renderer | 217 | // Renderer |
| 198 | values.fsr_sharpening_slider.SetGlobal(true); | 218 | values.fsr_sharpening_slider.SetGlobal(true); |
| 199 | values.renderer_backend.SetGlobal(true); | 219 | values.renderer_backend.SetGlobal(true); |
| 220 | values.async_presentation.SetGlobal(true); | ||
| 200 | values.renderer_force_max_clock.SetGlobal(true); | 221 | values.renderer_force_max_clock.SetGlobal(true); |
| 201 | values.vulkan_device.SetGlobal(true); | 222 | values.vulkan_device.SetGlobal(true); |
| 223 | values.fullscreen_mode.SetGlobal(true); | ||
| 202 | values.aspect_ratio.SetGlobal(true); | 224 | values.aspect_ratio.SetGlobal(true); |
| 225 | values.resolution_setup.SetGlobal(true); | ||
| 226 | values.scaling_filter.SetGlobal(true); | ||
| 227 | values.anti_aliasing.SetGlobal(true); | ||
| 203 | values.max_anisotropy.SetGlobal(true); | 228 | values.max_anisotropy.SetGlobal(true); |
| 204 | values.use_speed_limit.SetGlobal(true); | 229 | values.use_speed_limit.SetGlobal(true); |
| 205 | values.speed_limit.SetGlobal(true); | 230 | values.speed_limit.SetGlobal(true); |
| @@ -208,15 +233,18 @@ void RestoreGlobalState(bool is_powered_on) { | |||
| 208 | values.use_asynchronous_gpu_emulation.SetGlobal(true); | 233 | values.use_asynchronous_gpu_emulation.SetGlobal(true); |
| 209 | values.nvdec_emulation.SetGlobal(true); | 234 | values.nvdec_emulation.SetGlobal(true); |
| 210 | values.accelerate_astc.SetGlobal(true); | 235 | values.accelerate_astc.SetGlobal(true); |
| 211 | values.use_vsync.SetGlobal(true); | 236 | values.async_astc.SetGlobal(true); |
| 237 | values.astc_recompression.SetGlobal(true); | ||
| 238 | values.use_reactive_flushing.SetGlobal(true); | ||
| 212 | values.shader_backend.SetGlobal(true); | 239 | values.shader_backend.SetGlobal(true); |
| 213 | values.use_asynchronous_shaders.SetGlobal(true); | 240 | values.use_asynchronous_shaders.SetGlobal(true); |
| 214 | values.use_fast_gpu_time.SetGlobal(true); | 241 | values.use_fast_gpu_time.SetGlobal(true); |
| 215 | values.use_pessimistic_flushes.SetGlobal(true); | ||
| 216 | values.use_vulkan_driver_pipeline_cache.SetGlobal(true); | 242 | values.use_vulkan_driver_pipeline_cache.SetGlobal(true); |
| 217 | values.bg_red.SetGlobal(true); | 243 | values.bg_red.SetGlobal(true); |
| 218 | values.bg_green.SetGlobal(true); | 244 | values.bg_green.SetGlobal(true); |
| 219 | values.bg_blue.SetGlobal(true); | 245 | values.bg_blue.SetGlobal(true); |
| 246 | values.enable_compute_pipelines.SetGlobal(true); | ||
| 247 | values.use_video_framerate.SetGlobal(true); | ||
| 220 | 248 | ||
| 221 | // System | 249 | // System |
| 222 | values.language_index.SetGlobal(true); | 250 | values.language_index.SetGlobal(true); |