Restore the D-Pad behavior (see #18028)

This commit is contained in:
Henrik Rydgård committed 2023-09-11 11:41:29 +02:00
1 parent ef6ea1bd23
commit 72be2f5459
2 files changed
+14 -12

No files matched your search

+13 -12
View File
@@ -351,22 +351,23 @@ void PSPDpad::ProcessTouch(float x, float y, bool down) {
}
int lastDown = down_;
int pressed = ctrlMask & ~lastDown;
int released = (~ctrlMask) & lastDown;
down_ = ctrlMask;
__CtrlUpdateButtons(ctrlMask, CTRL_LEFT | CTRL_RIGHT | CTRL_UP | CTRL_DOWN);
if (g_Config.bHapticFeedback) {
int pressed = down_ & ~lastDown;
static const int dir[4] = { CTRL_RIGHT, CTRL_DOWN, CTRL_LEFT, CTRL_UP };
bool vibrate = false;
for (int i = 0; i < 4; i++) {
if (pressed & dir[i]) {
vibrate = true;
}
bool vibrate = false;
static const int dir[4] = { CTRL_RIGHT, CTRL_DOWN, CTRL_LEFT, CTRL_UP };
for (int i = 0; i < 4; i++) {
if (pressed & dir[i]) {
vibrate = true;
__CtrlUpdateButtons(dir[i], 0);
}
if (vibrate) {
System_Vibrate(HAPTIC_VIRTUAL_KEY);
if (released & dir[i]) {
__CtrlUpdateButtons(0, dir[i]);
}
}
if (vibrate && g_Config.bHapticFeedback) {
System_Vibrate(HAPTIC_VIRTUAL_KEY);
}
}
void PSPDpad::Draw(UIContext &dc) {