Commit Graph
100 Commits
Author SHA1 Message Date
Sam Lantinga 855d28e97a Fixed crash if a clipboard event was sent with video uninitialized
This can happen if you're using SDL on Android without using the video subsystem.
2025-07-17 08:47:32 -07:00
Sam Lantinga 7510a67159 Fixed typo
Fixes https://github.com/libsdl-org/SDL/issues/13373
2025-07-16 19:31:10 -07:00
Sam Lantinga a53eb5221b Added support for the PDP REALMz Wireless Controller for Switch 2025-07-15 17:41:54 -07:00
Sam Lantinga 1b65f25465 testcontroller: use the correct label for face buttons 2025-07-15 15:52:40 -07:00
Sam Lantinga 08e3758e3f Added paddle bindings for the 8BitDo Pro 3 controller 2025-07-15 10:15:52 -07:00
Sam Lantinga d53fcab609 Reordered the 8BitDo Pro 3 controller 2025-07-15 10:09:06 -07:00
Sam Lantinga 277f91c317 Removed the Mayflash GameCube adapter from the PS3 controller list 2025-07-14 11:30:15 -07:00
Sam Lantinga 92e8224d32 Fixed build 2025-07-11 13:05:37 -07:00
Sam Lantinga 0b2e389ee3 Fixed long delay when enumerating the Razer Huntsman keyboard
Fixes https://github.com/libsdl-org/SDL/issues/13236
2025-07-11 12:34:14 -07:00
Sam Lantinga 937e8d55a4 Set hwndTarget to NULL when unregistering raw input
Fixes https://github.com/libsdl-org/SDL/issues/13335
2025-07-11 12:14:36 -07:00
Sam Lantinga f199aafaeb Fixed long delay when enumerating the Razer Huntsman keyboard
Fixes https://github.com/libsdl-org/SDL/issues/13236
2025-07-11 11:55:46 -07:00
Sam Lantinga afa27243df Ignore sensor delta values that look like they're out of range 2025-06-26 11:10:21 -07:00
Sam Lantinga 8d5bf053f7 Fixed detecting 8BitDo sensor timestamp on older firmware
Also updated the reported sensor rate over USB for new firmware
2025-06-26 10:47:35 -07:00
Sam Lantinga f40bf44928 Removed unnecessary include 2025-06-25 18:50:28 -07:00
Sam Lantinga 727b4924c8 Update the viewport when logical presentation changes
Fixes https://github.com/libsdl-org/SDL/issues/13256
2025-06-25 09:58:30 -07:00
Sam Lantinga 9ed83e71f6 Fixed memory leaks in KMSDRM property handling
Also cleaned up the code for consistency so it's easy to see memory leaks here.
2025-06-22 21:33:52 -07:00
Sam Lantinga aa4f916b71 Renamed SDL_PROP_AUDIOSTREAM_KEEP_ON_SHUTDOWN_BOOLEAN to SDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN 2025-06-22 21:17:06 -07:00
Sam Lantinga 038a3806eb Fixed Nintendo Switch Pro thumbstick calibration
Fixes https://github.com/libsdl-org/SDL/issues/13246
2025-06-21 19:55:05 -07:00
Sam Lantinga e6c2649afc Updated testffmpeg for ffmpeg 7.1 2025-06-21 08:48:40 -07:00
Sam Lantinga 7d9fd48557 alsa: recover from snd_pcm_avail() returning -EPIPE 2025-06-20 16:33:30 -07:00
Sam Lantinga e68f5ca99a alsa: use udev if available instead of a hotplug thread
This makes detecting audio device changes more responsive.
2025-06-20 19:19:31 -04:00
Sam Lantinga 051ce0ff89 alsa: fixed disconnecting the microphone when opened
Some devices take some time for data to become available, so we'll keep waiting as long as necessary for them to provide data.
2025-06-20 19:19:31 -04:00
Sam Lantinga c19ad189dc Clarify that SDL_GetAudioStreamDevice() returns the logical device. 2025-06-20 14:01:16 -07:00
Sam Lantinga 7882e60f0e Don't log an error for disconnected audio devices 2025-06-20 11:05:08 -07:00
Sam Lantinga d7939abf42 Use consistent style for pointer declarations and casts 2025-06-18 10:03:44 -07:00
Sam Lantinga efed3c63b3 Added support for an alternate version of the Vader 4 Pro 2025-06-17 10:02:10 -07:00
Sam Lantinga d6bae53341 Added support for an alternate version of the Vader 4 Pro 2025-06-17 08:07:12 -07:00
Sam Lantinga f62c982bcf Reverted Accelerometer and Gyro displays to throttled display (10hz)
Also made accelerometer threshold for drift calibration more lenient for very noisy accelerometers.

The testcontroller tool could eventually be used to come up with a better way to profile an IMU's "stationary" noise so that this threshold can be as tight as necessary for the sake of automatic drift calibration.

(thanks @HilariousCow!)
2025-06-16 11:14:22 -07:00
Sam Lantinga b833c618a9 Improved reliability detecting FlyDigi Vader controllers 2025-06-16 11:07:50 -07:00
Sam Lantinga e18a6313de Added gyro support for the Flydigi Vader 3 Pro controller 2025-06-12 09:10:07 -07:00
Sam Lantinga 5826966873 Fixed replacing existing specific gamepad mappings
If the first mapping we see doesn't have a CRC, continue looking for another exact CRC match.

Fixes testautomation --filter TestVirtualJoystick
2025-06-06 09:53:15 -07:00
Sam Lantinga f90a21483c Added support for the ZEROPLUS P4 Wired Gamepad 2025-06-06 09:25:36 -07:00
Sam Lantinga 638acdc02a Remove the CRC from automatically generated gamepad mappings
Fixes https://github.com/libsdl-org/SDL/issues/13127
2025-06-06 09:22:14 -07:00
Sam Lantinga 27464ffb08 Clarify that icon and cursor alternate images are added with SDL_AddSurfaceAlternateImage() 2025-06-05 09:00:49 -07:00
Sam Lantinga 6622f4e1ea Added support for the NACON Revolution X Unlimited controller on macOS
This adds support for the controller in Bluetooth mode.

Fixes https://github.com/libsdl-org/SDL/issues/13143
2025-06-03 15:05:11 -07:00
Sam Lantinga 7457857304 Fixed input from the MayFlash GameCube adapter with version 7 firmware 2025-06-03 11:13:43 -07:00
Sam Lantinga cf6c42e6e6 Use HEAPU8.set rather than Module.HEAPU8.set (thanks @sbc100!)
The Module object is the external interface to the application, internal symbols like HEAPU8 don't need to be exported to be used and usage should not be prefixed with Module.

Fixes https://github.com/libsdl-org/SDL/issues/13156
Closes https://github.com/libsdl-org/SDL/pull/13157
2025-06-02 09:47:26 -07:00
Sam Lantinga 4b0f48c4cf Mark gamepads as invalid if they can't be opened
Fixes https://github.com/libsdl-org/SDL/issues/13129
2025-06-02 09:21:13 -07:00
Sam Lantinga fc1c0618de kmsdrm: fixed creating GBM surfaces on NVIDIA cards 2025-05-29 11:20:24 -07:00
Sam Lantinga 885e611f3c Added macros to push/pop error messages while cleaning up 2025-05-29 10:53:46 -07:00
Sam Lantinga 61d105247e Fixed typos 2025-05-29 10:53:30 -07:00
Sam Lantinga 7db0ac7380 Updated SDL_StretchSurface() documentation
Fixes https://github.com/libsdl-org/SDL/issues/13135
2025-05-29 09:09:04 -07:00
Sam Lantinga 737b9e117d Removed obsolete documentation 2025-05-28 15:57:04 -07:00
Sam Lantinga d2be547642 Removed spurious parentheses 2025-05-28 13:28:12 -07:00
Sam Lantinga 36936cbf37 Set the serial number to the Bluetooth MAC address for 8BitDo controllers 2025-05-28 12:18:27 -07:00
Sam Lantinga aa870d511e Disable SDL_HINT_JOYSTICK_RAWINPUT by default
Windows can get in a state when it stops reporting raw input events for game controllers until reboot.

The downside of this change is that we lose support for trigger rumble and are limited to 4 controllers again, but if that's important for your application you can use SDL_SetHint(SDL_HINT_JOYSTICK_RAWINPUT, true) to enable this functionality.

Fixes https://github.com/libsdl-org/SDL/issues/13047
2025-05-27 09:51:48 -07:00
Sam Lantinga 8a2e2e75d1 Simplified loop logic 2025-05-27 08:47:32 -07:00
Sam Lantinga 1f6b5c681d Set the initial axis values for HIDAPI and XInput controllers
Fixes https://github.com/libsdl-org/SDL/issues/13020
2025-05-23 12:09:39 -07:00
Sam Lantinga c9cf4c42e0 Improved HIDAPI support for Flydigi controllers 2025-05-22 15:36:38 -07:00
Sam Lantinga 6f994cc7a8 Fixed macOS build 2025-05-22 10:18:14 -07:00
Sam Lantinga 264eb8d440 Fixed the Bluetooth flag for the combined Joy-Con controller 2025-05-21 13:30:00 -07:00
Sam Lantinga 992e4c59bd Fixed rare crash trying to interrupt SDL_WaitEvent()
Fixes https://github.com/libsdl-org/SDL/issues/12797
2025-05-19 14:15:44 -07:00
Sam Lantinga 25f2376e79 Fixed touch not being delivered as mouse events by default on Vita
Closes https://github.com/libsdl-org/SDL/pull/13070
2025-05-19 08:32:23 -07:00
Sam Lantinga db154c8b9b Added HIDAPI mapping for the 8BitDo SF30 Pro 2025-05-14 10:18:51 -07:00
Sam Lantinga ec685e87fd Clarify logic in UpdateLogicalPresentation() 2025-05-14 10:12:41 -07:00
Sam Lantinga cd95152b2c Fixed crash if out of memory in the Vulkan GPU driver 2025-05-13 09:07:15 -07:00
Sam Lantinga 87fe9ef79b Fixed crash if WGI isn't correlated in RAWINPUT_JoystickRumble() 2025-05-08 15:38:32 -07:00
Sam Lantinga 29d2116495 Define illegal_instruction() when it will be actually used 2025-05-08 11:51:35 -07:00
Sam Lantinga 2aa0957081 Fixed 8BitDo Ultimate 2 Wireless controller on macOS
When connected for the first time over Bluetooth on macOS, the first few reads return 0, so retry a few times in that case.
2025-05-08 10:48:02 -07:00
Sam Lantinga 8690a9ab54 Prefer the HIDAPI driver for 8BitDo controllers on macOS
The HIDAPI driver supports accelerometer, gyro, and rumble.
2025-05-08 10:08:08 -07:00
Sam Lantinga 2b57d58f7d Added GCController mapping for the 8BitDo SN30 Pro on macOS 2025-05-08 09:57:10 -07:00
Sam Lantinga d157600d3d Added GCController mapping for the 8BitDo Pro 2 on macOS
Fixes https://github.com/libsdl-org/SDL/issues/12987
2025-05-08 09:49:10 -07:00
Sam Lantinga 5bee85408c Cleanup 8BitDo HIDAPI support for SF30 Pro and SN30 Pro
This sets the correct number of buttons for older controllers, and adds parsing for older firmware USB reports
2025-05-07 12:11:27 -07:00
Sam Lantinga ca47dc59a9 Fixed building with the OpenVR video driver 2025-05-06 16:14:22 -07:00
Sam Lantinga 195ad85ba4 Fixed typo 2025-05-06 16:08:03 -07:00
Sam Lantinga d357aa29a3 Fixed initializing the OpenVR driver 2025-05-05 15:52:28 -07:00
Sam Lantinga f8c77908ad Use motor sequence ID 0 in the HIDAPI GIP driver
Using a 0 sequence number is always allowed and avoids having to synchronize sequence numbers with the controller (and potentially confusing other things talking to the controller)

Also fixes occasional long running rumble at controller connection.
2025-05-05 15:06:54 -07:00
Sam Lantinga ab12b7cbba Added support for the share button on the GameSir-K1 FLUX controller 2025-05-02 10:15:16 -07:00
Sam Lantinga 1e6a25324c Added support for the PowerA Battle Dragon Advanced Wireless Controller 2025-05-02 10:01:13 -07:00
Sam Lantinga caf269ce00 Added a link to the GIP documentation 2025-05-01 21:35:10 -07:00
Sam Lantinga 34c045aa39 Fixed paddles on the Xbox Elite controller using the GIP driver 2025-05-01 21:35:10 -07:00
Sam Lantinga ae251a05be Fixed warning: no previous prototype for function 'GIP_ParseMetadata' 2025-05-01 15:39:49 -07:00
Sam Lantinga 48dfc03a87 Added the gamepad hint SDL_GAMECONTROLLER_USE_GAMECUBE_LABELS
This is for internal use to signal that a mapping uses positional GameCube buttons. It's set so we know whether a mapping uses the older style labeled buttons or the newer style positional buttons. If a positional mapping is used with SDL2, then it will be ignored, since the hint is marked as defaulting true and the mapping conditional is that the hint is false.
2025-05-01 10:54:16 -07:00
Sam Lantinga 21a7bbbf14 Restore compatibility with older GameCube mappings
Restore the original button values for GameCube controllers, but swap labeled mappings to positional while loading mappings

Fixes https://github.com/libsdl-org/SDL/issues/12847
2025-05-01 10:54:16 -07:00
Sam Lantinga e3df61b070 Fixed right mouse button emulation when using a pen
Pen button 1 is typically used as right click. Pen button 2 (Wacom eraser) doesn't have a specific mapping, but we'll use middle click for now.
2025-04-30 11:07:31 -07:00
Sam Lantinga 106ccc722e Fixed missing simulated mouse events using a Wacom tablet
The low 16-bits of the message extra info is an event sequence number when using the Wacom tablet with Windows Ink disabled. The high bits of normal mouse motion when using touch input match the touch signature, 0xFF515700. The high bits of raw input mouse motion when using touch input do not match that signature, so we have to check for the touch bit in that case.

Fixes https://github.com/libsdl-org/SDL/issues/12927
2025-04-30 11:07:31 -07:00
Sam Lantinga 8ae962c904 Fixed build 2025-04-29 19:06:42 -07:00
Sam Lantinga e04064350f Fixed right click mouse emulation for the Wacom tablet
The problems are two-fold. When this happens a WM_POINTERDOWN event is sent with IS_POINTER_INCONTACT_WPARAM() evaluating as true. So when SDL_SendPenButton() is sent for the barrel button, there is no pen in contact yet, so the right mouse button is sent. Then SDL_SendPenTouch() is sent, which generates a left button press event.

Fixes https://github.com/libsdl-org/SDL/issues/12926
2025-04-29 19:03:42 -07:00
Sam Lantinga 8abcc27535 Removed timeout in SDL_RunOnMainThread()
Fixes https://github.com/libsdl-org/SDL/issues/12923
2025-04-29 08:56:56 -07:00
Sam Lantinga ef54c3bf18 Always enable D3D12 GPU on Windows
This isn't dependent on the render subsystem

Fixes https://github.com/libsdl-org/SDL/issues/12922
2025-04-29 08:51:26 -07:00
Sam Lantinga 31650d566c Added SDL_GAMEPAD_TYPE_GAMECUBE
The GameCube controller has a different face button layout than the Xbox or Nintendo Switch style controllers. It has the B button on the left and the X button on the right, so we should map those to SDL_GAMEPAD_BUTTON_WEST with SDL_GAMEPAD_BUTTON_LABEL_B and SDL_GAMEPAD_BUTTON_EAST with SDL_GAMEPAD_BUTTON_LABEL_X respectively.

Fixes https://github.com/libsdl-org/SDL/issues/12847
2025-04-27 11:01:50 -07:00
Sam Lantinga c2ed58db7b windows: Fix stale zoom/iconic state in WM_WINDOWPOSCHANGED handler
- IsIconic/IsZoomed must be checked after sending SDL_EVENT_WINDOW_SHOWN as that may trigger window operations if any are pending from when
  the window was hidden. e.g. the window may be shown, which triggers SDL_MaximizeWindow and a new WM_WINDOWPOSCHANGED where
  SDL_EVENT_WINDOW_MAXIMIZED is sent, then control returns to the original WM_WINDOWPOSCHANGED which would not think the window is zoomed
  and send SDL_EVENT_WINDOW_RESTORED.
2025-04-25 16:21:44 -07:00
Sam Lantinga 7642c0468d Log information about Wayland environment detection 2025-04-25 10:02:03 -07:00
Sam Lantinga da3c864d4c Reset the keyboard when entering a modal loop on Windows
Fixes https://github.com/libsdl-org/SDL/issues/12876
2025-04-24 13:58:17 -07:00
Sam Lantinga fcdaff4110 Fixed compiler warning 2025-04-24 10:36:49 -07:00
Sam Lantinga 695cad459b Corrected documentation for SDL_SetGPUSwapchainParameters() 2025-04-23 14:54:12 -07:00
Sam Lantinga 5a8be8e4c2 Fixed formatting 2025-04-22 14:33:47 -07:00
Sam Lantinga 89d7d406ab Added tests to cover invalid surface blits
Reproduction case for https://github.com/libsdl-org/SDL/issues/12844
2025-04-22 13:05:38 -07:00
Sam Lantinga 18fbe6a92f Renamed SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_UINT8 to SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_NUMBER
Typically we will name the property with the function that is used to set it, and document the range of values.
2025-04-22 10:28:20 -07:00
Sam Lantinga c076b0d17f Removed incorrect documentation for SDL_RenderViewportSet()
Closes https://github.com/libsdl-org/SDL/pull/12854
2025-04-22 10:17:11 -07:00
Sam Lantinga 3aed80cd82 Updated documentation for SDL_HINT_GPU_DRIVER 2025-04-22 08:58:44 -07:00
Sam Lantinga 4093e4a193 Fixed process I/O redirection to NUL on Windows 2025-04-11 15:44:58 -07:00
Sam Lantinga c025fdbb7c Add the CREATE_NO_WINDOW flag for background processes
Fixes https://github.com/libsdl-org/SDL/issues/12097
2025-04-11 15:44:58 -07:00
Sam Lantinga 8a57c83ff9 Updated to GameInput v1.1
The biggest change is that the C API is no longer available.

Here are more details:
https://www.nuget.org/packages/Microsoft.GameInput

Fixes https://github.com/libsdl-org/SDL/issues/12802
2025-04-11 13:42:58 -07:00
Sam Lantinga f35a2736b7 Don't reset the render target when invalidating GPU renderer cache state
Fixes https://github.com/libsdl-org/SDL/issues/12646
2025-04-11 09:23:02 -07:00
Sam Lantinga 98e76d283f Fixed conflict when linking both SDL and hidapi statically
Fixes https://github.com/libsdl-org/SDL/issues/12790
2025-04-10 09:57:37 -07:00
Sam Lantinga f303ccca64 Updated the report size for Ultimate 2 Wireless firmware v1.02 2025-04-09 09:17:53 -07:00
Sam Lantinga 93ac1e6894 Fixed non-XBox controllers being detected as Series X controllers
First make sure we have an XBox One controller before checking whether it's a Series X/S controller.
2025-04-08 12:20:27 -07:00
Sam Lantinga d29bb902f3 Don't treat the Keychron K1 Pro System Control keyboard as a joystick
Fixes https://github.com/libsdl-org/SDL/issues/12758
2025-04-08 11:07:20 -07:00
Sam Lantinga 46c314cc3d Revert "bool is 4 bytes in Apple MacOS X 32 bit PPC ABI"
This reverts commit 5a59b5f321.

The strong ABI guarantee only applies if bool is a byte (we repurposed a Uint8 field as a bool in SDL_gpu.h), and 32-bit PPC isn't a platform we support, so I'm going to back this patch out.
2025-04-08 08:14:25 -07:00