From fbf101de36f5b318b927aca0cc45753b9966537b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 22 Oct 2026 08:56:02 +0200 Subject: [PATCH] Touch controls: Rotate with the current orientation's display layout The D-pad and sticks always used the landscape layout's rotation settings, while the screen and physical pads use the current orientation's. Co-Authored-By: Claude Opus 5.5 (1M context) --- UI/GamepadEmu.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/UI/GamepadEmu.cpp b/UI/GamepadEmu.cpp index d49edbfdf3..79833e70d4 100644 --- a/UI/GamepadEmu.cpp +++ b/UI/GamepadEmu.cpp @@ -95,11 +95,12 @@ GamepadComponent::GamepadComponent(std::string_view key, UI::LayoutParams *layou static void rotateTouchHelper(float &dx, float &dy) { // rotates dx and dy depending on rotation count // modified from controlmapper.cpp - if (!g_Config.displayLayoutLandscape.bRotateControlsWithScreen) { + const DisplayLayoutConfig &layout = g_Config.GetDisplayLayoutConfig(g_display.GetDeviceOrientation()); + if (!layout.bRotateControlsWithScreen) { return; } int rotations = 0; - switch (g_Config.displayLayoutLandscape.iInternalScreenRotation) { + switch (layout.iInternalScreenRotation) { case ROTATION_LOCKED_HORIZONTAL180: rotations = 2; break; case ROTATION_LOCKED_VERTICAL: rotations = 3; break; case ROTATION_LOCKED_VERTICAL180: rotations = 1; break; @@ -459,8 +460,9 @@ void PSPDpad::Draw(UIContext &dc) { return; // from control mapper.cpp int rotations = 0; - if (g_Config.displayLayoutLandscape.bRotateControlsWithScreen) { - switch (g_Config.displayLayoutLandscape.iInternalScreenRotation) { + const DisplayLayoutConfig &layout = g_Config.GetDisplayLayoutConfig(g_display.GetDeviceOrientation()); + if (layout.bRotateControlsWithScreen) { + switch (layout.iInternalScreenRotation) { case ROTATION_LOCKED_HORIZONTAL180: rotations = 2; break; case ROTATION_LOCKED_VERTICAL: rotations = 3; break; case ROTATION_LOCKED_VERTICAL180: rotations = 1; break;