diff options
author | chai <chaifix@163.com> | 2019-01-31 18:38:35 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-01-31 18:38:35 +0800 |
commit | 2ec55fd974a63b705a4777c256d2222c874fa043 (patch) | |
tree | 48f1fea59ee9fc713a28a9aac3f05b98dc5ae66f /Source/3rdParty/SDL2/src/joystick/dummy/SDL_sysjoystick.c | |
parent | c581dfbf1e849f393861d15e82aa6446c0c1c310 (diff) |
*SDL project
Diffstat (limited to 'Source/3rdParty/SDL2/src/joystick/dummy/SDL_sysjoystick.c')
-rw-r--r-- | Source/3rdParty/SDL2/src/joystick/dummy/SDL_sysjoystick.c | 105 |
1 files changed, 49 insertions, 56 deletions
diff --git a/Source/3rdParty/SDL2/src/joystick/dummy/SDL_sysjoystick.c b/Source/3rdParty/SDL2/src/joystick/dummy/SDL_sysjoystick.c index 3dd96a0..ce0965d 100644 --- a/Source/3rdParty/SDL2/src/joystick/dummy/SDL_sysjoystick.c +++ b/Source/3rdParty/SDL2/src/joystick/dummy/SDL_sysjoystick.c @@ -28,100 +28,93 @@ #include "../SDL_sysjoystick.h" #include "../SDL_joystick_c.h" -/* Function to scan the system for joysticks. - * It should return 0, or -1 on an unrecoverable fatal error. - */ -int -SDL_SYS_JoystickInit(void) + +static int +DUMMY_JoystickInit(void) { return 0; } -int -SDL_SYS_NumJoysticks(void) +static int +DUMMY_JoystickGetCount(void) { return 0; } -void -SDL_SYS_JoystickDetect(void) +static void +DUMMY_JoystickDetect(void) { } -/* Function to get the device-dependent name of a joystick */ -const char * -SDL_SYS_JoystickNameForDeviceIndex(int device_index) +static const char * +DUMMY_JoystickGetDeviceName(int device_index) { - SDL_SetError("Logic error: No joysticks available"); - return (NULL); + return NULL; } -/* Function to perform the mapping from device index to the instance id for this index */ -SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) +static int +DUMMY_JoystickGetDevicePlayerIndex(int device_index) { - return device_index; + return -1; } -/* Function to open a joystick for use. - The joystick to open is specified by the device index. - This should fill the nbuttons and naxes fields of the joystick structure. - It returns 0, or -1 if there is an error. - */ -int -SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) +static SDL_JoystickGUID +DUMMY_JoystickGetDeviceGUID(int device_index) { - return SDL_SetError("Logic error: No joysticks available"); + SDL_JoystickGUID guid; + SDL_zero(guid); + return guid; } -/* Function to determine if this joystick is attached to the system right now */ -SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick) +static SDL_JoystickID +DUMMY_JoystickGetDeviceInstanceID(int device_index) { - return SDL_TRUE; + return -1; } -/* Function to update the state of a joystick - called as a device poll. - * This function shouldn't update the joystick structure directly, - * but instead should call SDL_PrivateJoystick*() to deliver events - * and update joystick device state. - */ -void -SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) +static int +DUMMY_JoystickOpen(SDL_Joystick * joystick, int device_index) { + return SDL_SetError("Logic error: No joysticks available"); } -/* Function to close a joystick after use */ -void -SDL_SYS_JoystickClose(SDL_Joystick * joystick) +static int +DUMMY_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) { + return SDL_Unsupported(); } -/* Function to perform any system-specific joystick related cleanup */ -void -SDL_SYS_JoystickQuit(void) +static void +DUMMY_JoystickUpdate(SDL_Joystick * joystick) { } -SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index ) +static void +DUMMY_JoystickClose(SDL_Joystick * joystick) { - SDL_JoystickGUID guid; - /* the GUID is just the first 16 chars of the name for now */ - const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index ); - SDL_zero( guid ); - SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) ); - return guid; } - -SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick) +static void +DUMMY_JoystickQuit(void) { - SDL_JoystickGUID guid; - /* the GUID is just the first 16 chars of the name for now */ - const char *name = joystick->name; - SDL_zero( guid ); - SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) ); - return guid; } +SDL_JoystickDriver SDL_DUMMY_JoystickDriver = +{ + DUMMY_JoystickInit, + DUMMY_JoystickGetCount, + DUMMY_JoystickDetect, + DUMMY_JoystickGetDeviceName, + DUMMY_JoystickGetDevicePlayerIndex, + DUMMY_JoystickGetDeviceGUID, + DUMMY_JoystickGetDeviceInstanceID, + DUMMY_JoystickOpen, + DUMMY_JoystickRumble, + DUMMY_JoystickUpdate, + DUMMY_JoystickClose, + DUMMY_JoystickQuit, +}; + #endif /* SDL_JOYSTICK_DUMMY || SDL_JOYSTICK_DISABLED */ /* vi: set ts=4 sw=4 expandtab: */ |