Commit graph

11700 commits

Author SHA1 Message Date
Sam Lantinga 6bf5f5a221 Don't send k_ePS4FeatureReportIdCapabilities to Sony PS4 controllers
This report is for third party controllers only, and might be causing issues with fake PS4 controllers.

Reference https://github.com/libsdl-org/SDL/issues/7960

(cherry picked from commit 092a4b780ca464de71b89ffa5dc655ce256ce350)
2023-07-10 09:48:43 -07:00
Sam Lantinga 92fd2938e7 Minor cleanup 2023-07-10 09:42:12 -07:00
Andre Barata 9cd7cbe134 Added support for absolute mice with evdev 2023-07-10 09:37:45 -07:00
Christopher Wellons 8231278817
Unaligned stacks on i686-w64-mingw32, may lead to crashes (#7607)
Co-authored-by: Ozkan Sezer <sezeroz@gmail.com>
2023-07-10 03:05:32 +03:00
Ozkan Sezer 0ad822eb70 SDL_RWFromMem, SDL_RWFromConstMem: reject negative size parameters. 2023-07-10 00:14:35 +03:00
Sam Lantinga 156c7badf5 Re-added mappings for older Xbox One controllers on Linux
The xpad kernel driver doesn't know about these controllers and ends up using BTN_C and BTN_Z and the automatic mapping doesn't work correctly.

It turns out VID 0x045e and PID 0x02e0 is used by the 8BitDo SN30 Pro when connecting via Bluetooth in XInput mode.

Fixes https://github.com/libsdl-org/SDL/issues/7925

(cherry picked from commit 80e1c75e1c6d330318478c1549a97aedb09e58bc)
2023-07-09 09:50:46 -07:00
Joshua Barnett 547c8c288b Add kernel32 to SDL_EXTRA_LIBS required for cross-compilation to Win32 native
Linking error experienced while compiling with the following toolchain
due to lack of kernel32.lib

d35e5f8dde/cmake/platforms/WinMsvc.cmake (L317-L321)
2023-07-09 14:02:32 +02:00
Sam Lantinga 4b1dd54a56 Fixed mapping BTN_TR2 to right trigger
(cherry picked from commit ea60da5b94ed8ec69aad69ca46e81567ab99ed2a)
2023-07-08 18:18:48 -07:00
Alex Maese acdde129bb X11: Use XFixes to detect clipboard updates
Currently, SDL_CLIPBOARDUPDATE events are only sent when an SDL window
has its selection cleared.  This change sends the event anytime the
XFixesSelectionNotify event is raised, and when the selection is either
the clipboard or the primary selection.
2023-07-08 13:17:40 -07:00
Sam Lantinga f8a0135edf Added WGI gamepad added/removed listeners for RAWINPUT
This fixes WGI correlation on startup when the WGI gamepad list isn't populated yet

(cherry picked from commit f047e178b610c6888212c3096c10eb3f64f31a15)
2023-07-08 10:40:12 -07:00
Sam Lantinga 1f7bc08884 Don't tickle Bluetooth PS4 controllers in simple mode with an effects packet
That will put the PS4 controller into enhanced mode, which breaks DirectInput games

(cherry picked from commit efed24850af2994802c28f7a257ea17c9ec97d0a)
2023-07-08 10:30:31 -07:00
Sam Lantinga de849d5e6f Lazily initialize the WGI gamepad support
Initializing "Windows.Gaming.Input.Gamepad" will put Bluetooth PS4 controllers into enhanced report mode, which breaks any game using DirectInput. Let's wait to do this until absolutely necessary.

(cherry picked from commit 785f57eb9102206e74ac7f9b363a37cbf037cf9d)
2023-07-08 10:30:14 -07:00
Sam Lantinga a6228e7aaf Added the hint SDL_HINT_JOYSTICK_WGI to control whether to use Windows.Gaming.Input for controllers 2023-07-08 09:34:58 -07:00
Sam Lantinga e16a83d393 Prefer using XInput for rumble over WGI, as it allows rumble in the background 2023-07-07 09:47:49 -07:00
Sam Lantinga a0a3957eb6 Continue running XInput detection while RAWINPUT is active
This allows us to re-enable XInput correlation for RAWINPUT devices without reintroducing the controller shutdown bug for controllers using the wireless adapter in https://github.com/libsdl-org/SDL/issues/3468.

Fixes https://github.com/libsdl-org/SDL/issues/7940
2023-07-07 09:47:48 -07:00
Takase b90343e512 video(wayland): use both --icon and --icon-name for Zenity (#7897)
video(wayland): use both --icon and --icon-name for Zenity

Many distros ship an older version of Zenity that supports GTK3, while some distros ship newer version of Zenity which uses libadwaita.

This command tries to use --icon and fall back to --icon-name when it fails.
2023-07-06 17:56:51 -07:00
Sam Clegg 042243471f emscripten: Add JS library dependencies using EM_JS_DEPS macro
See https://github.com/emscripten-core/emscripten/pull/19780
2023-07-06 18:15:49 -04:00
Sam Lantinga 3054c0dc50 Fixed %p formatting when there is following text
(cherry picked from commit f4bd17deeeca6957d92979cf07fa436c249a9eda)
2023-07-06 08:37:27 -07:00
Sam Lantinga 52d63ba26c Do a full UCS4 zero termination on iconv converted strings
We don't necessarily know the size of the output characters, so do a full 32-bit zero termination on the output string.

This fixes garbage at the end of Windows clipboard text

(cherry picked from commit ecbbac7c7292300cf998a2ff04db3c721203b0b7)
2023-07-05 22:25:49 -07:00
Sam Lantinga bad5431a14 Fixed wayland clipboard not always updating in response to Ctrl-C
(cherry picked from commit cc254d885d66d4c3499f63864b8d403e1e97f325)
2023-07-05 22:18:16 -07:00
Sam Lantinga 1ab452fc57 Fixed printf formatting for "%p" and added a unit test to check it
(cherry picked from commit c63aa9545eb800390176fd2fd86036da81f91100)
2023-07-05 22:17:15 -07:00
Sam Lantinga 2a946832ba Added GetClientScreenRect() and fixed build for C89 compilers
(cherry picked from commit 61ff86617ac9aa86e843aacd29b060b628bf9456)
2023-07-05 11:06:28 -07:00
Sam Lantinga 488a91eb40 Fixed crash if mutex functions are used before any mutex has been created
(cherry picked from commit cc49f1e279b7ef0edf30d8eeaee9e05fd079bf82)
2023-07-05 10:17:19 -07:00
expikr f75c0e3204 center cursor to client area (excludes titlebar thickness)
(cherry picked from commit a7326b9396662c1e248dd530f6985f24e0ea337e)
2023-07-05 10:12:53 -07:00
Sam Lantinga 4d4c81d438 Revert "Update SDL_windowswindow.c"
This reverts commit d0fdf6207bf231eccc7f50ec8b98f6301bb6ce46.

(cherry picked from commit f49f1434b9d4c13c821ae6f789defb07e140f1fe)
2023-07-05 09:22:56 -07:00
expikr 1e6c128c4c Update SDL_windowswindow.c
(cherry picked from commit d0fdf6207bf231eccc7f50ec8b98f6301bb6ce46)
2023-07-04 21:59:58 -07:00
Anonymous Maarten 1c6a649362 cmake: check whether SONAME actualy exists
//Have include libunwind.h
2023-07-05 00:25:24 +02:00
Anonymous Maarten 0262f757e1 cmake: check whether libunwind can be compiled and linked against 2023-07-05 00:25:24 +02:00
Anonymous Maarten 8908d16285 cmake: explicitly disable WINDOWS_EXPORT_ALL_SYMBOLS for SDL2
This fixes the following errors when a dll attempts to link to a shared SDL2::SDL2:

m.c.obj : error LNK2019: unresolved external symbol __imp___acrt_iob_func referenced in function printf
m.c.obj : error LNK2019: unresolved external symbol __imp___stdio_common_vfprintf referenced in function _vfprintf_l
MSVCRTD.lib(init.obj) : error LNK2019: unresolved external symbol _CrtDbgReport referenced in function _CRT_RTC_INIT
MSVCRTD.lib(init.obj) : error LNK2019: unresolved external symbol _CrtDbgReportW referenced in function _CRT_RTC_INITW
MSVCRTD.lib(error.obj) : error LNK2019: unresolved external symbol strcpy_s referenced in function "void __cdecl _RTC_StackFailure(void *,char const *)" (?_RTC_StackFailure@@YAXPEAXPEBD@Z)
MSVCRTD.lib(error.obj) : error LNK2019: unresolved external symbol strcat_s referenced in function "void __cdecl _RTC_StackFailure(void *,char const *)" (?_RTC_StackFailure@@YAXPEAXPEBD@Z)
MSVCRTD.lib(error.obj) : error LNK2019: unresolved external symbol __stdio_common_vsprintf_s referenced in function _vsprintf_s_l
MSVCRTD.lib(error.obj) : error LNK2001: unresolved external symbol __C_specific_handler_noexcept
MSVCRTD.lib(pdblkup.obj) : error LNK2019: unresolved external symbol _wmakepath_s referenced in function "int __cdecl GetPdbDllPathFromFilePath(wchar_t const *,wchar_t *,unsigned __int64)" (?GetPdbDllPathFromFilePath@@YAHPEB_WPEA_W_K@Z)
MSVCRTD.lib(pdblkup.obj) : error LNK2019: unresolved external symbol _wsplitpath_s referenced in function "int __cdecl GetPdbDllPathFromFilePath(wchar_t const *,wchar_t *,unsigned __int64)" (?GetPdbDllPathFromFilePath@@YAHPEB_WPEA_W_K@Z)
MSVCRTD.lib(pdblkup.obj) : error LNK2019: unresolved external symbol wcscpy_s referenced in function "int __cdecl GetPdbDllPathFromFilePath(wchar_t const *,wchar_t *,unsigned __int64)" (?GetPdbDllPathFromFilePath@@YAHPEB_WPEA_W_K@Z)
MSVCRTD.lib(pdblkup.obj) : error LNK2019: unresolved external symbol __vcrt_GetModuleFileNameW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll@@YAPEAUHINSTANCE__@@XZ)
MSVCRTD.lib(pdblkup.obj) : error LNK2019: unresolved external symbol __vcrt_GetModuleHandleW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll@@YAPEAUHINSTANCE__@@XZ)
MSVCRTD.lib(pdblkup.obj) : error LNK2019: unresolved external symbol __vcrt_LoadLibraryExW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll@@YAPEAUHINSTANCE__@@XZ)
2023-07-05 00:15:46 +02:00
Sam Lantinga 61808b03b5 Fixed resource leak and crash at exit in the D3D11 renderer
Also, for some reason ID3D11DeviceContext_OMGetRenderTargets() was failing in the second read pixels call in the "testautomation --filter render_testViewport" test.

We already know the target view, so just use that.

(cherry picked from commit 619f65af0c390dd10bc0e6bf9dc1227e7ecee54d)
2023-07-03 17:42:16 -07:00
Sam Lantinga d65185a6a7 Made error handling more consistent in D3D12_RenderReadPixels()
(cherry picked from commit 90262f274ab73a2a0db227f8a1a3ea823ba0faec)
2023-07-03 17:42:07 -07:00
Sam Lantinga bf277eb808 The clip rect is defined in terms of the current viewport
Don't use the viewport offset when setting the clip rect in the D3D12 renderer.

This fixes "testautomation --filter render_testViewport" on Windows

(cherry picked from commit 304d425f99b3b62e5f77ef869731bb702810a572)
2023-07-03 17:15:30 -07:00
Ozkan Sezer 825b0324cf fixed windows build after commit 7e8be3f 2023-07-04 02:24:28 +03:00
Sam Lantinga 7e8be3f280 Retry to open the clipboard in case another application has it open
This fixes 'testautomation --filter clipboard_testClipboardTextFunctions' on Windows

(cherry picked from commit c24496727cdd40d5c0ffdf7b6a61085ec3a2766d)
2023-07-03 16:11:07 -07:00
Sam Lantinga a6ba8a1585 Removed spurious casts
(cherry picked from commit f73419e122ab0c2c7920b9de0921f5d6a464115d)
2023-07-03 16:11:02 -07:00
Ryan C. Gordon e65ca61957
khronos: Fixed a typo in a Vulkan header, to match upstream.
Fixes #7916.

(cherry picked from commit c0bd18f023329aeddeddaf8efdf879dbaf2f517a)
2023-07-03 11:04:41 -04:00
scribam e42a3a3233 cmake: use SDL_CPU_ARM32 instead of CMAKE_GENERATOR_PLATFORM STREQUAL "ARM" 2023-07-01 23:26:19 +02:00
Ryan C. Gordon 769bf2ebcc
rwops: Use SetFilePointerEx on Windows for appending writes.
Fixes #7900.
2023-07-01 00:30:23 -04:00
Sam Lantinga fc0854651b Added Linux mapping for the Logitech Chillstream
Fixes https://github.com/libsdl-org/SDL/issues/7829

(cherry picked from commit 675fc8c38f3f5685d177f0ecf7f43d57a109992e)
2023-06-29 16:15:00 -07:00
Anonymous Maarten e6f635ca17 wayland: don't use libdecor_frame_get_* functions when header doesn't have it
and we're statically linking to the library.
This fixes building SDL with -DSDL_WAYLAND_SHARED=OFF

(cherry picked from commit 5b5b67df203e9f8391e7e53aa5de54abf14c482e)
2023-06-29 16:04:47 -04:00
Sam Lantinga 099e53f3a5 Fixed build 2023-06-29 11:25:54 -07:00
Sam Lantinga 0f940cb6ce Added support for the Nintendo Online Famicom controllers
(cherry picked from commit baa9c57581490bd9cdefabb213e7cb6d0c30b296)
2023-06-29 11:18:09 -07:00
Ryan C. Gordon 1453cfa4e9
pulseaudio: Move to a threaded mainloop.
This used to create a context and mainloop for each device and the hotplug
thread, but this isn't correct use of PulseAudio's API. Now we have a
single context and a pa_threaded_mainloop, and all threads cooperate around
it.

This was originally from SDL3, in 35292d7dba88faa667f86e77c63651d19ef49178.

Reference Issue #7883.
Reference Issue #7427.
2023-06-28 20:32:14 -04:00
Sam Lantinga 0ba93e4aac Don't crash if SDL_MapRGB() and SDL_MapRGBA() are passed a NULL format
(cherry picked from commit fadc4916a9bcc410c2148a91bf0adf742410a4ba)
2023-06-27 16:08:53 -07:00
Sam Lantinga 170428b107 Fixed Nintendo Switch Pro controllers that don't have readable user calibration
(cherry picked from commit 9ee1200e6f8fecd394d9355781af40ac90851546)
2023-06-27 07:50:00 -07:00
Narr the Reg 950ff0056a hidapi: switch: Handle MCU input reports
(cherry picked from commit 425062c123f88b6890277905714e02c9375f5b5e)
2023-06-26 10:07:15 -07:00
Sam Lantinga 38619bb28d SDL_FindFreePlayerIndex() will always return the next available player index
Fixes https://github.com/libsdl-org/SDL/issues/7868

(cherry picked from commit 87e916dd214866af9cfd67eb4618918bc8b0f1b4)
2023-06-24 15:40:09 -07:00
Sam Lantinga c6660afe44 Corrected the Victrix FS Pro as a PS4 controller instead of a PS3 controller
(cherry picked from commit 44bae1e8a9329481c72b22de5a595b953eee8417)
2023-06-23 15:44:15 -07:00
Sam Lantinga 8acf729650 Removed 100 ms hitch when querying third party Nintendo Switch controllers that don't respond to request for info 2023-06-21 14:11:41 -07:00
Sam Lantinga dfbdaca2b8 Use default sensor calibration if we can't read it from the Nintendo Switch controller
Fixes https://github.com/libsdl-org/SDL/issues/7830

(cherry picked from commit 3694dabe7c16bb8e76f6f4820a1987ce16c4a3c9)
2023-06-21 10:40:02 -07:00