diff options
| -rw-r--r-- | src/common/settings.h | 8 | ||||
| -rw-r--r-- | src/common/settings_common.h | 1 | ||||
| -rw-r--r-- | src/common/settings_enums.h | 2 | ||||
| -rw-r--r-- | src/core/frontend/applets/controller.cpp | 3 | ||||
| -rw-r--r-- | src/core/frontend/framebuffer_layout.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/service/apm/apm_controller.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/gesture.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/vi/vi.cpp | 2 | ||||
| -rw-r--r-- | src/core/telemetry_session.cpp | 4 | ||||
| -rw-r--r-- | src/yuzu/applets/qt_controller.cpp | 18 | ||||
| -rw-r--r-- | src/yuzu/bootmanager.cpp | 5 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 9 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.h | 3 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input.cpp | 18 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 16 |
17 files changed, 74 insertions, 35 deletions
diff --git a/src/common/settings.h b/src/common/settings.h index 4407c1e6d..6d44fc626 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; |
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..4c0c5434c 100644 --- a/src/core/frontend/applets/controller.cpp +++ b/src/core/frontend/applets/controller.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 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_enums.h" | ||
| 6 | #include "core/frontend/applets/controller.h" | 7 | #include "core/frontend/applets/controller.h" |
| 7 | #include "core/hid/emulated_controller.h" | 8 | #include "core/hid/emulated_controller.h" |
| 8 | #include "core/hid/hid_core.h" | 9 | #include "core/hid/hid_core.h" |
| @@ -62,7 +63,7 @@ void DefaultControllerApplet::ReconfigureControllers(ReconfigureCallback callbac | |||
| 62 | controller->Connect(true); | 63 | controller->Connect(true); |
| 63 | } | 64 | } |
| 64 | } else if (index == 0 && parameters.enable_single_mode && parameters.allow_handheld && | 65 | } else if (index == 0 && parameters.enable_single_mode && parameters.allow_handheld && |
| 65 | !Settings::values.use_docked_mode.GetValue()) { | 66 | Settings::values.use_docked_mode.GetValue() == Settings::ConsoleMode::Handheld) { |
| 66 | // We should *never* reach here under any normal circumstances. | 67 | // We should *never* reach here under any normal circumstances. |
| 67 | controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::Handheld); | 68 | controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::Handheld); |
| 68 | controller->Connect(true); | 69 | controller->Connect(true); |
diff --git a/src/core/frontend/framebuffer_layout.cpp b/src/core/frontend/framebuffer_layout.cpp index b4081fc39..ae0a44f12 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,8 @@ 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 = |
| 54 | Settings::values.use_docked_mode.GetValue() == Settings::ConsoleMode::Docked; | ||
| 53 | const u32 screen_width = is_docked ? ScreenDocked::Width : ScreenUndocked::Width; | 55 | const u32 screen_width = is_docked ? ScreenDocked::Width : ScreenUndocked::Width; |
| 54 | const u32 screen_height = is_docked ? ScreenDocked::Height : ScreenUndocked::Height; | 56 | const u32 screen_height = is_docked ? ScreenDocked::Height : ScreenUndocked::Height; |
| 55 | 57 | ||
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 8d057b3a8..81df91a2d 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::values.use_docked_mode.GetValue() == Settings::ConsoleMode::Docked) { |
| 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,8 @@ 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::values.use_docked_mode.GetValue() == |
| 926 | Settings::ConsoleMode::Docked}; | ||
| 925 | LOG_DEBUG(Service_AM, "called, use_docked_mode={}", use_docked_mode); | 927 | LOG_DEBUG(Service_AM, "called, use_docked_mode={}", use_docked_mode); |
| 926 | 928 | ||
| 927 | IPC::ResponseBuilder rb{ctx, 3}; | 929 | 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..1656b2e73 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,9 @@ 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::values.use_docked_mode.GetValue() == Settings::ConsoleMode::Docked |
| 71 | : PerformanceMode::Normal; | 72 | ? PerformanceMode::Boost |
| 73 | : PerformanceMode::Normal; | ||
| 72 | } | 74 | } |
| 73 | 75 | ||
| 74 | PerformanceConfiguration Controller::GetCurrentPerformanceConfiguration(PerformanceMode mode) { | 76 | 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..47d4c08fc 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::values.use_docked_mode.GetValue() == Settings::ConsoleMode::Docked) { |
| 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..ba752d472 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::values.use_docked_mode.GetValue() == Settings::ConsoleMode::Docked) { |
| 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..6b5f3a17a 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::values.use_docked_mode.GetValue() == Settings::ConsoleMode::Docked) { |
| 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..8a1cd24b0 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,8 @@ 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", |
| 280 | Settings::values.use_docked_mode.GetValue() == Settings::ConsoleMode::Docked); | ||
| 279 | } | 281 | } |
| 280 | 282 | ||
| 281 | bool TelemetrySession::SubmitTestcase() { | 283 | bool TelemetrySession::SubmitTestcase() { |
diff --git a/src/yuzu/applets/qt_controller.cpp b/src/yuzu/applets/qt_controller.cpp index 00aafb8f8..c783325fb 100644 --- a/src/yuzu/applets/qt_controller.cpp +++ b/src/yuzu/applets/qt_controller.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <thread> | 5 | #include <thread> |
| 6 | 6 | ||
| 7 | #include "common/assert.h" | 7 | #include "common/assert.h" |
| 8 | #include "common/settings_enums.h" | ||
| 8 | #include "common/string_util.h" | 9 | #include "common/string_util.h" |
| 9 | #include "core/core.h" | 10 | #include "core/core.h" |
| 10 | #include "core/hid/emulated_controller.h" | 11 | #include "core/hid/emulated_controller.h" |
| @@ -226,9 +227,14 @@ int QtControllerSelectorDialog::exec() { | |||
| 226 | } | 227 | } |
| 227 | 228 | ||
| 228 | void QtControllerSelectorDialog::ApplyConfiguration() { | 229 | void QtControllerSelectorDialog::ApplyConfiguration() { |
| 229 | const bool pre_docked_mode = Settings::values.use_docked_mode.GetValue(); | 230 | const bool pre_docked_mode = |
| 230 | Settings::values.use_docked_mode.SetValue(ui->radioDocked->isChecked()); | 231 | Settings::values.use_docked_mode.GetValue() == Settings::ConsoleMode::Docked; |
| 231 | OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue(), system); | 232 | Settings::values.use_docked_mode.SetValue(ui->radioDocked->isChecked() |
| 233 | ? Settings::ConsoleMode::Docked | ||
| 234 | : Settings::ConsoleMode::Handheld); | ||
| 235 | OnDockedModeChanged( | ||
| 236 | pre_docked_mode, | ||
| 237 | Settings::values.use_docked_mode.GetValue() == Settings::ConsoleMode::Docked, system); | ||
| 232 | 238 | ||
| 233 | Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); | 239 | Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); |
| 234 | Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); | 240 | Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); |
| @@ -616,8 +622,10 @@ void QtControllerSelectorDialog::UpdateDockedState(bool is_handheld) { | |||
| 616 | ui->radioDocked->setEnabled(!is_handheld); | 622 | ui->radioDocked->setEnabled(!is_handheld); |
| 617 | ui->radioUndocked->setEnabled(!is_handheld); | 623 | ui->radioUndocked->setEnabled(!is_handheld); |
| 618 | 624 | ||
| 619 | ui->radioDocked->setChecked(Settings::values.use_docked_mode.GetValue()); | 625 | ui->radioDocked->setChecked(Settings::values.use_docked_mode.GetValue() == |
| 620 | ui->radioUndocked->setChecked(!Settings::values.use_docked_mode.GetValue()); | 626 | Settings::ConsoleMode::Docked); |
| 627 | ui->radioUndocked->setChecked(Settings::values.use_docked_mode.GetValue() == | ||
| 628 | Settings::ConsoleMode::Handheld); | ||
| 621 | 629 | ||
| 622 | // Also force into undocked mode if the controller type is handheld. | 630 | // Also force into undocked mode if the controller type is handheld. |
| 623 | if (is_handheld) { | 631 | if (is_handheld) { |
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 407988b8f..37753b47e 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp | |||
| @@ -928,8 +928,9 @@ 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::values.use_docked_mode.GetValue() == Settings::ConsoleMode::Docked |
| 932 | : Layout::ScreenUndocked::Height; | 932 | ? Layout::ScreenDocked::Height |
| 933 | : Layout::ScreenUndocked::Height; | ||
| 933 | height *= Settings::values.resolution_info.up_factor; | 934 | height *= Settings::values.resolution_info.up_factor; |
| 934 | } | 935 | } |
| 935 | const u32 width = | 936 | 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..78ed8c610 100644 --- a/src/yuzu/configuration/configure_input.cpp +++ b/src/yuzu/configuration/configure_input.cpp | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #include <memory> | 4 | #include <memory> |
| 5 | #include <thread> | 5 | #include <thread> |
| 6 | 6 | ||
| 7 | #include "common/settings_enums.h" | ||
| 7 | #include "core/core.h" | 8 | #include "core/core.h" |
| 8 | #include "core/hid/emulated_controller.h" | 9 | #include "core/hid/emulated_controller.h" |
| 9 | #include "core/hid/hid_core.h" | 10 | #include "core/hid/hid_core.h" |
| @@ -197,9 +198,14 @@ void ConfigureInput::ApplyConfiguration() { | |||
| 197 | 198 | ||
| 198 | advanced->ApplyConfiguration(); | 199 | advanced->ApplyConfiguration(); |
| 199 | 200 | ||
| 200 | const bool pre_docked_mode = Settings::values.use_docked_mode.GetValue(); | 201 | const bool pre_docked_mode = |
| 201 | Settings::values.use_docked_mode.SetValue(ui->radioDocked->isChecked()); | 202 | Settings::values.use_docked_mode.GetValue() == Settings::ConsoleMode::Docked; |
| 202 | OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue(), system); | 203 | Settings::values.use_docked_mode.SetValue(ui->radioDocked->isChecked() |
| 204 | ? Settings::ConsoleMode::Docked | ||
| 205 | : Settings::ConsoleMode::Handheld); | ||
| 206 | OnDockedModeChanged( | ||
| 207 | pre_docked_mode, | ||
| 208 | Settings::values.use_docked_mode.GetValue() == Settings::ConsoleMode::Docked, system); | ||
| 203 | 209 | ||
| 204 | Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); | 210 | Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); |
| 205 | Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); | 211 | Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); |
| @@ -267,8 +273,10 @@ void ConfigureInput::UpdateDockedState(bool is_handheld) { | |||
| 267 | ui->radioDocked->setEnabled(!is_handheld); | 273 | ui->radioDocked->setEnabled(!is_handheld); |
| 268 | ui->radioUndocked->setEnabled(!is_handheld); | 274 | ui->radioUndocked->setEnabled(!is_handheld); |
| 269 | 275 | ||
| 270 | ui->radioDocked->setChecked(Settings::values.use_docked_mode.GetValue()); | 276 | ui->radioDocked->setChecked(Settings::values.use_docked_mode.GetValue() == |
| 271 | ui->radioUndocked->setChecked(!Settings::values.use_docked_mode.GetValue()); | 277 | Settings::ConsoleMode::Docked); |
| 278 | ui->radioUndocked->setChecked(Settings::values.use_docked_mode.GetValue() == | ||
| 279 | Settings::ConsoleMode::Handheld); | ||
| 272 | 280 | ||
| 273 | // Also force into undocked mode if the controller type is handheld. | 281 | // Also force into undocked mode if the controller type is handheld. |
| 274 | if (is_handheld) { | 282 | if (is_handheld) { |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index a9d035f3d..8ab4e73b1 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& [value, text] : Config::use_docked_mode_texts_map) { |
| 1162 | context_menu.addAction(docked_mode_pair.second, [this, docked_mode_pair] { | 1162 | context_menu.addAction(text, [this, value] { |
| 1163 | if (docked_mode_pair.first != Settings::values.use_docked_mode.GetValue()) { | 1163 | if (value != Settings::values.use_docked_mode.GetValue()) { |
| 1164 | OnToggleDockedMode(); | 1164 | OnToggleDockedMode(); |
| 1165 | } | 1165 | } |
| 1166 | }); | 1166 | }); |
| @@ -3636,7 +3636,8 @@ void GMainWindow::OnTasReset() { | |||
| 3636 | } | 3636 | } |
| 3637 | 3637 | ||
| 3638 | void GMainWindow::OnToggleDockedMode() { | 3638 | void GMainWindow::OnToggleDockedMode() { |
| 3639 | const bool is_docked = Settings::values.use_docked_mode.GetValue(); | 3639 | const bool is_docked = |
| 3640 | Settings::values.use_docked_mode.GetValue() == Settings::ConsoleMode::Docked; | ||
| 3640 | auto* player_1 = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1); | 3641 | auto* player_1 = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1); |
| 3641 | auto* handheld = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld); | 3642 | auto* handheld = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld); |
| 3642 | 3643 | ||
| @@ -3650,7 +3651,8 @@ void GMainWindow::OnToggleDockedMode() { | |||
| 3650 | controller_dialog->refreshConfiguration(); | 3651 | controller_dialog->refreshConfiguration(); |
| 3651 | } | 3652 | } |
| 3652 | 3653 | ||
| 3653 | Settings::values.use_docked_mode.SetValue(!is_docked); | 3654 | Settings::values.use_docked_mode.SetValue(is_docked ? Settings::ConsoleMode::Docked |
| 3655 | : Settings::ConsoleMode::Handheld); | ||
| 3654 | UpdateDockedButton(); | 3656 | UpdateDockedButton(); |
| 3655 | OnDockedModeChanged(is_docked, !is_docked, *system); | 3657 | OnDockedModeChanged(is_docked, !is_docked, *system); |
| 3656 | } | 3658 | } |
| @@ -4080,8 +4082,8 @@ void GMainWindow::UpdateGPUAccuracyButton() { | |||
| 4080 | } | 4082 | } |
| 4081 | 4083 | ||
| 4082 | void GMainWindow::UpdateDockedButton() { | 4084 | void GMainWindow::UpdateDockedButton() { |
| 4083 | const bool is_docked = Settings::values.use_docked_mode.GetValue(); | 4085 | const auto is_docked = Settings::values.use_docked_mode.GetValue(); |
| 4084 | dock_status_button->setChecked(is_docked); | 4086 | dock_status_button->setChecked(is_docked == Settings::ConsoleMode::Docked); |
| 4085 | dock_status_button->setText( | 4087 | dock_status_button->setText( |
| 4086 | Config::use_docked_mode_texts_map.find(is_docked)->second.toUpper()); | 4088 | Config::use_docked_mode_texts_map.find(is_docked)->second.toUpper()); |
| 4087 | } | 4089 | } |