diff options
| author | 2023-08-21 16:03:30 -0400 | |
|---|---|---|
| committer | 2023-08-22 16:07:52 -0400 | |
| commit | 387ede76d2e1e427f6722cbe19a018c95d762748 (patch) | |
| tree | 49f5a327eac0238c0e5197550f4753da592212b7 /src/core | |
| parent | shared_widget: Implement radio groups (diff) | |
| download | yuzu-387ede76d2e1e427f6722cbe19a018c95d762748.tar.gz yuzu-387ede76d2e1e427f6722cbe19a018c95d762748.tar.xz yuzu-387ede76d2e1e427f6722cbe19a018c95d762748.zip | |
general: Convert use_docked_mode to an enumeration
Allows some special interactions with it in the Qt frontend.
Diffstat (limited to 'src/core')
| -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 |
8 files changed, 19 insertions, 10 deletions
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() { |