Skip to content

Conversation

@danprice142
Copy link

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.

Rebased on latest upstream
Disabled DSU joystick on Emscripten due to lack of UDP socket support. Updated socket initialization to use ioctl with FIONBIO for better compatibility on Unix-like systems. Refactored header includes and comments for clarity and platform correctness. Fixed variable naming in DSU data packet handling and removed unnecessary 'static' from inline functions in header.
@slouken
Copy link
Collaborator

slouken commented Nov 14, 2025

FYI, this is failing CI.

Updated CMakeLists.txt to only enable DSU joystick on non-Emscripten targets and use sdl_link_dependency for required network libraries. Enhanced DSU socket creation for better non-blocking support and portability, including FIONBIO and ioctl handling. Added missing socket-related includes for non-Windows platforms in SDL_dsujoystick_driver.c.
@eloj
Copy link
Contributor

eloj commented Nov 14, 2025

The table-based CRC32 implementation here is directly equivalent to calling SDL_crc32() using 0 as the initial CRC.

Updated CMakeLists.txt to enable DSU joystick support only on Windows, Linux, Android, Haiku, FreeBSD, NetBSD, OpenBSD, and macOS. Added conditional inclusion of <sys/ioctl.h> in SDL_dsujoystick.c. Removed unused GetDSUMutex helper from SDL_dsujoystick_driver.c.
@slouken
Copy link
Collaborator

slouken commented Nov 15, 2025

The table-based CRC32 implementation here is directly equivalent to calling SDL_crc32() using 0 as the initial CRC.

Please replace your CRC implementation with SDL_crc32()

@slouken
Copy link
Collaborator

slouken commented Nov 15, 2025

Please merge SDL_dsujoystick_driver.c into SDL_dsujoystick.c. There's no need for these to be separate. The IN_JOYSTICK_DSU_ code in the header should probably be moved into the C file.

Moved all DSU joystick driver logic from SDL_dsujoystick_driver.c into SDL_dsujoystick.c, removing the separate driver file. Updated SDL_dsujoystick_c.h to remove internal driver declarations and macros now handled in the implementation. Updated VisualC project file to remove the deleted driver source.
Replace inet_addr() with InetPtonA() on Windows and inet_pton() on Unix-like systems to fix C4996 warnings on Windows ARM64 builds where warnings are treated as errors.
Extended DSU support to additional platforms including QNX, RISC OS, PlayStation Vita, PSP, PS2, and Nintendo 3DS. Updated CMakeLists.txt to handle platform-specific dependencies and added platform-specific socket handling, initialization, and cleanup in SDL_dsujoystick.c. Introduced wrappers for network functions and improved error handling for these platforms.
Dropped DSU support for PlayStation Vita, PSP, PS2, and Nintendo 3DS platforms I dont have a way to test anyway
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants