From df806125b9e82c41ae0ca6cede895301770f5a64 Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Wed, 22 Mar 2023 21:44:37 -0400 Subject: [PATCH] Android: Ignore input from invalid pointer identifier --- .../dolphinemu/overlay/InputOverlayPointer.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlayPointer.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlayPointer.java index 1d96f5c617..09d02a174a 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlayPointer.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlayPointer.java @@ -108,20 +108,21 @@ public class InputOverlayPointer break; } - if (trackId == -1) + int eventPointerIndex = event.findPointerIndex(trackId); + if (trackId == -1 || eventPointerIndex == -1) return; if (mMode == MODE_FOLLOW) { - mCurrentX = (event.getX(event.findPointerIndex(trackId)) - mGameCenterX) * mGameWidthHalfInv; - mCurrentY = (event.getY(event.findPointerIndex(trackId)) - mGameCenterY) * mGameHeightHalfInv; + mCurrentX = (event.getX(eventPointerIndex) - mGameCenterX) * mGameWidthHalfInv; + mCurrentY = (event.getY(eventPointerIndex) - mGameCenterY) * mGameHeightHalfInv; } else if (mMode == MODE_DRAG) { mCurrentX = mOldX + - (event.getX(event.findPointerIndex(trackId)) - mTouchStartX) * mGameWidthHalfInv; + (event.getX(eventPointerIndex) - mTouchStartX) * mGameWidthHalfInv; mCurrentY = mOldY + - (event.getY(event.findPointerIndex(trackId)) - mTouchStartY) * mGameHeightHalfInv; + (event.getY(eventPointerIndex) - mTouchStartY) * mGameHeightHalfInv; } }