src/joystick/bsd/SDL_sysjoystick.c
changeset 6707 70eeb7e3ec2f
parent 6700 c8f3d3f0251e
child 6744 4ac2bb6dc80c
     1.1 --- a/src/joystick/bsd/SDL_sysjoystick.c	Mon Nov 26 23:58:53 2012 -0800
     1.2 +++ b/src/joystick/bsd/SDL_sysjoystick.c	Tue Nov 27 00:58:12 2012 -0800
     1.3 @@ -157,7 +157,7 @@
     1.4  #define REP_BUF_DATA(rep) ((rep)->buf->data)
     1.5  #endif
     1.6  
     1.7 -int SDL_SYS_numjoysticks = 0;
     1.8 +static int SDL_SYS_numjoysticks = 0;
     1.9  
    1.10  int
    1.11  SDL_SYS_JoystickInit(void)
    1.12 @@ -200,13 +200,33 @@
    1.13      return (SDL_SYS_numjoysticks);
    1.14  }
    1.15  
    1.16 +int SDL_SYS_NumJoysticks()
    1.17 +{
    1.18 +    return SDL_SYS_numjoysticks;
    1.19 +}
    1.20 +
    1.21 +void SDL_SYS_JoystickDetect()
    1.22 +{
    1.23 +}
    1.24 +
    1.25 +SDL_bool SDL_SYS_JoystickNeedsPolling()
    1.26 +{
    1.27 +    return SDL_FALSE;
    1.28 +}
    1.29 +
    1.30  const char *
    1.31 -SDL_SYS_JoystickNameForIndex(int index)
    1.32 +SDL_SYS_JoystickNameForDeviceIndex(int device_index)
    1.33  {
    1.34 -    if (joydevnames[index] != NULL) {
    1.35 -        return (joydevnames[index]);
    1.36 +    if (joydevnames[device_index] != NULL) {
    1.37 +        return (joydevnames[device_index]);
    1.38      }
    1.39 -    return (joynames[index]);
    1.40 +    return (joynames[device_index]);
    1.41 +}
    1.42 +
    1.43 +/* Function to perform the mapping from device index to the instance id for this index */
    1.44 +SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
    1.45 +{
    1.46 +    return device_index;
    1.47  }
    1.48  
    1.49  static int
    1.50 @@ -404,6 +424,12 @@
    1.51      return (-1);
    1.52  }
    1.53  
    1.54 +/* Function to determine is this joystick is attached to the system right now */
    1.55 +SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
    1.56 +{
    1.57 +    return SDL_TRUE;
    1.58 +}
    1.59 +
    1.60  void
    1.61  SDL_SYS_JoystickUpdate(SDL_Joystick * joy)
    1.62  {
    1.63 @@ -558,43 +584,17 @@
    1.64      return;
    1.65  }
    1.66  
    1.67 -/* Function to perform the mapping from device index to the instance id for this index */
    1.68 -SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int index)
    1.69 -{
    1.70 -    return index;
    1.71 -}
    1.72 -
    1.73 -/* Function to determine is this joystick is attached to the system right now */
    1.74 -int SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
    1.75 -{
    1.76 -    return 1;
    1.77 -}
    1.78 -
    1.79 -int SDL_SYS_NumJoysticks()
    1.80 -{
    1.81 -    return SDL_SYS_numjoysticks;
    1.82 -}
    1.83 -
    1.84 -int SDL_SYS_JoystickNeedsPolling()
    1.85 -{
    1.86 -    return 0;
    1.87 -}
    1.88 -
    1.89 -void SDL_SYS_JoystickDetect()
    1.90 -{
    1.91 -}
    1.92 -
    1.93 -JoystickGUID SDL_SYS_PrivateJoystickGetDeviceGUID( int device_index )
    1.94 +JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
    1.95  {
    1.96      JoystickGUID guid;
    1.97      // the GUID is just the first 16 chars of the name for now
    1.98 -    const char *name = SDL_SYS_JoystickNameForIndex( device_index );
    1.99 +    const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
   1.100      SDL_zero( guid );
   1.101      SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
   1.102      return guid;
   1.103  }
   1.104  
   1.105 -JoystickGUID SDL_SYS_PrivateJoystickGetGUID(SDL_Joystick * joystick)
   1.106 +JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
   1.107  {
   1.108      JoystickGUID guid;
   1.109      // the GUID is just the first 16 chars of the name for now