From 5ef2f060193f708668fbc2302ca04ce808cce5d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 14 Feb 2025 11:00:24 -0600 Subject: [PATCH] Implement "Touch gliding" (keep all dragged/touched buttons pressed until touch release) I think the feature might need a better name though? Fixes #14490 --- Core/Config.cpp | 1 + Core/Config.h | 5 +++++ UI/GameSettingsScreen.cpp | 2 ++ UI/GamepadEmu.cpp | 2 +- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index 5a4a520c01..ccfcfa9955 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -284,6 +284,7 @@ static const ConfigSetting generalSettings[] = { ConfigSetting("SwipeSmoothing", &g_Config.fSwipeSmoothing, 0.3f, CfgFlag::PER_GAME), ConfigSetting("DoubleTapGesture", &g_Config.iDoubleTapGesture, 0, CfgFlag::PER_GAME), ConfigSetting("GestureControlEnabled", &g_Config.bGestureControlEnabled, false, CfgFlag::PER_GAME), + ConfigSetting("TouchGliding", &g_Config.bTouchGliding, false, CfgFlag::PER_GAME), // "default" means let emulator decide, "" means disable. ConfigSetting("ReportingHost", &g_Config.sReportHost, "default", CfgFlag::DEFAULT), diff --git a/Core/Config.h b/Core/Config.h index 706fcce91b..22c5c18ec0 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -361,7 +361,9 @@ public: // Disable diagonals bool bDisableDpadDiagonals; + bool bGamepadOnlyFocused; + // Control Style int iTouchButtonStyle; int iTouchButtonOpacity; @@ -377,6 +379,9 @@ public: // Sticky D-pad (can't glide off it) bool bStickyTouchDPad; + // Touch gliding (see #14490) + bool bTouchGliding; + //space between PSP buttons //the PSP button's center (triangle, circle, square, cross) ConfigTouchPos touchActionButtonCenter; diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index e7334d95f6..b55b147f47 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -801,6 +801,8 @@ void GameSettingsScreen::CreateControlsSettings(UI::ViewGroup *controlsSettings) autoHide->SetFormat(di->T("%d seconds")); autoHide->SetZeroLabel(co->T("Off")); + controlsSettings->Add(new CheckBox(&g_Config.bTouchGliding, co->T("Touch gliding"))); + // Hide stick background, useful when increasing the size CheckBox *hideStickBackground = controlsSettings->Add(new CheckBox(&g_Config.bHideStickBackground, co->T("Hide touch analog stick background circle"))); hideStickBackground->SetEnabledPtr(&g_Config.bShowTouchControls); diff --git a/UI/GamepadEmu.cpp b/UI/GamepadEmu.cpp index aecb6a4a85..90633be5d4 100644 --- a/UI/GamepadEmu.cpp +++ b/UI/GamepadEmu.cpp @@ -110,7 +110,7 @@ bool MultiTouchButton::Touch(const TouchInput &input) { if (!(input.flags & TOUCH_MOUSE) || input.buttons) { if (bounds_.Contains(input.x, input.y) && !(analogPointerMask & (1 << input.id))) pointerDownMask_ |= 1 << input.id; - else + else if (!g_Config.bTouchGliding) pointerDownMask_ &= ~(1 << input.id); } }