From 63bc4910cf69ae736852317b4e720cda8a98417c Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Tue, 10 Dec 2013 18:58:47 +0100 Subject: [PATCH] Touch controls: Make it harder to accidentally hit dpad diagonals. Treats the dpad as 4-way out to a certain radius. --- UI/GamepadEmu.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/UI/GamepadEmu.cpp b/UI/GamepadEmu.cpp index a76e2b7df0..8a039fe17f 100644 --- a/UI/GamepadEmu.cpp +++ b/UI/GamepadEmu.cpp @@ -143,8 +143,10 @@ void PSPDpad::ProcessTouch(float x, float y, bool down) { int ctrlMask = 0; int lastDown = down_; + + bool fourWay = g_Config.bDisableDpadDiagonals || rad < 1.25f; if (down) { - if (g_Config.bDisableDpadDiagonals) { + if (fourWay) { int direction = (int)(floorf((atan2f(dy, dx) / (2 * M_PI) * 4) + 0.5f)) & 3; switch (direction) { case 0: ctrlMask |= CTRL_RIGHT; break;