src/joystick/android/SDL_sysjoystick.c
changeset 6707 70eeb7e3ec2f
parent 6696 73e2ad636f6e
child 6744 4ac2bb6dc80c
     1.1 --- a/src/joystick/android/SDL_sysjoystick.c	Mon Nov 26 23:58:53 2012 -0800
     1.2 +++ b/src/joystick/android/SDL_sysjoystick.c	Tue Nov 27 00:58:12 2012 -0800
     1.3 @@ -46,16 +46,31 @@
     1.4      return (1);
     1.5  }
     1.6  
     1.7 +int SDL_SYS_NumJoysticks()
     1.8 +{
     1.9 +    return 1;
    1.10 +}
    1.11 +
    1.12 +void SDL_SYS_JoystickDetect()
    1.13 +{
    1.14 +}
    1.15 +
    1.16 +SDL_bool SDL_SYS_JoystickNeedsPolling()
    1.17 +{
    1.18 +    return SDL_FALSE;
    1.19 +}
    1.20 +
    1.21  /* Function to get the device-dependent name of a joystick */
    1.22  const char *
    1.23 -SDL_SYS_JoystickNameForIndex(int index)
    1.24 +SDL_SYS_JoystickNameForDeviceIndex(int device_index)
    1.25  {
    1.26 -    if (index == 0) {
    1.27 -        return accelerometerName;
    1.28 -    } else {
    1.29 -        SDL_SetError("No joystick available with that index");
    1.30 -        return (NULL);
    1.31 -    }
    1.32 +    return accelerometerName;
    1.33 +}
    1.34 +
    1.35 +/* Function to perform the mapping from device index to the instance id for this index */
    1.36 +SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
    1.37 +{
    1.38 +    return device_index;
    1.39  }
    1.40  
    1.41  /* Function to open a joystick for use.
    1.42 @@ -78,6 +93,11 @@
    1.43  	}
    1.44  }
    1.45  
    1.46 +/* Function to determine is this joystick is attached to the system right now */
    1.47 +SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
    1.48 +{
    1.49 +    return SDL_TRUE;
    1.50 +}
    1.51  
    1.52  /* Function to update the state of a joystick - called as a device poll.
    1.53   * This function shouldn't update the joystick structure directly,
    1.54 @@ -111,43 +131,17 @@
    1.55  {
    1.56  }
    1.57  
    1.58 -/* Function to perform the mapping from device index to the instance id for this index */
    1.59 -SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int index)
    1.60 -{
    1.61 -    return index;
    1.62 -}
    1.63 -
    1.64 -/* Function to determine is this joystick is attached to the system right now */
    1.65 -int SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
    1.66 -{
    1.67 -    return 1;
    1.68 -}
    1.69 -
    1.70 -int SDL_SYS_NumJoysticks()
    1.71 -{
    1.72 -    return 1;
    1.73 -}
    1.74 -
    1.75 -int SDL_SYS_JoystickNeedsPolling()
    1.76 -{
    1.77 -    return 0;
    1.78 -}
    1.79 -
    1.80 -void SDL_SYS_JoystickDetect()
    1.81 -{
    1.82 -}
    1.83 -
    1.84 -JoystickGUID SDL_SYS_PrivateJoystickGetDeviceGUID( int device_index )
    1.85 +JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
    1.86  {
    1.87      JoystickGUID guid;
    1.88      // the GUID is just the first 16 chars of the name for now
    1.89 -    const char *name = SDL_SYS_JoystickNameForIndex( device_index );
    1.90 +    const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
    1.91      SDL_zero( guid );
    1.92      SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
    1.93      return guid;
    1.94  }
    1.95  
    1.96 -JoystickGUID SDL_SYS_PrivateJoystickGetGUID(SDL_Joystick * joystick)
    1.97 +JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
    1.98  {
    1.99      JoystickGUID guid;
   1.100      // the GUID is just the first 16 chars of the name for now
   1.101 @@ -157,6 +151,6 @@
   1.102      return guid;
   1.103  }
   1.104  
   1.105 -#endif /* SDL_JOYSTICK_NDS */
   1.106 +#endif /* SDL_JOYSTICK_ANDROID */
   1.107  
   1.108  /* vi: set ts=4 sw=4 expandtab: */