From 0979ad52bec80c878a42287330b2b95cc831655a Mon Sep 17 00:00:00 2001 From: danprice142 Date: Fri, 14 Nov 2025 21:58:45 +0000 Subject: [PATCH] Restrict DSU joystick support to specific platforms Updated CMakeLists.txt to enable DSU joystick support only on Windows, Linux, Android, Haiku, FreeBSD, NetBSD, OpenBSD, and macOS. Added conditional inclusion of in SDL_dsujoystick.c. Removed unused GetDSUMutex helper from SDL_dsujoystick_driver.c. --- CMakeLists.txt | 2 +- src/joystick/dsu/SDL_dsujoystick.c | 4 +++- src/joystick/dsu/SDL_dsujoystick_driver.c | 6 ------ 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dba1ad3b4..6bf827978f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1377,7 +1377,7 @@ if(SDL_JOYSTICK) endif() # DSU (DualShock UDP) client support - if(SDL_DSU_JOYSTICK AND NOT EMSCRIPTEN) + if(SDL_DSU_JOYSTICK AND NOT EMSCRIPTEN AND (WINDOWS OR LINUX OR ANDROID OR HAIKU OR FREEBSD OR NETBSD OR OPENBSD OR MACOS)) set(SDL_JOYSTICK_DSU 1) sdl_glob_sources( "${SDL3_SOURCE_DIR}/src/joystick/dsu/*.c" diff --git a/src/joystick/dsu/SDL_dsujoystick.c b/src/joystick/dsu/SDL_dsujoystick.c index 977904e6c9..ecd6ead78b 100644 --- a/src/joystick/dsu/SDL_dsujoystick.c +++ b/src/joystick/dsu/SDL_dsujoystick.c @@ -61,7 +61,9 @@ typedef int socklen_t; #include #include #include - #include + #ifdef HAVE_SYS_IOCTL_H + #include + #endif #ifdef __sun #include #endif diff --git a/src/joystick/dsu/SDL_dsujoystick_driver.c b/src/joystick/dsu/SDL_dsujoystick_driver.c index 9573fdb567..147e0a71b1 100644 --- a/src/joystick/dsu/SDL_dsujoystick_driver.c +++ b/src/joystick/dsu/SDL_dsujoystick_driver.c @@ -64,12 +64,6 @@ extern SDL_JoystickDriver SDL_DSU_JoystickDriver; /* Global DSU context pointer */ struct DSU_Context_t *s_dsu_ctx = NULL; -/* Helper function to work around macro issues */ -static SDL_INLINE SDL_Mutex* GetDSUMutex(void) { - struct DSU_Context_t *ctx = s_dsu_ctx; - return ctx ? ctx->slots_mutex : NULL; -} - /* Forward declarations */ extern int SDLCALL DSU_ReceiverThread(void *data); extern void DSU_RequestControllerInfo(struct DSU_Context_t *ctx, Uint8 slot);