diff options
Diffstat (limited to 'src/core/settings.cpp')
| -rw-r--r-- | src/core/settings.cpp | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/src/core/settings.cpp b/src/core/settings.cpp index 28d3f9099..39306509a 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp | |||
| @@ -4,9 +4,10 @@ | |||
| 4 | 4 | ||
| 5 | #include <string_view> | 5 | #include <string_view> |
| 6 | 6 | ||
| 7 | #include "common/assert.h" | ||
| 7 | #include "common/file_util.h" | 8 | #include "common/file_util.h" |
| 9 | #include "common/logging/log.h" | ||
| 8 | #include "core/core.h" | 10 | #include "core/core.h" |
| 9 | #include "core/gdbstub/gdbstub.h" | ||
| 10 | #include "core/hle/service/hid/hid.h" | 11 | #include "core/hle/service/hid/hid.h" |
| 11 | #include "core/settings.h" | 12 | #include "core/settings.h" |
| 12 | #include "video_core/renderer_base.h" | 13 | #include "video_core/renderer_base.h" |
| @@ -14,7 +15,7 @@ | |||
| 14 | namespace Settings { | 15 | namespace Settings { |
| 15 | 16 | ||
| 16 | Values values = {}; | 17 | Values values = {}; |
| 17 | bool configuring_global = true; | 18 | static bool configuring_global = true; |
| 18 | 19 | ||
| 19 | std::string GetTimeZoneString() { | 20 | std::string GetTimeZoneString() { |
| 20 | static constexpr std::array timezones{ | 21 | static constexpr std::array timezones{ |
| @@ -31,13 +32,9 @@ std::string GetTimeZoneString() { | |||
| 31 | return timezones[time_zone_index]; | 32 | return timezones[time_zone_index]; |
| 32 | } | 33 | } |
| 33 | 34 | ||
| 34 | void Apply() { | 35 | void Apply(Core::System& system) { |
| 35 | GDBStub::SetServerPort(values.gdbstub_port); | 36 | if (system.IsPoweredOn()) { |
| 36 | GDBStub::ToggleServer(values.use_gdbstub); | 37 | system.Renderer().RefreshBaseSettings(); |
| 37 | |||
| 38 | auto& system_instance = Core::System::GetInstance(); | ||
| 39 | if (system_instance.IsPoweredOn()) { | ||
| 40 | system_instance.Renderer().RefreshBaseSettings(); | ||
| 41 | } | 38 | } |
| 42 | 39 | ||
| 43 | Service::HID::ReloadInputDevices(); | 40 | Service::HID::ReloadInputDevices(); |
| @@ -49,13 +46,14 @@ void LogSettings() { | |||
| 49 | }; | 46 | }; |
| 50 | 47 | ||
| 51 | LOG_INFO(Config, "yuzu Configuration:"); | 48 | LOG_INFO(Config, "yuzu Configuration:"); |
| 52 | log_setting("Controls_UseDockedMode", values.use_docked_mode); | 49 | log_setting("Controls_UseDockedMode", values.use_docked_mode.GetValue()); |
| 53 | log_setting("System_RngSeed", values.rng_seed.GetValue().value_or(0)); | 50 | log_setting("System_RngSeed", values.rng_seed.GetValue().value_or(0)); |
| 54 | log_setting("System_CurrentUser", values.current_user); | 51 | log_setting("System_CurrentUser", values.current_user); |
| 55 | log_setting("System_LanguageIndex", values.language_index.GetValue()); | 52 | log_setting("System_LanguageIndex", values.language_index.GetValue()); |
| 56 | log_setting("System_RegionIndex", values.region_index.GetValue()); | 53 | log_setting("System_RegionIndex", values.region_index.GetValue()); |
| 57 | log_setting("System_TimeZoneIndex", values.time_zone_index.GetValue()); | 54 | log_setting("System_TimeZoneIndex", values.time_zone_index.GetValue()); |
| 58 | log_setting("Core_UseMultiCore", values.use_multi_core.GetValue()); | 55 | log_setting("Core_UseMultiCore", values.use_multi_core.GetValue()); |
| 56 | log_setting("CPU_Accuracy", values.cpu_accuracy); | ||
| 59 | log_setting("Renderer_UseResolutionFactor", values.resolution_factor.GetValue()); | 57 | log_setting("Renderer_UseResolutionFactor", values.resolution_factor.GetValue()); |
| 60 | log_setting("Renderer_UseFrameLimit", values.use_frame_limit.GetValue()); | 58 | log_setting("Renderer_UseFrameLimit", values.use_frame_limit.GetValue()); |
| 61 | log_setting("Renderer_FrameLimit", values.frame_limit.GetValue()); | 59 | log_setting("Renderer_FrameLimit", values.frame_limit.GetValue()); |
| @@ -63,6 +61,7 @@ void LogSettings() { | |||
| 63 | log_setting("Renderer_GPUAccuracyLevel", values.gpu_accuracy.GetValue()); | 61 | log_setting("Renderer_GPUAccuracyLevel", values.gpu_accuracy.GetValue()); |
| 64 | log_setting("Renderer_UseAsynchronousGpuEmulation", | 62 | log_setting("Renderer_UseAsynchronousGpuEmulation", |
| 65 | values.use_asynchronous_gpu_emulation.GetValue()); | 63 | values.use_asynchronous_gpu_emulation.GetValue()); |
| 64 | log_setting("Renderer_UseNvdecEmulation", values.use_nvdec_emulation.GetValue()); | ||
| 66 | log_setting("Renderer_UseVsync", values.use_vsync.GetValue()); | 65 | log_setting("Renderer_UseVsync", values.use_vsync.GetValue()); |
| 67 | log_setting("Renderer_UseAssemblyShaders", values.use_assembly_shaders.GetValue()); | 66 | log_setting("Renderer_UseAssemblyShaders", values.use_assembly_shaders.GetValue()); |
| 68 | log_setting("Renderer_UseAsynchronousShaders", values.use_asynchronous_shaders.GetValue()); | 67 | log_setting("Renderer_UseAsynchronousShaders", values.use_asynchronous_shaders.GetValue()); |
| @@ -73,18 +72,17 @@ void LogSettings() { | |||
| 73 | log_setting("DataStorage_UseVirtualSd", values.use_virtual_sd); | 72 | log_setting("DataStorage_UseVirtualSd", values.use_virtual_sd); |
| 74 | log_setting("DataStorage_NandDir", Common::FS::GetUserPath(Common::FS::UserPath::NANDDir)); | 73 | log_setting("DataStorage_NandDir", Common::FS::GetUserPath(Common::FS::UserPath::NANDDir)); |
| 75 | log_setting("DataStorage_SdmcDir", Common::FS::GetUserPath(Common::FS::UserPath::SDMCDir)); | 74 | log_setting("DataStorage_SdmcDir", Common::FS::GetUserPath(Common::FS::UserPath::SDMCDir)); |
| 76 | log_setting("Debugging_UseGdbstub", values.use_gdbstub); | ||
| 77 | log_setting("Debugging_GdbstubPort", values.gdbstub_port); | ||
| 78 | log_setting("Debugging_ProgramArgs", values.program_args); | 75 | log_setting("Debugging_ProgramArgs", values.program_args); |
| 79 | log_setting("Services_BCATBackend", values.bcat_backend); | 76 | log_setting("Services_BCATBackend", values.bcat_backend); |
| 80 | log_setting("Services_BCATBoxcatLocal", values.bcat_boxcat_local); | 77 | log_setting("Services_BCATBoxcatLocal", values.bcat_boxcat_local); |
| 81 | } | 78 | } |
| 82 | 79 | ||
| 83 | float Volume() { | 80 | bool IsConfiguringGlobal() { |
| 84 | if (values.audio_muted) { | 81 | return configuring_global; |
| 85 | return 0.0f; | 82 | } |
| 86 | } | 83 | |
| 87 | return values.volume.GetValue(); | 84 | void SetConfiguringGlobal(bool is_global) { |
| 85 | configuring_global = is_global; | ||
| 88 | } | 86 | } |
| 89 | 87 | ||
| 90 | bool IsGPULevelExtreme() { | 88 | bool IsGPULevelExtreme() { |
| @@ -96,9 +94,16 @@ bool IsGPULevelHigh() { | |||
| 96 | values.gpu_accuracy.GetValue() == GPUAccuracy::High; | 94 | values.gpu_accuracy.GetValue() == GPUAccuracy::High; |
| 97 | } | 95 | } |
| 98 | 96 | ||
| 99 | void RestoreGlobalState() { | 97 | float Volume() { |
| 98 | if (values.audio_muted) { | ||
| 99 | return 0.0f; | ||
| 100 | } | ||
| 101 | return values.volume.GetValue(); | ||
| 102 | } | ||
| 103 | |||
| 104 | void RestoreGlobalState(bool is_powered_on) { | ||
| 100 | // If a game is running, DO NOT restore the global settings state | 105 | // If a game is running, DO NOT restore the global settings state |
| 101 | if (Core::System::GetInstance().IsPoweredOn()) { | 106 | if (is_powered_on) { |
| 102 | return; | 107 | return; |
| 103 | } | 108 | } |
| 104 | 109 | ||
| @@ -119,6 +124,7 @@ void RestoreGlobalState() { | |||
| 119 | values.use_disk_shader_cache.SetGlobal(true); | 124 | values.use_disk_shader_cache.SetGlobal(true); |
| 120 | values.gpu_accuracy.SetGlobal(true); | 125 | values.gpu_accuracy.SetGlobal(true); |
| 121 | values.use_asynchronous_gpu_emulation.SetGlobal(true); | 126 | values.use_asynchronous_gpu_emulation.SetGlobal(true); |
| 127 | values.use_nvdec_emulation.SetGlobal(true); | ||
| 122 | values.use_vsync.SetGlobal(true); | 128 | values.use_vsync.SetGlobal(true); |
| 123 | values.use_assembly_shaders.SetGlobal(true); | 129 | values.use_assembly_shaders.SetGlobal(true); |
| 124 | values.use_asynchronous_shaders.SetGlobal(true); | 130 | values.use_asynchronous_shaders.SetGlobal(true); |
| @@ -134,11 +140,12 @@ void RestoreGlobalState() { | |||
| 134 | values.rng_seed.SetGlobal(true); | 140 | values.rng_seed.SetGlobal(true); |
| 135 | values.custom_rtc.SetGlobal(true); | 141 | values.custom_rtc.SetGlobal(true); |
| 136 | values.sound_index.SetGlobal(true); | 142 | values.sound_index.SetGlobal(true); |
| 137 | } | ||
| 138 | 143 | ||
| 139 | void Sanitize() { | 144 | // Controls |
| 140 | values.use_asynchronous_gpu_emulation.SetValue( | 145 | values.players.SetGlobal(true); |
| 141 | values.use_asynchronous_gpu_emulation.GetValue() || values.use_multi_core.GetValue()); | 146 | values.use_docked_mode.SetGlobal(true); |
| 147 | values.vibration_enabled.SetGlobal(true); | ||
| 148 | values.motion_enabled.SetGlobal(true); | ||
| 142 | } | 149 | } |
| 143 | 150 | ||
| 144 | } // namespace Settings | 151 | } // namespace Settings |