src/joystick/dummy/SDL_sysjoystick.c
changeset 12088 399cc39583cc
parent 11811 5d94cb6b24d3
child 12090 c3209fca27b2
     1.1 --- a/src/joystick/dummy/SDL_sysjoystick.c	Wed Aug 08 15:39:20 2018 -0400
     1.2 +++ b/src/joystick/dummy/SDL_sysjoystick.c	Thu Aug 09 16:00:17 2018 -0700
     1.3 @@ -28,99 +28,92 @@
     1.4  #include "../SDL_sysjoystick.h"
     1.5  #include "../SDL_joystick_c.h"
     1.6  
     1.7 -/* Function to scan the system for joysticks.
     1.8 - * It should return 0, or -1 on an unrecoverable fatal error.
     1.9 - */
    1.10 -int
    1.11 -SDL_SYS_JoystickInit(void)
    1.12 +
    1.13 +static int
    1.14 +DUMMY_JoystickInit(void)
    1.15  {
    1.16      return 0;
    1.17  }
    1.18  
    1.19 -int
    1.20 -SDL_SYS_NumJoysticks(void)
    1.21 +static int
    1.22 +DUMMY_JoystickGetCount(void)
    1.23  {
    1.24      return 0;
    1.25  }
    1.26  
    1.27 -void
    1.28 -SDL_SYS_JoystickDetect(void)
    1.29 +static void
    1.30 +DUMMY_JoystickDetect(void)
    1.31  {
    1.32  }
    1.33  
    1.34 -/* Function to get the device-dependent name of a joystick */
    1.35 -const char *
    1.36 -SDL_SYS_JoystickNameForDeviceIndex(int device_index)
    1.37 +static const char *
    1.38 +DUMMY_JoystickGetDeviceName(int device_index)
    1.39  {
    1.40 -    SDL_SetError("Logic error: No joysticks available");
    1.41 -    return (NULL);
    1.42 +    return NULL;
    1.43  }
    1.44  
    1.45 -/* Function to perform the mapping from device index to the instance id for this index */
    1.46 -SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
    1.47 +static SDL_JoystickGUID
    1.48 +DUMMY_JoystickGetDeviceGUID(int device_index)
    1.49  {
    1.50 -    return device_index;
    1.51 +    SDL_JoystickGUID guid;
    1.52 +    SDL_zero(guid);
    1.53 +    return guid;
    1.54  }
    1.55  
    1.56 -/* Function to open a joystick for use.
    1.57 -   The joystick to open is specified by the device index.
    1.58 -   This should fill the nbuttons and naxes fields of the joystick structure.
    1.59 -   It returns 0, or -1 if there is an error.
    1.60 - */
    1.61 -int
    1.62 -SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
    1.63 +static SDL_JoystickID
    1.64 +DUMMY_JoystickGetDeviceInstanceID(int device_index)
    1.65 +{
    1.66 +    return -1;
    1.67 +}
    1.68 +
    1.69 +static int
    1.70 +DUMMY_JoystickOpen(SDL_Joystick * joystick, int device_index)
    1.71  {
    1.72      return SDL_SetError("Logic error: No joysticks available");
    1.73  }
    1.74  
    1.75 -/* Function to determine if this joystick is attached to the system right now */
    1.76 -SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
    1.77 +static SDL_bool
    1.78 +DUMMY_JoystickIsAttached(SDL_Joystick *joystick)
    1.79  {
    1.80 -    return SDL_TRUE;
    1.81 +    return SDL_FALSE;
    1.82  }
    1.83  
    1.84 -/* Function to update the state of a joystick - called as a device poll.
    1.85 - * This function shouldn't update the joystick structure directly,
    1.86 - * but instead should call SDL_PrivateJoystick*() to deliver events
    1.87 - * and update joystick device state.
    1.88 - */
    1.89 -void
    1.90 -SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
    1.91 +static int
    1.92 +DUMMY_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms)
    1.93 +{
    1.94 +    return SDL_Unsupported();
    1.95 +}
    1.96 +
    1.97 +static void
    1.98 +DUMMY_JoystickUpdate(SDL_Joystick * joystick)
    1.99  {
   1.100  }
   1.101  
   1.102 -/* Function to close a joystick after use */
   1.103 -void
   1.104 -SDL_SYS_JoystickClose(SDL_Joystick * joystick)
   1.105 +static void
   1.106 +DUMMY_JoystickClose(SDL_Joystick * joystick)
   1.107  {
   1.108  }
   1.109  
   1.110 -/* Function to perform any system-specific joystick related cleanup */
   1.111 -void
   1.112 -SDL_SYS_JoystickQuit(void)
   1.113 +static void
   1.114 +DUMMY_JoystickQuit(void)
   1.115  {
   1.116  }
   1.117  
   1.118 -SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
   1.119 +SDL_JoystickDriver SDL_DUMMY_JoystickDriver =
   1.120  {
   1.121 -    SDL_JoystickGUID guid;
   1.122 -    /* the GUID is just the first 16 chars of the name for now */
   1.123 -    const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
   1.124 -    SDL_zero( guid );
   1.125 -    SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
   1.126 -    return guid;
   1.127 -}
   1.128 -
   1.129 -
   1.130 -SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
   1.131 -{
   1.132 -    SDL_JoystickGUID guid;
   1.133 -    /* the GUID is just the first 16 chars of the name for now */
   1.134 -    const char *name = joystick->name;
   1.135 -    SDL_zero( guid );
   1.136 -    SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
   1.137 -    return guid;
   1.138 -}
   1.139 +    DUMMY_JoystickInit,
   1.140 +    DUMMY_JoystickGetCount,
   1.141 +    DUMMY_JoystickDetect,
   1.142 +    DUMMY_JoystickGetDeviceName,
   1.143 +    DUMMY_JoystickGetDeviceGUID,
   1.144 +    DUMMY_JoystickGetDeviceInstanceID,
   1.145 +    DUMMY_JoystickOpen,
   1.146 +    DUMMY_JoystickIsAttached,
   1.147 +    DUMMY_JoystickRumble,
   1.148 +    DUMMY_JoystickUpdate,
   1.149 +    DUMMY_JoystickClose,
   1.150 +    DUMMY_JoystickQuit,
   1.151 +};
   1.152  
   1.153  #endif /* SDL_JOYSTICK_DUMMY || SDL_JOYSTICK_DISABLED */
   1.154