Xbox GDKX support (#5869)

* Xbox GDK support (14 squashed commits)

* Added basic keyboard testing

* Update readme

* Code review fixes

* Fixed issue where controller add/removal wasn't working (since the device notification events don't work on Xbox, have to use the joystick thread to poll XInput)
This commit is contained in:
chalonverse
2022-07-01 13:59:14 -07:00
committed by GitHub
parent 0025621b80
commit f317d619cc
77 changed files with 2573 additions and 74 deletions

View File

@@ -26,6 +26,10 @@
#include "SDL_haptic.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
struct haptic_effect
{
@@ -203,6 +207,11 @@ extern int SDL_SYS_HapticUnpause(SDL_Haptic * haptic);
*/
extern int SDL_SYS_HapticStopAll(SDL_Haptic * haptic);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#endif /* SDL_syshaptic_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -23,6 +23,10 @@
#include "SDL_haptic.h"
#include "SDL_windowshaptic_c.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
extern int SDL_DINPUT_HapticInit(void);
extern int SDL_DINPUT_HapticMaybeAddDevice(const DIDEVICEINSTANCE *pdidInstance);
@@ -44,4 +48,9 @@ extern int SDL_DINPUT_HapticPause(SDL_Haptic * haptic);
extern int SDL_DINPUT_HapticUnpause(SDL_Haptic * haptic);
extern int SDL_DINPUT_HapticStopAll(SDL_Haptic * haptic);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -37,6 +37,10 @@
#include "SDL_dinputhaptic_c.h"
#include "SDL_xinputhaptic_c.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/*
* Internal stuff.
@@ -466,6 +470,11 @@ SDL_SYS_HapticStopAll(SDL_Haptic * haptic)
}
}
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#endif /* SDL_HAPTIC_DINPUT || SDL_HAPTIC_XINPUT */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -28,6 +28,11 @@
#include "../../core/windows/SDL_directx.h"
#include "../../core/windows/SDL_xinput.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/*
* Haptic system hardware data.
*/
@@ -84,6 +89,11 @@ extern SDL_hapticlist_item *SDL_hapticlist;
extern int SDL_SYS_AddHapticDevice(SDL_hapticlist_item *item);
extern int SDL_SYS_RemoveHapticDevice(SDL_hapticlist_item *prev, SDL_hapticlist_item *item);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#endif /* SDL_windowshaptic_c_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -35,6 +35,11 @@
#include "../../joystick/windows/SDL_windowsjoystick_c.h"
#include "../../thread/SDL_systhread.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/*
* Internal stuff.
*/
@@ -45,7 +50,7 @@ int
SDL_XINPUT_HapticInit(void)
{
if (SDL_GetHintBoolean(SDL_HINT_XINPUT_ENABLED, SDL_TRUE)) {
loaded_xinput = (WIN_LoadXInputDLL() == 0);
loaded_xinput = (WIN_LoadXInputDLL() == 0) ? SDL_TRUE : SDL_FALSE;
}
/* If the joystick subsystem is active, it will manage adding XInput haptic devices */
@@ -365,6 +370,11 @@ SDL_XINPUT_HapticStopAll(SDL_Haptic * haptic)
return (XINPUTSETSTATE(haptic->hwdata->userid, &vibration) == ERROR_SUCCESS) ? 0 : -1;
}
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#else /* !SDL_HAPTIC_XINPUT */
#include "../../core/windows/SDL_windows.h"

View File

@@ -23,6 +23,10 @@
#include "SDL_haptic.h"
#include "SDL_windowshaptic_c.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
extern int SDL_XINPUT_HapticInit(void);
extern int SDL_XINPUT_HapticMaybeAddDevice(const DWORD dwUserid);
@@ -44,4 +48,9 @@ extern int SDL_XINPUT_HapticPause(SDL_Haptic * haptic);
extern int SDL_XINPUT_HapticUnpause(SDL_Haptic * haptic);
extern int SDL_XINPUT_HapticStopAll(SDL_Haptic * haptic);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
/* vi: set ts=4 sw=4 expandtab: */