Skip to content

Commit

Permalink
DS: Fix touch input
Browse files Browse the repository at this point in the history
  • Loading branch information
Stewmath authored and sev- committed Apr 7, 2018
1 parent a43f914 commit c36a5f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions backends/platform/ds/arm7/source/main.cpp
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions backends/platform/ds/arm9/source/dsmain.cpp
Expand Up @@ -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())) {
Expand Down Expand Up @@ -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;
Expand All @@ -2648,7 +2648,7 @@ void penUpdate() {



if ((IPC->touchZ1 > 0) || ((penDownFrames == 2)) ) {
if ((!(IPC->buttons & 0x40)) || ((penDownFrames == 2)) ) {
penDownLastFrame = true;
penDownFrames++;
} else {
Expand Down

0 comments on commit c36a5f3

Please sign in to comment.