src/joystick/android/SDL_sysjoystick.c
changeset 6695 ec21e81c62aa
parent 6212 78d854de3a66
child 6696 73e2ad636f6e
     1.1 --- a/src/joystick/android/SDL_sysjoystick.c	Mon Nov 26 21:55:59 2012 -0800
     1.2 +++ b/src/joystick/android/SDL_sysjoystick.c	Mon Nov 26 22:02:01 2012 -0800
     1.3 @@ -43,14 +43,12 @@
     1.4  int
     1.5  SDL_SYS_JoystickInit(void)
     1.6  {
     1.7 -    SDL_numjoysticks = 1;
     1.8 -    
     1.9      return (1);
    1.10  }
    1.11  
    1.12  /* Function to get the device-dependent name of a joystick */
    1.13  const char *
    1.14 -SDL_SYS_JoystickName(int index)
    1.15 +SDL_SYS_JoystickNameForIndex(int index)
    1.16  {
    1.17      if (index == 0) {
    1.18          return accelerometerName;
    1.19 @@ -66,13 +64,12 @@
    1.20     It returns 0, or -1 if there is an error.
    1.21   */
    1.22  int
    1.23 -SDL_SYS_JoystickOpen(SDL_Joystick * joystick)
    1.24 +SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int index)
    1.25  {
    1.26      joystick->nbuttons = 0;
    1.27      joystick->nhats = 0;
    1.28      joystick->nballs = 0;
    1.29      joystick->naxes = 3;
    1.30 -    joystick->name = accelerometerName;
    1.31      return 0;
    1.32  }
    1.33  
    1.34 @@ -109,6 +106,52 @@
    1.35  {
    1.36  }
    1.37  
    1.38 +/* Function to perform the mapping from device index to the instance id for this index */
    1.39 +SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int index)
    1.40 +{
    1.41 +    return index;
    1.42 +}
    1.43 +
    1.44 +/* Function to determine is this joystick is attached to the system right now */
    1.45 +int SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
    1.46 +{
    1.47 +    return 1;
    1.48 +}
    1.49 +
    1.50 +int SDL_SYS_NumJoysticks()
    1.51 +{
    1.52 +    return 1;
    1.53 +}
    1.54 +
    1.55 +int SDL_SYS_JoystickNeedsPolling()
    1.56 +{
    1.57 +    return 0;
    1.58 +}
    1.59 +
    1.60 +void SDL_SYS_JoystickDetect()
    1.61 +{
    1.62 +}
    1.63 +
    1.64 +JoystickGUID SDL_SYS_PrivateJoystickGetDeviceGUID( int device_index )
    1.65 +{
    1.66 +    JoystickGUID guid;
    1.67 +    // the GUID is just the first 16 chars of the name for now
    1.68 +    const char *name = SDL_SYS_JoystickNameForIndex( device_index );
    1.69 +    SDL_zero( guid );
    1.70 +    SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
    1.71 +    return guid;
    1.72 +}
    1.73 +
    1.74 +JoystickGUID SDL_SYS_PrivateJoystickGetGUID(SDL_Joystick * joystick)
    1.75 +{
    1.76 +    JoystickGUID guid;
    1.77 +    // the GUID is just the first 16 chars of the name for now
    1.78 +    const char *name = joystick->name;
    1.79 +    SDL_zero( guid );
    1.80 +    SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
    1.81 +    return guid;
    1.82 +}
    1.83 +
    1.84  #endif /* SDL_JOYSTICK_NDS */
    1.85  
    1.86  /* vi: set ts=4 sw=4 expandtab: */