From c36a5f339555d11353ecbd704e4c812e77d4a0ae Mon Sep 17 00:00:00 2001 From: Matthew Stewart Date: Sat, 17 Feb 2018 21:38:04 -0500 Subject: DS: Fix touch input --- backends/platform/ds/arm7/source/main.cpp | 8 ++++---- backends/platform/ds/arm9/source/dsmain.cpp | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'backends/platform/ds') diff --git a/backends/platform/ds/arm7/source/main.cpp b/backends/platform/ds/arm7/source/main.cpp index c4a22b8f68..f0765f617a 100644 --- a/backends/platform/ds/arm7/source/main.cpp +++ b/backends/platform/ds/arm7/source/main.cpp @@ -443,11 +443,11 @@ void InterruptTimer3() { x = p.rawx; y = p.rawy; - xpx = p.px; - ypx = p.py; + //xpx = p.px; + //ypx = p.py; -// xpx = ( ((SCREEN_WIDTH -60) * x) / TOUCH_WIDTH ) - TOUCH_OFFSET_X; - // ypx = ( ((SCREEN_HEIGHT-60) * y) / TOUCH_HEIGHT ) - TOUCH_OFFSET_Y; + xpx = ( ((SCREEN_WIDTH -60) * x) / TOUCH_WIDTH ) - TOUCH_OFFSET_X; + ypx = ( ((SCREEN_HEIGHT-60) * y) / TOUCH_HEIGHT ) - TOUCH_OFFSET_Y; // xpx = (IPC->touchX - (int16) TOUCH_CAL_X1) * CNTRL_WIDTH / TOUCH_WIDTH + (int16) (TOUCH_CNTRL_X1 - 8); // ypx = (IPC->touchY - (int16) TOUCH_CAL_Y1) * CNTRL_HEIGHT / TOUCH_HEIGHT + (int16) (TOUCH_CNTRL_Y1 - 8); diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index ac030dbe2e..e44e360d5b 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -2499,7 +2499,7 @@ void penUpdate() { // if (getKeysHeld() & KEY_L) consolePrintf("%d, %d penX=%d, penY=%d tz=%d\n", IPC->touchXpx, IPC->touchYpx, penX, penY, IPC->touchZ1); - bool penDownThisFrame = (IPC->touchZ1 > 0) && (IPC->touchXpx > 0) && (IPC->touchYpx > 0); + bool penDownThisFrame = (!(IPC->buttons & 0x40)) && (IPC->touchXpx > 0) && (IPC->touchYpx > 0); static bool moved = false; if (( (tapScreenClicks) || getKeyboardEnable() ) && (getIsDisplayMode8Bit())) { @@ -2626,7 +2626,7 @@ void penUpdate() { penDownSaved = true; } - if ((IPC->touchZ1 > 0) && (IPC->touchXpx > 0) && (IPC->touchYpx > 0)) { + if ((!(IPC->buttons & 0x40)) && (IPC->touchXpx > 0) && (IPC->touchYpx > 0)) { penX = IPC->touchXpx + touchXOffset; penY = IPC->touchYpx + touchYOffset; moved = true; @@ -2648,7 +2648,7 @@ void penUpdate() { - if ((IPC->touchZ1 > 0) || ((penDownFrames == 2)) ) { + if ((!(IPC->buttons & 0x40)) || ((penDownFrames == 2)) ) { penDownLastFrame = true; penDownFrames++; } else { -- cgit v1.2.3