diff --git a/UI/GamepadEmu.cpp b/UI/GamepadEmu.cpp index b38ec5505fb1..1c72a3879c9d 100644 --- a/UI/GamepadEmu.cpp +++ b/UI/GamepadEmu.cpp @@ -35,6 +35,7 @@ #include "UI/GamepadEmu.h" static uint32_t usedPointerMask = 0; +static uint32_t analogPointerMask = 0; static u32 GetButtonColor() { return g_Config.iTouchButtonStyle != 0 ? 0xFFFFFF : 0xc0b080; @@ -96,6 +97,9 @@ void MultiTouchButton::GetContentDimensions(const UIContext &dc, float &w, float } void MultiTouchButton::Touch(const TouchInput &input) { + if (analogPointerMask & (1 << input.id)) + return; + GamepadView::Touch(input); if ((input.flags & TOUCH_DOWN) && bounds_.Contains(input.x, input.y)) { pointerDownMask_ |= 1 << input.id; @@ -152,6 +156,9 @@ void MultiTouchButton::Draw(UIContext &dc) { } void BoolButton::Touch(const TouchInput &input) { + if (analogPointerMask & (1 << input.id)) + return; + bool lastDown = pointerDownMask_ != 0; MultiTouchButton::Touch(input); bool down = pointerDownMask_ != 0; @@ -165,6 +172,9 @@ void BoolButton::Touch(const TouchInput &input) { } void PSPButton::Touch(const TouchInput &input) { + if (analogPointerMask & (1 << input.id)) + return; + bool lastDown = pointerDownMask_ != 0; MultiTouchButton::Touch(input); bool down = pointerDownMask_ != 0; @@ -192,6 +202,9 @@ void ComboKey::GetContentDimensions(const UIContext &dc, float &w, float &h) con } void ComboKey::Touch(const TouchInput &input) { + if (analogPointerMask & (1 << input.id)) + return; + using namespace CustomKey; bool lastDown = pointerDownMask_ != 0; MultiTouchButton::Touch(input); @@ -231,6 +244,9 @@ void PSPDpad::GetContentDimensions(const UIContext &dc, float &w, float &h) cons } void PSPDpad::Touch(const TouchInput &input) { + if (analogPointerMask & (1 << input.id)) + return; + GamepadView::Touch(input); if (input.flags & TOUCH_DOWN) { @@ -241,6 +257,9 @@ void PSPDpad::Touch(const TouchInput &input) { } } if (input.flags & TOUCH_MOVE) { + if (dragPointerId_ == -1 && bounds_.Contains(input.x, input.y)) { + dragPointerId_ = input.id; + } if (input.id == dragPointerId_) { ProcessTouch(input.x, input.y, true); } @@ -397,6 +416,7 @@ void PSPStick::Touch(const TouchInput &input) { centerY_ = bounds_.centerY(); __CtrlSetAnalogXY(stick_, 0.0f, 0.0f); usedPointerMask = 0; + analogPointerMask = 0; return; } if (input.flags & TOUCH_DOWN) { @@ -410,6 +430,7 @@ void PSPStick::Touch(const TouchInput &input) { } dragPointerId_ = input.id; usedPointerMask |= 1 << input.id; + analogPointerMask |= 1 << input.id; ProcessTouch(input.x, input.y, true); } } @@ -424,6 +445,7 @@ void PSPStick::Touch(const TouchInput &input) { centerX_ = bounds_.centerX(); centerY_ = bounds_.centerY(); usedPointerMask &= ~(1 << input.id); + analogPointerMask &= ~(1 << input.id); ProcessTouch(input.x, input.y, false); } } @@ -497,6 +519,7 @@ void PSPCustomStick::Touch(const TouchInput &input) { posX_ = 0.0f; posY_ = 0.0f; usedPointerMask = 0; + analogPointerMask = 0; return; } if (input.flags & TOUCH_DOWN) { @@ -510,6 +533,7 @@ void PSPCustomStick::Touch(const TouchInput &input) { } dragPointerId_ = input.id; usedPointerMask |= 1 << input.id; + analogPointerMask |= 1 << input.id; ProcessTouch(input.x, input.y, true); } } @@ -524,6 +548,7 @@ void PSPCustomStick::Touch(const TouchInput &input) { centerX_ = bounds_.centerX(); centerY_ = bounds_.centerY(); usedPointerMask &= ~(1 << input.id); + analogPointerMask &= ~(1 << input.id); ProcessTouch(input.x, input.y, false); } }