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) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-22 10:55:30 +02:00
1 parent 20686814a3
commit fbf101de36
1 file changed
+6 -4
+6 -4
View File
@@ -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;