Add DSU joystick driver

Introduces DSU client joystick support for SDL, enabling connection to DSU servers (such as DS4Windows and BetterJoy) to receive controller data over UDP, including motion sensors and touchpad data. Adds build system options, configuration hints, protocol implementation, and driver integration for Windows and other platforms.
This commit is contained in:
danprice142 2025-10-25 19:50:52 +01:00
parent 1c19bee000
commit df289d564a
9 changed files with 1428 additions and 0 deletions

View file

@ -352,6 +352,7 @@
#cmakedefine SDL_JOYSTICK_RAWINPUT @SDL_JOYSTICK_RAWINPUT@
#cmakedefine SDL_JOYSTICK_EMSCRIPTEN @SDL_JOYSTICK_EMSCRIPTEN@
#cmakedefine SDL_JOYSTICK_VIRTUAL @SDL_JOYSTICK_VIRTUAL@
#cmakedefine SDL_JOYSTICK_DSU @SDL_JOYSTICK_DSU@
#cmakedefine SDL_JOYSTICK_VITA @SDL_JOYSTICK_VITA@
#cmakedefine SDL_JOYSTICK_PSP @SDL_JOYSTICK_PSP@
#cmakedefine SDL_JOYSTICK_PS2 @SDL_JOYSTICK_PS2@

View file

@ -261,6 +261,7 @@ typedef unsigned int uintptr_t;
#define SDL_JOYSTICK_RAWINPUT 1
#endif
#define SDL_JOYSTICK_VIRTUAL 1
#define SDL_JOYSTICK_DSU 1
#ifdef HAVE_WINDOWS_GAMING_INPUT_H
#define SDL_JOYSTICK_WGI 1
#endif

View file

@ -1234,6 +1234,40 @@ extern "C" {
*/
#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED "SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED"
/**
* A variable controlling whether the DSU (DualShock UDP) joystick driver should be used.
*
* This variable can be set to the following values:
*
* - "0": DSU driver is disabled
* - "1": DSU driver is enabled (default)
*
* The DSU driver allows SDL to connect to DSU servers (DS4Windows, BetterJoy, etc.)
* to receive controller data over UDP, including motion sensors and touchpad data.
*/
#define SDL_HINT_JOYSTICK_DSU "SDL_JOYSTICK_DSU"
/**
* A variable controlling the DSU server address.
*
* The default value is "127.0.0.1"
*/
#define SDL_HINT_DSU_SERVER "SDL_DSU_SERVER"
/**
* A variable controlling the DSU server port.
*
* The default value is "26760"
*/
#define SDL_HINT_DSU_SERVER_PORT "SDL_DSU_SERVER_PORT"
/**
* A variable controlling the DSU client port.
*
* The default value is "0" (auto-select)
*/
#define SDL_HINT_DSU_CLIENT_PORT "SDL_DSU_CLIENT_PORT"
/**
* A variable controlling whether IOKit should be used for controller
* handling.