From 8222488377873b7919fa60ded8e739d335022c27 Mon Sep 17 00:00:00 2001 From: Darren Alton Date: Tue, 1 Jul 2008 13:02:50 +0000 Subject: [PATCH] Fixed a conflict between the touch and joystick drivers. They now should both behave as expected. --- src/file/SDL_rwops.c | 4 +++- src/joystick/nds/SDL_sysjoystick.c | 2 +- src/touchscreen/nds/SDL_systouchscreen.c | 11 ++++++++--- src/video/nds/SDL_ndsevents.c | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c index c3ecfe8bb..3fa33bd30 100644 --- a/src/file/SDL_rwops.c +++ b/src/file/SDL_rwops.c @@ -466,9 +466,11 @@ SDL_RWops * SDL_RWFromFP(FILE * fp, SDL_bool autoclose) { SDL_RWops *rwops = NULL; -#ifdef __NDS__ +#if 0 +ifdef __NDS__ /* set it up so we can use stdio file function */ fatInitDefault(); + printf("called fatInitDefault()"); #endif /* __NDS__ */ rwops = SDL_AllocRW(); if (rwops != NULL) { diff --git a/src/joystick/nds/SDL_sysjoystick.c b/src/joystick/nds/SDL_sysjoystick.c index 6ba46bb95..85763ed3b 100644 --- a/src/joystick/nds/SDL_sysjoystick.c +++ b/src/joystick/nds/SDL_sysjoystick.c @@ -91,7 +91,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) { u32 keysd, keysu; int magnitude = 16384; - scanKeys(); + /*scanKeys();*/ keysd = keysDown(); keysu = keysUp(); diff --git a/src/touchscreen/nds/SDL_systouchscreen.c b/src/touchscreen/nds/SDL_systouchscreen.c index 8d9540dfb..67c716a46 100644 --- a/src/touchscreen/nds/SDL_systouchscreen.c +++ b/src/touchscreen/nds/SDL_systouchscreen.c @@ -85,7 +85,7 @@ SDL_SYS_TouchscreenUpdate(SDL_Touchscreen * touchscreen) Uint16 xpos=0, ypos=0, pressure = 32767; touchPosition touch; - scanKeys(); + /*scanKeys();*/ keysd = keysDown(); keysh = keysHeld(); keysu = keysUp(); @@ -94,13 +94,18 @@ SDL_SYS_TouchscreenUpdate(SDL_Touchscreen * touchscreen) ypos = (touch.py << 16) / 192 + 1; /* TODO uses touch.x and touch.y for something. we discussed in the mailing list having both "hardware x/y" and - "screen x/y" coordinates. */ + "screen x/y" coordinates. maybe modify structs for that too + also, find out how Colors! gets pressure and see if it's practical here + */ if ((keysd & KEY_TOUCH)) { SDL_PrivateTouchPress(touchscreen, 0, xpos, ypos, pressure); } if ((keysh & KEY_TOUCH)) { - SDL_PrivateTouchMove(touchscreen, 0, xpos, ypos, pressure); + /* sometimes the touch jumps to y=1 before it reports as keysUp */ + if(ypos > 1) { + SDL_PrivateTouchMove(touchscreen, 0, xpos, ypos, pressure); + } } if ((keysu & KEY_TOUCH)) { SDL_PrivateTouchRelease(touchscreen, 0); diff --git a/src/video/nds/SDL_ndsevents.c b/src/video/nds/SDL_ndsevents.c index c72ac1525..e605425fb 100644 --- a/src/video/nds/SDL_ndsevents.c +++ b/src/video/nds/SDL_ndsevents.c @@ -38,7 +38,7 @@ void NDS_PumpEvents(_THIS) { - /* do nothing. */ + scanKeys(); } /* vi: set ts=4 sw=4 expandtab: */