diff options
Diffstat (limited to '')
25 files changed, 162 insertions, 40 deletions
diff --git a/src/android/app/src/main/jni/config.cpp b/src/android/app/src/main/jni/config.cpp index 5e1f10f99..9de9bd93e 100644 --- a/src/android/app/src/main/jni/config.cpp +++ b/src/android/app/src/main/jni/config.cpp | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include "common/fs/path_util.h" | 11 | #include "common/fs/path_util.h" |
| 12 | #include "common/logging/log.h" | 12 | #include "common/logging/log.h" |
| 13 | #include "common/settings.h" | 13 | #include "common/settings.h" |
| 14 | #include "common/settings_enums.h" | ||
| 14 | #include "core/hle/service/acc/profile_manager.h" | 15 | #include "core/hle/service/acc/profile_manager.h" |
| 15 | #include "input_common/main.h" | 16 | #include "input_common/main.h" |
| 16 | #include "jni/config.h" | 17 | #include "jni/config.h" |
| @@ -144,7 +145,9 @@ void Config::ReadValues() { | |||
| 144 | Service::Account::MAX_USERS - 1); | 145 | Service::Account::MAX_USERS - 1); |
| 145 | 146 | ||
| 146 | // Disable docked mode by default on Android | 147 | // Disable docked mode by default on Android |
| 147 | Settings::values.use_docked_mode = config->GetBoolean("System", "use_docked_mode", false); | 148 | Settings::values.use_docked_mode.SetValue(config->GetBoolean("System", "use_docked_mode", false) |
| 149 | ? Settings::ConsoleMode::Docked | ||
| 150 | : Settings::ConsoleMode::Handheld); | ||
| 148 | 151 | ||
| 149 | const auto rng_seed_enabled = config->GetBoolean("System", "rng_seed_enabled", false); | 152 | const auto rng_seed_enabled = config->GetBoolean("System", "rng_seed_enabled", false); |
| 150 | if (rng_seed_enabled) { | 153 | if (rng_seed_enabled) { |
diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index 8b99d1d6e..7e17833a0 100644 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp | |||
| @@ -420,7 +420,7 @@ public: | |||
| 420 | return false; | 420 | return false; |
| 421 | } | 421 | } |
| 422 | 422 | ||
| 423 | return !Settings::values.use_docked_mode.GetValue(); | 423 | return !Settings::IsDockedMode(); |
| 424 | } | 424 | } |
| 425 | 425 | ||
| 426 | void SetDeviceType([[maybe_unused]] int index, int type) { | 426 | void SetDeviceType([[maybe_unused]] int index, int type) { |
diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 16a58a750..524056841 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include <version> | 4 | #include <version> |
| 5 | #include "common/settings_enums.h" | ||
| 5 | #if __cpp_lib_chrono >= 201907L | 6 | #if __cpp_lib_chrono >= 201907L |
| 6 | #include <chrono> | 7 | #include <chrono> |
| 7 | #include <exception> | 8 | #include <exception> |
| @@ -145,6 +146,10 @@ bool IsFastmemEnabled() { | |||
| 145 | return true; | 146 | return true; |
| 146 | } | 147 | } |
| 147 | 148 | ||
| 149 | bool IsDockedMode() { | ||
| 150 | return values.use_docked_mode.GetValue() == Settings::ConsoleMode::Docked; | ||
| 151 | } | ||
| 152 | |||
| 148 | float Volume() { | 153 | float Volume() { |
| 149 | if (values.audio_muted) { | 154 | if (values.audio_muted) { |
| 150 | return 0.0f; | 155 | return 0.0f; |
diff --git a/src/common/settings.h b/src/common/settings.h index 4407c1e6d..b15213bd7 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -379,7 +379,13 @@ struct Values { | |||
| 379 | 379 | ||
| 380 | Setting<s32> current_user{linkage, 0, "current_user", Category::System}; | 380 | Setting<s32> current_user{linkage, 0, "current_user", Category::System}; |
| 381 | 381 | ||
| 382 | SwitchableSetting<bool> use_docked_mode{linkage, true, "use_docked_mode", Category::System}; | 382 | SwitchableSetting<ConsoleMode> use_docked_mode{linkage, |
| 383 | ConsoleMode::Docked, | ||
| 384 | "use_docked_mode", | ||
| 385 | Category::System, | ||
| 386 | Specialization::Radio, | ||
| 387 | true, | ||
| 388 | true}; | ||
| 383 | 389 | ||
| 384 | // Controls | 390 | // Controls |
| 385 | InputSetting<std::array<PlayerInput, 10>> players; | 391 | InputSetting<std::array<PlayerInput, 10>> players; |
| @@ -519,6 +525,8 @@ bool IsGPULevelHigh(); | |||
| 519 | 525 | ||
| 520 | bool IsFastmemEnabled(); | 526 | bool IsFastmemEnabled(); |
| 521 | 527 | ||
| 528 | bool IsDockedMode(); | ||
| 529 | |||
| 522 | float Volume(); | 530 | float Volume(); |
| 523 | 531 | ||
| 524 | std::string GetTimeZoneString(TimeZone time_zone); | 532 | std::string GetTimeZoneString(TimeZone time_zone); |
diff --git a/src/common/settings_common.h b/src/common/settings_common.h index 2efb329b0..3082e0ce1 100644 --- a/src/common/settings_common.h +++ b/src/common/settings_common.h | |||
| @@ -56,6 +56,7 @@ enum Specialization : u8 { | |||
| 56 | Scalar = 5, // Values are continuous | 56 | Scalar = 5, // Values are continuous |
| 57 | Countable = 6, // Can be stepped through | 57 | Countable = 6, // Can be stepped through |
| 58 | Paired = 7, // Another setting is associated with this setting | 58 | Paired = 7, // Another setting is associated with this setting |
| 59 | Radio = 8, // Setting should be presented in a radio group | ||
| 59 | 60 | ||
| 60 | Percentage = (1 << SpecializationAttributeOffset), // Should be represented as a percentage | 61 | Percentage = (1 << SpecializationAttributeOffset), // Should be represented as a percentage |
| 61 | }; | 62 | }; |
diff --git a/src/common/settings_enums.h b/src/common/settings_enums.h index e7cb59ea5..815cafe15 100644 --- a/src/common/settings_enums.h +++ b/src/common/settings_enums.h | |||
| @@ -146,6 +146,8 @@ ENUM(AntiAliasing, None, Fxaa, Smaa, MaxEnum); | |||
| 146 | 146 | ||
| 147 | ENUM(AspectRatio, R16_9, R4_3, R21_9, R16_10, Stretch); | 147 | ENUM(AspectRatio, R16_9, R4_3, R21_9, R16_10, Stretch); |
| 148 | 148 | ||
| 149 | ENUM(ConsoleMode, Handheld, Docked); | ||
| 150 | |||
| 149 | template <typename Type> | 151 | template <typename Type> |
| 150 | inline std::string CanonicalizeEnum(Type id) { | 152 | inline std::string CanonicalizeEnum(Type id) { |
| 151 | const auto group = EnumMetadata<Type>::Canonicalizations(); | 153 | const auto group = EnumMetadata<Type>::Canonicalizations(); |
diff --git a/src/core/frontend/applets/controller.cpp b/src/core/frontend/applets/controller.cpp index 3300d4f79..27755cb58 100644 --- a/src/core/frontend/applets/controller.cpp +++ b/src/core/frontend/applets/controller.cpp | |||
| @@ -3,6 +3,8 @@ | |||
| 3 | 3 | ||
| 4 | #include "common/assert.h" | 4 | #include "common/assert.h" |
| 5 | #include "common/logging/log.h" | 5 | #include "common/logging/log.h" |
| 6 | #include "common/settings.h" | ||
| 7 | #include "common/settings_enums.h" | ||
| 6 | #include "core/frontend/applets/controller.h" | 8 | #include "core/frontend/applets/controller.h" |
| 7 | #include "core/hid/emulated_controller.h" | 9 | #include "core/hid/emulated_controller.h" |
| 8 | #include "core/hid/hid_core.h" | 10 | #include "core/hid/hid_core.h" |
| @@ -62,7 +64,7 @@ void DefaultControllerApplet::ReconfigureControllers(ReconfigureCallback callbac | |||
| 62 | controller->Connect(true); | 64 | controller->Connect(true); |
| 63 | } | 65 | } |
| 64 | } else if (index == 0 && parameters.enable_single_mode && parameters.allow_handheld && | 66 | } else if (index == 0 && parameters.enable_single_mode && parameters.allow_handheld && |
| 65 | !Settings::values.use_docked_mode.GetValue()) { | 67 | !Settings::IsDockedMode()) { |
| 66 | // We should *never* reach here under any normal circumstances. | 68 | // We should *never* reach here under any normal circumstances. |
| 67 | controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::Handheld); | 69 | controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::Handheld); |
| 68 | controller->Connect(true); | 70 | controller->Connect(true); |
diff --git a/src/core/frontend/framebuffer_layout.cpp b/src/core/frontend/framebuffer_layout.cpp index b4081fc39..2590b20da 100644 --- a/src/core/frontend/framebuffer_layout.cpp +++ b/src/core/frontend/framebuffer_layout.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | #include "common/assert.h" | 6 | #include "common/assert.h" |
| 7 | #include "common/settings.h" | 7 | #include "common/settings.h" |
| 8 | #include "common/settings_enums.h" | ||
| 8 | #include "core/frontend/framebuffer_layout.h" | 9 | #include "core/frontend/framebuffer_layout.h" |
| 9 | 10 | ||
| 10 | namespace Layout { | 11 | namespace Layout { |
| @@ -49,7 +50,7 @@ FramebufferLayout DefaultFrameLayout(u32 width, u32 height) { | |||
| 49 | } | 50 | } |
| 50 | 51 | ||
| 51 | FramebufferLayout FrameLayoutFromResolutionScale(f32 res_scale) { | 52 | FramebufferLayout FrameLayoutFromResolutionScale(f32 res_scale) { |
| 52 | const bool is_docked = Settings::values.use_docked_mode.GetValue(); | 53 | const bool is_docked = Settings::IsDockedMode(); |
| 53 | const u32 screen_width = is_docked ? ScreenDocked::Width : ScreenUndocked::Width; | 54 | const u32 screen_width = is_docked ? ScreenDocked::Width : ScreenUndocked::Width; |
| 54 | const u32 screen_height = is_docked ? ScreenDocked::Height : ScreenUndocked::Height; | 55 | const u32 screen_height = is_docked ? ScreenDocked::Height : ScreenUndocked::Height; |
| 55 | 56 | ||
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 8d057b3a8..da33f0e44 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include <cinttypes> | 6 | #include <cinttypes> |
| 7 | #include <cstring> | 7 | #include <cstring> |
| 8 | #include "common/settings.h" | 8 | #include "common/settings.h" |
| 9 | #include "common/settings_enums.h" | ||
| 9 | #include "core/core.h" | 10 | #include "core/core.h" |
| 10 | #include "core/file_sys/control_metadata.h" | 11 | #include "core/file_sys/control_metadata.h" |
| 11 | #include "core/file_sys/patch_manager.h" | 12 | #include "core/file_sys/patch_manager.h" |
| @@ -833,7 +834,7 @@ void ICommonStateGetter::GetDefaultDisplayResolution(HLERequestContext& ctx) { | |||
| 833 | IPC::ResponseBuilder rb{ctx, 4}; | 834 | IPC::ResponseBuilder rb{ctx, 4}; |
| 834 | rb.Push(ResultSuccess); | 835 | rb.Push(ResultSuccess); |
| 835 | 836 | ||
| 836 | if (Settings::values.use_docked_mode.GetValue()) { | 837 | if (Settings::IsDockedMode()) { |
| 837 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth)); | 838 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth)); |
| 838 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedHeight)); | 839 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedHeight)); |
| 839 | } else { | 840 | } else { |
| @@ -921,7 +922,7 @@ void IStorage::Open(HLERequestContext& ctx) { | |||
| 921 | } | 922 | } |
| 922 | 923 | ||
| 923 | void ICommonStateGetter::GetOperationMode(HLERequestContext& ctx) { | 924 | void ICommonStateGetter::GetOperationMode(HLERequestContext& ctx) { |
| 924 | const bool use_docked_mode{Settings::values.use_docked_mode.GetValue()}; | 925 | const bool use_docked_mode{Settings::IsDockedMode()}; |
| 925 | LOG_DEBUG(Service_AM, "called, use_docked_mode={}", use_docked_mode); | 926 | LOG_DEBUG(Service_AM, "called, use_docked_mode={}", use_docked_mode); |
| 926 | 927 | ||
| 927 | IPC::ResponseBuilder rb{ctx, 3}; | 928 | IPC::ResponseBuilder rb{ctx, 3}; |
diff --git a/src/core/hle/service/apm/apm_controller.cpp b/src/core/hle/service/apm/apm_controller.cpp index 227fdd0cf..4f1aa5cc2 100644 --- a/src/core/hle/service/apm/apm_controller.cpp +++ b/src/core/hle/service/apm/apm_controller.cpp | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | #include "common/logging/log.h" | 8 | #include "common/logging/log.h" |
| 9 | #include "common/settings.h" | 9 | #include "common/settings.h" |
| 10 | #include "common/settings_enums.h" | ||
| 10 | #include "core/core_timing.h" | 11 | #include "core/core_timing.h" |
| 11 | #include "core/hle/service/apm/apm_controller.h" | 12 | #include "core/hle/service/apm/apm_controller.h" |
| 12 | 13 | ||
| @@ -67,8 +68,7 @@ void Controller::SetFromCpuBoostMode(CpuBoostMode mode) { | |||
| 67 | } | 68 | } |
| 68 | 69 | ||
| 69 | PerformanceMode Controller::GetCurrentPerformanceMode() const { | 70 | PerformanceMode Controller::GetCurrentPerformanceMode() const { |
| 70 | return Settings::values.use_docked_mode.GetValue() ? PerformanceMode::Boost | 71 | return Settings::IsDockedMode() ? PerformanceMode::Boost : PerformanceMode::Normal; |
| 71 | : PerformanceMode::Normal; | ||
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | PerformanceConfiguration Controller::GetCurrentPerformanceConfiguration(PerformanceMode mode) { | 74 | PerformanceConfiguration Controller::GetCurrentPerformanceConfiguration(PerformanceMode mode) { |
diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp index 03432f7cb..63eecd42b 100644 --- a/src/core/hle/service/hid/controllers/gesture.cpp +++ b/src/core/hle/service/hid/controllers/gesture.cpp | |||
| @@ -331,7 +331,7 @@ Controller_Gesture::GestureProperties Controller_Gesture::GetGestureProperties() | |||
| 331 | }; | 331 | }; |
| 332 | 332 | ||
| 333 | // Hack: There is no touch in docked but games still allow it | 333 | // Hack: There is no touch in docked but games still allow it |
| 334 | if (Settings::values.use_docked_mode.GetValue()) { | 334 | if (Settings::IsDockedMode()) { |
| 335 | gesture.points[id] = { | 335 | gesture.points[id] = { |
| 336 | .x = static_cast<s32>(active_x * Layout::ScreenDocked::Width), | 336 | .x = static_cast<s32>(active_x * Layout::ScreenDocked::Width), |
| 337 | .y = static_cast<s32>(active_y * Layout::ScreenDocked::Height), | 337 | .y = static_cast<s32>(active_y * Layout::ScreenDocked::Height), |
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 28818c813..3b349b4c4 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -1518,7 +1518,7 @@ bool Controller_NPad::IsControllerSupported(Core::HID::NpadStyleIndex controller | |||
| 1518 | return false; | 1518 | return false; |
| 1519 | } | 1519 | } |
| 1520 | // Handheld shouldn't be supported in docked mode | 1520 | // Handheld shouldn't be supported in docked mode |
| 1521 | if (Settings::values.use_docked_mode.GetValue()) { | 1521 | if (Settings::IsDockedMode()) { |
| 1522 | return false; | 1522 | return false; |
| 1523 | } | 1523 | } |
| 1524 | 1524 | ||
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 6bb02393c..2eb978379 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -217,7 +217,7 @@ private: | |||
| 217 | IPC::ResponseBuilder rb{ctx, 6}; | 217 | IPC::ResponseBuilder rb{ctx, 6}; |
| 218 | rb.Push(ResultSuccess); | 218 | rb.Push(ResultSuccess); |
| 219 | 219 | ||
| 220 | if (Settings::values.use_docked_mode.GetValue()) { | 220 | if (Settings::IsDockedMode()) { |
| 221 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth)); | 221 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth)); |
| 222 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedHeight)); | 222 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedHeight)); |
| 223 | } else { | 223 | } else { |
diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index 62b3f6636..c26179e03 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include "common/logging/log.h" | 14 | #include "common/logging/log.h" |
| 15 | 15 | ||
| 16 | #include "common/settings.h" | 16 | #include "common/settings.h" |
| 17 | #include "common/settings_enums.h" | ||
| 17 | #include "core/file_sys/control_metadata.h" | 18 | #include "core/file_sys/control_metadata.h" |
| 18 | #include "core/file_sys/patch_manager.h" | 19 | #include "core/file_sys/patch_manager.h" |
| 19 | #include "core/loader/loader.h" | 20 | #include "core/loader/loader.h" |
| @@ -275,7 +276,7 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader, | |||
| 275 | static_cast<u32>(Settings::values.shader_backend.GetValue())); | 276 | static_cast<u32>(Settings::values.shader_backend.GetValue())); |
| 276 | AddField(field_type, "Renderer_UseAsynchronousShaders", | 277 | AddField(field_type, "Renderer_UseAsynchronousShaders", |
| 277 | Settings::values.use_asynchronous_shaders.GetValue()); | 278 | Settings::values.use_asynchronous_shaders.GetValue()); |
| 278 | AddField(field_type, "System_UseDockedMode", Settings::values.use_docked_mode.GetValue()); | 279 | AddField(field_type, "System_UseDockedMode", Settings::IsDockedMode()); |
| 279 | } | 280 | } |
| 280 | 281 | ||
| 281 | bool TelemetrySession::SubmitTestcase() { | 282 | bool TelemetrySession::SubmitTestcase() { |
diff --git a/src/yuzu/applets/qt_controller.cpp b/src/yuzu/applets/qt_controller.cpp index 00aafb8f8..d15559518 100644 --- a/src/yuzu/applets/qt_controller.cpp +++ b/src/yuzu/applets/qt_controller.cpp | |||
| @@ -5,6 +5,8 @@ | |||
| 5 | #include <thread> | 5 | #include <thread> |
| 6 | 6 | ||
| 7 | #include "common/assert.h" | 7 | #include "common/assert.h" |
| 8 | #include "common/settings.h" | ||
| 9 | #include "common/settings_enums.h" | ||
| 8 | #include "common/string_util.h" | 10 | #include "common/string_util.h" |
| 9 | #include "core/core.h" | 11 | #include "core/core.h" |
| 10 | #include "core/hid/emulated_controller.h" | 12 | #include "core/hid/emulated_controller.h" |
| @@ -226,9 +228,11 @@ int QtControllerSelectorDialog::exec() { | |||
| 226 | } | 228 | } |
| 227 | 229 | ||
| 228 | void QtControllerSelectorDialog::ApplyConfiguration() { | 230 | void QtControllerSelectorDialog::ApplyConfiguration() { |
| 229 | const bool pre_docked_mode = Settings::values.use_docked_mode.GetValue(); | 231 | const bool pre_docked_mode = Settings::IsDockedMode(); |
| 230 | Settings::values.use_docked_mode.SetValue(ui->radioDocked->isChecked()); | 232 | const bool docked_mode_selected = ui->radioDocked->isChecked(); |
| 231 | OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue(), system); | 233 | Settings::values.use_docked_mode.SetValue( |
| 234 | docked_mode_selected ? Settings::ConsoleMode::Docked : Settings::ConsoleMode::Handheld); | ||
| 235 | OnDockedModeChanged(pre_docked_mode, docked_mode_selected, system); | ||
| 232 | 236 | ||
| 233 | Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); | 237 | Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); |
| 234 | Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); | 238 | Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); |
| @@ -616,8 +620,8 @@ void QtControllerSelectorDialog::UpdateDockedState(bool is_handheld) { | |||
| 616 | ui->radioDocked->setEnabled(!is_handheld); | 620 | ui->radioDocked->setEnabled(!is_handheld); |
| 617 | ui->radioUndocked->setEnabled(!is_handheld); | 621 | ui->radioUndocked->setEnabled(!is_handheld); |
| 618 | 622 | ||
| 619 | ui->radioDocked->setChecked(Settings::values.use_docked_mode.GetValue()); | 623 | ui->radioDocked->setChecked(Settings::IsDockedMode()); |
| 620 | ui->radioUndocked->setChecked(!Settings::values.use_docked_mode.GetValue()); | 624 | ui->radioUndocked->setChecked(!Settings::IsDockedMode()); |
| 621 | 625 | ||
| 622 | // Also force into undocked mode if the controller type is handheld. | 626 | // Also force into undocked mode if the controller type is handheld. |
| 623 | if (is_handheld) { | 627 | if (is_handheld) { |
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 407988b8f..2afa72140 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp | |||
| @@ -928,8 +928,8 @@ void GRenderWindow::CaptureScreenshot(const QString& screenshot_path) { | |||
| 928 | const Layout::FramebufferLayout layout{[]() { | 928 | const Layout::FramebufferLayout layout{[]() { |
| 929 | u32 height = UISettings::values.screenshot_height.GetValue(); | 929 | u32 height = UISettings::values.screenshot_height.GetValue(); |
| 930 | if (height == 0) { | 930 | if (height == 0) { |
| 931 | height = Settings::values.use_docked_mode.GetValue() ? Layout::ScreenDocked::Height | 931 | height = Settings::IsDockedMode() ? Layout::ScreenDocked::Height |
| 932 | : Layout::ScreenUndocked::Height; | 932 | : Layout::ScreenUndocked::Height; |
| 933 | height *= Settings::values.resolution_info.up_factor; | 933 | height *= Settings::values.resolution_info.up_factor; |
| 934 | } | 934 | } |
| 935 | const u32 width = | 935 | const u32 width = |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index b22c83303..1de093447 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include "common/fs/path_util.h" | 9 | #include "common/fs/path_util.h" |
| 10 | #include "common/settings.h" | 10 | #include "common/settings.h" |
| 11 | #include "common/settings_common.h" | 11 | #include "common/settings_common.h" |
| 12 | #include "common/settings_enums.h" | ||
| 12 | #include "core/core.h" | 13 | #include "core/core.h" |
| 13 | #include "core/hle/service/acc/profile_manager.h" | 14 | #include "core/hle/service/acc/profile_manager.h" |
| 14 | #include "core/hle/service/hid/controllers/npad.h" | 15 | #include "core/hle/service/hid/controllers/npad.h" |
| @@ -85,9 +86,9 @@ const std::map<Settings::ScalingFilter, QString> Config::scaling_filter_texts_ma | |||
| 85 | {Settings::ScalingFilter::Fsr, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "FSR"))}, | 86 | {Settings::ScalingFilter::Fsr, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "FSR"))}, |
| 86 | }; | 87 | }; |
| 87 | 88 | ||
| 88 | const std::map<bool, QString> Config::use_docked_mode_texts_map = { | 89 | const std::map<Settings::ConsoleMode, QString> Config::use_docked_mode_texts_map = { |
| 89 | {true, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Docked"))}, | 90 | {Settings::ConsoleMode::Docked, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Docked"))}, |
| 90 | {false, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Handheld"))}, | 91 | {Settings::ConsoleMode::Handheld, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Handheld"))}, |
| 91 | }; | 92 | }; |
| 92 | 93 | ||
| 93 | const std::map<Settings::GpuAccuracy, QString> Config::gpu_accuracy_texts_map = { | 94 | const std::map<Settings::GpuAccuracy, QString> Config::gpu_accuracy_texts_map = { |
| @@ -376,7 +377,7 @@ void Config::ReadControlValues() { | |||
| 376 | const auto controller_type = Settings::values.players.GetValue()[0].controller_type; | 377 | const auto controller_type = Settings::values.players.GetValue()[0].controller_type; |
| 377 | if (controller_type == Settings::ControllerType::Handheld) { | 378 | if (controller_type == Settings::ControllerType::Handheld) { |
| 378 | Settings::values.use_docked_mode.SetGlobal(!IsCustomConfig()); | 379 | Settings::values.use_docked_mode.SetGlobal(!IsCustomConfig()); |
| 379 | Settings::values.use_docked_mode.SetValue(false); | 380 | Settings::values.use_docked_mode.SetValue(Settings::ConsoleMode::Handheld); |
| 380 | } | 381 | } |
| 381 | 382 | ||
| 382 | if (IsCustomConfig()) { | 383 | if (IsCustomConfig()) { |
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h index 0ac74c8e7..727feebfb 100644 --- a/src/yuzu/configuration/config.h +++ b/src/yuzu/configuration/config.h | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <QMetaType> | 9 | #include <QMetaType> |
| 10 | #include <QVariant> | 10 | #include <QVariant> |
| 11 | #include "common/settings.h" | 11 | #include "common/settings.h" |
| 12 | #include "common/settings_enums.h" | ||
| 12 | #include "yuzu/uisettings.h" | 13 | #include "yuzu/uisettings.h" |
| 13 | 14 | ||
| 14 | class QSettings; | 15 | class QSettings; |
| @@ -51,7 +52,7 @@ public: | |||
| 51 | 52 | ||
| 52 | static const std::map<Settings::AntiAliasing, QString> anti_aliasing_texts_map; | 53 | static const std::map<Settings::AntiAliasing, QString> anti_aliasing_texts_map; |
| 53 | static const std::map<Settings::ScalingFilter, QString> scaling_filter_texts_map; | 54 | static const std::map<Settings::ScalingFilter, QString> scaling_filter_texts_map; |
| 54 | static const std::map<bool, QString> use_docked_mode_texts_map; | 55 | static const std::map<Settings::ConsoleMode, QString> use_docked_mode_texts_map; |
| 55 | static const std::map<Settings::GpuAccuracy, QString> gpu_accuracy_texts_map; | 56 | static const std::map<Settings::GpuAccuracy, QString> gpu_accuracy_texts_map; |
| 56 | static const std::map<Settings::RendererBackend, QString> renderer_backend_texts_map; | 57 | static const std::map<Settings::RendererBackend, QString> renderer_backend_texts_map; |
| 57 | static const std::map<Settings::ShaderBackend, QString> shader_backend_texts_map; | 58 | static const std::map<Settings::ShaderBackend, QString> shader_backend_texts_map; |
diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cpp index 7fce85bca..e8f9ebfd8 100644 --- a/src/yuzu/configuration/configure_input.cpp +++ b/src/yuzu/configuration/configure_input.cpp | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | #include <memory> | 4 | #include <memory> |
| 5 | #include <thread> | 5 | #include <thread> |
| 6 | 6 | ||
| 7 | #include "common/settings.h" | ||
| 8 | #include "common/settings_enums.h" | ||
| 7 | #include "core/core.h" | 9 | #include "core/core.h" |
| 8 | #include "core/hid/emulated_controller.h" | 10 | #include "core/hid/emulated_controller.h" |
| 9 | #include "core/hid/hid_core.h" | 11 | #include "core/hid/hid_core.h" |
| @@ -197,9 +199,11 @@ void ConfigureInput::ApplyConfiguration() { | |||
| 197 | 199 | ||
| 198 | advanced->ApplyConfiguration(); | 200 | advanced->ApplyConfiguration(); |
| 199 | 201 | ||
| 200 | const bool pre_docked_mode = Settings::values.use_docked_mode.GetValue(); | 202 | const bool pre_docked_mode = Settings::IsDockedMode(); |
| 201 | Settings::values.use_docked_mode.SetValue(ui->radioDocked->isChecked()); | 203 | const bool docked_mode_selected = ui->radioDocked->isChecked(); |
| 202 | OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue(), system); | 204 | Settings::values.use_docked_mode.SetValue( |
| 205 | docked_mode_selected ? Settings::ConsoleMode::Docked : Settings::ConsoleMode::Handheld); | ||
| 206 | OnDockedModeChanged(pre_docked_mode, docked_mode_selected, system); | ||
| 203 | 207 | ||
| 204 | Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); | 208 | Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); |
| 205 | Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); | 209 | Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); |
| @@ -267,8 +271,8 @@ void ConfigureInput::UpdateDockedState(bool is_handheld) { | |||
| 267 | ui->radioDocked->setEnabled(!is_handheld); | 271 | ui->radioDocked->setEnabled(!is_handheld); |
| 268 | ui->radioUndocked->setEnabled(!is_handheld); | 272 | ui->radioUndocked->setEnabled(!is_handheld); |
| 269 | 273 | ||
| 270 | ui->radioDocked->setChecked(Settings::values.use_docked_mode.GetValue()); | 274 | ui->radioDocked->setChecked(Settings::IsDockedMode()); |
| 271 | ui->radioUndocked->setChecked(!Settings::values.use_docked_mode.GetValue()); | 275 | ui->radioUndocked->setChecked(!Settings::IsDockedMode()); |
| 272 | 276 | ||
| 273 | // Also force into undocked mode if the controller type is handheld. | 277 | // Also force into undocked mode if the controller type is handheld. |
| 274 | if (is_handheld) { | 278 | if (is_handheld) { |
diff --git a/src/yuzu/configuration/configure_per_game.cpp b/src/yuzu/configuration/configure_per_game.cpp index 4f9e8db08..b91d6ad4a 100644 --- a/src/yuzu/configuration/configure_per_game.cpp +++ b/src/yuzu/configuration/configure_per_game.cpp | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | 18 | ||
| 19 | #include "common/fs/fs_util.h" | 19 | #include "common/fs/fs_util.h" |
| 20 | #include "common/settings_enums.h" | 20 | #include "common/settings_enums.h" |
| 21 | #include "common/settings_input.h" | ||
| 21 | #include "configuration/shared_widget.h" | 22 | #include "configuration/shared_widget.h" |
| 22 | #include "core/core.h" | 23 | #include "core/core.h" |
| 23 | #include "core/file_sys/control_metadata.h" | 24 | #include "core/file_sys/control_metadata.h" |
| @@ -98,6 +99,12 @@ void ConfigurePerGame::ApplyConfiguration() { | |||
| 98 | addons_tab->ApplyConfiguration(); | 99 | addons_tab->ApplyConfiguration(); |
| 99 | input_tab->ApplyConfiguration(); | 100 | input_tab->ApplyConfiguration(); |
| 100 | 101 | ||
| 102 | if (Settings::IsDockedMode() && Settings::values.players.GetValue()[0].controller_type == | ||
| 103 | Settings::ControllerType::Handheld) { | ||
| 104 | Settings::values.use_docked_mode.SetValue(Settings::ConsoleMode::Handheld); | ||
| 105 | Settings::values.use_docked_mode.SetGlobal(true); | ||
| 106 | } | ||
| 107 | |||
| 101 | system.ApplySettings(); | 108 | system.ApplySettings(); |
| 102 | Settings::LogSettings(); | 109 | Settings::LogSettings(); |
| 103 | 110 | ||
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index c4833f4e7..0c8e5c8b4 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp | |||
| @@ -106,6 +106,11 @@ void ConfigureSystem::Setup(const ConfigurationShared::Builder& builder) { | |||
| 106 | push(Settings::values.linkage.by_category[Settings::Category::System]); | 106 | push(Settings::values.linkage.by_category[Settings::Category::System]); |
| 107 | 107 | ||
| 108 | for (auto setting : settings) { | 108 | for (auto setting : settings) { |
| 109 | if (setting->Id() == Settings::values.use_docked_mode.Id() && | ||
| 110 | Settings::IsConfiguringGlobal()) { | ||
| 111 | continue; | ||
| 112 | } | ||
| 113 | |||
| 109 | ConfigurationShared::Widget* widget = builder.BuildWidget(setting, apply_funcs); | 114 | ConfigurationShared::Widget* widget = builder.BuildWidget(setting, apply_funcs); |
| 110 | 115 | ||
| 111 | if (widget == nullptr) { | 116 | if (widget == nullptr) { |
diff --git a/src/yuzu/configuration/shared_translation.cpp b/src/yuzu/configuration/shared_translation.cpp index 335810788..276bdbaba 100644 --- a/src/yuzu/configuration/shared_translation.cpp +++ b/src/yuzu/configuration/shared_translation.cpp | |||
| @@ -135,7 +135,7 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent) { | |||
| 135 | INSERT(Settings, region_index, "Region:", ""); | 135 | INSERT(Settings, region_index, "Region:", ""); |
| 136 | INSERT(Settings, time_zone_index, "Time Zone:", ""); | 136 | INSERT(Settings, time_zone_index, "Time Zone:", ""); |
| 137 | INSERT(Settings, sound_index, "Sound Output Mode:", ""); | 137 | INSERT(Settings, sound_index, "Sound Output Mode:", ""); |
| 138 | INSERT(Settings, use_docked_mode, "", ""); | 138 | INSERT(Settings, use_docked_mode, "Console Mode:", ""); |
| 139 | INSERT(Settings, current_user, "", ""); | 139 | INSERT(Settings, current_user, "", ""); |
| 140 | 140 | ||
| 141 | // Controls | 141 | // Controls |
| @@ -379,6 +379,9 @@ std::unique_ptr<ComboboxTranslationMap> ComboboxEnumeration(QWidget* parent) { | |||
| 379 | PAIR(MemoryLayout, Memory_6Gb, "6GB DRAM (Unsafe)"), | 379 | PAIR(MemoryLayout, Memory_6Gb, "6GB DRAM (Unsafe)"), |
| 380 | PAIR(MemoryLayout, Memory_8Gb, "8GB DRAM (Unsafe)"), | 380 | PAIR(MemoryLayout, Memory_8Gb, "8GB DRAM (Unsafe)"), |
| 381 | }}); | 381 | }}); |
| 382 | translations->insert( | ||
| 383 | {Settings::EnumMetadata<Settings::ConsoleMode>::Index(), | ||
| 384 | {PAIR(ConsoleMode, Docked, "Docked"), PAIR(ConsoleMode, Handheld, "Handheld")}}); | ||
| 382 | 385 | ||
| 383 | #undef PAIR | 386 | #undef PAIR |
| 384 | #undef CTX_PAIR | 387 | #undef CTX_PAIR |
diff --git a/src/yuzu/configuration/shared_widget.cpp b/src/yuzu/configuration/shared_widget.cpp index 4e45bc844..7721e58f9 100644 --- a/src/yuzu/configuration/shared_widget.cpp +++ b/src/yuzu/configuration/shared_widget.cpp | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <QLineEdit> | 23 | #include <QLineEdit> |
| 24 | #include <QObject> | 24 | #include <QObject> |
| 25 | #include <QPushButton> | 25 | #include <QPushButton> |
| 26 | #include <QRadioButton> | ||
| 26 | #include <QRegularExpression> | 27 | #include <QRegularExpression> |
| 27 | #include <QSizePolicy> | 28 | #include <QSizePolicy> |
| 28 | #include <QSlider> | 29 | #include <QSlider> |
| @@ -171,6 +172,65 @@ QWidget* Widget::CreateCombobox(std::function<std::string()>& serializer, | |||
| 171 | return combobox; | 172 | return combobox; |
| 172 | } | 173 | } |
| 173 | 174 | ||
| 175 | QWidget* Widget::CreateRadioGroup(std::function<std::string()>& serializer, | ||
| 176 | std::function<void()>& restore_func, | ||
| 177 | const std::function<void()>& touch) { | ||
| 178 | const auto type = setting.EnumIndex(); | ||
| 179 | |||
| 180 | QWidget* group = new QWidget(this); | ||
| 181 | QHBoxLayout* layout = new QHBoxLayout(group); | ||
| 182 | layout->setContentsMargins(0, 0, 0, 0); | ||
| 183 | group->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); | ||
| 184 | |||
| 185 | const ComboboxTranslations* enumeration{nullptr}; | ||
| 186 | if (combobox_enumerations.contains(type)) { | ||
| 187 | enumeration = &combobox_enumerations.at(type); | ||
| 188 | for (const auto& [id, name] : *enumeration) { | ||
| 189 | QRadioButton* radio_button = new QRadioButton(name, group); | ||
| 190 | layout->addWidget(radio_button); | ||
| 191 | radio_buttons.push_back({id, radio_button}); | ||
| 192 | } | ||
| 193 | } else { | ||
| 194 | return group; | ||
| 195 | } | ||
| 196 | |||
| 197 | const auto get_selected = [=]() -> u32 { | ||
| 198 | for (const auto& [id, button] : radio_buttons) { | ||
| 199 | if (button->isChecked()) { | ||
| 200 | return id; | ||
| 201 | } | ||
| 202 | } | ||
| 203 | return -1; | ||
| 204 | }; | ||
| 205 | |||
| 206 | const auto set_index = [=](u32 value) { | ||
| 207 | for (const auto& [id, button] : radio_buttons) { | ||
| 208 | button->setChecked(id == value); | ||
| 209 | } | ||
| 210 | }; | ||
| 211 | |||
| 212 | const u32 setting_value = std::stoi(setting.ToString()); | ||
| 213 | set_index(setting_value); | ||
| 214 | |||
| 215 | serializer = [get_selected]() { | ||
| 216 | int current = get_selected(); | ||
| 217 | return std::to_string(current); | ||
| 218 | }; | ||
| 219 | |||
| 220 | restore_func = [this, set_index]() { | ||
| 221 | const u32 global_value = std::stoi(RelevantDefault(setting)); | ||
| 222 | set_index(global_value); | ||
| 223 | }; | ||
| 224 | |||
| 225 | if (!Settings::IsConfiguringGlobal()) { | ||
| 226 | for (const auto& [id, button] : radio_buttons) { | ||
| 227 | QObject::connect(button, &QAbstractButton::clicked, [touch]() { touch(); }); | ||
| 228 | } | ||
| 229 | } | ||
| 230 | |||
| 231 | return group; | ||
| 232 | } | ||
| 233 | |||
| 174 | QWidget* Widget::CreateLineEdit(std::function<std::string()>& serializer, | 234 | QWidget* Widget::CreateLineEdit(std::function<std::string()>& serializer, |
| 175 | std::function<void()>& restore_func, | 235 | std::function<void()>& restore_func, |
| 176 | const std::function<void()>& touch, bool managed) { | 236 | const std::function<void()>& touch, bool managed) { |
| @@ -411,6 +471,8 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu | |||
| 411 | return RequestType::Slider; | 471 | return RequestType::Slider; |
| 412 | case Settings::Specialization::Countable: | 472 | case Settings::Specialization::Countable: |
| 413 | return RequestType::SpinBox; | 473 | return RequestType::SpinBox; |
| 474 | case Settings::Specialization::Radio: | ||
| 475 | return RequestType::RadioGroup; | ||
| 414 | default: | 476 | default: |
| 415 | break; | 477 | break; |
| 416 | } | 478 | } |
| @@ -439,7 +501,11 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu | |||
| 439 | if (setting.TypeId() == typeid(bool)) { | 501 | if (setting.TypeId() == typeid(bool)) { |
| 440 | data_component = CreateCheckBox(&setting, label, serializer, restore_func, touch); | 502 | data_component = CreateCheckBox(&setting, label, serializer, restore_func, touch); |
| 441 | } else if (setting.IsEnum()) { | 503 | } else if (setting.IsEnum()) { |
| 442 | data_component = CreateCombobox(serializer, restore_func, touch); | 504 | if (request == RequestType::RadioGroup) { |
| 505 | data_component = CreateRadioGroup(serializer, restore_func, touch); | ||
| 506 | } else { | ||
| 507 | data_component = CreateCombobox(serializer, restore_func, touch); | ||
| 508 | } | ||
| 443 | } else if (type == typeid(u32) || type == typeid(int) || type == typeid(u16) || | 509 | } else if (type == typeid(u32) || type == typeid(int) || type == typeid(u16) || |
| 444 | type == typeid(s64) || type == typeid(u8)) { | 510 | type == typeid(s64) || type == typeid(u8)) { |
| 445 | switch (request) { | 511 | switch (request) { |
diff --git a/src/yuzu/configuration/shared_widget.h b/src/yuzu/configuration/shared_widget.h index e64693bab..5303dd898 100644 --- a/src/yuzu/configuration/shared_widget.h +++ b/src/yuzu/configuration/shared_widget.h | |||
| @@ -22,6 +22,7 @@ class QObject; | |||
| 22 | class QPushButton; | 22 | class QPushButton; |
| 23 | class QSlider; | 23 | class QSlider; |
| 24 | class QSpinBox; | 24 | class QSpinBox; |
| 25 | class QRadioButton; | ||
| 25 | 26 | ||
| 26 | namespace Settings { | 27 | namespace Settings { |
| 27 | class BasicSetting; | 28 | class BasicSetting; |
| @@ -38,6 +39,7 @@ enum class RequestType { | |||
| 38 | LineEdit, | 39 | LineEdit, |
| 39 | HexEdit, | 40 | HexEdit, |
| 40 | DateTimeEdit, | 41 | DateTimeEdit, |
| 42 | RadioGroup, | ||
| 41 | MaxEnum, | 43 | MaxEnum, |
| 42 | }; | 44 | }; |
| 43 | 45 | ||
| @@ -91,6 +93,7 @@ public: | |||
| 91 | QSlider* slider{}; | 93 | QSlider* slider{}; |
| 92 | QComboBox* combobox{}; | 94 | QComboBox* combobox{}; |
| 93 | QDateTimeEdit* date_time_edit{}; | 95 | QDateTimeEdit* date_time_edit{}; |
| 96 | std::vector<std::pair<u32, QRadioButton*>> radio_buttons{}; | ||
| 94 | 97 | ||
| 95 | private: | 98 | private: |
| 96 | void SetupComponent(const QString& label, std::function<void()>& load_func, bool managed, | 99 | void SetupComponent(const QString& label, std::function<void()>& load_func, bool managed, |
| @@ -106,6 +109,9 @@ private: | |||
| 106 | QWidget* CreateCombobox(std::function<std::string()>& serializer, | 109 | QWidget* CreateCombobox(std::function<std::string()>& serializer, |
| 107 | std::function<void()>& restore_func, | 110 | std::function<void()>& restore_func, |
| 108 | const std::function<void()>& touch); | 111 | const std::function<void()>& touch); |
| 112 | QWidget* CreateRadioGroup(std::function<std::string()>& serializer, | ||
| 113 | std::function<void()>& restore_func, | ||
| 114 | const std::function<void()>& touch); | ||
| 109 | QWidget* CreateLineEdit(std::function<std::string()>& serializer, | 115 | QWidget* CreateLineEdit(std::function<std::string()>& serializer, |
| 110 | std::function<void()>& restore_func, const std::function<void()>& touch, | 116 | std::function<void()>& restore_func, const std::function<void()>& touch, |
| 111 | bool managed = true); | 117 | bool managed = true); |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 8e933af64..33c9fd0af 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -1158,9 +1158,9 @@ void GMainWindow::InitializeWidgets() { | |||
| 1158 | [this](const QPoint& menu_location) { | 1158 | [this](const QPoint& menu_location) { |
| 1159 | QMenu context_menu; | 1159 | QMenu context_menu; |
| 1160 | 1160 | ||
| 1161 | for (auto const& docked_mode_pair : Config::use_docked_mode_texts_map) { | 1161 | for (auto const& pair : Config::use_docked_mode_texts_map) { |
| 1162 | context_menu.addAction(docked_mode_pair.second, [this, docked_mode_pair] { | 1162 | context_menu.addAction(pair.second, [this, &pair] { |
| 1163 | if (docked_mode_pair.first != Settings::values.use_docked_mode.GetValue()) { | 1163 | if (pair.first != Settings::values.use_docked_mode.GetValue()) { |
| 1164 | OnToggleDockedMode(); | 1164 | OnToggleDockedMode(); |
| 1165 | } | 1165 | } |
| 1166 | }); | 1166 | }); |
| @@ -3674,7 +3674,7 @@ void GMainWindow::OnTasReset() { | |||
| 3674 | } | 3674 | } |
| 3675 | 3675 | ||
| 3676 | void GMainWindow::OnToggleDockedMode() { | 3676 | void GMainWindow::OnToggleDockedMode() { |
| 3677 | const bool is_docked = Settings::values.use_docked_mode.GetValue(); | 3677 | const bool is_docked = Settings::IsDockedMode(); |
| 3678 | auto* player_1 = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1); | 3678 | auto* player_1 = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1); |
| 3679 | auto* handheld = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld); | 3679 | auto* handheld = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld); |
| 3680 | 3680 | ||
| @@ -3688,7 +3688,8 @@ void GMainWindow::OnToggleDockedMode() { | |||
| 3688 | controller_dialog->refreshConfiguration(); | 3688 | controller_dialog->refreshConfiguration(); |
| 3689 | } | 3689 | } |
| 3690 | 3690 | ||
| 3691 | Settings::values.use_docked_mode.SetValue(!is_docked); | 3691 | Settings::values.use_docked_mode.SetValue(is_docked ? Settings::ConsoleMode::Handheld |
| 3692 | : Settings::ConsoleMode::Docked); | ||
| 3692 | UpdateDockedButton(); | 3693 | UpdateDockedButton(); |
| 3693 | OnDockedModeChanged(is_docked, !is_docked, *system); | 3694 | OnDockedModeChanged(is_docked, !is_docked, *system); |
| 3694 | } | 3695 | } |
| @@ -4118,10 +4119,10 @@ void GMainWindow::UpdateGPUAccuracyButton() { | |||
| 4118 | } | 4119 | } |
| 4119 | 4120 | ||
| 4120 | void GMainWindow::UpdateDockedButton() { | 4121 | void GMainWindow::UpdateDockedButton() { |
| 4121 | const bool is_docked = Settings::values.use_docked_mode.GetValue(); | 4122 | const auto console_mode = Settings::values.use_docked_mode.GetValue(); |
| 4122 | dock_status_button->setChecked(is_docked); | 4123 | dock_status_button->setChecked(Settings::IsDockedMode()); |
| 4123 | dock_status_button->setText( | 4124 | dock_status_button->setText( |
| 4124 | Config::use_docked_mode_texts_map.find(is_docked)->second.toUpper()); | 4125 | Config::use_docked_mode_texts_map.find(console_mode)->second.toUpper()); |
| 4125 | } | 4126 | } |
| 4126 | 4127 | ||
| 4127 | void GMainWindow::UpdateAPIText() { | 4128 | void GMainWindow::UpdateAPIText() { |