Commit Graph

11838 Commits

Author SHA1 Message Date
Sylvain f3b0dc5007 Fixed bug #8301 - Software renderer draws long lines incorrectly / SDL_RENDERLINEMETHOD_GEOMETRY
(cherry picked from commit ce0e0675de)
2024-01-16 07:08:15 -08:00
Ryan C. Gordon c69e858e7a
audio: Patched to compile (mixed declarations and code). 2024-01-16 10:07:14 -05:00
Ryan C. Gordon 1e2f311811
audio: backport SDL3's audio datatype converters.
These are faster and more precise.

This did not change the Uint16 versions (as SDL3 dropped them, and honestly
no one should be using them in SDL2), nor the NEON converters (as this was
not changed in SDL3, so far).

Fixes #8786.
2024-01-16 10:04:09 -05:00
Sam Lantinga eae81ec80e Touchpads already have their right/left buttons swapped in raw input
Fixes https://github.com/libsdl-org/SDL/issues/8597

(cherry picked from commit cf5e0637b5)
2024-01-15 19:46:31 -08:00
Sam Lantinga f641d91f67 Restore window minimum and maximum size if it is recreated
Fixes https://github.com/libsdl-org/SDL/issues/8805

(cherry picked from commit fb2d7ed83e)
2024-01-15 16:35:03 -08:00
Susko3 38d11e5cc6 Add missing `(void)` in functions params 2024-01-13 11:45:44 -08:00
Susko3 bbe4d693eb Use correct touch check flag
Matches the one in `GetMouseMessageSource()`.
From my testing on Windows 11, the lower 8 bits in touch events cycle
trough the values 0x8c-0x95 in order.

(cherry picked from commit d747daf03d)
2024-01-13 11:44:43 -08:00
Sam Lantinga b6e97d9ff0 Fixed Xcode warnings 2024-01-13 08:15:41 -08:00
Sam Lantinga 5db6eb7742 Removed reference to deleted header from Xcode project 2024-01-13 08:10:04 -08:00
Sylvain 347b6cdcb6
Prevent ASAN warning:
like SDL_triangle.c:305:30: runtime error: left shift of negative value -672
(even if the value was correctly computed)

(cherry picked from commit 4033a0a83b)
2024-01-13 13:58:30 +01:00
Alberto Mardegan 66209135df render: Fix line clipping with translated viewports
The previous code was working incorrectly on viewports not having the
top left corner on the origin: even in those cases we only need to look
at the width and height of the viewport, because the drawing coordinates
are translated.

Fixes #8828
2024-01-11 14:36:55 -08:00
Sylvain 01fa4dd9d1 Fixed ASAN warning, runtime error: left shift of 160 by 24 places cannot be represented in type 'int'
(cherry picked from commit cf0d1d7234)
2024-01-11 09:02:19 -08:00
Frank Praznik 9fe09950f1 wayland: Raise the frame throttle limit
Raise the minimum frame throttle limit to 1/3 the refresh rate (or 20hz) to prevent titles from timing out when occluded.
2024-01-10 17:06:47 -05:00
Caleb Cornett 71cd1fa595 Fix compile error with XInputOnGameInput.h
(cherry picked from commit d766f68cb3)
2024-01-10 12:54:00 -08:00
Simon McVittie 4f2c7328d6 test: Use AUDIO_F32SYS for native-endianness
AUDIO_F32 is an alias for AUDIO_F32LSB, 32-bit floating point with least
significant byte first, resulting in audio_resampleLoss() failing on
big-endian machines. This particular test generates a buffer with
native-endianness float values, so it ought to be using AUDIO_F32SYS,
which is 32-bit floating point in the native endianness.

Already fixed by commit 47bcb078 "Fixed some incorrect SDL_AUDIO_F32 uses"
on the SDL 3 branch.

Resolves: https://github.com/libsdl-org/SDL/issues/8818
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-10 06:10:23 -08:00
Simon McVittie 1634a4cc30 test: Use SDL_CreateRGBSurfaceWithFormatFrom for SDLTest_ImageFace
Unlike the test images in the previous commit, this one is
4-bytes-per-pixel RGBA32, so the masks used here appear to be correct
for both endiannesses. Converting it to SDL_PIXELFORMAT_RGBA32 just
makes it more concise.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-10 06:09:40 -08:00
Simon McVittie feaf52dba6 test: Fix encoding declaration for RGB24 test images
All of these test images are provided as an octal dump of
3-bytes-per-pixel data with red, green and blue bytes in that order,
referred to as RGB24 in SDL's taxonomy. However, the call to
SDL_CreateRGBSurfaceFrom() used masks that would have been appropriate
for RGBA32 data.

On little-endian platforms, the test images loaded as intended anyway,
because SDL does not actually check all four masks before deciding to
use RGB24 (it only looks at the red mask), and the red channel happens to
be in the 0x000000FF position for both RGB24 and RGBA32 on little-endian.

Unfortunately, on big-endian platforms, the required masks are not the
same and the call failed with "Unknown pixel format". As far as I can
tell, this means testautomation_surface has never succeeded on big-endian
platforms, but presumably nobody has tried to run it on such platforms
until now.

In the SDL 3 branch, this was fixed as a side-effect of commit
932f6134 "Remove mask versions of SDL_CreateRGBSurface* #6701  (#6711)",
which I have used as a reference to confirm that RGB24 is correct.

Resolves: https://github.com/libsdl-org/SDL/issues/8817
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-10 06:09:40 -08:00
Sam Lantinga 970ed36de5 Only force X11 if SDL_VIDEO_DRIVER_X11 is available 2024-01-09 11:56:26 -08:00
Sam Lantinga bd2f1e9ea6 Use the X11 driver if the application uses X11-based graphics frameworks
Fixes https://github.com/libsdl-org/SDL/issues/8812
2024-01-09 11:24:10 -08:00
Ozkan Sezer 2afd04d09b test/acinclude.m4 (AM_PATH_SDL2): apply recent sdl2.m4 PKG_CONFIG patch 2024-01-09 17:11:10 +03:00
Simon McVittie 69f3bb2e34 test: Accept small numerical differences in more mathematical tests
We can't rely on irrational numbers like pi being represented exactly,
particularly when compiling for i386, where the i387 floating-point
interface carries out calculations in registers that have higher
precision than the actual double-precision variable. The 1980s were a
strange time.

Resolves: https://github.com/libsdl-org/SDL/issues/8311
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 6248472c0c)
2024-01-09 06:06:46 -08:00
Anonymous Maarten d1c5038f16 testautomation: don't do float equality tests
(cherry picked from commit 474c8d0073)
2024-01-09 06:06:46 -08:00
Sam Lantinga f62d1220ac Restore the previously initialized subsystems after the Init/Quit test
Fixes https://github.com/libsdl-org/SDL/issues/8796
2024-01-08 14:32:52 -08:00
Sam Lantinga 4c11307a4e Only initialize audio drivers that have been requested
If testautomation is running with only a specific audio driver enabled, we shouldn't try to open other ones, as they might fail.

Fixes https://github.com/libsdl-org/SDL/issues/8797
2024-01-08 13:38:29 -08:00
Simon McVittie b1a82b5772 gamecontroller: Fix function name in cherry-picked documentation
SDL_GetGamepadAxis() is a SDL3-specific name: SDL2 calls gamepads
"game controllers".

Fixes: d3c21666 "gamepad: Clarify range and direction of axes"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-08 11:09:55 -08:00
Anonymous Maarten 3ff56fda1a testautomation: only require accelerated renderer with non-dummy video driver
Backported from SDL3 commit 85e3099b.

Co-authored-by: Simon McVittie <smcv@collabora.com>
Resolves: https://github.com/libsdl-org/SDL/issues/8799
2024-01-08 11:01:06 -08:00
Simon McVittie 64754f3a2a test: When listing test-cases, say which ones are disabled
When a test has been disabled because it's known not to work reliably
or it's a test for unimplemented functionality, we probably don't want
to encourage developers and testers to run it and report its failures
as a bug.

Helps: #8798, #8800
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-08 09:50:11 -08:00
Sam Lantinga d3c21666de gamepad: Clarify range and direction of axes
It would be easy to assume that all APIs that reference
SDL_JOYSTICK_AXIS_MAX work the same way, but they do not: triggers
generally use the full signed 16-bit range in the lower-level joystick
API, but are normalized to be non-negative by the higher-level gamepad
API.

We also never said explicitly which direction is positive here.
Experimentally, it's right (X), down (Y), and pressed (triggers).

Resolves: https://github.com/libsdl-org/SDL/issues/8793
Signed-off-by: Simon McVittie <smcv@collabora.com>

(cherry picked from commit 059fb560ba)
2024-01-08 09:48:04 -08:00
Sam Lantinga 5e12e4b813 Updated documentation for SDL_HINT_SHUTDOWN_DBUS_ON_QUIT
(cherry picked from commit 3deefa6b43)
2024-01-07 14:24:56 -08:00
Semphris 8c4e4d57b3 Add hint to make SDL handle dbus_shutdown()
(cherry picked from commit 2348e8b6a2)
2024-01-07 14:23:57 -08:00
Sam Lantinga ca3b8fe91d Fixed build 2024-01-06 08:33:30 -08:00
Sam Lantinga e1c3dcb403 Don't try to send the PS third-party feature request to the Logitech G815 keyboard
Fixes https://github.com/libsdl-org/SDL/issues/8373

(cherry picked from commit d3daba791a)
2024-01-06 08:30:20 -08:00
Sam Lantinga c309546e8c Fixed warning: no previous prototype for function 'SDL_GetGameControllerTypeFromString' [-Wmissing-prototypes] 2024-01-06 08:23:55 -08:00
Sam Lantinga 0e913a22db Renamed ShowTextInput/HideTextInput to ShowScreenKeyboard/HideScreenKeyboard on Android
This better reflects the actual implementation and makes SDL_HINT_ENABLE_SCREEN_KEYBOARD work on Android.

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

(cherry picked from commit 014a63b4b5)
2024-01-06 08:23:11 -08:00
Sam Lantinga be29ca0189 Use the application requested size to determine automatic orientation on iOS
Fixes https://github.com/libsdl-org/SDL/issues/8201

(cherry picked from commit e3b5999bb4)
2024-01-06 07:39:25 -08:00
Sam Lantinga f892ae10d6 updateKeyboard should use the SDL window's screen instead of the view window's screen, which may be nil.
Fixes https://github.com/libsdl-org/SDL/issues/8200

(cherry picked from commit 3a9a52fe6c)
2024-01-06 07:37:14 -08:00
Sam Lantinga 674e894574 Added mapping for the RX Gamepad, e.g. Pandora Box 7
Fixes https://github.com/libsdl-org/SDL/issues/8217

(cherry picked from commit e100992c17)
2024-01-06 06:19:30 -08:00
J. Neuschäfer b1ad45acdd Fix memory barriers on ARMv5
The ARM926EJ-S Technical Reference Manual states:

> You can only access CP15 registers with MRC and MCR instructions in a
> privileged mode. CDP, LDC, STC, MCRR, and MRRC instructions, and unprivileged
> MRC or MCR instructions to CP15 cause the Undefined instruction exception to
> be taken.

Furthermore, `MCR p15, 0, <Rd>, c7, c10, 5` (later called Data Memory Barrier)
is not specified for the ARM926. Thus, SDL should not use these cache
instructions on ARMv5.

(cherry picked from commit 139a0931a3)
2024-01-05 09:01:30 -08:00
jfmu eb1b9b418c SDL_audio.c: Fix crash if we switch from direct output to streaming, and if the buffersizes change. 2024-01-04 19:41:38 -05:00
Ozkan Sezer 7b4f1ef01b yuv2rgb: warning fixes and comment out unused code
(cherry picked from commit 46de6241d7)
(cherry picked from commit 0bd77a5b93)
(cherry picked from commit f341c06552)
(cherry picked from commit 4d2f9f3a32)
(cherry picked from commit 06f8f9a891)
(cherry picked from commit 0c4cb3d153)
(cherry picked from commit 0dad56354c)
2024-01-03 09:07:50 -05:00
Vicki Pfau 41bf6b5a51 Add basic rumble support to Steam Deck
(cherry picked from commit bec1b8f849)
2024-01-01 21:48:41 -08:00
Sam Lantinga 0fc3574464 Updated copyright for 2024 2024-01-01 13:19:49 -08:00
Sam Lantinga d649f95723 Use GNU sed if available
Fixes update-copyright.sh on macOS, which doesn't support the -b option.

(cherry picked from commit a357021800)
2024-01-01 13:18:35 -08:00
Sam Lantinga 4f8dd2d39d Speed up processing of update-copyright.sh
(cherry picked from commit 78ccadd5a2)
2024-01-01 13:18:35 -08:00
Simon McVittie b02c8267f9 sdl2.m4: Call $PKG_CONFIG rather than hard-coding pkg-config
When cross-compiling, pkg.m4 will set the PKG_CONFIG variable
to a suitable pkg-config executable, which might be a
host-architecture-prefixed name like aarch64-linux-gnu-pkg-config. This
ensures that we will use a suitable search path that is suitable for
the host architecture (the machine we are compiling for) rather than
the build architecture (the machine we are compiling on) to find
dependency libraries like SDL. When using pkg-config as a substitute
for sdl2-config, we will similarly need to use the
host-architecture-prefixed pkg-config.

Setting the PKG_CONFIG environment variable is also the canonical way to
request that a different pkg-config implementation be used, if that
becomes necessary for some reason.

Co-authored-by: Helmut Grohne <helmut@subdivi.de>
Bug-Debian: https://bugs.debian.org/1059749
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-01 08:27:02 -08:00
SDL Wiki Bot 0f8f4f6764 Sync SDL3 wiki -> header
(cherry picked from commit 5df3eac925)
2023-12-27 14:49:59 -08:00
Reilly Brogan 8030e7546a Fix static build with libdecor 0.2.0
(cherry picked from commit 4ce935b910)
2023-12-26 16:30:32 -08:00
Reilly Brogan 5dfb0c19c8 Fix static build with libdrm 2.4.116 2023-12-26 16:29:01 -08:00
Alynne 2afbb5713c Add Access Controller
(cherry picked from commit cae657140c)
2023-12-26 09:58:47 -08:00
Tyson Whitehead 3b1e0e163b Try SDL_UDEV_deviceclass to detect joysticks even if in a container
The udev container issue is mostly to do with device notifications
and netlink. The device classification stuff just pokes file in /sys
and /run/udev. Doesn't hurt to try it first for classifying joysticks
and then fall to the guess heuristics if it fails.
2023-12-24 16:02:38 -08:00