Commit graph

11617 commits

Author SHA1 Message Date
Sam Lantinga f7dc8c0eaa Fixed LED pending check failing when the controller timestamp is very large
In this case we know the controller has been on for a while and the Bluetooth connection LED cycle is complete.

Also fixed the timestamp being zero the first time it is checked

(cherry picked from commit bd4f155bbbdc4be34505535e4bd936ae12671925)
2023-07-17 17:40:17 -07:00
Sam Lantinga bb036ef544 Don't send k_EPS5FeatureReportIdCapabilities to Sony PS5 controllers
This report is for third party controllers only.

(cherry picked from commit 16dd5f0da4ee950e9f998a757dcb4789463e67e2)
2023-07-17 17:39:33 -07:00
Sam Lantinga 910dad505a Don't tickle Bluetooth PS5 controllers in simple mode with an effects packet
That will put the PS5 controller into enhanced mode, which breaks DirectInput games

(cherry picked from commit 2fef0be2f646ae048e239aa6694e632081c85238)
2023-07-17 17:36:41 -07:00
Ozkan Sezer 4b2b475ac2 remove unused vulkan/*.hpp files.
(cherry picked from commit 611b3dd1fd7aec30ba9c830c7c5f8a0cdbaf9ff5)
2023-07-17 00:11:51 +03:00
Sam Lantinga a4ad293d4a Relicensed testutils to match other test code
Permission granted in 76a7b629bf (commitcomment-121408342)

(cherry picked from commit 6c2472d459602eb3c3ee109d6e8f255336109673)
2023-07-16 04:37:15 -07:00
Sam Lantinga 6089b35706 Fixed getting the CRC of virtual joysticks without a VID/PID
(cherry picked from commit b40fb5c51e2a5350ba00fbf4db86b4ae1066db92)
2023-07-16 04:36:06 -07:00
Frank Praznik a999100858 wayland/video: Validate the returned window display pointer before dereferencing it
If, in the case where all displays has been disconnected, and some window state change occurs before an active display is re-added and finalized, the pointer returned by SDL_GetDisplayForWindow() will be null necessitating that the returned pointer be checked for validity before dereferencing it.
2023-07-14 10:43:54 -04:00
Anonymous Maarten 57e9a9eee6 ci: move 'set -eu' to after source_cmd 2023-07-14 15:02:10 +02:00
Ryan C. Gordon b9d16dac4e
pulseaudio: Some fixes that seem to avoid an assertion in libpulse.
- Make sure the hotplug thread has hit its main loop before letting
  DetectDevices continue.
- Don't unref the context subscription operation until it completes
  (or we are shutting down).

I'm not sure which change fixed the problem, but at least one of them
appears to have done so.

Reference Issue #7971.
2023-07-12 23:29:39 -04:00
Ozkan Sezer 776a5e0d25 pulseaudio: eliminate <pulse/simple.h> include. 2023-07-13 01:51:10 +03:00
Ozkan Sezer 376c6a9dd1 apply commit 3aba9d4473 to autotools, too. 2023-07-13 01:51:02 +03:00
Ryan C. Gordon 3aba9d4473
pulseaudio: We should be using libpulse, not libpulse-simple.
This probably worked by a quirk of the dynamic loader...?

(cherry picked from commit 6aef14fb2d40bc39580d198423930741104c8d94)
2023-07-12 16:43:05 -04:00
Ryan C. Gordon 832b524180
pulseaudio: don't wait on pa_context_subscribe in hotplug thread.
This risks blocking the thread if disaster ensues, and we can wait in the
thread's main loop for subscription as well anywhere else.

Reference Issue #7971.

(cherry picked from commit 956b18f50cc3794f253b025cca6e5e00c445fd67)
2023-07-12 16:05:09 -04:00
Ozkan Sezer 29d461b628 need pulseaudio >=0.9.15. call pa_threaded_mainloop_set_name only if available. 2023-07-12 21:39:41 +03:00
Sam Lantinga e8b6edd5a0 RAWINPUT_RegisterNotifications() should return int, for consistency
(cherry picked from commit 1903d7b1bf6c73ef23e4d6934c9fec5246dd0b2e)
2023-07-11 10:52:57 -07:00
Sam Lantinga 34c5bde355 Improved RAWINPUT <-> XInput/WGI device correlation
If there is only one controller slot available, assume that's the one matching new RAWINPUt devices. This will be right most of the time, and uncorrelation will fix any bad guesses.

(cherry picked from commit 41882a1acb6054dc7a56fd5ff7f0a279ba1144c0)
2023-07-11 10:46:37 -07:00
Sam Lantinga 9117b2e300 Fixed crash if RAWINPUT is not initialized
We shouldn't be doing any of this work in that case

(cherry picked from commit dfc5e6964eca0a0813768518d08cf1c80136e896)
2023-07-11 10:46:37 -07:00
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