diff options
Diffstat (limited to 'src/core/settings.cpp')
| -rw-r--r-- | src/core/settings.cpp | 77 |
1 files changed, 39 insertions, 38 deletions
diff --git a/src/core/settings.cpp b/src/core/settings.cpp index 64a3c69d3..e8a6f2a6e 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <string_view> | ||
| 6 | |||
| 5 | #include "common/file_util.h" | 7 | #include "common/file_util.h" |
| 6 | #include "core/core.h" | 8 | #include "core/core.h" |
| 7 | #include "core/gdbstub/gdbstub.h" | 9 | #include "core/gdbstub/gdbstub.h" |
| @@ -65,18 +67,18 @@ Values values = {}; | |||
| 65 | bool configuring_global = true; | 67 | bool configuring_global = true; |
| 66 | 68 | ||
| 67 | std::string GetTimeZoneString() { | 69 | std::string GetTimeZoneString() { |
| 68 | static constexpr std::array<const char*, 46> timezones{{ | 70 | static constexpr std::array timezones{ |
| 69 | "auto", "default", "CET", "CST6CDT", "Cuba", "EET", "Egypt", "Eire", | 71 | "auto", "default", "CET", "CST6CDT", "Cuba", "EET", "Egypt", "Eire", |
| 70 | "EST", "EST5EDT", "GB", "GB-Eire", "GMT", "GMT+0", "GMT-0", "GMT0", | 72 | "EST", "EST5EDT", "GB", "GB-Eire", "GMT", "GMT+0", "GMT-0", "GMT0", |
| 71 | "Greenwich", "Hongkong", "HST", "Iceland", "Iran", "Israel", "Jamaica", "Japan", | 73 | "Greenwich", "Hongkong", "HST", "Iceland", "Iran", "Israel", "Jamaica", "Japan", |
| 72 | "Kwajalein", "Libya", "MET", "MST", "MST7MDT", "Navajo", "NZ", "NZ-CHAT", | 74 | "Kwajalein", "Libya", "MET", "MST", "MST7MDT", "Navajo", "NZ", "NZ-CHAT", |
| 73 | "Poland", "Portugal", "PRC", "PST8PDT", "ROC", "ROK", "Singapore", "Turkey", | 75 | "Poland", "Portugal", "PRC", "PST8PDT", "ROC", "ROK", "Singapore", "Turkey", |
| 74 | "UCT", "Universal", "UTC", "W-SU", "WET", "Zulu", | 76 | "UCT", "Universal", "UTC", "W-SU", "WET", "Zulu", |
| 75 | }}; | 77 | }; |
| 76 | |||
| 77 | ASSERT(Settings::values.time_zone_index.GetValue() < timezones.size()); | ||
| 78 | 78 | ||
| 79 | return timezones[Settings::values.time_zone_index.GetValue()]; | 79 | const auto time_zone_index = static_cast<std::size_t>(values.time_zone_index.GetValue()); |
| 80 | ASSERT(time_zone_index < timezones.size()); | ||
| 81 | return timezones[time_zone_index]; | ||
| 80 | } | 82 | } |
| 81 | 83 | ||
| 82 | void Apply() { | 84 | void Apply() { |
| @@ -91,41 +93,40 @@ void Apply() { | |||
| 91 | Service::HID::ReloadInputDevices(); | 93 | Service::HID::ReloadInputDevices(); |
| 92 | } | 94 | } |
| 93 | 95 | ||
| 94 | template <typename T> | ||
| 95 | void LogSetting(const std::string& name, const T& value) { | ||
| 96 | LOG_INFO(Config, "{}: {}", name, value); | ||
| 97 | } | ||
| 98 | |||
| 99 | void LogSettings() { | 96 | void LogSettings() { |
| 97 | const auto log_setting = [](std::string_view name, const auto& value) { | ||
| 98 | LOG_INFO(Config, "{}: {}", name, value); | ||
| 99 | }; | ||
| 100 | |||
| 100 | LOG_INFO(Config, "yuzu Configuration:"); | 101 | LOG_INFO(Config, "yuzu Configuration:"); |
| 101 | LogSetting("Controls_UseDockedMode", Settings::values.use_docked_mode); | 102 | log_setting("Controls_UseDockedMode", values.use_docked_mode); |
| 102 | LogSetting("System_RngSeed", Settings::values.rng_seed.GetValue().value_or(0)); | 103 | log_setting("System_RngSeed", values.rng_seed.GetValue().value_or(0)); |
| 103 | LogSetting("System_CurrentUser", Settings::values.current_user); | 104 | log_setting("System_CurrentUser", values.current_user); |
| 104 | LogSetting("System_LanguageIndex", Settings::values.language_index.GetValue()); | 105 | log_setting("System_LanguageIndex", values.language_index.GetValue()); |
| 105 | LogSetting("System_RegionIndex", Settings::values.region_index.GetValue()); | 106 | log_setting("System_RegionIndex", values.region_index.GetValue()); |
| 106 | LogSetting("System_TimeZoneIndex", Settings::values.time_zone_index.GetValue()); | 107 | log_setting("System_TimeZoneIndex", values.time_zone_index.GetValue()); |
| 107 | LogSetting("Core_UseMultiCore", Settings::values.use_multi_core.GetValue()); | 108 | log_setting("Core_UseMultiCore", values.use_multi_core.GetValue()); |
| 108 | LogSetting("Renderer_UseResolutionFactor", Settings::values.resolution_factor.GetValue()); | 109 | log_setting("Renderer_UseResolutionFactor", values.resolution_factor.GetValue()); |
| 109 | LogSetting("Renderer_UseFrameLimit", Settings::values.use_frame_limit.GetValue()); | 110 | log_setting("Renderer_UseFrameLimit", values.use_frame_limit.GetValue()); |
| 110 | LogSetting("Renderer_FrameLimit", Settings::values.frame_limit.GetValue()); | 111 | log_setting("Renderer_FrameLimit", values.frame_limit.GetValue()); |
| 111 | LogSetting("Renderer_UseDiskShaderCache", Settings::values.use_disk_shader_cache.GetValue()); | 112 | log_setting("Renderer_UseDiskShaderCache", values.use_disk_shader_cache.GetValue()); |
| 112 | LogSetting("Renderer_GPUAccuracyLevel", Settings::values.gpu_accuracy.GetValue()); | 113 | log_setting("Renderer_GPUAccuracyLevel", values.gpu_accuracy.GetValue()); |
| 113 | LogSetting("Renderer_UseAsynchronousGpuEmulation", | 114 | log_setting("Renderer_UseAsynchronousGpuEmulation", |
| 114 | Settings::values.use_asynchronous_gpu_emulation.GetValue()); | 115 | values.use_asynchronous_gpu_emulation.GetValue()); |
| 115 | LogSetting("Renderer_UseVsync", Settings::values.use_vsync.GetValue()); | 116 | log_setting("Renderer_UseVsync", values.use_vsync.GetValue()); |
| 116 | LogSetting("Renderer_UseAssemblyShaders", Settings::values.use_assembly_shaders.GetValue()); | 117 | log_setting("Renderer_UseAssemblyShaders", values.use_assembly_shaders.GetValue()); |
| 117 | LogSetting("Renderer_AnisotropicFilteringLevel", Settings::values.max_anisotropy.GetValue()); | 118 | log_setting("Renderer_AnisotropicFilteringLevel", values.max_anisotropy.GetValue()); |
| 118 | LogSetting("Audio_OutputEngine", Settings::values.sink_id); | 119 | log_setting("Audio_OutputEngine", values.sink_id); |
| 119 | LogSetting("Audio_EnableAudioStretching", Settings::values.enable_audio_stretching.GetValue()); | 120 | log_setting("Audio_EnableAudioStretching", values.enable_audio_stretching.GetValue()); |
| 120 | LogSetting("Audio_OutputDevice", Settings::values.audio_device_id); | 121 | log_setting("Audio_OutputDevice", values.audio_device_id); |
| 121 | LogSetting("DataStorage_UseVirtualSd", Settings::values.use_virtual_sd); | 122 | log_setting("DataStorage_UseVirtualSd", values.use_virtual_sd); |
| 122 | LogSetting("DataStorage_NandDir", FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)); | 123 | log_setting("DataStorage_NandDir", FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)); |
| 123 | LogSetting("DataStorage_SdmcDir", FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)); | 124 | log_setting("DataStorage_SdmcDir", FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)); |
| 124 | LogSetting("Debugging_UseGdbstub", Settings::values.use_gdbstub); | 125 | log_setting("Debugging_UseGdbstub", values.use_gdbstub); |
| 125 | LogSetting("Debugging_GdbstubPort", Settings::values.gdbstub_port); | 126 | log_setting("Debugging_GdbstubPort", values.gdbstub_port); |
| 126 | LogSetting("Debugging_ProgramArgs", Settings::values.program_args); | 127 | log_setting("Debugging_ProgramArgs", values.program_args); |
| 127 | LogSetting("Services_BCATBackend", Settings::values.bcat_backend); | 128 | log_setting("Services_BCATBackend", values.bcat_backend); |
| 128 | LogSetting("Services_BCATBoxcatLocal", Settings::values.bcat_boxcat_local); | 129 | log_setting("Services_BCATBoxcatLocal", values.bcat_boxcat_local); |
| 129 | } | 130 | } |
| 130 | 131 | ||
| 131 | float Volume() { | 132 | float Volume() { |