Fixed a conflict between the touch and joystick drivers. They now should both behave as expected. gsoc2008_nds
authorDarren Alton <dalton@stevens.edu>
Tue, 01 Jul 2008 13:02:50 +0000
branchgsoc2008_nds
changeset 2676082cc3ffd7d8
parent 2675 5e4274591163
child 2677 6386764eb222
Fixed a conflict between the touch and joystick drivers. They now should both behave as expected.
src/file/SDL_rwops.c
src/joystick/nds/SDL_sysjoystick.c
src/touchscreen/nds/SDL_systouchscreen.c
src/video/nds/SDL_ndsevents.c
     1.1 --- a/src/file/SDL_rwops.c	Sun Jun 29 21:32:31 2008 +0000
     1.2 +++ b/src/file/SDL_rwops.c	Tue Jul 01 13:02:50 2008 +0000
     1.3 @@ -466,9 +466,11 @@
     1.4  SDL_RWFromFP(FILE * fp, SDL_bool autoclose)
     1.5  {
     1.6      SDL_RWops *rwops = NULL;
     1.7 -#ifdef __NDS__
     1.8 +#if 0
     1.9 +ifdef __NDS__
    1.10      /* set it up so we can use stdio file function */
    1.11      fatInitDefault();
    1.12 +    printf("called fatInitDefault()");
    1.13  #endif /* __NDS__ */
    1.14      rwops = SDL_AllocRW();
    1.15      if (rwops != NULL) {
     2.1 --- a/src/joystick/nds/SDL_sysjoystick.c	Sun Jun 29 21:32:31 2008 +0000
     2.2 +++ b/src/joystick/nds/SDL_sysjoystick.c	Tue Jul 01 13:02:50 2008 +0000
     2.3 @@ -91,7 +91,7 @@
     2.4  {
     2.5      u32 keysd, keysu;
     2.6      int magnitude = 16384;
     2.7 -    scanKeys();
     2.8 +    /*scanKeys();*/
     2.9      keysd = keysDown();
    2.10      keysu = keysUp();
    2.11  
     3.1 --- a/src/touchscreen/nds/SDL_systouchscreen.c	Sun Jun 29 21:32:31 2008 +0000
     3.2 +++ b/src/touchscreen/nds/SDL_systouchscreen.c	Tue Jul 01 13:02:50 2008 +0000
     3.3 @@ -85,7 +85,7 @@
     3.4      Uint16 xpos=0, ypos=0, pressure = 32767;
     3.5      touchPosition touch;
     3.6  
     3.7 -    scanKeys();
     3.8 +    /*scanKeys();*/
     3.9      keysd = keysDown();
    3.10      keysh = keysHeld();
    3.11      keysu = keysUp();
    3.12 @@ -94,13 +94,18 @@
    3.13      ypos = (touch.py << 16) / 192 + 1;
    3.14      /* TODO uses touch.x and touch.y for something.
    3.15         we discussed in the mailing list having both "hardware x/y" and
    3.16 -       "screen x/y" coordinates. */
    3.17 +       "screen x/y" coordinates.  maybe modify structs for that too
    3.18 +       also, find out how Colors! gets pressure and see if it's practical here
    3.19 +     */
    3.20  
    3.21      if ((keysd & KEY_TOUCH)) {
    3.22          SDL_PrivateTouchPress(touchscreen, 0, xpos, ypos, pressure);
    3.23      }
    3.24      if ((keysh & KEY_TOUCH)) {
    3.25 -    	SDL_PrivateTouchMove(touchscreen, 0, xpos, ypos, pressure); 
    3.26 +    	/* sometimes the touch jumps to y=1 before it reports as keysUp */
    3.27 +    	if(ypos > 1) {
    3.28 +	    SDL_PrivateTouchMove(touchscreen, 0, xpos, ypos, pressure);
    3.29 +	}
    3.30      }
    3.31      if ((keysu & KEY_TOUCH)) {
    3.32          SDL_PrivateTouchRelease(touchscreen, 0);
     4.1 --- a/src/video/nds/SDL_ndsevents.c	Sun Jun 29 21:32:31 2008 +0000
     4.2 +++ b/src/video/nds/SDL_ndsevents.c	Tue Jul 01 13:02:50 2008 +0000
     4.3 @@ -38,7 +38,7 @@
     4.4  void
     4.5  NDS_PumpEvents(_THIS)
     4.6  {
     4.7 -    /* do nothing. */
     4.8 +    scanKeys();
     4.9  }
    4.10  
    4.11  /* vi: set ts=4 sw=4 expandtab: */