diff options
| author | 2020-11-04 04:16:34 -0500 | |
|---|---|---|
| committer | 2020-11-04 04:16:37 -0500 | |
| commit | 7aae6d6d2bd9784cba5df5b98cd29198456dcbeb (patch) | |
| tree | ce40aa9bdfb1a7e6c1827681b68dee50c6f47623 /src/core/settings.cpp | |
| parent | Merge pull request #4887 from lioncash/common-build (diff) | |
| download | yuzu-7aae6d6d2bd9784cba5df5b98cd29198456dcbeb.tar.gz yuzu-7aae6d6d2bd9784cba5df5b98cd29198456dcbeb.tar.xz yuzu-7aae6d6d2bd9784cba5df5b98cd29198456dcbeb.zip | |
core/settings: Move configuring_global behind an API
Rather than have directly modified global state here, we can make it an
implementation detail and have an interface that changes are queried
through.
Diffstat (limited to 'src/core/settings.cpp')
| -rw-r--r-- | src/core/settings.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/core/settings.cpp b/src/core/settings.cpp index e14c02045..a99d3cf5a 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | namespace Settings { | 14 | namespace Settings { |
| 15 | 15 | ||
| 16 | Values values = {}; | 16 | Values values = {}; |
| 17 | bool configuring_global = true; | 17 | static bool configuring_global = true; |
| 18 | 18 | ||
| 19 | std::string GetTimeZoneString() { | 19 | std::string GetTimeZoneString() { |
| 20 | static constexpr std::array timezones{ | 20 | static constexpr std::array timezones{ |
| @@ -81,11 +81,12 @@ void LogSettings() { | |||
| 81 | log_setting("Services_BCATBoxcatLocal", values.bcat_boxcat_local); | 81 | log_setting("Services_BCATBoxcatLocal", values.bcat_boxcat_local); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | float Volume() { | 84 | bool IsConfiguringGlobal() { |
| 85 | if (values.audio_muted) { | 85 | return configuring_global; |
| 86 | return 0.0f; | 86 | } |
| 87 | } | 87 | |
| 88 | return values.volume.GetValue(); | 88 | void SetConfiguringGlobal(bool is_global) { |
| 89 | configuring_global = is_global; | ||
| 89 | } | 90 | } |
| 90 | 91 | ||
| 91 | bool IsGPULevelExtreme() { | 92 | bool IsGPULevelExtreme() { |
| @@ -97,6 +98,13 @@ bool IsGPULevelHigh() { | |||
| 97 | values.gpu_accuracy.GetValue() == GPUAccuracy::High; | 98 | values.gpu_accuracy.GetValue() == GPUAccuracy::High; |
| 98 | } | 99 | } |
| 99 | 100 | ||
| 101 | float Volume() { | ||
| 102 | if (values.audio_muted) { | ||
| 103 | return 0.0f; | ||
| 104 | } | ||
| 105 | return values.volume.GetValue(); | ||
| 106 | } | ||
| 107 | |||
| 100 | void RestoreGlobalState() { | 108 | void RestoreGlobalState() { |
| 101 | // If a game is running, DO NOT restore the global settings state | 109 | // If a game is running, DO NOT restore the global settings state |
| 102 | if (Core::System::GetInstance().IsPoweredOn()) { | 110 | if (Core::System::GetInstance().IsPoweredOn()) { |