Commit Graph

11554 Commits

Author SHA1 Message Date
Sam Lantinga d9fd3ce83c Fixed Visual Studio warning 4459
(cherry picked from commit d135daad5b)
2024-04-24 01:22:24 +03:00
Julian Uy 7fa9f1559c PS2 use WaitSemaEx for waiting for semaphore with timeout
(cherry picked from commit 557d8e2f24)
2024-04-24 01:22:04 +03:00
Ozkan Sezer b2ec286e35 CI, macOS: install autoconf.
Reference issue: https://github.com/libsdl-org/SDL/issues/9606 .

(cherry picked from commit 26e3d65ea8)
2024-04-24 00:33:56 +03:00
Sam Lantinga 05eb08053d Fixed IOS_SupportedHIDDevice() returning SDL_FALSE before initialization
(cherry picked from commit 34392db9c3)
(cherry picked from commit cc7c0a2dab)
2023-11-14 10:58:45 -08:00
Sam Lantinga c2ebe1024b Added SDL_HINT_JOYSTICK_IOKIT and SDL_HINT_JOYSTICK_MFI to control whether the IOKit and GCController drivers should be used for joystick support.
This can be used to work around issues where the Apple GCController driver doesn't work for some controllers but there's no way to know which GCController maps to which IOKit device.

(cherry picked from commit 708f18d49e)
(cherry picked from commit 76cc24e34a)
2023-11-14 10:35:14 -08:00
Sam Lantinga 1a722ef500 Fixed a memory leak at window creation.
Windows updates the desktop display mode once at video init (in WIN_InitModes()) and once when creating a window (in WIN_RefreshDisplays())

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

(cherry picked from commit bea34c5380)
(cherry picked from commit 0ec1209eab)
2023-11-14 10:35:14 -08:00
Sam Lantinga 6303197b20 Revert "Check to make sure the Windows joystick device has buttons and axes"
This reverts commit ad0af48883.

It turns out the ROG PUGIO II actually enumerates as a gamepad, so this change didn't have any effect anyway. We're getting lots of reports of people's racing pedals and similar devices no longer showing up, so we'll revert this again.

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

(cherry picked from commit 2c1fbe1967)
(cherry picked from commit cc20d0147e)
2023-11-13 21:37:50 -08:00
Sam Lantinga 6c0a114efb Fixed the ROG PUGIO II showing up as a game controller
This mouse actually enumerates as a gamepad with 2 axes, 8 buttons and a hat.

We'll ignore it like the other ROG mice, unless someone specifically wants to use it as a gamepad.

(cherry picked from commit edd044e901)
(cherry picked from commit 8c82b73027)
2023-11-13 21:37:50 -08:00
Sam Lantinga e5ccc80aba Removed useless branch test
Fixes https://github.com/libsdl-org/SDL/issues/8286
2023-11-08 01:34:42 -08:00
Sam Lantinga 00096baf18 Actually we need to enumerate the 8BitDo Xbox SKUs
At the point we're calling SDL_IsJoystickXboxSeriesX(), we don't know for sure that the controller is an Xbox controller.

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

(cherry picked from commit 15bc12165a)
(cherry picked from commit af7fe2cf9b)
2023-11-08 00:43:57 -08:00
Sam Lantinga 1dbe85efd1 Assume all 8BitDo Xbox controllers have a share button
Fixes https://github.com/libsdl-org/SDL/issues/8174

(cherry picked from commit 8049af3355)
(cherry picked from commit 524ccf033f)
2023-11-08 00:36:49 -08:00
Sam Lantinga 52bffcbcd5 Destroy the window surface if we've created it for the software renderer
Fixes https://github.com/libsdl-org/SDL/issues/8011

(cherry picked from commit 624905a7f1)
2023-11-07 21:47:24 -08:00
Sam Lantinga 89433c2339 Added a mapping for the Atari VCS controller connected over Bluetooth (thanks @WizzardSK!)
Fixes https://github.com/libsdl-org/SDL/issues/7116

(cherry picked from commit 28e623c504)
(cherry picked from commit 4ace02df5f)
2023-11-07 18:09:14 -08:00
Sam Lantinga b0fd3fad53 Make sure we include the null terminator in XLookupStringAsUTF8()
Fixes https://github.com/libsdl-org/SDL/issues/6728

(cherry picked from commit 4106697774)
(cherry picked from commit 70adacf08a)
2023-11-07 16:25:27 -08:00
Sam Lantinga 31dfc10c3b Fixed connecting and disconnecting real-joysticks closing virtual joysticks in Emscripten (thanks David!)
Emscripten was using its own, private integer in order to allocate
new SDL_JoystickIDs.  SDL keeps a similar integer for allocating
joystick-ids, one which is shared across multiple joystick backends.

SDL 2.0.13 introduces a new joystick-backend, a Virtual joystick
backend, which allows for software-driven joysticks, and which is
designed to sit alongside joystick-backends that provide access to
physical joysticks.

The Emscripten and the Virtual backends were, at times, getting
allocated the same SDL_JoystickIDs, if and when both backends were used
simultaneously.  This could happen if, for example, an application
was using a virtual joystick in order to drive a touch-screen
based joystick, while also supporting physical joysticks through the
Emscripten backend.

When two joysticks end up with the same SDL_JoystickID, conflicts
can occur.  For example, disconnecting a physical joystick with
the same SDL_JoystickID as a virtual one, can lead to the virtual
joystick being closed, inadvertently.

This fix makes the Emscripten backend use SDL's cross-joystick-backend
integer counter, which is shared among joystick backends, for allocating
new SDL_JoystickIDs, rather than a private, Emscripten-specific
counter.

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

(cherry picked from commit 07cb7c10a1)
(cherry picked from commit 0c85173d5b)
2023-11-06 17:13:30 -08:00
Sam Lantinga 66399e4211 Revert "cmake: fold HAVE_INPUT_EVENTS into HAVE_LINUX_INPUT_H"
This reverts commit 01eb305493.
2023-11-06 12:17:15 -08:00
Sam Lantinga 45075eec86 Revert "configure: move HAVE_LINUX_INPUT_H to CheckInputEvents()"
This reverts commit 221d6ea8a8.

Fixes https://github.com/libsdl-org/SDL/issues/8488
2023-11-06 12:16:44 -08:00
Ozkan Sezer 9b2c70c9c8 fix a possible memory leak in SDL_vasprintf()
(cherry picked from commit 1a83bf2399)
2023-11-05 20:02:10 +03:00
Sam Lantinga ac23faf0a6 Fixed potential uninitialized memory access (thanks Mathieu!)
GetRawInputDeviceList() can return a different number of devices than was allocated.

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

(cherry picked from commit b9784feb24)
(cherry picked from commit aa129c9257)
2023-11-04 21:12:36 -07:00
Ozkan Sezer 221d6ea8a8 configure: move HAVE_LINUX_INPUT_H to CheckInputEvents()
c.f.: https://github.com/libsdl-org/SDL/pull/8459.
Ref. issue https://github.com/libsdl-org/SDL/issues/8450
(cherry picked from commit e226008d83)
2023-11-02 23:33:50 +03:00
Anonymous Maarten 01eb305493 cmake: fold HAVE_INPUT_EVENTS into HAVE_LINUX_INPUT_H
(cherry picked from commit 8b1b6734f6)
2023-11-02 21:29:23 +01:00
Sam Lantinga 15ead9a40d Updated to version 2.28.5 for release 2023-11-02 10:00:33 -07:00
Sam Lantinga 7ebfaa0ea2 Check to make sure the Windows joystick device has buttons and axes
This reverts commit e5a15f94e2.

It turns out removing this check allows mice like the ROG PUGIO II to show up as game controllers. We need to find a different way to differentiate between gaming mice and pedals.

Since these mice show up as controllers, and potentially causing games to use them instead of real controllers, we'll go ahead revert this change for now.

Reopens https://github.com/libsdl-org/SDL/issues/8227

(cherry picked from commit ad0af48883)
(cherry picked from commit 20ecd2afcb)
2023-11-02 08:45:00 -07:00
Anonymous Maarten 5f4ddebf76 cmake: reset check state before testing -fobjc-arc
(cherry picked from commit 517db6d887)
2023-10-30 21:13:42 +01:00
Anonymous Maarten 0f8858cf2d cmake: check -fobjc-arc compiler flag on Apple platforms
(cherry picked from commit 20630b2e6c)
2023-10-30 19:57:02 +01:00
Anonymous Maarten 98abc15769 cmake: file(RELATIVE_PATH) needs 2 absolute paths
(cherry picked from commit 7774de0fe3)
2023-10-30 19:47:21 +01:00
Frank Praznik 746d74b140 wayland: Sanity check pointers and protocols before confining
(cherry picked from commit 875e45e70b)
(cherry picked from commit 60e8ff16dc)
2023-10-29 14:32:02 -04:00
Frank Praznik 7d9595b14f wayland: Check the relative pointer handle before destroying
If the relative protocol is unsupported, this will always be null and the destroy function won't be called.

(cherry picked from commit 0e87b71d08)
(cherry picked from commit 19c3e125ba)
2023-10-29 14:31:46 -04:00
Sam Lantinga 63d259edf0 Fixed making the EGL context current when resuming on Android
Make sure that we don't have the context cached as current on the current thread.

(cherry picked from commit 8b6da3c701)
(cherry picked from commit 832afa81a1)
2023-10-26 17:09:34 -07:00
Ozkan Sezer fcd0c9843e CI: change FreeBSD CI runner to cross-platform-actions. 2023-10-26 01:03:56 +03:00
Sam Lantinga 74b3959e04 Added support for the HP HyperX Clutch Gladiate controller
(cherry picked from commit f52b330ed8)
(cherry picked from commit 1db0bd3fc0)
2023-10-25 09:02:04 -07:00
Sam Lantinga a5df48514e Added support for "%[]" sscanf syntax
Fixes https://github.com/libsdl-org/SDL/issues/8423

(cherry picked from commit 39a961ba41)
(cherry picked from commit 4194a902e8)
2023-10-24 17:34:39 -07:00
Sam Lantinga 78d5fbf398 SDL_IsJoystickProductWheel() returns SDL_TRUE for Asetek wheelbases (thanks @IOBYTE!)
(cherry picked from commit e07f6c0a17)
(cherry picked from commit d47c286b12)
2023-10-23 10:44:44 -07:00
Sam Lantinga 5d66429cc3 Add missing error reporting in Android_JNI_FileOpen()
Fixes https://github.com/libsdl-org/SDL/issues/8427

(cherry picked from commit a844d90942)
(cherry picked from commit 259009a7ea)
2023-10-23 08:28:57 -07:00
Sam Lantinga 2ca041d294 Revert "Check to make sure the Windows joystick device has buttons and axes"
This reverts commit 642504bc59.

We have SDL_HINT_JOYSTICK_ROG_CHAKRAM to ignore or allow the ROG Chakram X mouse to be used as a joystick.

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

(cherry picked from commit e5a15f94e2)
(cherry picked from commit e3e41b69a1)
2023-10-22 09:24:44 -07:00
Cameron Gutman b3f19b14d7 Check for device disconnection in HIDAPI_JoystickOpen()
HIDAPI joystick drivers may call HIDAPI_JoystickDisconnected() in their
UpdateDevice() function during HIDAPI_JoystickOpen(). If they do this
today, the opened joystick will end up partially initialized (no name,
path, mapping GUID, etc.) because HIDAPI_GetDeviceByIndex() will no
longer be able to find the SDL_HIDAPI_Device for the removed joystick.

Worse still, joystick->hwdata->device becomes a dangling freed pointer
the next time HIDAPI_UpdateDeviceList() is called. This leads to a UAF
when the application or SDL calls SDL_JoystickClose() on this joystick.

Fix all this by checking if the device no longer has any associated
joysticks after calling UpdateDevice() and failing the open call if so.

(cherry picked from commit 435e7ce663)
(cherry picked from commit 4aab2342e9)
2023-10-17 20:40:35 -07:00
Sylvain a85cf62c12 Fix sdltest_randomAsciiStringWithMaximumLength() where it requests a string a size 0
seen with: ./testautomation --seed MILAFAP2AKVP3V4G --filter sdltest_randomAsciiStringWithMaximumLength
2023-10-13 20:24:48 +02:00
Ryan C. Gordon 5be746acbc
x11: Properly check for XInput2 support before using it.
This specifically fixes a crash in X11_WarpMouseInternal if XInput2 was
missing at runtime, but also cleans up a few other existing checks.

Fixes #8378.

(cherry picked from commit 82f54af617)
(cherry picked from commit 2849ca404e)
2023-10-11 01:11:01 -04:00
Anonymous Maarten 2abefb1c16 ci: stop FreeBSD job after 30 minutes
(cherry picked from commit aee4862958)
2023-10-11 00:23:41 +02:00
Ozkan Sezer 6fc17b0e2b artsaudio: revert bad arts_init return code check from commit ce5da5d. 2023-10-10 10:40:00 +03:00
Frank Praznik 1f7ec57d3b wayland: Unref the libdecor window when hiding
Hiding the decorations while not unreferencing the frame was a workaround for an internal libdecor use-after-free bug that was fixed some time ago. Revert to unreferencing the window when hiding to ensure that it is properly destroyed.

Reverts dd2e318
2023-10-05 20:26:29 +02:00
Anonymous Maarten 36eb4845b5 triangle: don't read destination pixel when you're going to discard it anyways 2023-10-05 15:00:06 +02:00
Anonymous Maarten d5ba5bb05f blit_slow: don't read destination pixel when you're going to discard it anyways
(cherry picked from commit 4cd0c13823)
(cherry picked from commit 2d5c05a69c)
2023-10-04 19:43:03 -07:00
Sam Lantinga cc016b0046 Updated to version 2.28.4 for release 2023-10-01 12:05:05 -07:00
Anonymous Maarten 8c3fd5aec2 snd_pcm_plugin_flush was removed in QNX 7.1 and later
Co-authored-by: elahav <elahav@users.noreply.github.com>
2023-09-30 16:53:53 +02:00
Anonymous Maarten 24d145f4b6 cmake: add qnx support
Co-authored-by: elahav <elahav@users.noreply.github.com>
2023-09-30 16:53:53 +02:00
Anonymous Maarten 145ad48c0e Allow the use of posix_spawn() instead of vfork/execlp()
Backport of #7041

Co-authored-by: elahav <elahav@users.noreply.github.com>
2023-09-30 16:53:53 +02:00
Simon McVittie fd495bb57c SDLTest_CompareSurfaces: Decode pixels correctly on big-endian platforms
Previously, if acting on a surface with less than 32 bits per pixel,
this code was placing the pixel value from the surface in the first
few bytes of the Uint32 to be decoded, and unrelated data from a
subsequent pixel in the remaining bytes.

Because SDL_GetRGBA takes the bits to be decoded from the
least-significant bits of the given value, ignoring the higher-order
bits if any, this happened to be correct on little-endian platforms,
where the first few bytes store the least-significant bits of an
integer.

However, it was incorrect on big-endian, where the first few bytes are
the most-significant bits of an integer.

The previous implementation also assumed that unaligned access to a
32-bit quantity is possible, which is not the case on all CPUs (but
happens to be true on x86).

These issues were not discovered until now because
SDLTest_CompareSurfaces() is only used in testautomation, which until
recently was not being run routinely at build-time, because it contained
other assumptions that can fail in an autobuilder or CI environment.

Resolves: https://github.com/libsdl-org/SDL/issues/8315
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit d95d2d7051)
(cherry picked from commit 6b5eadb10f)
2023-09-29 06:57:07 -07:00
Sam Lantinga d58fa94ee9 SDL_iconv_string() defaults to UTF-8
Fixes https://github.com/libsdl-org/SDL/issues/8287

(cherry picked from commit 1375d2049d)
(cherry picked from commit 9772d0512c)
2023-09-24 17:28:23 -07:00
Sam Lantinga d691010686 Check for NULL before dereferencing newly allocated memory
Fixes https://github.com/libsdl-org/SDL/issues/8289

(cherry picked from commit 70a1bc6973)
(cherry picked from commit 27f2df2292)
2023-09-24 17:19:03 -07:00