SDL_windowsjoystick.c
Go to the documentation of this file.
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#if SDL_JOYSTICK_DINPUT || SDL_JOYSTICK_XINPUT
/* DirectInput joystick driver; written by Glenn Maynard, based on Andrei de
* A. Formiga's WINMM driver.
*
* Hats and sliders are completely untested; the app I'm writing this for mostly
* doesn't use them and I don't own any joysticks with them.
*
* We don't bother to use event notification here. It doesn't seem to work
* with polled devices, and it's fine to call IDirectInputDevice8_GetDeviceData and
* let it return 0 events. */
#include "SDL_error.h"
#include "SDL_assert.h"
#include "SDL_events.h"
#include "SDL_timer.h"
#include "SDL_mutex.h"
#include "SDL_joystick.h"
#include "../SDL_sysjoystick.h"
#include "../../thread/SDL_systhread.h"
#include "../../core/windows/SDL_windows.h"
#if !defined(__WINRT__)
#include <dbt.h>
#endif
#define INITGUID /* Only set here, if set twice will cause mingw32 to break. */
#include "SDL_windowsjoystick_c.h"
#include "SDL_dinputjoystick_c.h"
#include "SDL_xinputjoystick_c.h"
#include "../../haptic/windows/SDL_dinputhaptic_c.h" /* For haptic hot plugging */
#include "../../haptic/windows/SDL_xinputhaptic_c.h" /* For haptic hot plugging */
#ifndef DEVICE_NOTIFY_WINDOW_HANDLE
#define DEVICE_NOTIFY_WINDOW_HANDLE 0x00000000
#endif
/* local variables */
static SDL_bool s_bDeviceAdded = SDL_FALSE;
static SDL_bool s_bDeviceRemoved = SDL_FALSE;
static SDL_JoystickID s_nInstanceID = -1;
static SDL_cond *s_condJoystickThread = NULL;
static SDL_mutex *s_mutexJoyStickEnum = NULL;
static SDL_Thread *s_threadJoystick = NULL;
static SDL_bool s_bJoystickThreadQuit = SDL_FALSE;
JoyStick_DeviceData *SYS_Joystick; /* array to hold joystick ID values */
static SDL_bool s_bWindowsDeviceChanged = SDL_FALSE;
#ifdef __WINRT__
typedef struct
{
int unused;
} SDL_DeviceNotificationData;
static void
SDL_CleanupDeviceNotification(SDL_DeviceNotificationData *data)
{
}
static int
SDL_CreateDeviceNotification(SDL_DeviceNotificationData *data)
{
return 0;
}
static SDL_bool
SDL_WaitForDeviceNotification(SDL_DeviceNotificationData *data, SDL_mutex *mutex)
{
return SDL_FALSE;
}
#else /* !__WINRT__ */
typedef struct
{
HRESULT coinitialized;
WNDCLASSEX wincl;
HWND messageWindow;
HDEVNOTIFY hNotify;
} SDL_DeviceNotificationData;
#define IDT_SDL_DEVICE_CHANGE_TIMER_1 1200
#define IDT_SDL_DEVICE_CHANGE_TIMER_2 1201
/* windowproc for our joystick detect thread message only window, to detect any USB device addition/removal */
static LRESULT CALLBACK
SDL_PrivateJoystickDetectProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_DEVICECHANGE:
switch (wParam) {
case DBT_DEVICEARRIVAL:
case DBT_DEVICEREMOVECOMPLETE:
if (((DEV_BROADCAST_HDR*)lParam)->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) {
/* notify 300ms and 2 seconds later to ensure all APIs have updated status */
SetTimer(hwnd, IDT_SDL_DEVICE_CHANGE_TIMER_1, 300, NULL);
SetTimer(hwnd, IDT_SDL_DEVICE_CHANGE_TIMER_2, 2000, NULL);
}
break;
}
return 0;
case WM_TIMER:
KillTimer(hwnd, wParam);
s_bWindowsDeviceChanged = SDL_TRUE;
return 0;
}
return DefWindowProc (hwnd, message, wParam, lParam);
}
static void
SDL_CleanupDeviceNotification(SDL_DeviceNotificationData *data)
{
if (data->hNotify)
UnregisterDeviceNotification(data->hNotify);
if (data->messageWindow)
DestroyWindow(data->messageWindow);
UnregisterClass(data->wincl.lpszClassName, data->wincl.hInstance);
if (data->coinitialized == S_OK) {
WIN_CoUninitialize();
}
}
static int
SDL_CreateDeviceNotification(SDL_DeviceNotificationData *data)
{
DEV_BROADCAST_DEVICEINTERFACE dbh;
GUID GUID_DEVINTERFACE_HID = { 0x4D1E55B2L, 0xF16F, 0x11CF, { 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30 } };
SDL_zerop(data);
data->coinitialized = WIN_CoInitialize();
data->wincl.hInstance = GetModuleHandle(NULL);
data->wincl.lpszClassName = L"Message";
data->wincl.lpfnWndProc = SDL_PrivateJoystickDetectProc; /* This function is called by windows */
data->wincl.cbSize = sizeof (WNDCLASSEX);
if (!RegisterClassEx(&data->wincl)) {
WIN_SetError("Failed to create register class for joystick autodetect");
SDL_CleanupDeviceNotification(data);
return -1;
}
data->messageWindow = (HWND)CreateWindowEx(0, L"Message", NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL);
if (!data->messageWindow) {
WIN_SetError("Failed to create message window for joystick autodetect");
SDL_CleanupDeviceNotification(data);
return -1;
}
SDL_zero(dbh);
dbh.dbcc_size = sizeof(dbh);
dbh.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
dbh.dbcc_classguid = GUID_DEVINTERFACE_HID;
data->hNotify = RegisterDeviceNotification(data->messageWindow, &dbh, DEVICE_NOTIFY_WINDOW_HANDLE);
if (!data->hNotify) {
WIN_SetError("Failed to create notify device for joystick autodetect");
SDL_CleanupDeviceNotification(data);
return -1;
}
return 0;
}
static SDL_bool
SDL_WaitForDeviceNotification(SDL_DeviceNotificationData *data, SDL_mutex *mutex)
{
MSG msg;
int lastret = 1;
if (!data->messageWindow) {
return SDL_FALSE; /* device notifications require a window */
}
SDL_UnlockMutex(mutex);
while (lastret > 0 && s_bWindowsDeviceChanged == SDL_FALSE) {
lastret = GetMessage(&msg, NULL, 0, 0); /* WM_QUIT causes return value of 0 */
if (lastret > 0) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
SDL_LockMutex(mutex);
return (lastret != -1) ? SDL_TRUE : SDL_FALSE;
}
#endif /* __WINRT__ */
/* Function/thread to scan the system for joysticks. */
static int
SDL_JoystickThread(void *_data)
{
SDL_DeviceNotificationData notification_data;
#if SDL_JOYSTICK_XINPUT
SDL_bool bOpenedXInputDevices[XUSER_MAX_COUNT];
SDL_zero(bOpenedXInputDevices);
#endif
if (SDL_CreateDeviceNotification(&notification_data) < 0) {
return -1;
}
SDL_LockMutex(s_mutexJoyStickEnum);
while (s_bJoystickThreadQuit == SDL_FALSE) {
SDL_bool bXInputChanged = SDL_FALSE;
if (SDL_WaitForDeviceNotification(&notification_data, s_mutexJoyStickEnum) == SDL_FALSE) {
#if SDL_JOYSTICK_XINPUT
/* WM_DEVICECHANGE not working, poll for new XINPUT controllers */
SDL_CondWaitTimeout(s_condJoystickThread, s_mutexJoyStickEnum, 1000);
if (SDL_XINPUT_Enabled() && XINPUTGETCAPABILITIES) {
/* scan for any change in XInput devices */
Uint8 userId;
for (userId = 0; userId < XUSER_MAX_COUNT; userId++) {
XINPUT_CAPABILITIES capabilities;
const DWORD result = XINPUTGETCAPABILITIES(userId, XINPUT_FLAG_GAMEPAD, &capabilities);
const SDL_bool available = (result == ERROR_SUCCESS);
if (bOpenedXInputDevices[userId] != available) {
bXInputChanged = SDL_TRUE;
bOpenedXInputDevices[userId] = available;
}
}
}
#else
/* WM_DEVICECHANGE not working, no XINPUT, no point in keeping thread alive */
break;
#endif /* SDL_JOYSTICK_XINPUT */
}
if (s_bWindowsDeviceChanged || bXInputChanged) {
s_bDeviceRemoved = SDL_TRUE;
s_bDeviceAdded = SDL_TRUE;
s_bWindowsDeviceChanged = SDL_FALSE;
}
}
SDL_UnlockMutex(s_mutexJoyStickEnum);
SDL_CleanupDeviceNotification(&notification_data);
return 1;
}
void SDL_SYS_AddJoystickDevice(JoyStick_DeviceData *device)
{
device->send_add_event = SDL_TRUE;
device->nInstanceID = ++s_nInstanceID;
device->pNext = SYS_Joystick;
SYS_Joystick = device;
s_bDeviceAdded = SDL_TRUE;
}
/* Function to scan the system for joysticks.
* Joystick 0 should be the system default joystick.
* It should return 0, or -1 on an unrecoverable fatal error.
*/
int
SDL_SYS_JoystickInit(void)
{
if (SDL_DINPUT_JoystickInit() < 0) {
SDL_SYS_JoystickQuit();
return -1;
}
if (SDL_XINPUT_JoystickInit() < 0) {
SDL_SYS_JoystickQuit();
return -1;
}
s_mutexJoyStickEnum = SDL_CreateMutex();
s_condJoystickThread = SDL_CreateCond();
s_bDeviceAdded = SDL_TRUE; /* force a scan of the system for joysticks this first time */
SDL_SYS_JoystickDetect();
if (!s_threadJoystick) {
/* spin up the thread to detect hotplug of devices */
s_bJoystickThreadQuit = SDL_FALSE;
s_threadJoystick = SDL_CreateThreadInternal(SDL_JoystickThread, "SDL_joystick", 64 * 1024, NULL);
}
return SDL_SYS_NumJoysticks();
}
/* return the number of joysticks that are connected right now */
int
SDL_SYS_NumJoysticks(void)
{
int nJoysticks = 0;
JoyStick_DeviceData *device = SYS_Joystick;
while (device) {
nJoysticks++;
device = device->pNext;
}
return nJoysticks;
}
/* detect any new joysticks being inserted into the system */
void
SDL_SYS_JoystickDetect(void)
{
JoyStick_DeviceData *pCurList = NULL;
/* only enum the devices if the joystick thread told us something changed */
if (!s_bDeviceAdded && !s_bDeviceRemoved) {
return; /* thread hasn't signaled, nothing to do right now. */
}
SDL_LockMutex(s_mutexJoyStickEnum);
s_bDeviceAdded = SDL_FALSE;
s_bDeviceRemoved = SDL_FALSE;
pCurList = SYS_Joystick;
SYS_Joystick = NULL;
/* Look for DirectInput joysticks, wheels, head trackers, gamepads, etc.. */
SDL_DINPUT_JoystickDetect(&pCurList);
/* Look for XInput devices. Do this last, so they're first in the final list. */
SDL_XINPUT_JoystickDetect(&pCurList);
SDL_UnlockMutex(s_mutexJoyStickEnum);
while (pCurList) {
JoyStick_DeviceData *pListNext = NULL;
if (pCurList->bXInputDevice) {
SDL_XINPUT_MaybeRemoveDevice(pCurList->XInputUserId);
} else {
SDL_DINPUT_MaybeRemoveDevice(&pCurList->dxdevice);
}
SDL_PrivateJoystickRemoved(pCurList->nInstanceID);
pListNext = pCurList->pNext;
SDL_free(pCurList->joystickname);
SDL_free(pCurList);
pCurList = pListNext;
}
if (s_bDeviceAdded) {
JoyStick_DeviceData *pNewJoystick;
int device_index = 0;
s_bDeviceAdded = SDL_FALSE;
pNewJoystick = SYS_Joystick;
while (pNewJoystick) {
if (pNewJoystick->send_add_event) {
if (pNewJoystick->bXInputDevice) {
SDL_XINPUT_MaybeAddDevice(pNewJoystick->XInputUserId);
} else {
SDL_DINPUT_MaybeAddDevice(&pNewJoystick->dxdevice);
}
SDL_PrivateJoystickAdded(device_index);
pNewJoystick->send_add_event = SDL_FALSE;
}
device_index++;
pNewJoystick = pNewJoystick->pNext;
}
}
}
/* Function to get the device-dependent name of a joystick */
const char *
SDL_SYS_JoystickNameForDeviceIndex(int device_index)
{
JoyStick_DeviceData *device = SYS_Joystick;
for (; device_index > 0; device_index--)
device = device->pNext;
return device->joystickname;
}
/* Function to perform the mapping between current device instance and this joysticks instance id */
SDL_JoystickID
SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
{
JoyStick_DeviceData *device = SYS_Joystick;
int index;
for (index = device_index; index > 0; index--)
device = device->pNext;
return device->nInstanceID;
}
/* 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)
{
JoyStick_DeviceData *joystickdevice = SYS_Joystick;
for (; device_index > 0; device_index--)
joystickdevice = joystickdevice->pNext;
/* allocate memory for system specific hardware data */
joystick->instance_id = joystickdevice->nInstanceID;
joystick->hwdata =
(struct joystick_hwdata *) SDL_malloc(sizeof(struct joystick_hwdata));
if (joystick->hwdata == NULL) {
return SDL_OutOfMemory();
}
SDL_zerop(joystick->hwdata);
joystick->hwdata->guid = joystickdevice->guid;
if (joystickdevice->bXInputDevice) {
return SDL_XINPUT_JoystickOpen(joystick, joystickdevice);
} else {
return SDL_DINPUT_JoystickOpen(joystick, joystickdevice);
}
}
/* return true if this joystick is plugged in right now */
SDL_bool
SDL_SYS_JoystickAttached(SDL_Joystick * joystick)
{
return joystick->hwdata && !joystick->hwdata->removed;
}
void
SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
{
if (!joystick->hwdata || joystick->hwdata->removed) {
return;
}
if (joystick->hwdata->bXInputDevice) {
SDL_XINPUT_JoystickUpdate(joystick);
} else {
SDL_DINPUT_JoystickUpdate(joystick);
}
if (joystick->hwdata->removed) {
joystick->force_recentering = SDL_TRUE;
}
}
/* Function to close a joystick after use */
void
SDL_SYS_JoystickClose(SDL_Joystick * joystick)
{
if (joystick->hwdata->bXInputDevice) {
SDL_XINPUT_JoystickClose(joystick);
} else {
SDL_DINPUT_JoystickClose(joystick);
}
SDL_free(joystick->hwdata);
}
/* Function to perform any system-specific joystick related cleanup */
void
SDL_SYS_JoystickQuit(void)
{
JoyStick_DeviceData *device = SYS_Joystick;
while (device) {
JoyStick_DeviceData *device_next = device->pNext;
SDL_free(device->joystickname);
SDL_free(device);
device = device_next;
}
SYS_Joystick = NULL;
if (s_threadJoystick) {
SDL_LockMutex(s_mutexJoyStickEnum);
s_bJoystickThreadQuit = SDL_TRUE;
SDL_CondBroadcast(s_condJoystickThread); /* signal the joystick thread to quit */
SDL_UnlockMutex(s_mutexJoyStickEnum);
#ifndef __WINRT__
PostThreadMessage(SDL_GetThreadID(s_threadJoystick), WM_QUIT, 0, 0);
#endif
SDL_WaitThread(s_threadJoystick, NULL); /* wait for it to bugger off */
SDL_DestroyMutex(s_mutexJoyStickEnum);
SDL_DestroyCond(s_condJoystickThread);
s_condJoystickThread= NULL;
s_mutexJoyStickEnum = NULL;
s_threadJoystick = NULL;
}
SDL_DINPUT_JoystickQuit();
SDL_XINPUT_JoystickQuit();
s_bDeviceAdded = SDL_FALSE;
s_bDeviceRemoved = SDL_FALSE;
}
/* return the stable device guid for this device index */
SDL_JoystickGUID
SDL_SYS_JoystickGetDeviceGUID(int device_index)
{
JoyStick_DeviceData *device = SYS_Joystick;
int index;
for (index = device_index; index > 0; index--)
device = device->pNext;
return device->guid;
}
SDL_JoystickGUID
SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
{
return joystick->hwdata->guid;
}
#endif /* SDL_JOYSTICK_DINPUT || SDL_JOYSTICK_XINPUT */
/* vi: set ts=4 sw=4 expandtab: */
SYS_Joystick
JoyStick_DeviceData * SYS_Joystick
SDL_LockMutex
#define SDL_LockMutex
Definition: SDL_dynapi_overrides.h:260
SDL_DINPUT_MaybeRemoveDevice
int SDL_DINPUT_MaybeRemoveDevice(const DIDEVICEINSTANCE *pdidInstance)
Definition: SDL_dinputhaptic.c:1205
JoyStick_DeviceData::guid
SDL_JoystickGUID guid
Definition: SDL_windowsjoystick_c.h:32
SDL_joystick.h
SDL_TRUE
Definition: SDL_stdinc.h:142
SDL_PrivateJoystickRemoved
void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance)
Definition: SDL_joystick.c:638
result
GLuint64EXT * result
Definition: SDL_opengl_glext.h:9432
message
GLuint GLsizei const GLchar * message
Definition: SDL_opengl_glext.h:2483
SDL_dinputjoystick_c.h
SDL_XINPUT_MaybeAddDevice
int SDL_XINPUT_MaybeAddDevice(const DWORD dwUserid)
Definition: SDL_xinputhaptic.c:381
available
static int available()
Definition: video.c:356
JoyStick_DeviceData::pNext
struct JoyStick_DeviceData * pNext
Definition: SDL_windowsjoystick_c.h:41
SDL_FALSE
Definition: SDL_stdinc.h:141
SDL_CreateMutex
#define SDL_CreateMutex
Definition: SDL_dynapi_overrides.h:259
SDL_SYS_AddJoystickDevice
void SDL_SYS_AddJoystickDevice(JoyStick_DeviceData *device)
SDL_DINPUT_JoystickOpen
int SDL_DINPUT_JoystickOpen(SDL_Joystick *joystick, JoyStick_DeviceData *joystickdevice)
Definition: SDL_dinputjoystick.c:970
JoyStick_DeviceData
Definition: SDL_windowsjoystick_c.h:30
SDL_events.h
JoyStick_DeviceData::bXInputDevice
SDL_bool bXInputDevice
Definition: SDL_windowsjoystick_c.h:36
SDL_DINPUT_MaybeAddDevice
int SDL_DINPUT_MaybeAddDevice(const DIDEVICEINSTANCE *pdidInstance)
Definition: SDL_dinputhaptic.c:1199
JoyStick_DeviceData::joystickname
char * joystickname
Definition: SDL_windowsjoystick_c.h:33
SDL_mutex.h
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
SDL_DestroyCond
#define SDL_DestroyCond
Definition: SDL_dynapi_overrides.h:272
SDL_XINPUT_JoystickOpen
int SDL_XINPUT_JoystickOpen(SDL_Joystick *joystick, JoyStick_DeviceData *joystickdevice)
Definition: SDL_xinputjoystick.c:500
SDL_SYS_JoystickQuit
void SDL_SYS_JoystickQuit(void)
Definition: SDL_sysjoystick.m:734
mutex
static SDL_mutex * mutex
Definition: testlock.c:23
SDL_zerop
#define SDL_zerop(x)
Definition: SDL_stdinc.h:417
SDL_XINPUT_JoystickClose
void SDL_XINPUT_JoystickClose(SDL_Joystick *joystick)
Definition: SDL_xinputjoystick.c:511
SDL_cond
Definition: SDL_syscond.c:31
JoyStick_DeviceData::nInstanceID
SDL_JoystickID nInstanceID
Definition: SDL_windowsjoystick_c.h:35
SDL_xinputjoystick_c.h
SDL_mutex
Definition: SDL_sysmutex.c:29
joystick_hwdata
Definition: SDL_sysjoystick_c.h:44
device
static SDL_AudioDeviceID device
Definition: loopwave.c:37
SDL_DINPUT_JoystickInit
int SDL_DINPUT_JoystickInit(void)
Definition: SDL_dinputjoystick.c:959
SDL_CreateThreadInternal
SDL_Thread * SDL_CreateThreadInternal(int(*fn)(void *), const char *name, const size_t stacksize, void *data)
Definition: SDL_thread.c:427
SDL_XINPUT_MaybeRemoveDevice
int SDL_XINPUT_MaybeRemoveDevice(const DWORD dwUserid)
Definition: SDL_xinputhaptic.c:387
SDL_CondWaitTimeout
#define SDL_CondWaitTimeout
Definition: SDL_dynapi_overrides.h:276
SDL_JoystickID
Sint32 SDL_JoystickID
Definition: SDL_joystick.h:81
WIN_CoInitialize
HRESULT WIN_CoInitialize(void)
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:157
SDL_free
#define SDL_free
Definition: SDL_dynapi_overrides.h:377
SDL_SYS_JoystickAttached
SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
Definition: SDL_sysjoystick.m:469
SDL_windowsjoystick_c.h
SDL_XINPUT_Enabled
SDL_bool SDL_XINPUT_Enabled(void)
Definition: SDL_xinputjoystick.c:483
SDL_PrivateJoystickAdded
void SDL_PrivateJoystickAdded(int device_index)
Definition: SDL_joystick.c:595
SDL_zero
#define SDL_zero(x)
Definition: SDL_stdinc.h:416
JoyStick_DeviceData::send_add_event
Uint8 send_add_event
Definition: SDL_windowsjoystick_c.h:34
SDL_SYS_JoystickNameForDeviceIndex
const char * SDL_SYS_JoystickNameForDeviceIndex(int device_index)
Definition: SDL_sysjoystick.m:402
SDL_CreateCond
#define SDL_CreateCond
Definition: SDL_dynapi_overrides.h:271
SDL_GetThreadID
#define SDL_GetThreadID
Definition: SDL_dynapi_overrides.h:476
SDL_CondBroadcast
#define SDL_CondBroadcast
Definition: SDL_dynapi_overrides.h:274
S_OK
#define S_OK
Definition: SDL_directx.h:47
SDL_SYS_JoystickUpdate
void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick)
Definition: SDL_sysjoystick.m:682
index
GLuint index
Definition: SDL_opengl_glext.h:660
SDL_XINPUT_JoystickInit
int SDL_XINPUT_JoystickInit(void)
Definition: SDL_xinputjoystick.c:489
SDL_SYS_JoystickGetGUID
SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick *joystick)
Definition: SDL_sysjoystick.m:784
SDL_SYS_JoystickInit
int SDL_SYS_JoystickInit(void)
Definition: SDL_sysjoystick.m:330
NULL
#define NULL
Definition: begin_code.h:164
SDL_OutOfMemory
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:139
WIN_CoUninitialize
void WIN_CoUninitialize(void)
SDL_SYS_NumJoysticks
int SDL_SYS_NumJoysticks(void)
Definition: SDL_sysjoystick.m:389
WIN_SetError
int WIN_SetError(const char *prefix)
JoyStick_DeviceData::XInputUserId
Uint8 XInputUserId
Definition: SDL_windowsjoystick_c.h:38
SDL_XINPUT_JoystickQuit
void SDL_XINPUT_JoystickQuit(void)
Definition: SDL_xinputjoystick.c:516
SDL_DestroyMutex
#define SDL_DestroyMutex
Definition: SDL_dynapi_overrides.h:263
SDL_DINPUT_JoystickUpdate
void SDL_DINPUT_JoystickUpdate(SDL_Joystick *joystick)
Definition: SDL_dinputjoystick.c:976
SDL_DINPUT_JoystickDetect
void SDL_DINPUT_JoystickDetect(JoyStick_DeviceData **pContext)
Definition: SDL_dinputjoystick.c:965
SDL_JoystickGUID
Definition: SDL_joystick.h:70
SDL_SYS_GetInstanceIdOfDeviceIndex
SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
Definition: SDL_sysjoystick.m:409
SDL_Thread
Definition: SDL_thread_c.h:54
SDL_UnlockMutex
#define SDL_UnlockMutex
Definition: SDL_dynapi_overrides.h:262
SDL_XINPUT_JoystickUpdate
void SDL_XINPUT_JoystickUpdate(SDL_Joystick *joystick)
Definition: SDL_xinputjoystick.c:506
SDL_SYS_JoystickOpen
int SDL_SYS_JoystickOpen(SDL_Joystick *joystick, int device_index)
Definition: SDL_sysjoystick.m:421
SDL_malloc
#define SDL_malloc
Definition: SDL_dynapi_overrides.h:374
SDL_DINPUT_JoystickClose
void SDL_DINPUT_JoystickClose(SDL_Joystick *joystick)
Definition: SDL_dinputjoystick.c:981
JoyStick_DeviceData::dxdevice
DIDEVICEINSTANCE dxdevice
Definition: SDL_windowsjoystick_c.h:39
SDL_timer.h
SDL_SYS_JoystickClose
void SDL_SYS_JoystickClose(SDL_Joystick *joystick)
Definition: SDL_sysjoystick.m:704
SDL_error.h
SDL_SYS_JoystickGetDeviceGUID
SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID(int device_index)
Definition: SDL_sysjoystick.m:771
SDL_XINPUT_JoystickDetect
void SDL_XINPUT_JoystickDetect(JoyStick_DeviceData **pContext)
Definition: SDL_xinputjoystick.c:495
SDL_assert.h
SDL_WaitThread
#define SDL_WaitThread
Definition: SDL_dynapi_overrides.h:478
SDL_SYS_JoystickDetect
void SDL_SYS_JoystickDetect(void)
Definition: SDL_sysjoystick.m:395
SDL_DINPUT_JoystickQuit
void SDL_DINPUT_JoystickQuit(void)
Definition: SDL_dinputjoystick.c:986