2 Simple DirectMedia Layer
3 Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
21 #include "../../SDL_internal.h"
23 #if defined(SDL_JOYSTICK_DUMMY) || defined(SDL_JOYSTICK_DISABLED)
25 /* This is the dummy implementation of the SDL joystick API */
27 #include "SDL_joystick.h"
28 #include "../SDL_sysjoystick.h"
29 #include "../SDL_joystick_c.h"
31 /* Function to scan the system for joysticks.
32 * It should return 0, or -1 on an unrecoverable fatal error.
35 SDL_SYS_JoystickInit(void)
41 SDL_SYS_NumJoysticks(void)
47 SDL_SYS_JoystickDetect(void)
51 /* Function to get the device-dependent name of a joystick */
53 SDL_SYS_JoystickNameForDeviceIndex(int device_index)
55 SDL_SetError("Logic error: No joysticks available");
59 /* Function to perform the mapping from device index to the instance id for this index */
60 SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
65 /* Function to open a joystick for use.
66 The joystick to open is specified by the device index.
67 This should fill the nbuttons and naxes fields of the joystick structure.
68 It returns 0, or -1 if there is an error.
71 SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
73 return SDL_SetError("Logic error: No joysticks available");
76 /* Function to determine if this joystick is attached to the system right now */
77 SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
82 /* Function to update the state of a joystick - called as a device poll.
83 * This function shouldn't update the joystick structure directly,
84 * but instead should call SDL_PrivateJoystick*() to deliver events
85 * and update joystick device state.
88 SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
92 /* Function to close a joystick after use */
94 SDL_SYS_JoystickClose(SDL_Joystick * joystick)
98 /* Function to perform any system-specific joystick related cleanup */
100 SDL_SYS_JoystickQuit(void)
104 SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
106 SDL_JoystickGUID guid;
107 /* the GUID is just the first 16 chars of the name for now */
108 const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
110 SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
115 SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
117 SDL_JoystickGUID guid;
118 /* the GUID is just the first 16 chars of the name for now */
119 const char *name = joystick->name;
121 SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
125 #endif /* SDL_JOYSTICK_DUMMY || SDL_JOYSTICK_DISABLED */
127 /* vi: set ts=4 sw=4 expandtab: */