Compare commits

...

1401 Commits

Author SHA1 Message Date
Sam Lantinga
7a44b1ab00 Updated to version 2.32.0 for release 2025-02-08 09:10:22 -08:00
Sam Lantinga
3e97d41da4 Updated to version 2.31.1 for RC build 2025-02-08 08:56:53 -08:00
ds-sloth
dab0205174 Delete src/thread/n3ds/SDL_syscond.c 2025-02-06 18:12:31 -08:00
Ryan C. Gordon
d2693d4c7d dynapi: Don't use SDL_getenv; it might malloc before the app sets an allocator.
Use platform-specific code instead, so SDL's allocator never comes into play.
2025-02-06 12:40:13 -05:00
Sam Lantinga
ed7e7edb70 Don't use the HIDAPI driver for Thrustmaster wheels
Closes https://github.com/libsdl-org/SDL/pull/12173

(cherry picked from commit 6782cfe2c5)
2025-02-05 17:21:48 -08:00
Thomas Bernard
466cedc0da fix: in sdl2.pc libdir was changed to prefix
(cherry picked from commit 9464f334b5)
2025-02-05 07:49:11 -08:00
Thomas Bernard
b84adb3720 fix: do note assume "make", use $(MAKE)
(cherry picked from commit 1c9643249d)
2025-02-05 07:49:11 -08:00
Sam Lantinga
2847273885 Fixed mis-cherry-pick 2025-02-01 11:03:33 -08:00
Anonymous Maarten
799ede831e testatomic: destroy threads + free all memory at quit to fix --trackmem
(cherry picked from commit 831c79d32f)
2025-02-01 11:02:53 -08:00
Sam Lantinga
482d964733 Don't filter out controllers when launched by Steam under Proton
Fixes https://github.com/libsdl-org/SDL/issues/11579
Fixes https://github.com/libsdl-org/SDL/issues/12106

(cherry picked from commit 3060105cfa)
2025-01-31 15:40:21 -08:00
Sam Lantinga
da0cf3f634 Fixed detecting Steam Deck controller on Proton 9.04
Newer versions of Proton properly pass through the Steam virtual gamepad VID/PID, but older Proton (9.x and older) don't, so we have to rely on Steam and Proton hiding controllers we shouldn't have access to.

Fixes https://github.com/libsdl-org/SDL/issues/12106
2025-01-31 15:32:33 -08:00
Sam Lantinga
55a75875f0 Improved XInput controller detection
Sometimes we'll get a Windows.Gaming.Input callback before the raw input device is even in the list, so try some other methods to better detect XInput devices.
2025-01-31 08:45:20 -08:00
Deve
934d6954e2 Fixed crash when trying to disconnect secondary display on iOS 2025-01-29 14:45:49 -08:00
Sam Lantinga
0efe8892d6 Skip IsRegularFileOrPipe() check on Emscripten
The sandbox guarantees that this will be true.

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

(backported from from commit 1c7cc60286)
2025-01-28 10:47:10 +03:00
Ryan C. Gordon
d3a4d62fc2 .wikiheaders-options: Removed wikipreamble setting.
Reference https://github.com/libsdl-org/sdlwiki/issues/713.
2025-01-24 01:51:11 -05:00
Anonymous Maarten
3f02118264 ci: bump to NetBSD 10.1
(cherry picked from commit 98c447802f)
(cherry picked from commit 18ecd2ccad)
2025-01-23 00:32:56 +03:00
Tomasz Pakuła
5bf8955b25 Use proper polar direction when creating FF_RUMBLE effect
Uses proper polar direction of 90 degrees. Previous value probably came from mistakenly using spherical system default.
2025-01-20 16:52:11 -08:00
Tomasz Pakuła
529ed102fc Translate conditional effect direction instead of hardcoding it to 0
Provious code wrongly assumed that direction is not an important part
of conditional effect. Moreover, if there's need to hardcode polar
direction, the default should be 0x4000 (north).

For one axis affects, a direction of 0 means complete lack of force, if
a FFB-enabled device takes direction into force calculation. A sine function
graph can be used to represent the resulting forces where X is the input
direction and Y is the force multiplier (360 degrees equals to 1).

This fixes conditional effect playback on Moza Racing devices, which do
not ignore direction field.
2025-01-20 16:52:11 -08:00
Sam Lantinga
4b19f7e012 Added support for the 8BitDo Ultimate 2C Wireless in Bluetooth mode
Closes https://github.com/libsdl-org/SDL/pull/11415

(cherry picked from commit c7d1fd90ea)
2025-01-18 07:07:12 -08:00
ROllerozxa
878ea48b60 Vita: Fix off-by-one error for synthetic mouse events
(cherry picked from commit cdc5483cf9)
2025-01-16 11:59:25 -08:00
Ozkan Sezer
ab8bd0ef86 fix emscripten builds 2025-01-16 18:50:00 +03:00
Sam Lantinga
9f25821ffd Fixed detection of function keys on Emscripten
Fixes https://github.com/libsdl-org/SDL/issues/11973

(cherry picked from commit 67382e9c83)
2025-01-16 07:32:38 -08:00
CasualPokePlayer
780ec8fac0 Set EGL surface for foreign X11 windows
Also slightly changes up the cleanup code for SetupWindowData, to avoid copy pasting.

See #10611
2025-01-16 10:20:25 -05:00
SDL Wiki Bot
220a23dad2 Sync SDL2 wiki -> header
[ci skip]
2025-01-15 15:27:42 +00:00
Anonymous Maarten
d7825af4de ci: bump FreeBSD to 14.2
[sdl-ci-filter netbsd]
[sdl-ci-filter freebsd]
(cherry picked from commit db97da4ccb)
2025-01-15 06:20:02 +03:00
Sam Lantinga
91b76f5c29 Fixed potentially overlapping memcpy() to use memmove() 2025-01-14 14:34:29 -08:00
SDL Wiki Bot
aa9b4ec894 Sync SDL2 wiki -> header
[ci skip]
2025-01-11 16:25:41 +00:00
Frank Praznik
0efeb82a28 wayland: Only apply the toplevel bounds to resizable windows 2025-01-06 17:20:10 -05:00
Frank Praznik
e5a3fcd071 wayland: Apply toplevel bounds to windows
Apply the supplied xdg-toplevel bounds to resizable windows during initial mapping. Libdecor functionality will have to be added separately, as the functionality needs to be added to the library first.
2025-01-06 17:13:16 -05:00
Anonymous Maarten
ebe561f916 Revert "cmake: consider X11 as not available when xext.h is not found"
This reverts commit fe5468799b.
2025-01-06 20:35:09 +01:00
Erica Z
f804293a27 fix integer overflow ub in testautomation_sdltest
Patch originally from https://github.com/libsdl-org/sdl2-compat/pull/241
2025-01-06 10:37:46 -05:00
Erica Z
793103ef52 comment out signed multiplication overflow ub in testplatform
Patch originally from https://github.com/libsdl-org/sdl2-compat/pull/241
2025-01-06 10:36:32 -05:00
Daniel Tang
db2997548c Let SDL_IM_MODULE=fcitx override Wayland as a workaround to fix key repetition detection (#11859) 2025-01-05 14:34:30 -08:00
Anonymous Maarten
fe5468799b cmake: consider X11 as not available when xext.h is not found
This is user friendlier than straight up erroring

Backport of 16ad3e5af6
2025-01-05 16:06:01 +01:00
Ryan C. Gordon
c9c991b559 test_fuzzer: Patched to compile on Visual Studio. 2025-01-04 01:02:10 -05:00
Ryan C. Gordon
20574c016a coreaudio: Workaround for crash when disconnecting a bluetooth audio device.
Our understanding of what's going on here might be incorrect, but it seems
like we're getting this callback at a point where we shouldn't be able to,
with a device we've already closed.

If we're on the wrong track, this code should still be harmless; it just
verifies a device is still in the open list before dereferencing it.

Reference Issue #10432.
2025-01-04 00:30:31 -05:00
Anonymous Maarten
1fa217434b Avoid undefined signed overflow in SDLTest_RandomIntegerInRange
Partial backport of efba42a67b
2025-01-04 01:07:40 +01:00
SDL Wiki Bot
9dc8c82082 Sync SDL2 wiki -> header
[ci skip]
2025-01-03 13:15:22 +00:00
Joshua Root
6024c2731f prepare_audioqueue: legacy OS compatibility fix 2025-01-02 14:16:33 -08:00
Joshua Root
d58f026827 windowWillStartLiveResize: legacy OS compatibility fix 2025-01-02 14:16:33 -08:00
Joshua Root
ed0eb7714a showAlert: legacy OS compatibility fix 2025-01-02 14:16:33 -08:00
Anonymous Maarten
123b967a99 Port back nolibc SDL_strtol implementations from SDL3 to SDL2 2025-01-02 21:46:28 +01:00
Anonymous Maarten
840638404a testautomation: port back SDL3's strtol and strtod tests
Triggered by b713e7581b
2025-01-02 01:31:34 +01:00
Sam Lantinga
adb51845af Fixed N3DS_TOUCH_ID, 0 is an invalid touch ID 2025-01-01 09:06:23 -08:00
Sam Lantinga
5a25183b39 Revert "Backed out Vita touch ID change for SDL2"
This reverts commit a326ebce61.

It turns out that 0 is an invalid touch ID for SDL2, per the documentation for SDL_GetTouchDevice()
2025-01-01 09:03:24 -08:00
Sam Lantinga
a326ebce61 Backed out Vita touch ID change for SDL2
0 is still a valid touch ID in SDL2 and shouldn't be changed at this point
2025-01-01 08:24:31 -08:00
Sam Lantinga
2b5b8fdbd5 Updated copyright for 2025 2025-01-01 07:47:53 -08:00
Sam Lantinga
0efb7c7829 Fixed spacing 2024-12-30 10:05:40 -08:00
Arquimedes
89977d0d16 Update SDLActivity.java
Fix Full immersive mode in Android 9 and higher.

LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
will make sure to use all the screen when  the fullscreen flag is enabled.

The other option is 
LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS will work in some cases but in devices that have a camera in the middle this flag will not work.
2024-12-30 09:56:35 -08:00
Anonymous Maarten
fc608ffb5f cmake: really disable xrandr by default on Solarir
Fixes libsdl-org/SDL#10099
2024-12-28 11:57:03 +01:00
Anonymous Maarten
5ac94b519c cmake: disable xrandr by default on Solaris
Backport of 0be6dc5734

Fixes libsdl-org/SDL#10099
2024-12-28 04:04:31 +01:00
Anonymous Maarten
e02f651c05 cmake: Solaris' SunPro has alternative way to link to pthread libraries
Fixes libsdl-org/SDL#10096

(cherry picked from commit 4fbd6cba60)
2024-12-28 03:46:52 +01:00
Ryan C. Gordon
96b4535cc7 misc: Fixed typo in iOS error message. 2024-12-26 23:36:28 -05:00
Ryan C. Gordon
e55a23050e misc: Make SDL_OpenURL work with VisionOS, tvOS, etc.
(cherry picked from commit 7bbe6025be)
2024-12-26 23:36:06 -05:00
Ryan C. Gordon
c6e1806ba9 misc: Fix SDL_OpenURL on newer iOS releases.
Apparently as of iOS 18.2, the deprecated API we were using just refuses to
work at all.

Fixes #11728.

(cherry picked from commit ffed1c50c0)
2024-12-26 23:35:29 -05:00
Sam Lantinga
ddfdb0ca7b Don't overwrite non-CRC gamepad mapping with a new mapping that specifies a CRC
Fixes https://github.com/libsdl-org/SDL/issues/11723

(cherry picked from commit 1413bfb185)
2024-12-26 20:20:39 -08:00
Sam Lantinga
348bb53cc1 Corrected CoreAudio surround sound channel layouts
Fixes https://github.com/libsdl-org/SDL/issues/11709

(cherry picked from commit b2178857dc)
2024-12-24 15:10:35 -08:00
Blaž Tomažič
e79b0ce2e4 Use pthread_setname_np also on Android
Set thread name on Android the same way as we do on Linux.

Acording to Bionic source code this function is available since 2013 [1] and
hase the same signature.

[1] 2a1bb4e646
2024-12-24 07:40:04 -08:00
Sam Lantinga
884c8b684a Allow rendering during the modal resize loop on macOS
Fixes https://github.com/libsdl-org/SDL/issues/11508

(cherry picked from commit 9a43c08146)
2024-12-23 11:55:49 -08:00
Wolfywolfy
9491389baf Remove EXTRA_CFLAGS. 2024-12-20 15:19:09 -08:00
Sam Lantinga
974098464f Enable high refresh rates on iOS
Fixes https://github.com/libsdl-org/SDL/issues/7518

(cherry picked from commit 835b6e0c1a)
2024-12-18 14:43:33 -08:00
Sam Lantinga
7f880c9121 Fixed crash if the controller product name is NULL
This happens when the Razer Synapse software emulates a controller with a keyboard

(cherry picked from commit 7117d545a3)
2024-12-17 16:54:55 -08:00
Ryan C. Gordon
ad93f50ee6 emscriptenaudio: Removed comment about Firefox not supporting userActivation.
It does now, and has since Firefox 120 (around November 2023).

(cherry picked from commit e0cee83a3a)
2024-12-12 10:52:49 -05:00
Ryan C. Gordon
bc88a43d97 .wikiheaders-option: Filled in quickref metadata.
This is still disabled because SDL2's documentation can be spotty at times,
but it's better to have this stuff available in case we ever make some
documentation improvements.
2024-12-12 10:49:36 -05:00
Sam Lantinga
9791069d78 Fixed Chinese locales on PSP (thanks @ccawley2011!)
(cherry picked from commit 962268ca21)
2024-12-10 14:48:14 -08:00
Anonymous Maarten
3c142abcb2 Build optimized stripped MinGW binary releases 2024-12-09 17:21:54 +01:00
Anonymous Maarten
d890d2594a Add build-release.py updates from satellite libraries
Ported from fc2fd42197

[ci skip]
2024-12-08 04:34:44 +01:00
Anonymous Maarten
af94954161 Add test sources to mingw release artifact 2024-12-07 02:05:15 +01:00
Anonymous Maarten
c46bec009b vc: bump CMake compatibility version of sdl2-config.cmake 2024-12-05 04:30:34 +01:00
Frank Praznik
91bb1bb6fd wayland: Check the returned display value for null
In reality, this condition will never occur, since the index is checked before calling the display retrieval function, but aggressive LTO with jump threading can generate a warning if this isn't explicitly checked.
2024-12-03 11:53:14 -05:00
Sam Lantinga
e539135104 Fixed potential buffer overflow
(cherry picked from commit 6aab5a089d)
2024-12-03 08:34:34 -08:00
Christian Ehrhardt
8d00ca02f1 dynapi: order for a reproducible build
The objfiles of different builds show various differences in
the calls to SDL_DYNAPI_entry elements. This is generated
dynamically by gendynapi.pl which uses an unordered opendir/readdir
pair. To make the build reproducible and thereby e.g. debugging
easier change this to be used in an ordered fashion.

Fixes #11565.

(cherry picked from commit 5418740c4a)
2024-12-02 09:54:50 -08:00
staphen
a4ec0b1531 Fix order of events in case audio buffer size changes 2024-11-28 22:28:24 +03:00
Ivan Epifanov
6428cee892 Vita: implement mousewheel and buttons 4/5 2024-11-27 08:23:40 -08:00
Peter Seiderer
b64540dd66 DirectFB: fix DirectFB_SetTextureScaleMode() declaration
Fixes:

  src/video/directfb/SDL_DirectFB_render.c: In function ‘DirectFB_CreateRenderer’:
  src/video/directfb/SDL_DirectFB_render.c:1153:35: error: assignment to ‘void (*)(SDL_Renderer *, SDL_Texture *, SDL_ScaleMode)’ from incompatible pointer type ‘void (*)(void)’ [-Wincompatible-pointer-types]
   1153 |     renderer->SetTextureScaleMode = DirectFB_SetTextureScaleMode;
        |                                   ^

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
Notes:
  - declaration was just recently changed by commit 'Fix warning for Android
    NDK compiler: "function declaration without a prototype is deprecated in
    all versions of C [-Wstrict-prototypes]"', see
    ccade50587
2024-11-27 08:21:10 -08:00
Sam Lantinga
a5da9be5e6 Fixed build 2024-11-24 17:54:55 -08:00
Starbuck5
9f07ac8bba Speed up full-surface fills
(cherry picked from commit 7a3f5ef129)
2024-11-24 17:45:24 -08:00
Anonymous Maarten
ba433e4a5d ci: merge all workflows 2024-11-23 20:00:37 +01:00
Anonymous Maarten
dface78331 ci: don't do 'brew install pkg-config' anymore
Assume it is installed by default
2024-11-22 21:47:15 +01:00
Wouter Wijsman
f39c5cf989 PSP: Add locale support 2024-11-22 08:37:39 -08:00
Alibek Omarov
f9c50e1bf7 Add proguard rules for SDL2
Based on existing work by @AntTheAlchemist on SDL3 branch.
2024-11-20 10:13:53 -08:00
Anonymous Maarten
e924f12a7b cmake: Compatibility with CMake < 3.10 will be removed in a future CMake version 2024-11-17 21:53:32 +01:00
Anonymous Maarten
c672c0e80f ci: pin MSVC ARM Windows SDK version to 10.0.22621.0 2024-11-17 21:33:53 +01:00
Ozkan Sezer
51570d9257 build system: disable 3dNow! support by default
Closes: https://github.com/libsdl-org/SDL/issues/11472.
2024-11-17 17:55:32 +03:00
jimtahu
d1af211010 Always Use Next Display Index
WIN_AddDisplay asserted that the returned index is the expected next
one in the list. This can be an unexpected number when displays are
add and removed in a batch (eg, Remote Desktop disconnect and reconnect).
Instead always just make use of the next index, even if it is not the
expected next index value. This fixes issue #9105

(cherry picked from commit bee8874629)
2024-11-15 14:35:55 -08:00
rsn8887
6dcf75710c SDL_vitatouch.c: re-enable front touch on Vita 2024-11-15 10:13:35 -08:00
Ryan C. Gordon
17b9ed7d82 audio: Favor OpenSL ES over AAudio.
There are low-latency fixes in SDL3 that really need to be backported to SDL2
before AAudio will be nicer across a range of devices, so OpenSL ES is safer
in SDL2 at the moment. At least, we suspect as such.

Fixes #11457.
2024-11-13 18:22:59 -05:00
Sam Lantinga
f1a3a18c1e Removed SDL_HINT_ENABLE_STEAM_CONTROLLERS
This was only respected on Steam Link hardware, which now uses SDL3 where it has been replaced by SDL_HINT_JOYSTICK_HIDAPI_STEAM.
2024-11-08 15:23:31 -08:00
L zard
b308172862 testautomation keyboard: use space instead of a
(cherry picked from commit 1ed1bc1d5d)
2024-11-08 18:21:32 +03:00
Zack Middleton
761ea32b74 Fix SDL_PRIs64 to use standard PRId64
PRIs64 doesn't exist in C standards.

(cherry picked from commit 8a2cac7aaa)
2024-11-08 12:40:50 +03:00
Sam Lantinga
74ff82f4a2 Support multiple joystick buttons bound to the same gamepad button
(cherry picked from commit ed943318e2)
2024-11-05 11:50:18 -08:00
Ryan C. Gordon
67b537cef4 .wikiheader-options: Treat SDL int types (Uint64, etc) as API prefixes.
This makes any reference to them in the docs link to their wiki pages.

Also fixup the integer type documentation, so the SDL2 wiki _has_ actual
pages for them.  :)
2024-11-01 23:52:03 -04:00
Anonymous Maarten
48aa1cccf7 Port build-script from SDL3
[ci skip]
2024-11-02 01:58:46 +01:00
SDL Wiki Bot
15bc3f25ee Sync SDL2 wiki -> header
[ci skip]
2024-11-01 19:42:53 +00:00
Wouter Wijsman
7cbb131c75 PSP: Allow building tests in parallel 2024-11-01 08:56:13 -04:00
Sam Lantinga
3b7a45853c Fixed the PS5 controller face buttons on Amazon Fire TV, Android 11
(cherry picked from commit 09495059df)
2024-10-30 05:23:54 -07:00
Sam Lantinga
d2b9ecd281 Revert "aaudio: Set low-latency audio mode."
This reverts commit 1e016fd5ea.

In order to use low latency mode, you need to set low latency callbacks. This has always been recommended and is apparently required on Android 15. SDL3 has these implemented correctly but SDL2 does not, so we should revert this for now.

Fixes https://github.com/libsdl-org/SDL/issues/11376
2024-10-29 22:32:59 -07:00
dv-senna
478dff3585 SDL_vulkan.h: undefine VK_DEFINE_HANDLER and VK_DEFINE_NON_DISPATCHABLE_HANDLE
Allows including vulkan.hpp in user code in C++ before SDL_vulkan.h w/o errors.
Fixes:  https://github.com/libsdl-org/SDL/issues/11328 .

(cherry picked from commit 149ecffd6f)
2024-10-29 20:35:10 +03:00
Ryan C. Gordon
5b0e838a74 wasapi: Deal with device buffer sizes changing.
Otherwise, it would fill the previous size's worth of data into the current
size's buffer.

Fixes #11122.
2024-10-28 13:43:48 -04:00
SDL Wiki Bot
96e7306a7a Sync SDL2 wiki -> header
[ci skip]
2024-10-27 21:41:54 +00:00
Jordan Christiansen
a22baafcf4 docs: Explain events for already plugged in controllers 2024-10-27 14:41:06 -07:00
Ryan C. Gordon
e5348c611d cocoa: Patched to compile. 2024-10-24 23:59:12 -04:00
Ryan C. Gordon
5cb87ff99f cocoa: Make sure GL context destruction happens on the main thread.
Fixes #10900.

(cherry picked from commit 344546b4ea)
2024-10-24 23:48:58 -04:00
Ryan C. Gordon
00f15dd215 emscripten: scale mousewheel X coordinates correctly, not just Y coordinates.
Fixes #10454.

(cherry picked from commit 4ea26a7771)
2024-10-23 23:39:40 -04:00
Ivan Epifanov
52714d5063 VITA: fix SDL_ShowMessageBox by using different memory type 2024-10-22 12:19:50 -07:00
SDL Wiki Bot
bcf1397e33 Sync SDL2 wiki -> header
[ci skip]
2024-10-20 01:02:07 +00:00
SDL Wiki Bot
1af0b39833 Sync SDL2 wiki -> header
[ci skip]
2024-10-20 00:51:30 +00:00
SDL Wiki Bot
4ca7a19348 Sync SDL2 wiki -> header
[ci skip]
2024-10-19 18:04:39 +00:00
Ivan Epifanov
86fd4ed83c VITA: fix yuv texture update 2024-10-17 07:54:02 -07:00
Sam Lantinga
b6fa4dc794 Only use Steam Virtual Gamepads if we're running under Steam
Fixes https://github.com/libsdl-org/SDL/issues/11214
Fixes https://github.com/libsdl-org/SDL/issues/11215

(cherry picked from commit 8a30def5f2)
2024-10-16 17:51:50 -07:00
Sam Lantinga
cfb3db01dc Added support for the Steam Virtual Gamepad on macOS Sequoia
(cherry picked from commit d7b1ba1bfc)
2024-10-16 17:51:50 -07:00
Ozkan Sezer
a976f7f71b SDL_stdinc.h: provide a prototype for strdup for __clang_analyzer__ case
Because strdup is not ANSI but POSIX, and its prototype might be hidden..

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

(cherry picked from commit 3ebfdb04be)
2024-10-16 22:03:50 +03:00
Pierre Wendling
378234437f VisualC: Set the correct component to false.
When SDL2_main would not be found, it would incorrectly flag the shared SDL2 library as not found.
2024-10-13 09:00:35 -07:00
Cameron Cawley
23d456e146 3DS: Support simple message boxes 2024-10-12 16:07:34 -07:00
Cameron Cawley
d7bb56f163 3DS: Only bundle resources with tests that need them 2024-10-12 16:06:54 -07:00
Cameron Cawley
084dbb6410 Allow for more fine tuning of Duff's device routines 2024-10-12 16:06:54 -07:00
Cameron Cawley
90f792f83c Reduce the size of the SDL_blit_0 alpha code 2024-10-12 16:06:54 -07:00
Cameron Cawley
e2f27362cb testdrawchessboard: Allow using the standard render API 2024-10-12 13:56:51 -07:00
Sam Lantinga
da4608ed03 Fixed typo in SDL_audio.h 2024-10-10 08:49:41 -07:00
Guldoman
5fe010270a x11: Set correct clipboard target type in SelectionRequest handling 2024-10-09 07:31:43 -07:00
Sam Clegg
3deb07ea39 [emscripten] Fixes for data addresses above 2gb
This includes both wasm64 and wasm32 when addressing more than 2gb of
memory.

Fixes: #9052
2024-10-08 16:35:58 -04:00
Sam Lantinga
da19244f7f Added support for wired XBox controllers on macOS 15.0 Sequoia
Fixes https://github.com/libsdl-org/SDL/issues/11002

(cherry picked from commit 7da728a642)
2024-10-07 16:41:34 -07:00
Sam Lantinga
bb33eb409e Fixed detecting the Steam Virtual Gamepad on macOS 2024-10-07 16:21:44 -07:00
Frank Praznik
a86f8dedb9 wayland: Add support for setting window icons via the xdg-toplevel-icon-v1 protocol 2024-10-07 14:24:33 -04:00
Frank Praznik
ea77d1d385 wayland: Factor out the general SHM buffer allocation/free functions from the cursor code 2024-10-07 14:24:33 -04:00
Anonymous Maarten
e4126d8d6f Add parametrized release script
[ci skip]
2024-10-04 23:42:29 +02:00
Ryan C. Gordon
2c60d95ee2 .wikiheaders-options: fix redundant language. 2024-10-04 15:41:54 -04:00
Ryan C. Gordon
ef05f66c08 .wikiheaders-options: Declare SDL3 the current stable API! 2024-10-04 15:39:12 -04:00
Ryan C. Gordon
9f7ccbe8d4 opengles2: Restore previous default texture_formats.
They were inadvertently byteswapped when making the rest of the backend
bigendian-friendly.

Fixes #11031.
2024-10-04 02:32:24 -04:00
Frank Praznik
643437f5b0 Reapply "wayland: Don't initialize OpenGL when the window flags didn't specify it"
This reverts commit 120b8d4189.

The issue this was patching over in Vanilla-Conquer was the lack of an exposure event when showing a window, which has since been remedied.

Attaching EGL window objects can also cause protocol violations now that the explicit sync protocol is in use, if SDL creates one and then the client tries to attach one itself, so they really shouldn't be created unless the client specifically requested it.
2024-10-02 13:50:14 -04:00
Anonymous Maarten
2b2907db18 Add docs to mingw release and don't modify libtool files in mingw's Makefile 2024-10-01 23:04:32 +02:00
Anonymous Maarten
8291b1be36 Port SDL3 release scripts to SDL2
[skip ci]
2024-10-01 21:09:41 +02:00
Vladimir Serbinenko
1edaad1721 Handle wayland touch cancel message
Suppose host has some three-finger gesture. Then we get the following sequence
of events:
DOWN-DOWN-DOWN-MOTION-CANCEL

Note that there is no UP in this sequence. So if we don't handle CANCEL then
we end up thinking that fingers are still touching the screen. Ideally we
should inform the application that cancel has happened as not to trigger
spurious taps but still this is way better than being stuck with phantom
finger touch.
2024-09-26 13:35:31 -04:00
Sam Lantinga
c9f3cbe02f Don't use BlitARGBto555PixelAlpha() for SDL_PIXELFORMAT_ARGB1555
This didn't properly take into account destination alpha.

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

(cherry picked from commit 1aea43846e)
2024-09-25 21:58:20 -07:00
Cameron Gutman
656b599828 Throttle tickle reports to PS4/PS5 controllers
UpdateDevice() can be called at an arbitrary rate, so we need to
pace ourselves to avoid filling up the rumble queue with these.

(cherry picked from commit 6ec8b1a173)
2024-09-25 07:21:31 -07:00
Cameron Gutman
7eb85b07e0 kmsdrm: Fix one more place that doesn't try to drop master 2024-09-23 18:59:54 -05:00
Cameron Gutman
dab4f856c1 kmsdrm: Keep fd around if we can drop master
Modern kernels (v5.8+) allow non-root usage of drmDropMaster(), so
we can hold on to our fd after dropping master on it. This fixes
populating drm_fd in the KMSDRM SysWMinfo when using Vulkan.

Also add a missing error check for open() while we're here.
2024-09-22 16:36:34 -07:00
Cameron Gutman
a4a8a29075 cmake: don't check c++ compiler flags for asan when CXX is not enabled
Backport of fd2b9c0602 to SDL2
2024-09-21 12:14:53 -05:00
SDL Wiki Bot
c43b976e5b Sync SDL2 wiki -> header 2024-09-21 13:17:38 +00:00
Erin Melucci
055ce096f5 Don't call GetMessageTime on Xbox platforms
Fixes a compilation issue due to the GAMES partition of WinAPI not including GetMessageTime
2024-09-20 07:26:38 -07:00
T3hD0gg
ec9a9fee58 Add Thrustmaster TMX VID & PID to wheel device list.
(cherry picked from commit 594edb6bd2)
2024-09-18 22:22:01 -07:00
Cameron Gutman
e239295491 wayland: Fix memory leaks 2024-09-18 20:44:26 -04:00
Ozkan Sezer
46ee6a3848 update config.guess and config.sub from mainstream 2024-09-18 17:33:10 +03:00
Ozkan Sezer
d6b7be8abd autotools, libtool, win32: add 'aarch64' support to the file magic test.
From libtool development commit 1638a6407573b74517b57a0f6e596918344a4394
2024-09-17 14:10:02 +03:00
Sam Lantinga
1b26b54402 Verify that the subsystems were successfully initialized
(cherry picked from commit 0548050fc5)
2024-09-15 12:05:31 -07:00
Loymdayddaud
bc9d12e560 Typo fix 2024-09-14 21:13:56 -07:00
Anders Jenbo
d9b4b7d0e0 Spell "unknown" correctly
(cherry picked from commit ee377793fe)
2024-09-13 12:29:56 -07:00
Ryan C. Gordon
58f2586b44 pulseaudio: Hotplug thread fixes.
This used a tiny stack, which apparently upsets Blender for various
technical reasons. Instead, just use the default stack size, which should
give it plenty of space to work.

If the thread failed to create, we would then wait on a semaphore that would
never trigger, so don't do that anymore!

Fixes #10806.

(cherry-picked from commit b7dc30ca24)
2024-09-12 18:00:58 -04:00
SDL Wiki Bot
ea820edc62 Sync SDL2 wiki -> header 2024-09-10 15:35:30 +00:00
Frank Praznik
8fa99993af wayland: Send exposure events when showing or resizing the window
Clients may rely on this event to signal when they should redraw themselves, so send it when appropriate.
2024-09-10 10:19:48 -04:00
Simon McVittie
54757c29dd x11vulkan: Use the correct SONAME of libX11-xcb.so.1 on Linux, etc.
On most Unix platforms supported by SDL, the canonical name used to load
a library at runtime includes its ABI major version, and the name
without a version is not guaranteed to exist on non-developer systems.
libX11-xcb.so.1 is correct on Linux, and probably on other Unix
platforms like FreeBSD.

A notable exception is OpenBSD, which apparently does not use
ABI-suffixed names, so continue to use libX11-xcb.so there.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 7713a7eec7)
2024-09-09 12:54:02 -07:00
Sam Lantinga
f5ed158d1f SDL_XINPUT_Enabled() returns false until XInput DLL is successfully loaded
We make sure we initialize XInput first, so that anything checking whether it's enabled gets a valid result based on whether we were able to load it or not.

(cherry picked from commit 8f46cb771c)
2024-09-06 11:24:43 -07:00
Sam Lantinga
5aadfd4eaf Fixed race condition at startup that could cause a crash in the XInput driver
(cherry picked from commit 6d7c211faf)
2024-09-06 10:17:37 -07:00
Sam Lantinga
224a37faab Fixed memory leak in testthread
(cherry picked from commit dfe6efcd2d)
2024-09-05 07:11:56 -07:00
Sam Lantinga
a75227aaeb Use atomic variables for thread communication
Fixes https://github.com/libsdl-org/SDL/issues/10711

(cherry picked from commit a0f36fb85b)
2024-09-05 07:09:27 -07:00
Ozkan Sezer
37d3eea939 testlocale, testplatform, testqsort: replace exit(1) calls with return 1 2024-09-05 00:28:32 +03:00
Sam Lantinga
2834d8b3b7 Revert "Sync SDL2 wiki -> header"
This reverts commit f23cc950f5.

This edit was incorrect.
2024-09-04 09:15:20 -07:00
Sam Lantinga
10b4a79379 Make newer DRM and GBM functions optional
Fixes https://github.com/libsdl-org/SDL/issues/10675

(cherry picked from commit d501f6db07)
2024-09-02 11:11:02 -07:00
Anonymous Maarten
57f1ea71ab Increase maximum line length of SDLTest_LogAllocations 2024-09-01 02:18:47 +02:00
Anonymous Maarten
2ae8b4c651 test: use SDL_test for parsing arguments in all non-interactive tests 2024-08-31 23:49:22 +02:00
Anonymous Maarten
47a525610c ci: build in RelWithDebInfo mode 2024-08-31 23:49:22 +02:00
Anonymous Maarten
510eda22f1 SDL_test: print stack traces of leaks on Windows
(ported from SDL3)
2024-08-31 23:49:22 +02:00
Anonymous Maarten
877c19da41 SDL_test: do late addres to name conversion, if libunwind supports it 2024-08-31 23:49:22 +02:00
Anonymous Maarten
622b511613 Copy sdlprocdump from SDL3 2024-08-31 23:49:22 +02:00
Anonymous Maarten
564765d22b ctest: fail if there are outstanding allocations
backport of b68ac011e0
2024-08-31 23:49:22 +02:00
Anonymous Maarten
1260ada519 SDL_test: use mutex based on SDL_atomic_t in memory tracking
SDL_Mutex or SDL_SpinLock cannot be used as these use SDL_malloc internally.

Backport of c7a1876536
2024-08-31 23:49:22 +02:00
Ozkan Sezer
4eac44bed4 RAWINPUT_JoystickOpen: add missing SDL_stack_free() calls.
Fixes https://github.com/libsdl-org/SDL/issues/10574.
(cherry picked from commit 845212388e)
2024-08-25 11:05:50 +03:00
Francisco Javier Trujillo Mata
1b8d5631ef Allow MessageBox to work without window 2024-08-23 11:50:00 -07:00
Sam Lantinga
0de601dc64 Added support for the Retro-bit Controller in PS3 mode
Fixes https://github.com/libsdl-org/SDL/issues/10557

(cherry picked from commit e75175129f)
2024-08-19 16:47:54 -07:00
Sam Lantinga
a3546e5069 PSP: Throw SDL_EVENT_QUIT event upon exit (thanks @sharkwouter!)
Closes https://github.com/libsdl-org/SDL/pull/10565

(cherry picked from commit 59ac561062)
2024-08-18 08:30:03 -07:00
Sam Lantinga
4bd07ea9a4 Revert "PSP: Throw SDL_Quit event upon exit"
This reverts commit e52e68d160.
2024-08-18 08:27:29 -07:00
Wouter Wijsman
e52e68d160 PSP: Throw SDL_Quit event upon exit 2024-08-18 08:22:20 -07:00
Ozkan Sezer
30972d7e7f SDL_x11mouse.c: avoid -Wunused-variable if xinput2 is not available 2024-08-17 11:23:32 +03:00
ds-sloth
2824d138b9 SDL_rwops.c: stdio_seek - skip API call for RW_SEEK_CUR with 0 offset
Reference Issue #10556.
2024-08-16 17:12:34 -04:00
Frank Praznik
8fcbf972c6 wayland: Send fake warp coordinates when emulating warps with relative mode
Send the fake warp coordinates when emulating warps with relative mode to ensure that it appears that the cursor is always reset to where the application expects it to be.

Fixes cases where games can continue moving the camera if the mouse is lifted during motion.
2024-08-16 11:24:13 -04:00
Frank Praznik
5b57573439 x11: Track cursor visibility internally
Cursor visibility in the SDL input layer only reflects whether ShowCursor/HideCursor was called. In the case of relative mode, the cursor can be hidden, but the SDL_Mouse visibility flag will be true.

Track cursor visibility separately in the X11 driver. Fixes the cursor becoming visible when using the warping relative mode with XWayland.

(cherry picked from commit b0713a7d30)
2024-08-16 10:34:36 -04:00
Sam Lantinga
b360214950 Use drmModeAddFB() if drmModeAddFB2WithModifiers() fails
Fixes https://github.com/libsdl-org/SDL/issues/10276

(cherry picked from commit 8e99ec34bb)
2024-08-15 11:53:02 -07:00
Wohlstand
dd6c663918 SDL_vitatouch.c: Fixed the incorrect touch device IDs
- Begining of device ID with 0 violates the SDL's specification that means the 0 is an error, invalid, failure, etc. But on Vita here it's an actual device...
- Replacing 0 and 1 with 1 and 2 to resolve this violation.
2024-08-14 08:32:02 -07:00
Anonymous Maarten
764c44db02 cmake/test: don't test swift on ios/tvos platform 2024-08-14 10:35:43 +00:00
Anonymous Maarten
52090046fe cmake: ios and tvos applications need to link to SDL2main library 2024-08-14 10:35:43 +00:00
Anonymous Maarten
3d7007fb2d testgles: ignore GLES deprecation on Apple platforms 2024-08-14 10:35:43 +00:00
Anonymous Maarten
248cb3ca9c Fix -Wdeclaration-after-statement warnings 2024-08-14 10:35:43 +00:00
Anonymous Maarten
354a35c1d7 cmake: port back Apple changes from SDL3 2024-08-14 10:35:43 +00:00
Sam Lantinga
70890b175e Fixed build 2024-08-13 07:39:43 -07:00
Ilya Mizus
586a2dc721 Fixed secondary screens on KMSDRM (#10535)
* Removed window movement to left top corner that breaks secondary screens on KMSDRM

(cherry picked from commit ce98550cbb)
2024-08-13 07:20:07 -07:00
Ryan C. Gordon
155c3bb0a3 SDL_GLattr: formatted wiki documentation to be wikiheaders-friendly.
Reference https://github.com/libsdl-org/sdlwiki/issues/544
2024-08-12 01:23:12 -04:00
KaJe
5ecbc00f36 Add Cammus C12 VID & PID to wheel device list.
Add Cammus C12 in the SDL wheel list to enable wheel detection for them.

(cherry picked from commit e1571d704d)
2024-08-09 06:48:49 -07:00
Sam Lantinga
a5bff78d81 kmsdrm: free the connector when looking for available devices
Fixes https://github.com/libsdl-org/SDL/issues/10499

(cherry picked from commit 1a57ea7fba)
2024-08-08 09:29:38 -07:00
Sam Lantinga
5ca0639a42 Fixed crash when the current mouse capture window is destroyed
Fixes https://github.com/libsdl-org/SDL/issues/10494

(cherry picked from commit 91d97a367e)
2024-08-07 12:28:53 -07:00
hsnovel
81252eb06d add failsafe for querying cache line size on linux 2024-08-06 09:51:00 -07:00
Sam Lantinga
1512013320 Added detail about why a file couldn't be opened (thanks mgerhardy!)
Fixes https://github.com/libsdl-org/SDL/issues/10484
2024-08-06 05:45:48 -07:00
Sam Lantinga
8f5d3ca57d Added SDL_CreateRenderer to the "see also" for SDL_RenderPresent() 2024-08-05 07:58:02 -07:00
Sam Lantinga
2efbe7fa3f Implemented left-justification in SDL_PrintString()
Fixes https://github.com/libsdl-org/SDL/issues/10310

(cherry picked from commit f59d66f4b1)
2024-08-04 20:05:41 -07:00
Anonymous Maarten
5c013a4f0d ci: add GDK
SDL2 port of 31b3f5ea79
2024-08-04 17:17:43 +02:00
Anonymous Maarten
7cf3234efe cmake: SDL2 target is not always available 2024-08-04 15:52:16 +02:00
Sam Lantinga
230f1debd0 Fixed macOS build 2024-08-01 14:11:06 -07:00
Sam Lantinga
0b6eff4167 Fixed building on macOS with OpenGL disabled
Fixes https://github.com/libsdl-org/SDL/issues/6226
2024-08-01 13:57:26 -07:00
Sam Lantinga
7fdf794377 Fixed crash with joystick rumble after disconnection
This prevents continuing a rumble after the first one fails, and fixes a long standing crash issue if rumble is started immediately before the controller is disconnected.

Thanks to @AntTheAlchemist for the key bug report that showed what was happening here.

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

(cherry picked from commit 0a924b185d)
2024-07-29 13:50:55 -07:00
Sam Lantinga
15c73f5bfe Fixed whitespace
(cherry picked from commit 67b973b5fa)
2024-07-29 12:52:40 -07:00
SDL Wiki Bot
eee439debe Sync SDL2 wiki -> header 2024-07-29 19:46:06 +00:00
Ryan C. Gordon
0ba3d9862d SDL_RWFromFile: On Apple platforms, offer a hint to not look in resource dirs.
Fixes #8403.
2024-07-29 15:45:03 -04:00
Charles Cross
e306cbcbee Updates CheckLibUDev() to match main, fixing missing HAVE_LIBUDEV 2024-07-29 07:21:14 -07:00
Ozkan Sezer
2cb2897e50 SDL_mslibc.c: revert PR/10303 changes 2024-07-28 22:47:51 +03:00
Frank Praznik
5d1ca1c8c7 wayland: Don't fail to retrieve a system cursor if no window is focused
Doing this can leave the cursor data in a weird, corrupt state.

(cherry picked from commit 5617ce277d)
2024-07-27 20:30:52 -04:00
Anonymous Maarten
50a6a39dd6 cmake: use genexes for linking against apple frameworks 2024-07-27 17:13:52 +02:00
Ozkan Sezer
73066492f6 testshader.c: include stdlib.h for exit() 2024-07-22 17:40:56 +03:00
Ozkan Sezer
86b4d035db SDL_stdinc.h (SDL_COMPILE_TIME_ASSERT): Keep C++ case alone (after PR/10331)
Some versions of gcc will define __STDC_VERSION__ even when compiling in C++ mode.
Reference issue: https://github.com/libsdl-org/SDL/issues/6078 which was fixed by
f6b81125b3

(cherry picked from commit 70c1012e8c)
2024-07-22 16:02:00 +03:00
Anonymous Maarten
5d606eaae2 stdinc: c23 deprecated _Static_assert in favor of static_assert
(cherry picked from commit 22bfbdbc02)
2024-07-21 21:55:10 +03:00
Charlie Birks
6e931bee01 emscripten: restore key event prevent default behaviour
This restores the behaviour before 9221548114 where we only preventDefault the event if:
- the key is recognised
- the event is enabled
- the event is not filtered

(ignoring the KEYPRESS special case, which is unchanged)
2024-07-19 09:39:00 -07:00
Anonymous Maarten
fd32342ced ci: build MSVC workflows using Ninja generator 2024-07-19 10:20:11 +00:00
Anonymous Maarten
ab4370c247 cmake: detect ARM64EC and enable SDL_LIBC by default 2024-07-19 10:20:11 +00:00
Anonymous Maarten
7fb8b62a4d cmake: fix building UWP with non-MSVC generator 2024-07-19 10:20:11 +00:00
Anonymous Maarten
11c0dfbdfe Fix UWP build in non-UNICODE mode 2024-07-19 10:20:11 +00:00
vanfanel
5ab1151508 Fix KMSDRM double buffering. 2024-07-18 14:35:00 -07:00
vanfanel
9e6b8d56e3 Add SDL_VIDEO_DOUBLE_BUFFER support to the Wayland backend. 2024-07-17 16:36:04 -04:00
Amir
ccade50587 Fix warning for Android NDK compiler: "function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]"
https://stackoverflow.com/questions/42125/warning-error-function-declaration-isnt-a-prototype
In C int foo() and int foo(void) are different functions. int foo() accepts an arbitrary number of arguments, while int foo(void) accepts 0 arguments. In C++ they mean the same thing.
2024-07-17 10:51:30 -07:00
Ryan C. Gordon
3f9591babe README-macos: fixed some text.
(cherry picked from commit 199e6929e5)
2024-07-16 08:27:12 -04:00
Anonymous Maarten
256269afb3 sdl2-config.in: use backtics instead of $() for older shells
/bin/sh of Solaris does not understand $()
2024-07-14 19:36:46 +02:00
Anonymous Maarten
2eeb39298e pthread: timespec.tv_nsec must be less then 1000000000 ns 2024-07-14 17:29:07 +02:00
ceski
3b7eafedb3 Add a Windows mapping for SplitFish Game Controller
(cherry picked from commit 68cf17d0d4)
2024-07-12 22:04:29 -07:00
Anonymous Maarten
bc39952b23 cmake: only add SDL_LIBC=0 compile options to SDL2 libraries 2024-07-12 23:09:56 +02:00
Anonymous Maarten
a25f94c9a8 ci: run VC tests under sdlprocdump 2024-07-12 18:47:18 +02:00
Anonymous Maarten
bba51871a8 cmake: only link SDL2 against test executables 2024-07-12 18:47:18 +02:00
Sam Lantinga
b057159db7 Make sure SDL subsystems are initialized before starting threads 2024-07-12 09:09:57 -07:00
Sam Lantinga
b378bc5c83 Make sure timers are initialized before any threads start
This prevents race conditions and divide by zero if multiple threads start using the time functions simultaneously.
2024-07-12 08:00:04 -07:00
Sam Lantinga
b13dcf24d6 Fixed OS/2 build 2024-07-11 13:55:24 -07:00
Sam Lantinga
551164812a Added TLS initialization and shutdown functions
Fixes https://github.com/libsdl-org/SDL/issues/8576

(cherry picked from commit b517043936)
2024-07-11 13:10:15 -07:00
Ozkan Sezer
956a8bf6c0 ci: bump FreeBSD
Reference issue: https://github.com/libsdl-org/SDL/issues/10224.
2024-07-11 18:55:50 +03:00
Ryan C. Gordon
663411ff77 haiku: Don't change the cwd on startup if launched from a Terminal.
This patch was written by @pulkomandy. Thanks!

Reference Issue #7596.
2024-07-11 11:42:21 -04:00
Substring
a2215ff81c KMSDRM: fix unsupported modifiers
(cherry picked from commit 9548bba63a)
2024-07-10 14:42:32 -07:00
Ahmed Essam
b80f6ec05c emscripten: don't consume key down/up events if the user disabled them 2024-07-10 09:29:43 -07:00
Sam Lantinga
3899cb1696 Revert "Fixed build"
This reverts commit 026dfc6305.

Fixed build again!
2024-07-08 14:46:15 -07:00
Sam Lantinga
026dfc6305 Fixed build 2024-07-08 11:39:08 -07:00
Sam Lantinga
e22c89536a Make sure we're actually running on Windows before using D3D renderers 2024-07-08 11:28:29 -07:00
Frank Praznik
849c905d8c wayland: Always create a viewport for the window if available
Viewports decouple the buffer from the window size and avoids the window geometry hacks used to prevent problems if a buffer with an old size in the pipeline ends up being committed.

Fixes an invalid geometry warning and incorrect overview size for fullscreen windows on GNOME, and avoids flicker when entering/exiting fullscreen or moving the window between scaled and non-scaled displays.
2024-07-08 11:54:10 -04:00
mariob92
58e179c8b5 wgl/glx: Fix attribute list for SDL_GL_FLOATBUFFERS
This commit fixes the attribute list in the WGL and GLX code when requesting a floating point pixel format. The name of the attribute was missing in the list.

Fixes libsdl-org#10189

(cherry picked from commit 9389712917)
2024-07-06 11:56:38 -07:00
Sam Lantinga
4c44450258 Improved detection of Nintendo Switch Pro controller report mode
Fixes https://github.com/libsdl-org/SDL/issues/10182

(cherry picked from commit 4ba2e9f4f4)
2024-07-06 05:30:08 -07:00
Ozkan Sezer
6a10309568 SDL_hidapi.c: work-around watcom build error when libusb is enabled 2024-07-05 18:56:10 +03:00
Max Maisel
22770e6496 Drain HIDAPI buffer in SDL_hidapi_steamdeck.c.
Add a loop around SDL_hid_read() in the Steam Deck HIDAPI driver as it
is done in other HIDAPI drivers. This loop reads data from the device and
processes it until the input buffer is empty which ensures that clients
always get the latest data.

This fixes an input latency issue if the application polls the events
slower than the hardware generates them.
2024-07-05 08:27:09 -07:00
Sam Lantinga
a4cbba1276 Try to create an accelerated renderer for the window surface even if SDL_HINT_RENDER_DRIVER is "software"
This case is properly handled inside SDL_CreateWindowTexture()

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

(cherry picked from commit c7ed78a9ef)
2024-07-05 08:23:17 -07:00
Ryan C. Gordon
b47deb58a2 vitagxm: Patched to compile. 2024-07-04 20:37:46 -04:00
Ryan C. Gordon
2c32fd254c Revert "render: Set renderer->window to NULL in SDL_DestroyRendererWithoutFreeing."
This reverts commit 9f8dffbd2d.

This causes some tests to fail, and wasn't otherwise a necessary change, so
I'm backing it out.

(Looks like some sort of interaction with software renderers and their
surfaces not getting destroyed...?)

(cherry picked from commit f9a06c20ed)
2024-07-04 19:47:39 -04:00
Ryan C. Gordon
5f0f337d33 vitagxm: Patched to compile. 2024-07-04 18:48:21 -04:00
Ryan C. Gordon
1413d67748 render: SDL_DestroyWindow hollows out its renderer but doesn't free it.
This allows apps to destroy the window and renderer in either order, but
makes sure that the renderer can properly clean up its resources while OpenGL
contexts and libraries are still loaded, etc.

If the window is destroyed first, the renderer is (mostly) destroyed but its
pointer remains valid. Attempts to use the renderer will return an error,
but it can still be explicitly destroyed, at which time the struct is free'd.

If the renderer is destroyed first, everything works as before, and a new
renderer can still be created on the existing window.

Fixes #10174.

(cherry picked from commit cab3defc18)
2024-07-04 18:46:43 -04:00
Ryan C. Gordon
944dc4701c render: Manage memory for SDL_Renderer* at higher level.
Previously, each backend would allocate and free the renderer struct. Now
the higher level does it, so the backends only manage their private resources.

This removes some boilerplate and avoids some potential accidents.

(Manually cherry-picked from 39c8434f5f)

Reference Issue #10174.
2024-07-04 18:17:20 -04:00
Sam Lantinga
845ebbbe96 Added support for the ROG RAIKIRI
(cherry picked from commit a04596c9a7)
2024-07-03 13:54:31 -07:00
Sam Lantinga
cd8ea5e3f1 Only use the default gamepad mapping if an automatic mapping isn't available
Fixes https://github.com/libsdl-org/SDL/issues/10162

(cherry picked from commit 0f8054cf87)
2024-07-03 11:47:20 -07:00
Sam Lantinga
288aea3b40 Fixed build 2024-06-29 11:22:29 -07:00
Sam Lantinga
0d9e54237c Respect SDL_HINT_RENDER_DRIVER when creating an accelerated window surface
Fixes https://github.com/libsdl-org/SDL/issues/10061

(cherry picked from commit 2a58e7b11c)
2024-06-29 11:13:01 -07:00
Sam Lantinga
a3f0c373d3 Clean up any renderer in SDL_DestroyWindowSurface()
Also added an automated test to verify window surface functionality.

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

(cherry picked from commit a522bfe3f1)
2024-06-29 11:04:15 -07:00
Ozkan Sezer
a0ec7c0906 libtool.m4: fix appending of -no_fixup_chains to allow_undefined_flag. 2024-06-29 17:50:40 +03:00
Ozkan Sezer
98ec8b88c1 acinclude/libtool.m4: updates from mainstream git:
- Disables chained fixups for macOS ('-no_fixup_chains' if supported by
  linker), because it is not compatible with '-undefined dynamic_lookup'
- Fixes Wstrict-prototypes warnings
- Regenerate the 'configure' script.
2024-06-29 17:03:04 +03:00
1F616EMO
3bf2b90da0 Remove the inconsistent and lag-causing usleep call in SDL_fcitx.c 2024-06-29 00:08:08 -07:00
Ryan C. Gordon
14183f8eca SDL_endian.h: Fix byte order detection on Solaris (and some SPARC compilers).
Fixes #10093.
2024-06-28 00:11:23 -04:00
Ryan C. Gordon
d96f1d5360 begin_code: Solaris Studio has __has_attribute defined by isn't usable here.
Fixes #10095.
2024-06-27 20:38:45 -04:00
Ryan C. Gordon
3e4bb5acd0 x11: Fix build when X_HAVE_UTF8_STRING is not defined.
Fixes #10094.
2024-06-27 01:53:39 -04:00
Ryan C. Gordon
498cbffd89 atomic: Solaris needs the _nv variant of atomic_or_uint.
(This means "new value" and returns the atomically updated value. Before, we
were returning a value from a void function.)
2024-06-27 01:43:25 -04:00
Ryan C. Gordon
b23343b7cd configure.ac: Explicitly disable Vulkan support on Solaris.
Fixes #10100.
2024-06-27 01:39:44 -04:00
Sam Lantinga
ee3b2b7de1 Make sure we don't try to use the XInput DLL after it's unloaded
Steam ran into a crash SDL_XINPUT_JoystickDetect() with XINPUTGETCAPABILITIES being NULL. I'm not sure how that happened, and there may still be a race condition if this is a multi-threaded issue, but at least this is more correct.

(cherry picked from commit 0ae4fd0ec9)
2024-06-26 15:55:31 -07:00
Sam Lantinga
88bbab275f Fixed building with older libdrm headers
(cherry picked from commit 8949de3978)
2024-06-26 15:55:08 -07:00
Sam Lantinga
ecde0ca6b6 Fixed building with the steamrt/scout SDK
(cherry picked from commit 4b82bed259)
2024-06-26 15:54:53 -07:00
Sam Lantinga
64d4baccb5 Fix building with the steamrt/scout SDK
(cherry picked from commit b552f26e6a)
2024-06-26 15:54:20 -07:00
Francisco Javier Trujillo Mata
10c14e78b6 Fixing systimer 2024-06-26 15:28:16 -07:00
Francisco Javier Trujillo Mata
4d82ceae0c Add slash to cwd call 2024-06-26 14:55:30 -07:00
Frank Praznik
20f1061cc8 video: Fix memory leak when deleting a video display
The display deletion code would not free the driver data or name if the display index was the last, or only one, in the list.
2024-06-26 12:19:14 -04:00
Frank Praznik
3b88d4f46f wayland: Fix double free when deleting an output display 2024-06-26 12:19:14 -04:00
Cecill Etheredge
6589287ed6 fix: Use drmModeAddFB2WithModifiers instead of drmModeAddFB to allow using GBM modifiers.
This fixes corrupt framebuffers on platforms that require the use of modifiers.

(cherry picked from commit 620e875335)
2024-06-25 14:21:17 -07:00
Anonymous Maarten
8ae7841d91 Revert "Make sdl2-config interpreter configurable"
This reverts commit b9f005505b.

Making the interpreter configurable is a band-aid fix.
So revert the workaround until we know the actual cause.
2024-06-25 00:44:55 +02:00
Edoardo Lolletti
99d7b9e626 Fix std::thread memory leak
In the stdcpp thread implementation, the allocated std::thread objects were never deleted after joining/detaching

(cherry picked from commit 20dbe90771)
2024-06-24 11:51:21 -07:00
Anonymous Maarten
b9f005505b Make sdl2-config interpreter configurable 2024-06-23 23:30:50 +02:00
Ganael Laplanche
ab5740bde2 Fix joystick (/dev/input/xxx) support on FreeBSD
Backport f8ad4abe from main branch.

When switching to CMake, src/joystick/linux/SDL_sysjoystick.c file got
excluded from FreeBSD builds, losing support for /dev/input/xxx devices.

See also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279907
and: https://github.com/libsdl-org/SDL/pull/10087
2024-06-23 00:06:55 -07:00
Blaž Tomažič
6a2dd96ac7 android: actually use ReLinker
When loading libraries the `SDL.mContext` is still `null`. This results in
relinker code path in `SDL.loadLibrary(...)` always throwing a null exception
and fallbacking to system loader.

Fix it by passing the context explicitly.
2024-06-20 09:35:28 -07:00
Blaž Tomažič
b444e656cd android: add an option to manually pass the context when loading a native library 2024-06-20 09:35:28 -07:00
SDL Wiki Bot
c1d10c36e7 Sync SDL2 wiki -> header 2024-06-20 16:30:15 +00:00
expikr
194d72bb29 Add SDL_MOUSE_RELATIVE_CURSOR_VISIBLE (#7947)
(cherry picked from commit ee559d51be)
2024-06-20 09:28:58 -07:00
Aikawa Yataro
4800edfa0c Update qsort implementation
(cherry picked from commit 0fe9f5da54)
2024-06-19 05:47:55 +03:00
Sam Lantinga
5a26b26880 Fixed requesting USB permission on Android 14 (thanks @ikhoeyZX!)
Fixes https://github.com/libsdl-org/SDL/issues/9831

(cherry picked from commit 8ab1ffca8a)
2024-06-17 15:11:48 -07:00
Sam Lantinga
a6fdd155fb Pass through the original name used by the Steam Virtual Gamepad
Proton uses this on Linux to determine what the XInput slot is for the gamepad. Other applications will get the real controller name and VID/PID by virtue of the code in SDL_steam_virtual_gamepad.c

(cherry picked from commit 361cae0874)
2024-06-17 12:14:59 -07:00
Miku AuahDark
77285b6c3f Android: Use SCREEN_ORIENTATION_FULL_USER instead of SCREEN_ORIENTATION_FULL_SENSOR for resizable window.
The former will respect user orientation lock setting while the latter does not.

(cherry picked from commit 3373667faa)
2024-06-17 09:55:03 -07:00
SDL Wiki Bot
744eb00b04 Sync SDL2 wiki -> header 2024-06-16 15:02:26 +00:00
rfht
177dfddaf7 simplify OpenBSD D-pad calculation with bitwise operation (#7996)
(cherry picked from commit 4d63c919f9)
2024-06-16 05:56:35 -07:00
Ryan C. Gordon
510f413bb8 coreaudio: simplify memory leak fix.
I _did_ appreciate the explanation, but it doesn't have to live in the
source code; also we can just release `devuid` and then check for error with
the usual macro, since SDL is done with it either way at this point.

(cherry picked from commit 17af09f3a9)
2024-06-15 11:47:27 -04:00
obeecodes
a9da8dd22d Addressed memory leak in SDL_coreaudio.m
(cherry picked from commit 3b5dce10c4)
2024-06-15 08:09:14 -07:00
Ozkan Sezer
a4d240d295 SDL_events.c: remove long long casts an the override of SDL_PRIs64 2024-06-14 18:47:56 +03:00
Ozkan Sezer
9422c57201 revert commit ac25395 as it broke linux.. 2024-06-14 14:56:32 +03:00
Ozkan Sezer
ac253956b9 SDL_events.c: override of SDL_PRIs64 for mingw is no longer needed
(cherry picked from commit 65d911aff0)
2024-06-14 14:51:10 +03:00
Ozkan Sezer
948b926d47 SDL_qsort.c: better match private funcs' compare args to SDL3 version. 2024-06-14 14:50:32 +03:00
SDL Wiki Bot
143d5d779c Sync SDL2 wiki -> header 2024-06-14 06:11:54 +00:00
Sam Lantinga
169f77ed5e Re-enable full controller reports for Joy-Con controllers
When they are in simple report mode, the thumbstick gets turned into a digital hat, so let's use them in full report mode.

(cherry picked from commit bf27269952)
2024-06-13 00:02:00 -07:00
Sam Lantinga
6b9bf71133 Try to guess the type of a Nintendo Switch controller if we can't read the device info
(cherry picked from commit 6619de8f24)
2024-06-13 00:01:40 -07:00
Sam Lantinga
f1b19aa744 Ignore spurious reply packets when reading Nintendo Switch controller reports
(cherry picked from commit 5ee9a840b1)
2024-06-12 23:59:07 -07:00
Ozkan Sezer
ce6d3c5cc1 SDL_qsort.c: change private function compare args to SDL_CompareCallback
fixes watcom os/2 and win32 builds after commit b2b2369414
2024-06-13 04:50:56 +03:00
Ryan C. Gordon
b2b2369414 Moved function pointer params to typedefs, etc, for latest wikiheaders. 2024-06-12 19:29:21 -04:00
Sam Lantinga
477c718744 Added wiki-style documentation for SDL_JoystickGUID 2024-06-08 08:50:24 -07:00
Hanicef
1c3090a1ac Fix broken dead key behavior on Wayland
This fixes numerous problems regarding dead keys on Wayland. Most
notably, Wayland was enforcing dead keys on SDL_KEYDOWN and SDL_KEYUP
events, which caused unresponsiveness on keys that were mapped to dead
keys (tilde on US-Intl is most notable for this, commonly used as a
console key).

When starting text input, not all state was reset properly. The text
input protocol requires to be re-enabled every time text input changes,
which SDL did not do. Also, XKB compose state was not reset at all,
causing composite and dead keys to carry over from when text input was
disabled.
2024-06-08 11:43:20 -04:00
Sam Lantinga
7fce9f3fd0 Minor cleanup for SDL style 2024-06-07 09:26:55 -07:00
Sam Lantinga
2e8bd8f1f3 Fixed build 2024-06-07 09:05:10 -07:00
Fabrice Desclaux
22c14442e2 Fix spurious LCtrl on RAlt key pressed 2024-06-07 08:45:47 -07:00
Oleg
0f9191a643 Added VRS DirectForce Pro wheelbase VID/PID to wheel devices list
(cherry picked from commit 7529b4bed5)
2024-06-06 09:54:40 -07:00
Frank Praznik
fc6bbde525 wayland: Set the initial min/max limits on non-libdecor windows during a show operation
Libdecor windows will have this done during the first frame configure, but bare xdg-toplevel windows need it set explicitly, or a non-resizable window might be able to be resized.
2024-06-06 09:50:38 -04:00
Sam Lantinga
f520062ad1 Fixed PlayStation detection interrupting input for the Logitech K400 keyboard
Also added the Logitech Chillstream to the list of PS3 controllers and fixed the right shoulder axis.

(cherry picked from commit b6d7adfec1)
2024-06-05 19:29:48 -07:00
Sam Lantinga
e2f597de84 Added support for the Saitek Cyborg V.3 Rumble Pad in PS3 mode
(cherry picked from commit b6ca360228)
2024-06-05 19:28:26 -07:00
Ozkan Sezer
70faef84aa build-scripts/ltmain.sh: minor updates hand-picked from mainstream 2024-06-05 23:11:10 +03:00
Sam Lantinga
997ef88605 Sort joystick drivers in Android.mk
(cherry picked from commit 27728db41d)
2024-06-05 12:09:45 -07:00
Sam Lantinga
f725ce492c Build the dummy joystick driver on Android
Fixes https://github.com/libsdl-org/SDL/issues/9978

(cherry picked from commit 69bfa5c951)
2024-06-05 12:09:39 -07:00
erysdren
e1bb00cdc9 Add a basic ShowMessageBox implementation for PSP (#9932) 2024-06-05 17:36:18 +02:00
erysdren
6da5242535 SDL_render_psp.c: Fix crash in PSP_DestroyRenderer() 2024-06-04 15:06:44 -07:00
Wouter Wijsman
018f2791c7 PSP: Add on-screen keyboard support 2024-06-04 14:04:45 -07:00
Carlo Bramini
2cb1a2d0a7 SDL_assert: add support for aarch64-w64-mingw32
GCC 15 development branch provides an experimental support for Windows on ARM64, which will be officially released next year, according to latest news.
I tried to compile SDL2 with this new compiler but I got a tiny problem into SDL_assert.h because it couldn't find the right platform.
However, it has been easy to fix and I included it into this PR.
More details can be also found here:
https://learn.microsoft.com/en-us/cpp/intrinsics/debugbreak?view=msvc-170
2024-06-03 10:52:11 -07:00
Wouter Wijsman
295266c708 Merge pull request #9953 from sharkwouter/fix-double-libs-in-pkgconfig
CMake: Prevent double SDL2 and SDL2main entries in sdl2.pc
2024-06-03 14:49:10 +02:00
Wouter Wijsman
1803e6555f CMake: Prevent double SDL2 and SDL2main entries in sdl2.pc 2024-06-03 10:53:45 +02:00
Ozkan Sezer
863670c0a8 always define PRI?64 using 'I64' when targeting windows
avoids -Wformat warnings from mingw toolchains -- e.g.:
src/test/SDL_test_harness.c:581:37: warning: unknown conversion type character 'l' in format [-Wformat=]

(cherry picked from commit 49b6c24722)
2024-06-01 22:37:50 +03:00
Sam Lantinga
35d719ef25 Added support for the Razer Kitsune in PS5 mode
(cherry picked from commit e3beaa1972)
2024-05-31 15:18:46 -07:00
mechakotik
1568501dd6 android: Default to custom theme in styles.xml
Custom theme file exists in project, but is not used by app, which is kinda unintuitive. Using it by default so people who not familiar with Android development won't spend lots of time troubleshooting.

(cherry picked from commit 8f88c32ca6)
2024-05-31 11:33:01 -07:00
Ozkan Sezer
d5e5d4a802 move vista+ display config function ptr calls to device->driverdata
backport from PR/9923 (commit e4518af377)
2024-05-31 20:04:20 +03:00
Sam Lantinga
51ba036e64 Verify that the timer callback is passed the correct parameters 2024-05-30 16:53:28 -07:00
Anonymous Maarten
5e876db89f autotools needs to check d3d12sdklayers.h too 2024-05-28 17:02:26 +02:00
Ozkan Sezer
0439fc6007 Makefile.in: add VisualC-GDK to SRC_DIST
Fixes https://github.com/libsdl-org/SDL/issues/9913
2024-05-28 14:10:24 +03:00
Ozkan Sezer
6825a4aabb SDL_config_os2.h: remove duplicated HAVE_WCSL* defines. 2024-05-28 08:01:02 +03:00
Sam Lantinga
8bc47dc3f1 Fixed compiling SDL_platform_defines.h on macOS with older compilers (thanks @sezero!)
Fixes #9632

(cherry picked from commit 36015ad5e5)
2024-05-27 14:38:41 -07:00
Ozkan Sezer
b3081bbbd2 regenerated the configure script. 2024-05-27 23:40:04 +03:00
Cameron Cawley
65d8c07c7d Allow building the Raspberry Pi video driver with standard EGL headers 2024-05-27 12:30:58 -07:00
Anonymous Maarten
6c29778826 VC+d3d12: use __has_include to detect presence of d3d12 ehaders
backport of 4fa5006247
2024-05-27 02:42:20 +02:00
Anonymous Maarten
6c10201e58 cmake: direct3d12 renderer needs d3d12.h and d3d12sdklayers.h
Older MinGW releases don't ship d3d12sdklayers.h

backport of 3af4f120d0
2024-05-27 02:34:26 +02:00
Anonymous Maarten
c79e616806 d3d12: older Windows SDK headers contain wrong function prototypes
Declare correct function pointers ourselves.

Backport of:
- 98fcf112e7
- 89a4d9ae67
2024-05-25 00:41:47 +02:00
Anonymous Maarten
54c435409b d3d12: xbox has no DXGI_PRESENT flags 2024-05-25 00:41:47 +02:00
Sam Lantinga
964e0c9b47 Added Linux bindings for the Qanba Drone 2 Arcade Joystick
(cherry picked from commit 98a9ca5e32)
2024-05-23 15:35:03 -07:00
SDL Wiki Bot
01314ff1d4 Sync SDL2 wiki -> header 2024-05-21 20:45:35 +00:00
SDL Wiki Bot
f88e8da176 Sync SDL2 wiki -> header 2024-05-20 16:47:07 +00:00
Ryan C. Gordon
0466c45605 hidapi: Replace BSD license with "original" hidapi license.
HIDAPI's source code licensing says this:

```
HIDAPI can be used under one of three licenses.

1. The GNU General Public License, version 3.0, in LICENSE-gpl3.txt
2. A BSD-Style License, in LICENSE-bsd.txt.
3. The more liberal original HIDAPI license. LICENSE-orig.txt

The license chosen is at the discretion of the user of HIDAPI. For example:
1. An author of GPL software would likely use HIDAPI under the terms of the
GPL.

2. An author of commercial closed-source software would likely use HIDAPI
under the terms of the BSD-style license or the original HIDAPI license.
```

Since the original license in LICENSE-orig.txt is basically only clause 3 of
the zlib license (do not remove this notice from the source code), it makes
sense to switch to it, since it adds no new requirements to the user.

(Plus, it's extremely short and direct, which is always nice.)

The entire license:

```
 HIDAPI - Multi-Platform library for
 communication with HID devices.

 Copyright 2009, Alan Ott, Signal 11 Software.
 All Rights Reserved.

 This software may be used by anyone for any reason so
 long as the copyright notice in the source files
 remains intact.
```

Fixes #9786.

(cherry picked from commit dd09d4b4ee)
2024-05-20 12:45:36 -04:00
SDL Wiki Bot
a26d2e705d Sync SDL2 wiki -> header 2024-05-20 01:51:21 +00:00
Phena Ildanach
fdf28471c0 hidapi: Use a whitelist for libusb when other backends are available 2024-05-17 11:17:56 -07:00
APGR22
e4fc07cad0 Added NULL pointer check
(cherry picked from commit 961488b0dc)
2024-05-17 09:01:11 -07:00
SDL Wiki Bot
c419c4ce99 Sync SDL2 wiki -> header 2024-05-16 17:17:42 +00:00
Frank Praznik
a25a5a243c wayland: Disable warp emulation when restoring cursor visibility with the shape protocol
(cherry picked from commit 67f3a3ee54)
2024-05-16 13:01:19 -04:00
Frank Praznik
3794e3dc90 wayland: Set the cursor visibility flag when using the cursor shape protocol
(cherry picked from commit 9ac523f940)
2024-05-16 12:00:28 -04:00
Anonymous Maarten
62f35ab1b6 Use SDL_test + don't use macros
The structure of the existing loop makes the inner loop of the previous commit unnecessary.

Manual backport of 558630d59c
2024-05-16 17:54:13 +02:00
SDL Wiki Bot
67bea86b10 Sync SDL2 wiki -> header 2024-05-16 15:51:44 +00:00
Ryan C. Gordon
1c3a1e1139 wikiheaders: Updated to latest, cleaned up category documentation a little.
This documentation needs a LOT of work--maybe someday--but it's definitely not
_broken_ right now, which is good enough for now.
2024-05-16 11:49:21 -04:00
Oleg
96e3799495 Added Moza wheelbases VID/PID to wheel devices list
(cherry picked from commit 79cabeef18)
2024-05-15 19:40:34 -07:00
Oleg
1f54ee1da6 Added Simucube wheelbases VID/PID to wheel devices list
(cherry picked from commit dc9d9dd85a)
2024-05-15 19:40:34 -07:00
Oleg
0c7a83ecd5 Added Cammus C5 wheelbase VID/PID to wheel devices list
(cherry picked from commit ce9177b64f)
2024-05-15 19:40:34 -07:00
Ryan C. Gordon
0805990668 wikiheaders: Automatically categorize API symbols by subsystem. 2024-05-14 10:50:37 -04:00
Sam Lantinga
efaa58732a Don't enable enhanced report mode for Bluetooth Nintendo Switch controllers by default
This breaks applications using them in DirectInput mode, which isn't worth just getting battery status. We'll turn on enhanced mode if the application enables sensors.

(cherry picked from commit a87fa020ac)
2024-05-10 12:19:18 -07:00
Ozkan Sezer
b6899f82fb SDL_iconv_string: simplify recomputation of outbuf and outbytesleft
Noticed this in SDL-1.2 where gcc-13 emits a -Wuse-after-free warning.
No such warning in SDL2 and SDL3, because unlike SDL1.2, SDL_realloc()
is not a macro expanding to libc realloc(). It warns, of course, if
SDL_realloc() is replaced with plain realloc():

src/stdlib/SDL_iconv.c: In function 'SDL_iconv_string_REAL':
src/stdlib/SDL_iconv.c:824:39: warning: pointer 'oldstring' may be used after 'realloc' [-Wuse-after-free]
  824 |             outbuf = string + (outbuf - oldstring);
      |                               ~~~~~~~~^~~~~~~~~~~~
src/stdlib/SDL_iconv.c:818:30: note: call to 'realloc' here
  818 |             string = (char *)realloc(string, stringsize + sizeof(Uint32));
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(cherry picked from commit 2205626816)
2024-05-10 18:56:24 +03:00
Ozkan Sezer
312a8a19d7 SDL_x11sym.h: corrected XQueryKeymap() proto.
Noticed this in SDL-1.2 in a gcc-13 build, which emitted the following
warning:  (No such warnings in SDL2 and SDL3, due to macro differences)

./src/video/x11/SDL_x11sym.h:84:48: warning: argument 2 of type 'char *' declared as a pointer [-Warray-parameter=]
   84 | SDL_X11_SYM(int,XQueryKeymap,(Display* a,char *b),(a,b),return)
      |                                          ~~~~~~^
./src/video/x11/SDL_x11dyn.c:95:15: note: in definition of macro 'SDL_X11_SYM'
   95 |         rc fn params { ret p##fn args ; }
      |               ^~~~~~
In file included from ./src/video/x11/SDL_x11dyn.h:27,
                 from ./src/video/x11/SDL_x11dyn.c:26:
/usr/include/X11/Xlib.h:2980:5: note: previously declared as an array 'char[32]'
 2980 |     char [32]           /* keys_return */
      |     ^~~~~~~~~

The original actually was char[32] but was changed with
8ada1e8a6e
(https://bugzilla.libsdl.org/show_bug.cgi?id=170
https://github.com/libsdl-org/SDL-1.2/issues/101)

(cherry picked from commit b2fca55e5c)
2024-05-10 18:56:10 +03:00
SDL Wiki Bot
b8b1ebf57b Sync SDL2 wiki -> header 2024-05-09 20:40:40 +00:00
Ryan C. Gordon
62175552e9 SDL_video.h: Make a note that changing fullscreen mode might reset renderers. 2024-05-09 14:52:12 -04:00
SDL Wiki Bot
f23cc950f5 Sync SDL2 wiki -> header 2024-05-09 17:59:37 +00:00
Ryan C. Gordon
ed0eb7ee06 SDL_video.h: Add a '\sa' for SDL_GLContext to SDL_GL_CreateContext. 2024-05-09 13:37:53 -04:00
SDL Wiki Bot
7d0ea2a881 Sync SDL2 wiki -> header 2024-05-09 17:33:40 +00:00
SDL Wiki Bot
dd48b6f8cf Sync SDL2 wiki -> header 2024-05-09 17:28:40 +00:00
SDL Wiki Bot
17ad4fdf4b Sync SDL2 wiki -> header 2024-05-09 03:56:41 +00:00
SDL Wiki Bot
1b7c2c9e41 Sync SDL2 wiki -> header 2024-05-09 03:46:31 +00:00
Ryan C. Gordon
7d60ff9965 SDL_JoystickEventState: Make documentation and implementation match.
This changes the `SDL_EVENTS_DISABLED` path's return value from SDL_DISABLE
to SDL_IGNORE to match expectations, but doesn't actually change the ABI,
since these two symbols are both zero.

Fixes https://github.com/libsdl-org/sdlwiki/issues/460
2024-05-08 16:41:58 -04:00
Ryan C. Gordon
d499b25a3f SDL_vulkan.h: Fixed typo in SDL_Vulkan_LoadLibrary docs. 2024-05-08 03:53:07 -04:00
Ryan C. Gordon
06f437e1b6 wikiheaders: sync up with main branch. 2024-05-07 14:24:39 -04:00
Sam Lantinga
8c92af5e54 Added a Windows mapping for the SPEEDLINK STRIKE Gamepad
Fixes https://github.com/libsdl-org/SDL/issues/9705

(cherry picked from commit 01d560df50)
2024-05-06 10:11:39 -07:00
Ozkan Sezer
d8fbeec096 autotools, cmake, macOS: Do not use the system iconv() by default
backport from PR #9676 by @flibitijibibo
2024-05-03 11:56:50 +03:00
Ryan C. Gordon
8b4e389ad0 wikiheaders: updated from SDL3, plus fixes to headers to deal with that. 2024-05-02 13:00:03 -04:00
Ozkan Sezer
63ea838db6 test, watcom.mif: revert 78391e6530
%copy isn't recognized by older wmake versions.
2024-05-01 17:37:20 +03:00
Ozkan Sezer
78391e6530 test, watcom.mif: revert 9ecdcd8bb and use %copy instead
Ref.: https://github.com/open-watcom/open-watcom-v2/issues/1281.
2024-05-01 17:02:50 +03:00
Ozkan Sezer
9ecdcd8bb6 test, watcom makefile: change copy command to use a dos path separator
fixes copy failure with recent open watcom wmake changes. (Issue reported
mainstream as https://github.com/open-watcom/open-watcom-v2/issues/1281)
2024-05-01 11:02:10 +03:00
Ryan C. Gordon
8f6a5c9ad2 wikiheaders-options: Correct project full name. 2024-04-30 22:01:23 -04:00
Ryan C. Gordon
59937e0fd5 wikiheaders: manpages See Also sections should specify 3 vs 3type.
(cherry picked from commit 5481ea4cd4)
2024-04-30 21:56:43 -04:00
Ryan C. Gordon
2f54d8a458 wikiheaders: Manpages go in man3 directory, even if they're 3type.
(cherry picked from commit 9210c68c44)
2024-04-30 21:56:34 -04:00
Sam Lantinga
1caa427035 Fixed building with GDK (thanks @Romans-I-XVI!) 2024-04-30 10:20:55 -07:00
Austin Sojka
7554e82ec3 Added GDK app constrained/unconstrained events (#9608) 2024-04-30 10:19:29 -07:00
yuanhecai
75340b827d loongarch: Delete the configuration of the compilation option "mlasx" 2024-04-25 20:33:12 -07:00
Sam Lantinga
67c60e0b9c Fixed build error (thanks @sezero!)
(cherry picked from commit ac5a61cd60)
2024-04-25 09:45:36 -07:00
Tyson Whitehead
45b804c158 Avoid opening non-joystick devices if possible to speedup scanning
Closing a device file takes 0.01 to 0.5s, which can add up to
significant startup delays. The udev classification does not
require opening the actual device files, so, use it if possible,
and only fall back to opening the device and probing otherwise.
2024-04-25 08:47:55 -07:00
Tyson Whitehead
0963c11af8 Initialize udev before joystick manual scan so class lookup works
LINUX_JoystickInit does a manual scan first so devices are sorted.
If SDL_UDEV_Init hasn't run by then, then the product info cannot
be looked up by SDL_UDEV_GetProductInfo and the initial-plugged-
in-device classification falls back to heuristic guessing.
2024-04-25 08:47:55 -07:00
Frank Praznik
863d4a0f2a x11: Fix pointer warp on XWayland
XWayland seems to require that the pointer be hidden when it is warped, so hide and show the pointer when warping, if required.

Note that XWayland still only allows warping within the window, so attempts to warp to global coordinates outside the window won't work.

(cherry picked from commit a845c7027e)
2024-04-25 10:44:55 -04:00
Sam Lantinga
59cc43ccbb Added a note about WIN+V for future reference (thanks @orconut!) 2024-04-24 09:38:26 -07:00
Sam Lantinga
33af02ae68 Fixed Win+V handling (pasting from clipboard history) on Windows (thanks @ocornut!)
Fixes https://github.com/libsdl-org/SDL/issues/9613
2024-04-24 09:22:57 -07:00
Ryan C. Gordon
ab10bf54f2 SDL_TextInputEvent: Improve documentation.
Fixes https://github.com/libsdl-org/sdlwiki/issues/516
2024-04-24 11:17:25 -04:00
Ozkan Sezer
26e3d65ea8 CI, macOS: install autoconf.
Reference issue: https://github.com/libsdl-org/SDL/issues/9606 .
2024-04-24 00:33:14 +03:00
Ryan C. Gordon
e03ad30a57 docs: heavy editing to make this happy with latest wikibridge.
The public headers saw lots of cleanups, backporting from SDL3 docs, and
merging with the wiki.

The markdown files in docs/README-*.md were converted to Unix endlines.
2024-04-23 14:21:54 -04:00
Ryan C. Gordon
a96196c958 include: Fixed SDL_AudioFormat documentation. 2024-04-23 10:19:26 -04:00
Ryan C. Gordon
623a83f2b5 Sync wiki -> SDL2. 2024-04-23 10:00:05 -04:00
Ryan C. Gordon
e69d0e516b wikiheaders_options: People can include specific headers if they want!
Reference Issue #9536.
2024-04-22 18:48:27 -04:00
yassineimounachen
8f18e2f52d Add USB IDs for the Thrustmaster TS-XW racing wheel
To be of use, this depends on https://github.com/berarma/oversteer/pull/200 and https://github.com/Kimplul/hid-tmff2/pull/94.

(cherry picked from commit 5ffb2f47d1)
2024-04-22 11:36:30 -07:00
Sam Lantinga
4e29be814e Fixed compilation with C89 (thanks @d-s-a!)
Closes https://github.com/libsdl-org/SDL/pull/9564
2024-04-17 07:47:29 -07:00
Sam Lantinga
effc16954f Fixed build 2024-04-15 09:32:00 -07:00
Cameron Cawley
59a0416819 3DS: Improve framebuffer support 2024-04-15 04:38:28 -10:00
Cameron Cawley
154ec5c57a testmouse: Create the window on the touch screen when building for the 3DS 2024-04-15 03:33:10 -10:00
Cameron Cawley
4df852cbbf 3DS: Ensure that touchscreen events are associated with a window 2024-04-15 03:33:10 -10:00
Cameron Cawley
6c6b497f89 Prefer display modes that exactly match the desired format or refresh rate 2024-04-15 03:31:10 -10:00
Cameron Cawley
596096a86a Add a quirk for fullscreen-only video drivers 2024-04-15 03:30:21 -10:00
Romans-I-XVI
4c3b8b2b93 Fixed reference path for buildshaders.bat
This makes it so the build still works when project is referenced by another solution
2024-04-15 03:23:33 -10:00
Ryan C. Gordon
e75d72670f include: Fixes to make the headers friendly with the latest wikiheaders. 2024-04-11 01:17:27 -04:00
Anonymous Maarten
9216b7a5ee stdinc: modify default alloca prototype
For compatibilty with TinyCC.

Backport of 06758685a5
2024-04-10 10:05:08 +02:00
Clownacy
1fa6142903 Fix default Windows window icon not suiting the DPI.
For whatever reason, `ExtractIconEx` returns icons whose sizes are
inappropriate for the current DPI, resulting in terribly-blurry
window icons at higher DPIs.

To solve this, the window icon is now set to the first icon group
that is present in the executable. This behaviour should match what
Explorer does. By selecting an icon group instead of a specific icon,
Windows is free to select the icon within the group that best suits
the current DPI.
2024-04-02 12:03:01 -07:00
Zhuoran
906ad64d7b Fix Caps Lock and Backspace mapping for Colemak 2024-04-02 07:48:58 -07:00
Brian Collins
f1690e265e Workaround a macOS cursor-related bug.
This fixes an macOS bug that is only known to occur in fullscreen windows on the built-in displays of newer MacBooks with camera notches. When the mouse is moved near the top of such a window (within about 44 units) and then moved back down, the cursor rects aren't respected. This can cause the default cursor to be visible when it should not be.
2024-04-01 16:18:02 -07:00
Ryan C. Gordon
02246aaeb9 wikiheaders.pl: Report a function's header file name.
(cherry picked from commit e055a9fc2d)
2024-03-31 12:58:19 -04:00
Ozkan Sezer
4d91f0e796 SDL_stdinc.h: Android passes sizeof(ENUM) == sizeof(int) assertion
Reference issue: https://github.com/libsdl-org/SDL/issues/9392 .

(cherry picked from commit 6cf71ca9a9)
2024-03-28 21:10:00 +03:00
Ryan C. Gordon
0d8ce4a761 psp: Fixed building with pspdev when not using CMake.
(psp-cmake defines `__PSP__` on the command line, but the compiler itself
only defines `__psp__` and some variations.

Fixes #9378.
2024-03-28 09:47:28 -04:00
Sam Lantinga
5fff9bc1e3 Don't fail joystick initialization if udev isn't available 2024-03-25 11:45:41 -07:00
Ozkan Sezer
358a80a473 remove non-existent vulkan.hpp and vulkan_mir.h from Xcode project 2024-03-25 21:23:24 +03:00
Anonymous Maarten
eb185e8d88 VisualC: remove vulkan.hpp 2024-03-25 18:04:40 +01:00
Alynne
cbc9bd9804 Add Yawman Arrow flightstick controller
(cherry picked from commit 2b4c75690c)
2024-03-25 06:35:32 -07:00
Wouter Wijsman
5d80179954 PSP: send initial SDL_JOYDEVICEADDED event 2024-03-24 17:09:41 -07:00
Tyson Whitehead
6e1611cc77 udev: Fix O(n^2) device walking issue (closes #9092)
I believe there was a O(n^2) device walking issues on startup

- MaybeAddDevice gets called for every device at startup
- MaybeAddDevice calls IsJoystick
- IsJoystick calls SDL_UDEV_GetProductInfo
- SDL_UDEV_GetProductInfo calls udev_enumerate_scan_devices
- udev_enumerate_scan_devices walks all the devices

Prior to commit 3b1e0e1 this was mostly masked as IsJoystick only
called SDL_UDEV_GetProductInfo when a JSIOCGNAME ioctl was
successful. This fixes the O(n^2) behaviour by directly getting
the device via udev_device_new_from_devnum (based on type, major,
and minor number) instead of enumerating everything via
udev_enumerate_scan_devices and matching on name.
2024-03-24 11:48:31 -07:00
rofl0r
6ba3e56538 SDL_GetWindowSurface: update documentation re: surface->pixels 2024-03-24 11:33:32 -07:00
rofl0r
7b6695f4d4 PSP: zero-copy WindowSurface API for direct VRAM access
if all one needs is a raw framebuffer to the PSP's vram,
instead of dealing with renderers and textures, that need to be
copied hence and forth, this method allows one to create a window,
set the pixel format using SDL_SetWindowDisplayMode() - preferably
BGR565 for optimal speed (the other possible natively supported
option is ABGR8888) - and then request SDL_GetWindowSurface(),
which provides one with a surface with direct framebuffer access.
note that the pixels pointer inside the surface will be switched
after each call because of double-buffering.

it's advisable to overwrite all pixels of the PSP visible area
(480x272) to not encounter old data.

after writing the pixels, a call to SDL_UpdateWindowSurface()
sends the changes to the graphics chip.

the result is a raw framerate of 250 fps with BGR565 mode, under
optimal circumstances - i.e. nothing else is done than drawing,
and the drawing loop is as simple as possible.
that leaves about 12 ms per frame for other tasks and still allow
a fluent 60 fps.
2024-03-24 11:33:32 -07:00
rofl0r
37c664a13d PSP: fix regression, GetTicks64 should return millisecs
introduced in 82b449611a
2024-03-23 16:53:28 -07:00
Sylvain
763d768f7d Fix bug #9331 - SDL3 Android crash getVibrator() == null
(cherry picked from commit 1855ce68af)
2024-03-23 16:32:00 -07:00
rofl0r
82b449611a PSP: improve performance counter res to us granularity 2024-03-23 09:31:42 -07:00
Marcel Hild
fa18c9bf4a Add support for MadCatz Saitek Side Panel Control Deck
Signed-off-by: Marcel Hild <hild@b4mad.net>
(cherry picked from commit 67e425bcf8)
2024-03-22 09:16:20 -07:00
Frank Praznik
5df737bb3c wayland: Check the returned display pointer before dereferencing
Fixes a crash when all displays are disconnected.
2024-03-20 15:44:32 -04:00
Sam Lantinga
a9ac349846 Poll for the initial controller state when using DirectInput
This fixes getting a deflected axis as the first buffered input reading on a generic USB controller (G-Shark GS-GP702)

(cherry picked from commit 70b0d33106)
2024-03-20 10:41:56 -07:00
Pierre Wendling
4a79fe44ff N3DS: Fix locale name and early return.
- The name for simplified Chinese should be `zh_CN`.
- Ensure `cfguExit` is called even if `CFGU_GetSystemLanguage` failed.

(cherry picked from commit 390fff4ae0)
2024-03-19 16:54:30 -07:00
Cameron Gutman
43f0ae1e54 Improve event processing latency when gamepad/sensor is open
By using the SDL_WaitEventTimeout_Device() path even when polling is required,
we can still achieve sub-millisecond latency for non-gamepad/sensor events when
a gamepad or sensor is in use by the application.
2024-03-19 01:21:49 -05:00
rofl0r
c17d2246fb PSP/Joystick: fix formatting 2024-03-17 13:22:53 -07:00
rofl0r
86f223d664 PSP: don't block on joystick event query
using the blocking sceCtrlReadBufferPositive() effectively turns SDL_PollEvent() into WaitForVblank(), because the functions does exactly that if no input is buffered.
due to this, calling SDL_PollEvent() once per frame averaged in 7 ms delay out of the available 16ms budget to get a frame calculated and drawn to achieve 60 fps.
2024-03-17 13:22:53 -07:00
Sam Lantinga
2d6c100058 Added a mapping for the Defender Joystick Cobra R4 (thanks @kotenok2000!)
(cherry picked from commit d972244d3a)
2024-03-17 12:14:17 -07:00
Sam Lantinga
07f04bb35e Use the CRC as part of the unique key for mappings
(cherry picked from commit 4697153d1e)
2024-03-17 12:14:11 -07:00
Frank Praznik
24aedc1439 wayland: Always use the entire buffer for the viewport source
Not doing so can result in protocol errors if the viewport source region is updated and a buffer with the old, smaller dimensions is committed.
2024-03-17 10:46:58 -04:00
Sam Lantinga
b8daf14fe5 If a mapping specifies a crc, don't match for controllers that don't have that CRC
The CRC is used to distinguish between different controllers that have the same VID/PID, so if the CRC doesn't match, it's probably a different controller that we don't know about.

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

(cherry picked from commit 30e93b40c2)
2024-03-14 13:36:12 -07:00
Frank Praznik
525c317ed9 wayland: Add cursor-shape-v1 protocol support
This is the preferred method of handling the cursor shape on KDE 6 and likely other window managers going forward.

Manual backport of c2e9693
2024-03-14 09:49:40 -04:00
Frank Praznik
59d4a39456 Add checks for memfd_create() and posix_fallocate() to the autotools build 2024-03-13 11:23:43 -04:00
Frank Praznik
88bdc028ec Fix build (C90 declaration order) 2024-03-12 22:06:36 -04:00
Frank Praznik
d3c89bb479 wayland: Allocate the cursor shared memory buffer entirely in memory, if possible.
Use memfd_create() to allocate the temporary SHM backing file in memory, and set the size with posix_fallocate(), which will return an error on insufficient space vs ftruncate(), which will silently succeed and allow a SIGBUS error to occur if the unbacked memory is accessed.

Additionally, make the legacy path more robust by unlinking the temp file, so it won't persist after close, and unmapping the shared memory buffer.

(cherry picked from commit 9bdb992925)
2024-03-12 20:56:16 -04:00
Sam Lantinga
e54774faca Removed incorrect mapping for a HORI controller
This broke support for the Hori Fighting Stick EX2, which gets a good mapping if the automatic mapping is allowed to create one.

If the original controller needs a mapping, it should be added with a crc, since that VID/PID combination is used by several HORI controllers.

(cherry picked from commit d79f865251)
2024-03-11 17:14:11 -07:00
Anonymous Maarten
3184936950 cmake: we only need a C++ compiler for Android, Haiku and UWP 2024-03-11 01:26:13 +01:00
Sam Lantinga
66054a6515 Turn HIDAPI joystick support off by default on mobile platforms
On Android, HIDAPI prompts for permissions and acquires exclusive access to the device, and on Apple mobile platforms it doesn't do anything except for handling Bluetooth Steam Controllers.

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

(cherry picked from commit e3cf2e4794)
2024-03-10 15:03:47 -07:00
Sam Lantinga
cd197be53b Fixed crash if joystick functions are passed a NULL joystick
In particular this affects the doomsday game engine if no joystick or
gamepad is attached.

(cherry picked from commit 0dfdf1f3f2)
[smcv: Also included minor adjustment from https://github.com/libsdl-org/SDL/pull/9233]
2024-03-09 08:40:49 -08:00
Sam Lantinga
528b71284f Added support for the 6-button SEGA Mega Drive Control Pad for Nintendo Online 2024-03-08 12:38:05 -08:00
Sam Lantinga
26054d9934 Fixed mapping for the Sanwa Supply JY-P76USV controller
(cherry picked from commit 57a160c9ab)
2024-03-06 20:54:33 -08:00
Jade Macho
da9bfc43e7 GDK: Partially revert 2670eb44af
MsgWaitForMultipleObjects is desktop-only.

(cherry picked from commit e1e5d33420)
2024-03-06 21:28:00 +03:00
Ozkan Sezer
177a836653 SDL_RWFromFile, stdio: allow named pipes along with regular files.
Fixes https://github.com/libsdl-org/SDL/issues/9174
2024-03-06 18:50:00 +03:00
Sam Lantinga
bdc7ad8f56 Keep track of whether the Android on-screen keyboard was opened by the application
Fixes https://github.com/libsdl-org/SDL/issues/9202

(cherry picked from commit edbcef11ff)
2024-03-05 13:53:56 -08:00
Sam Lantinga
75c5cff0bf Fixed "${folder^}Activity: bad substitution" with bash 3.2 on macOS
(cherry picked from commit c36f773eb4)
2024-03-05 13:47:59 -08:00
Sam Lantinga
a842bc29fa Uppercase the first letter of the class name to match Java conventions
Fixes https://github.com/libsdl-org/SDL/issues/8930

(cherry picked from commit 4189edaeb7)
2024-03-03 16:57:16 -08:00
Sam Lantinga
d35dee76c7 Added a mapping for the Sanwa Supply JY-P76USV controller
Fixes https://github.com/libsdl-org/SDL/issues/8644

(cherry picked from commit ccd309c433)
2024-03-03 12:23:59 -08:00
Sam Lantinga
9e1e0fb92f Removed the mapping for the G-Shark GS-GP702
This uses the same chipset as the DragonRise Inc. Generic USB Joystick, which many manufacturers use for different products with different mappings.

In order to add a mapping for a controller using this chipset, we need a unique crc for the device name.

(cherry picked from commit 8d8076263e)
2024-03-03 12:20:43 -08:00
Sam Lantinga
627e15871a SDL_GameControllerGetAppleSFSymbolsNameForAxis() returns NULL if the symbol isn't found 2024-03-03 11:56:29 -08:00
Sam Lantinga
b87116ff03 SDL_GameControllerGetAppleSFSymbolsNameForButton() returns NULL if the symbol isn't found
Fixes https://github.com/libsdl-org/SDL/issues/9071
2024-03-03 11:09:03 -08:00
Sam Lantinga
05f6709617 If the viewport changes the cliprect should be updated
The clip rectangle is defined to be viewport relative, so if the viewport changes we need to update it.

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

(cherry picked from commit d0af01e7d4)
2024-02-28 08:48:40 -08:00
Frank Praznik
9eaf7d8cc8 wayland: Remove all references to destroyed outputs from windows
The removal of a wl_output may not be accompanied by leave events for the surfaces present on it. Ensure that no window continues to hold a reference to a removed output.
2024-02-27 11:48:45 -05:00
scribam
9a65d123a7 ci: update deprecated node.js 16 actions
(cherry picked from commit 38d24778ed)
2024-02-23 22:02:13 +01:00
scribam
fdbf233cfb ci: bump cross-platform-actions/action version to v0.23.0
(cherry picked from commit cbe330befd)
2024-02-23 23:21:28 +03:00
Frank Praznik
54faea8b89 x11: Don't resize, move, or raise windows when changing the min/max size
The resize/move/raise calls when changing a window's min/max size are redundant, as the video core will call the X11_SetWindowSize() function after the change, and the resize function will perform whatever actions are necessary.
2024-02-23 14:35:56 -05:00
Sam Lantinga
69fb802a90 Fixed Visual Studio warning 4459
(cherry picked from commit d135daad5b)
2024-02-21 23:33:11 +03:00
Ryan C. Gordon
4316c5ec02 audio: fix SSE conversion of Sint8 audio to Float32.
Fixes #9099.
2024-02-21 15:16:08 -05:00
Sam Lantinga
903d888cc3 Convert mouse wheel coordinates to renderer view
Fixes https://github.com/libsdl-org/SDL/issues/9097
2024-02-20 15:44:26 -08:00
Frank Praznik
f24216c2ba wayland: Don't pass null string pointers to wl_cursor_theme_get_cursor
The function calls strcmp internally without checking for a null string parameter, and calling strcmp with a null parameter is undefined behavior.
2024-02-18 12:11:29 -05:00
Ryan C. Gordon
df00a7dd4c x11: Cleaned up system cursor code to match previous Wayland change. 2024-02-16 08:37:23 -05:00
Ryan C. Gordon
827917ea60 wayland: Minor cleanup in new mouse cursor selection code.
- Move legacy name choice to a separate function, so we can `return` a
  string in one line instead of assign a variable and `break` for each item.
- Have the case statement cover SDL_NUM_SYSTEM_CURSORS, and not `default`, so
  compiler will (maybe) warn us if an enum value is added but not included here.
- Only choose a legacy name if necessary.
2024-02-16 08:22:13 -05:00
Simon McVittie
271df2fdd8 emscripten, wayland, x11: Share the table of CSS cursor names
As suggested in #8939.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-16 07:52:55 -05:00
Simon McVittie
aa6c390bbd emscripten, wayland, x11: Map SIZEALL to "all-scroll" instead of "move"
These previously mapped SIZEALL to "move", but "move" is not guaranteed
to be a four-pointed arrow: according to the CSS spec, it's actually
intended to be a drag-and-drop cursor, analogous to "alias" and "copy".
Map it to "all-scroll" instead, as in Wayland: while this is *also* not
semantically guaranteed to be a four-pointed arrow, it is at least
*suggested* to make it a four-pointed arrow.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-16 07:52:55 -05:00
Ryan C. Gordon
67827c0b00 wayland: Prefer to use CSS names for cursors, falling back to X11
SDL3's Wayland code already uses the CSS names exclusively with no
fallback, but since SDL2 has historically used the older names, keeping
them as a fallback makes sense if the CSS names don't work out.

[smcv: Added commit message]
Tested-by: Simon McVittie <smcv@collabora.com>
2024-02-16 07:52:55 -05:00
Simon McVittie
e2535ba547 wayland: Use CSS/freedesktop cursor name "default" as a fallback
The "left_ptr" name is an X11 thing, and there's no guarantee that
Wayland cursor themes contain it. In particular, GNOME's Adwaita theme
as of version 46.beta only contains the CSS/freedesktop names.

To test, either move one of the known cursors out of the way, or edit
the switch statement above to use a wrong name for one of them.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-16 07:52:55 -05:00
Ryan C. Gordon
6c0e3532fa x11: Use XcursorLibraryLoadCursor to load system cursors when available.
Apparently this is necessary on the latest Gnome to get properly themed
cursors, vs ancient X11 standard cursors, as Gnome has dropped the old
theme names that XCreateFontCursor eventually expected to find.

Fixes #8939.

(cherry picked from commit cb9565354c)
2024-02-16 02:12:45 -05:00
Ozkan Sezer
bc30fb295d don't let SDL_render.c:render_drivers[] have an empty initializer list. 2024-02-15 20:33:24 +03:00
Ozkan Sezer
d0731ab9a3 Check the SDL_VIDEO_RENDER_??? macros with #if instead of #ifdef
Allows users to disable them by defining them as 0.

Closes https://github.com/libsdl-org/SDL/issues/8996
2024-02-15 02:55:02 +03:00
Frank Praznik
699cec1a8d wayland: Don't store wl_output pointers in mode driver data
They aren't used for anything, and cause problems if the video core tries to free them.

Manual backport of f9ba0e1
2024-02-14 11:12:41 -05:00
Sam Lantinga
120b8d4189 Revert "wayland: Don't initialize OpenGL when the window flags didn't specify it"
This reverts commit f522c5380c.

We don't want this change for SDL2, and we're doing further investigation for SDL3.

Fixes https://github.com/libsdl-org/SDL/issues/9035
2024-02-12 16:01:48 -08:00
Sam Lantinga
6669d04ea6 Fixed error: unused variable 'axes' [-Werror,-Wunused-variable]
(cherry picked from commit 814a94c349)
2024-02-12 11:18:41 -08:00
Sam Lantinga
971c5c2610 Explicitly retain and release NSObjects in C structures
Fixes https://github.com/libsdl-org/SDL/issues/9021
Fixes https://github.com/libsdl-org/SDL/issues/9042

(cherry picked from commit 42cdbf6b21)
2024-02-12 10:21:34 -08:00
Chris Collins
de0cb94e72 Wayland: Avoid SEGV if a modifier notification comes before the keymap
(cherry picked from commit 0f81598e9f)
2024-02-10 07:04:33 -08:00
Hans-Kristian Arntzen
4ae87e215e Fix broken use of MsgWaitForMultipleObjects.
- Timeout < 0 was not handled properly
- Return value for success is WAIT_OBJECT_0 + nCount, not positive value

(cherry picked from commit 69f2bd151e)
2024-02-10 07:03:03 -08:00
Sam Lantinga
646cccede7 Guarded ElementAlreadyHandled with #ifdef ENABLE_PHYSICAL_INPUT_PROFILE (thanks @Donione!)
Fixes https://github.com/libsdl-org/SDL/issues/9033

(cherry picked from commit 3ebbf0f409)
2024-02-09 16:12:57 -08:00
Sam Lantinga
93d7b6e50c Redefine XINPUT_CAPABILITIES_EX as an SDL typedef
mingw-w64 has added this from Proton (which added this from SDL), so we need to re-define it as a local symbol to avoid conflicting with mingw-w64 headers.

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

(cherry picked from commit b7c61569f8)
2024-02-09 01:28:15 -08:00
Sam Lantinga
40b61b81f1 Added VIDPID for OpenFFBoard wheel (thanks @groybe!)
Closes https://github.com/libsdl-org/SDL/pull/7987

(cherry picked from commit 26e947f8ea)
2024-02-07 16:35:49 -08:00
pastdue
d2a3347c19 Emscripten_SetWindowFullscreen: Fix crash due to uninitialized EmscriptenFullscreenStrategy members
(cherry picked from commit 7b74e2eeb8)
2024-02-06 16:27:18 -08:00
meyraud705
a09b0b05eb Fix memory leak in SDL_UpdateSteamVirtualGamepadInfo()
(cherry picked from commit 82d89ff4fb)
2024-02-06 01:56:22 -08:00
Wohlstand
a29f37c14a SDL_windowsopengl.c: WGL: Fixed null-pointer dereference crash
Fixes #8968

Fixed crash after 594a79c2f9
2024-02-03 06:18:56 -08:00
Wohlstand
ca01016577 SDL_audiotypecvt.c: Fixed memory corruption when resampling S16 t F32 2024-02-03 08:20:04 -05:00
Joshua Root
c53c351921 Fix SDL_mfijoystick build issues
Add missing guards around use of physicalInputProfile.

Add explicit import of Foundation which seems to be needed on some
systems to get the NSArray definition.

Add __unsafe_unretained to ObjC types in struct so the compiler doesn't
complain about that not being allowed with ARC.

Closes: #8979
(cherry picked from commit e0158f68e4)
2024-02-02 22:25:17 -08:00
Sam Lantinga
fc787a41dc vulkan_metal.h: Make compatible with ObjC ARC (thanks @jmroot!)
(re)Fixes #6598

We need to remember to apply this again once we update from upstream headers.

(cherry picked from commit e67e0c5d55)
2024-02-02 18:31:14 -08:00
Sam Lantinga
05bb182a53 Don't test 10-bit pixel format conversion
We either need to explicitly test using the sRGB colorspace or update the tests for HDR10 color conversion. We'll just disable them for now, as these formats aren't commonly used in games.

(cherry picked from commit f9c57e16b0)
2024-02-02 18:26:01 -08:00
Simon McVittie
58907d2c27 testautomation_math: Fix misleading log output
These originally checked for expected ± EPSILON as logged, but since
commit 880c6939 they check for expected ± max_err, where max_err may
need to be greater than EPSILON for very large expected results like
the ones in exp_regularCases().

Also, EPSILON is so small that the default precision of the %f format
(6 decimal places) would never actually have shown its effect, so log
it in scientific notation instead.

Fixes: 880c6939 "testautomation_math: do relative comparison + more precise correct trigonometric values"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-02 07:45:06 -08:00
Simon McVittie
a7bd18c0d5 test: Don't accept results that are much less than expected
While looking at the other tests in this file, I noticed that instead
of checking for a result in the range of expected ± FLT_EPSILON as I
would have expected, these tests would accept any result strictly less
than expected + FLT_EPSILON, for example a wrong result that is very
large and negative. This is presumably not what was intended, so add
the SDL_fabs() that I assume was meant to be here.

Fixes: 474c8d00 "testautomation: don't do float equality tests"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-02 07:45:06 -08:00
Simon McVittie
f73abd49c3 testautomation: Don't expect exp to yield exact floating point results
In the Steam Runtime 1 'scout' environment, when compiling for i386
using the default gcc-4.6, Exp(34.125) matches the desired value to the
precision shown in the log (6 decimal places) but is not an exact match
for the desired value.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-02 07:45:06 -08:00
Sam Lantinga
8eed915dfa Don't use the system iconv on Apple mobile platforms
Fixes https://github.com/libsdl-org/SDL/issues/8964

(cherry picked from commit d6a48e4958)
2024-02-01 15:55:00 -08:00
Sam Lantinga
8ce6fb2513 Use the exact motion associated with the warp
When Windows DPI scaling is enabled, the warp coordinates will be modified, so make sure we send exactly the coordinates that the warp attempted.

Fixes https://github.com/libsdl-org/SDL/issues/8940
2024-01-30 11:11:10 -08:00
Francisco Javier Trujillo Mata
d34a7c5ed2 Fixing viewport 2024-01-29 20:42:42 -08:00
Francisco Javier Trujillo Mata
36b8438280 Fix scissor usage 2024-01-29 20:42:42 -08:00
Francisco Javier Trujillo Mata
faa8fc2917 Fix color 2024-01-29 20:42:42 -08:00
Ozkan Sezer
971508c0d7 autotools: a few libtool updates from mainstream 2024-01-28 20:04:34 +03:00
Sam Lantinga
c55bd24827 Fixed testautomation log callback calling convention
(cherry picked from commit 9f7eb6c4c1)
2024-01-27 22:44:55 -08:00
Ryan C. Gordon
ec25d6b1e8 aaudio: Backport headphone hotplugging support from SDL3.
Fixes #4985.
2024-01-28 00:19:48 -05:00
Sam Lantinga
bb30a35364 Fixed Watcom build 2024-01-27 20:28:43 -08:00
Sam Lantinga
11c932bf1d Fixed build 2024-01-27 20:18:39 -08:00
Sam Lantinga
f0b8fee88f Added the environment variable SDL_LOGGING to control default log output
(cherry picked from commit 12bdb2b4d0)
2024-01-27 19:46:25 -08:00
Sam Lantinga
6ec3f5a28e Simplified the default log category logic
Now it's much clearer and easier to tweak the defaults

(cherry picked from commit 4fba663368)
2024-01-27 19:34:24 -08:00
Sam Lantinga
2c11068569 Document that the default log priority is error, not critical
(cherry picked from commit a7a98d8bbb)
2024-01-27 19:31:48 -08:00
Ozkan Sezer
fcd1c155cc SDL_rwops.c (SDL_IsRegularFile): fix WinRT build failure due to S_ISREG 2024-01-28 02:20:00 +03:00
Ozkan Sezer
230ae797a7 SDL_RWFromFile, stdio: reject if the file is not a regular file.
Fixes https://github.com/libsdl-org/SDL/issues/8935
2024-01-28 01:44:50 +03:00
Sam Lantinga
5297596132 Report out of memory instead of crashing in SDL_LoadFile_RW()
Fixes https://github.com/libsdl-org/SDL/issues/8935
2024-01-27 12:15:43 -08:00
Sam Lantinga
332213163c Fixed N3DS build 2024-01-27 11:56:33 -08:00
Sam Lantinga
4ff3b28273 Enable text input on video initialization without popping up an on-screen keyboard
Fixes https://github.com/libsdl-org/SDL/issues/8561
2024-01-27 11:52:58 -08:00
Ryan C. Gordon
f931b25f4c wasapi: If GetDeviceBuf can't get a full buffer, go back to waiting.
Reference Issue #8924.
2024-01-26 23:25:43 -05:00
Ryan C. Gordon
1e06a3614f wasapi: Clamp device->spec.samples to the hardware buffer size.
Reference Issue #8924.

(cherry picked from commit ad1a11164c)
2024-01-26 13:59:46 -05:00
Ryan C. Gordon
7aab3f0db6 blendmode: Corrected docs for SDL_BLENDOPERATION_[REV_]SUBTRACT.
They were documented backwards.

Fixes #8910.

(cherry picked from commit ecbbef8b8d)
2024-01-25 17:49:39 -05:00
Sam Lantinga
08caafe2f1 Improved timing accuracy of SDL_WaitEventTimeout() on Windows
We don't need to use the hack of setting a timer and waiting for a timer message, MsgWaitForMultipleObjects() will allow us to wait for input directly with a timeout.

Before this change, sleeping for 20 ms would actually sleep for around 30 ms, with this change the sleep time is pretty accurate at 20-21 ms.

(cherry picked from commit 2670eb44af)
2024-01-25 06:34:29 -08:00
Ningyuan Li
138fe3d43d mayflash adapter PS4 support
(cherry picked from commit d6ebbc2fa4)
2024-01-24 19:26:27 -08:00
Sam Lantinga
b16ef14c7c Make sure we include the matching copy of vk_video headers
(cherry picked from commit 1ac9602909)
2024-01-24 09:41:48 -08:00
Sam Lantinga
0f5a815657 Update to the latest version of the Khronos headers
(cherry picked from commit fc74bf8455)
2024-01-24 09:41:48 -08:00
Sam Lantinga
9196584773 Fixed ambiguity between std::byte and byte in rpcndr.h
Fixes https://github.com/libsdl-org/SDL/issues/8911

(cherry picked from commit a71f99c71f)
2024-01-23 09:02:00 -08:00
Ozkan Sezer
48b62e2e57 make video/pandora to actually compile somehow.
no one ever maintained it for years..
2024-01-23 17:50:10 +03:00
Ozkan Sezer
9e352e61db fixes after ShowMessageBox changes:
- SDL_video.c (SDL_ShowMessageBox): remove C99'ism.
- SDL_os2video.c (OS2DIVE_bootstrap): add OS2_ShowMessageBox
- SDL_os2video.c (OS2VMAN_bootstrap): add OS2_ShowMessageBox
- SDL_DirectFB_video.c (DirectFB_bootstrap): NULL ShowMessageBox
- SDL_naclvideo.c (NACL_bootstrap): NULL ShowMessageBox
2024-01-23 04:11:20 +03:00
Ryan C. Gordon
c5c0b2cb34 SDL_ShowMessageBox: Remove #ifdefs and respect SDL_VIDEO_DRIVER hint.
Fixes #8892.

(cherry picked from commit c88c12148d)
2024-01-22 19:44:17 -05:00
Ryan C. Gordon
1e016fd5ea aaudio: Set low-latency audio mode.
Note that apparently this has caused some weird-sounding audio
on some Android devices, so we might wrap this in a hint later,
or try to check for specific devices.

Fixes #8888.
2024-01-22 18:23:14 -05:00
Ozkan Sezer
aaf426e280 testhaptic.c: include stdlib.h for exit() 2024-01-23 01:20:00 +03:00
Frank Praznik
a8eeb181b6 wayland: Always create the backing input store, even if there is no seat
Fixes a crash if no seat was available at initialization, but still allows for one to still be created later if an input device is added.

Manual backport of 84e47b4
2024-01-22 12:52:59 -05:00
Sam Lantinga
4845027cad Updated to version 2.31.0 for development 2024-01-22 09:12:34 -08:00
Sam Lantinga
ef7261bc41 Updated to version 2.29.2 for RC build 2024-01-22 08:43:05 -08:00
Sam Lantinga
12bab1c981 Fixed warning C4244: '=': conversion from 'Sint64' to 'int', possible loss of data 2024-01-22 08:39:22 -08:00
pionere
61821bd876 fix audio conversion from S16 to F32 using SSE2 2024-01-22 10:45:58 -05:00
Simon McVittie
0f9422a6a5 linux: Handle upower's UP_DEVICE_STATE_PENDING_CHARGE, PENDING_DISCHARGE
On my laptop, the battery is configured to stop charging at around 80%
most of the time, to increase the overall useful lifetime of the battery.
When in that state, upower reports UP_DEVICE_STATE_PENDING_CHARGE
(numeric value 5), which SDL previously mapped to SDL_POWERSTATE_UNKNOWN.
This made the platform_testGetPowerInfo automated test fail, because
it assumes that SDL_POWERSTATE_UNKNOWN means no battery is connected,
and does not expect to see a percentage.

Map UP_DEVICE_STATE_PENDING_CHARGE (5) to SDL_POWERSTATE_CHARGED, which
seems close enough.

Also map UP_DEVICE_STATE_PENDING_DISCHARGE (6) to
SDL_POWERSTATE_ON_BATTERY, which matches how at least GNOME presents it.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit eebd5d18a2)
2024-01-22 06:34:12 -08:00
Simon McVittie
55ba686530 test: Run testautomation under Autotools too, not just CMake
The CMake build system runs this since #8313, so we already have to make
sure it doesn't regress.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-22 06:33:27 -08:00
Simon McVittie
4cb43db1a9 test: Don't distinguish between different categories of tests
It's reasonable to assume that any of them might need a display and an
audio backend. We run them with SDL_VIDEODRIVER and SDL_AUDIODRIVER
set to dummy anyway.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-22 06:33:27 -08:00
Sylvain
237535b23a Fixed bug #8897 - SDL_BlitSurface segfault when dest_rect is null 2024-01-22 09:22:41 +01:00
yuanhecai
ed5d3d9f82 Fix compilation on loongarch 2024-01-21 19:27:59 -08:00
Frank Praznik
f569cc56a9 tests: Fix automated audio tests on Windows and Linux
If a specific audio driver was requested for testing, don't loop over all drivers in the init, open/close, and pause/unpause tests.

Additionally, drivers can fail if attempting to open an audio device when no underlying output is present, which is a valid case if the system has no audio hardware available. Check for the presence of audio output devices before attempting to open them.

Fixes automated tests with various drivers on Windows and Linux.
2024-01-21 23:44:53 +01:00
Frank Praznik
06dd70bc8b video: Use string comparison instead of #ifdefs for driver detection
The dummy driver can be in use on these platforms, so check the actual driver name string.

Fixes the automated video tests with the dummy driver on Win32.
2024-01-21 23:44:53 +01:00
Anonymous Maarten
a420eb79bb cmake: run testautomation with CTest on ci 2024-01-21 23:44:53 +01:00
Anonymous Maarten
41fc398114 Move check for SDL_Delay upper bounds to testtimer
(cherry picked from commit f45761908a)
2024-01-21 23:44:53 +01:00
Anonymous Maarten
1737340978 Use helper_ddtod function to compare atan2 infinity cases
This fixes a test failure when building on mingw32 in Release mode.
2024-01-21 23:44:53 +01:00
Anonymous Maarten
69a6efcd1b Avoid using higher precision floating point numbers by using it in a function 2024-01-21 23:44:53 +01:00
Anonymous Maarten
fbee0b86bf video: verify SDL_GetNumVideoDisplays is succesful 2024-01-21 23:44:53 +01:00
Anonymous Maarten
880c69392a testautomation_math: do relative comparison + more precise correct trigonometric values 2024-01-21 23:44:53 +01:00
Anonymous Maarten
811adaa342 Only test error message when using specific video drivers
The dummy driver does not sen an error message when passing
a NULL rect argument to SDL_SetTextInputRect.
2024-01-21 23:44:53 +01:00
Sylvain
5368f45567 Remove one test that contains call of SDL_Quit() / SDL_Init() because it
conficts with the initializaion of test common.
(before it used SDL_VideoInit SDL_VideoQuit which weren't perturbated by SDL_Quit())
2024-01-21 23:44:53 +01:00
Sylvain
3d5679bb8e Fix video_getSetWindowPosition() that fail when checking events,
because testautomation_events.c() didn't finish to poll all events before

(cherry picked from commit 3ccfd361cb)
2024-01-21 23:44:53 +01:00
Sam Lantinga
e3203278f4 Updated tests so they'll pass if we enable the C runtime in SDL2.dll
This isn't needed here, but will be necessary for sdl2-compat
2024-01-21 11:23:50 -08:00
Ethan Lee
b5aec14d43 gdk: Backport SDL3 MR #8844
Co-authored-by: chalonverse <sanjay12@gmail.com>
2024-01-21 13:55:17 -05:00
Ozkan Sezer
8eb2ec6a8d watcom makefiles: remove yuv_rgb_lsx.c from sources 2024-01-21 11:56:20 +03:00
Sam Lantinga
83f3045ee8 Revert "updated WhatsNew.txt"
This reverts commit c3a3f18076.
2024-01-20 05:28:05 -08:00
Sylvain
f1bc5f305c Prevent asan warning on qsort():
'src/stdlib/SDL_qsort.c:27:5: runtime error: null pointer passed as argument 1, which is declared to never be null`

(cherry picked from commit 2cd583ee13)
2024-01-20 11:26:37 +01:00
Ozkan Sezer
c3a3f18076 updated WhatsNew.txt 2024-01-20 11:51:00 +03:00
Sylvain
5d6eb4a5a5 Fixed overflow in SDL_SoftStretch() (see #8878)
(cherry picked from commit 7b02d328fa)
2024-01-20 06:39:21 +01:00
Sam Lantinga
cfc22ac7d7 Added patch notes for the SDL 2.30.0 release 2024-01-19 20:11:07 -08:00
Sam Lantinga
b4f99deb9e Updated to version 2.29.1 for RC build 2024-01-19 19:58:24 -08:00
Ryan C. Gordon
1e13aa2c98 androidaudio: same fix as AAudio for pausing thread when backgrounding app.
Reference Issue #8748.
2024-01-19 22:15:27 -05:00
Sam Lantinga
109bb2f17e Make sure the render target isn't bound as a resource
Fixes https://github.com/libsdl-org/SDL/issues/3380

(cherry picked from commit a73132177d)
2024-01-19 15:18:14 -08:00
Sam Lantinga
f7ab765b84 Fixed crash scaling very large surfaces
Fixes https://github.com/libsdl-org/SDL/issues/8878

(cherry picked from commit 09ba55b462)
2024-01-19 13:06:57 -08:00
Ryan C. Gordon
910e040e9e aaudio: Block the audio device thread when in the background.
Fixes #8748.
2024-01-19 15:10:43 -05:00
Sylvain Becker
bb969ac747 Fixed bug #7614: Segmentation Fault in SDL_BlitSurface (#7808)
Update SDL_BlitSurface to use Intersect functions

(cherry picked from commit 3639743d89)
2024-01-19 08:53:16 -08:00
Sam Lantinga
87b5bb5840 Fixed potential overflow in software triangle rendering
(cherry picked from commit bd5d4d61ed)
2024-01-19 08:33:39 -08:00
Sam Lantinga
11b111e1f8 Fixed types used in documentation (thanks @Dragon-Baroque!) 2024-01-19 05:26:44 -08:00
Sam Lantinga
be576c5fe7 Updated Xcode projects after 472a415c8f 2024-01-18 17:08:20 -08:00
Anonymous Maarten
472a415c8f video: move standard c, sse and lsx implementations of yuv2rgb to its own source 2024-01-18 17:06:27 -08:00
Simon McVittie
0d9719964f testautomation_surface: Make sure error is set by the function we expect
If the error behaviour in one of these cases was wrong, that could have
been hidden by the error indicator remaining set from a previous test.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-18 13:22:11 -08:00
Simon McVittie
e8075179e0 testautomation_surface: Really make width * bpp overflow
A surface of width (0x7fff'ffff) / 2 = 0x3fff'ffff is not quite large
enough to make the pitch overflow in the way we wanted to test here:
with a 32-bit format, that makes each row 0xffff'fffc bytes, which
(just) fits in a 32-bit unsigned size_t. Increasing it to 0x4000'0000
pixels per row is enough to trigger the overflow we intended to test.

In SDL 2, this test bug was hidden by the fact that allocating
0xffff'fffc bytes on a 32-bit platform is very likely to fail, and SDL 2
reported both "malloc() failed" and "this amount of memory is too large
for a size_t" with the same error code.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-18 13:22:11 -08:00
Simon McVittie
62d063f735 testautomation_surface: Really make pitch + alignment overflow
Adding 3 bytes of alignment to 0x7fff'ffff is not enough to make it
overflow a 4-byte unsigned size_t, so this test was not exercising
the intended failure mode. We cannot actually make this overflow
with a signed 32-bit width and an 8-bit format: the maximum width is
not enough to achieve that. However, if we switch to a 24-bit format,
we can make the calculation overflow.

In SDL 2, this test bug was hidden by the fact that allocating
0x7fff'ffff bytes on a 32-bit platform will usually fail, and SDL 2
reported both "malloc() failed" and "this amount of memory is too large
for a size_t" with the same error code.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-18 13:22:11 -08:00
Ryan C. Gordon
cc7fe8c255 x11: XI_Motion should mark the global mouse position as changed.
Otherwise we'll miss it when XWarpPointer() is used. x11vnc may do this to
manage mouse input in some circumstances, so it can be possible for _all_
mouse motion to go through this path, breaking SDL_GetGlobalMouseState().

Thanks to @chrismile for all the detective work to figure this out!

Fixes #8827.
2024-01-18 15:10:16 -05:00
Ozkan Sezer
f52a12a8fe remove several instances of unnecessary emptry str "" after SDL_PRI??? 2024-01-18 17:25:56 +03:00
Ozkan Sezer
3d6cf2b5c0 update config.guess and config.sub from mainstream 2024-01-18 00:29:56 +03:00
Ryan C. Gordon
f7f9478caf docs: Note SDL_UpdateWindowSurfaceRects can update beyond specified areas.
Reference Issue #8825.
2024-01-16 15:23:56 -05:00
Sylvain
9db80adfba Fixed bug #7614: Segmentation Fault in SDL_BlitSurface
(cherry picked from commit e6c8872fdc)
2024-01-16 07:11:19 -08:00
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
Sam Lantinga
857e5b08c3 Fixed trying to add a game controller mapping for the accelerometer on iOS
Fixes https://github.com/libsdl-org/SDL/issues/8716

(cherry picked from commit 0e5ea3cc4b)
2023-12-24 11:22:22 -08:00
Sam Lantinga
49eb375a59 Added SDL2.framework to the embedded frameworks for SDL test programs
Fixes https://github.com/libsdl-org/SDL/issues/8737
2023-12-24 09:17:48 -08:00
Sam Lantinga
aeda6a8e6f Record the initial input report mode and only restore simple mode if that's what we started with
Fixes https://github.com/libsdl-org/SDL/issues/8108
Closes https://github.com/libsdl-org/SDL/pull/8115

(cherry picked from commit c3d84c3342)
2023-12-24 08:23:36 -08:00
Sam Lantinga
fe76c40716 Added a runtime check for BLUETOOTH_CONNECT in addition to BLUETOOTH (thanks @perepujal!)
Fixes https://github.com/libsdl-org/SDL/issues/8731

(cherry picked from commit bb0e0ae080)
2023-12-24 06:51:48 -08:00
Julian Uy
884c21c565 Use common generic syscond for platforms with no cond implementation 2023-12-24 06:35:59 -08:00
Julian Uy
557d8e2f24 PS2 use WaitSemaEx for waiting for semaphore with timeout 2023-12-24 06:34:45 -08:00
Sylvain
3a8032f491 Make sure the string is terminated, fixed invalid read in SDL_PrivateGameControllerParseControllerConfigString()
(cherry picked from commit 312f98c2a1)
2023-12-23 12:58:54 -08:00
Lukas Senionis
e7c4575719 Use crc16 return value when calculating GUID
Fixes the regression introduced by 919cd56b20

(cherry picked from commit a2e05480d6)
2023-12-21 07:00:57 -08:00
Ozkan Sezer
39a0013900 Makefile.os2: -DSDL_USE_LIBICONV to fix linkage for GNU libiconv option 2023-12-21 08:55:04 +03:00
Ozkan Sezer
ca26cde4e1 SDL_config_os2.h: enable SDL_JOYSTICK_VIRTUAL 2023-12-21 08:55:02 +03:00
Sam Lantinga
eba591a910 Fixed Xcode project 2023-12-20 19:42:43 -08:00
Sam Lantinga
919cd56b20 Use the original manufacturer and product strings for the joystick CRC
This allows the most information possible for the CRC string, which is used to differentiate controllers with the same VID/PID.

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

(cherry picked from commit 1f1ee6f77c)
2023-12-20 19:25:35 -08:00
Ozkan Sezer
d76097dc5e fix os/2 and watcom builds after commit 7bb0e839a6 2023-12-21 01:11:24 +03:00
Sam Lantinga
2fecefce19 Updated Xcode project with Steam Deck controller driver 2023-12-20 13:29:58 -08:00
Sam Lantinga
7bb0e839a6 Added Steam Input API support for game controllers
Added support for getting the real controller info, as well as the function SDL_GameControllerGetSteamHandle() to get the Steam Input API handle, from the virtual gamepads provided by Steam.

Also added an event SDL_CONTROLLERSTEAMHANDLEUPDATED which is triggered when a controller's API handle changes, e.g. the controllers were reassigned slots in the Steam UI.

(cherry picked from commit c981a597dc)
2023-12-20 13:29:57 -08:00
Sylvain
9720672374 Fix compilation / same as sdl2-compat
testautomation_platform.c:351:28: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  351 |     result = SDL_SetError("%s", testError);
      |                            ^~
/home/slvn/release/Release_SDL/sdl2-compat/test/testautomation_platform.c:364:64: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  364 |                             "SDL_GetError(): expected message '%s', was message: '%s'",
(cherry picked from commit 56f111dffc)
2023-12-20 22:29:51 +03:00
Vicki Pfau
5240071b1c Sync more Steam Controller header definitions for the Steam Deck
(cherry picked from commit a8f4f40d08)
2023-12-20 06:50:54 -08:00
Ozkan Sezer
5773c347d5 test/watcom.mif: disable W201 warning for testautomation_stdlib.c. 2023-12-17 20:51:10 +03:00
Ozkan Sezer
3ac69c6210 test/watcom.mif: remove a stale rule. 2023-12-17 20:51:02 +03:00
Sam Lantinga
91f8b4dea2 Added a controller name for the Steam virtual gamepad
(cherry picked from commit 4d5949dcf6)
2023-12-17 10:08:17 -08:00
Sam Lantinga
2aadef022e Pass through the name of the controller for the XInput mapping
(cherry picked from commit e6d88b254add377743de7bf33a7a4fec8cec79c3)
2023-12-17 09:32:54 -08:00
Dimitriy Ryazantcev
7391cd34da XInput: Use XInputGetCapabilitiesEx instead of fragile GuessXInputDevice
XInputGetCapabilitiesEx (ordinal 108) is available in XInput 1.4 that is shipped with Windows 8 and newer.

(cherry picked from commit 08a7ca4d53)
2023-12-17 09:32:43 -08:00
Sam Lantinga
d622c3c9cc Verify that the %p format specifier works for 64-bit pointers
(cherry picked from commit 7f75178908)
2023-12-17 08:15:19 -08:00
Susko3
cfecc569b5 Differentiate between Windows Ink (pen) and regular touch input
SDL2 backport of https://github.com/libsdl-org/SDL/pull/5926
2023-12-16 21:41:22 -08:00
Frank Praznik
867d8643d7 wayland: Handle mouse focus when receiving touch events
Compositors may switch from mouse to touch mode when a touch event is received, causing a pointer leave event and subsequent loss of mouse focus.

Don't relinquish mouse focus on surfaces with active touch events. If there are active touch events when pointer focus is lost, the keyboard focus is used as a fallback for relinquishing mouse focus: if, in this case, the keyboard focus is then lost and there are no active touches, mouse focus is lost, and if all touches are raised and there is no keyboard or pointer focus, then the window loses mouse focus.

(cherry picked from commit 21879faf48)
2023-12-14 14:33:18 -05:00
Sam Lantinga
239b5278bf Revert "Back out Steam virtual gamepad changes"
This reverts commit f0e7f3e7e5.
2023-12-13 09:46:10 -08:00
Frank Praznik
cc6d8eb72b tests: Fix whitespace 2023-12-12 17:17:00 -05:00
Frank Praznik
a78cdbd7e3 tests: Backport automated video test changes
Changes to the SDL3 video system required some changes to the test suite since the video system always reports the true window size and position.

While SDL2 doesn't directly require these changes, they are needed for SDL2-Compat and committed here to keep the two test suites in sync.
2023-12-12 16:10:44 -05:00
Max Maisel
33588662ef Refactor away some additional integer types. 2023-12-12 12:52:04 -08:00
Max Maisel
b620788b4c Add new file to OpenWatcom makefiles. 2023-12-12 12:52:04 -08:00
Max Maisel
20cc644833 Add new file to vcxproj files. 2023-12-12 12:52:04 -08:00
Max Maisel
bed789794d Add new steam deck HIDAPI controller to controller database. 2023-12-12 12:52:04 -08:00
Max Maisel
0dbe9022fc Disable lizard mode while steam deck HID device is opened. 2023-12-12 12:52:04 -08:00
Max Maisel
a6b9d987e9 Translate steam deck HID reports to SDL events. 2023-12-12 12:52:04 -08:00
Max Maisel
5718ba253f Implement steam deck HIDAPI initialization. 2023-12-12 12:52:04 -08:00
Max Maisel
e7f03de468 Add steam deck detection and HIDAPI driver scaffold. 2023-12-12 12:52:04 -08:00
Dimitriy Ryazantcev
33843b0933 Use existing XUSB driver software PID 0x02a1 instead of PID 0x02fe
0x02fe is actually PID of Xbox Wireless Adapter for Windows 10 (Model 1790) and creates confusion.

Here is USB descriptor dump: https://github.com/DJm00n/ControllersInfo/blob/master/xboxone/DescriptorDump_Adapter%20(Xbox%20Wireless%20Adapter%20for%20Windows).txt

(cherry picked from commit c790572674)
2023-12-11 11:49:28 -08:00
Sam Lantinga
7d94121606 You should call present when using a software renderer as well.
Fixes https://github.com/libsdl-org/SDL/issues/8676

(cherry picked from commit 581d1cab25)
2023-12-11 08:44:11 -08:00
Sam Lantinga
79a8e8cf04 Make built-in joystick device lists extendable by using hints
Fixes https://github.com/libsdl-org/SDL/issues/8595

(cherry picked from commit 5173b0c2cc)
2023-12-10 22:52:12 -08:00
Sam Lantinga
6526c4d0fc Refactor VIDPID list loading code
(cherry picked from commit d91e96e7f5)
2023-12-10 09:02:56 -08:00
Sam Lantinga
f0e7f3e7e5 Back out Steam virtual gamepad changes
We are planning a different approach to handle these
2023-12-10 08:38:20 -08:00
Anonymous Maarten
10c292b055 cmake+xcode: use IMPORTED SHARED framework target 2023-12-10 11:50:11 +01:00
Sam Lantinga
ddac844034 Fixed build 2023-12-09 21:44:12 -08:00
Sam Lantinga
dd28637947 Use the Steam virtual gamepad slot as the gamepad player index
(cherry picked from commit 7529d25b2b)
2023-12-09 21:01:08 -08:00
Sam Lantinga
5b26d4e0ca Sort Steam virtual gamepads by Steam controller slot
This makes sure that games launched by Steam see the first controller first, and the controllers in the game match up with the controllers in the Steam UI.

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

(cherry picked from commit 17723381da)
2023-12-09 20:35:33 -08:00
Ethan Lee
757c984ddb gamecontroller: Backport 3.0 'type:' field to 2.0 2023-11-30 14:42:56 -08:00
Ryan C. Gordon
61cd57d378 cocoa: Resync modifier keypressed on NSEventTypeFlagsChanged event.
Fixes #7507.

(cherry picked from commit 70b65d4170)
2023-11-29 21:40:30 -05:00
Anonymous Maarten
0134672345 cmake: copy sources to binary directory in separate target
Don't do it in POST_BUILD to avoid multiple parallel builds
stepping on each others toes.
Also don't use copy_if_different, but unconditionally copy it.
The build system should take care of dependencies.

SDL2 backport of fea6e7afb1
2023-11-28 23:03:30 +01:00
Sam Lantinga
8f14dc6998 Corrected comment
(cherry picked from commit 45938bbfa5)
2023-11-28 12:30:10 -08:00
zoeyjodon
3381828cc6 Fix 3DS Analog Values (#8581)
(cherry picked from commit 059e550e98)
2023-11-28 12:29:55 -08:00
shenleban tongying
be0e303ec8 document the purpose of SDL_SetTextInputRect
(cherry picked from commit 3e6513c773)
2023-11-28 12:11:31 -08:00
Sam Lantinga
546bab0a8c Fixed the GameCube HIDAPI controller mapping
Fixes https://github.com/libsdl-org/SDL/issues/8617
Closes https://github.com/libsdl-org/SDL/pull/8623
Closes https://github.com/libsdl-org/SDL/pull/7930
2023-11-28 10:26:58 -08:00
Sam Lantinga
98ee4a5292 Removed HIDAPI controller mappings
These are already provided internally by SDL

(cherry picked from commit dd984dcd9f)
2023-11-28 10:11:56 -08:00
Ryan C. Gordon
d42fa25a9e test: SDLTest_PrintEvent now reports key event mod state. 2023-11-28 13:07:56 -05:00
Ryan C. Gordon
7d25a443c4 cocoa: Use -[NSApplicationDelegate applicationSupportsSecureRestorableState].
This prevents warnings at startup on macOS Sonoma (14.0).
2023-11-28 12:24:33 -05:00
Ryan C. Gordon
3fbaf737ef test: Removed unnecessary line added by copy/paste error. 2023-11-28 12:11:13 -05:00
Ryan C. Gordon
258849c9bc test: testwm2 now displays keyboard mod state. 2023-11-28 12:05:02 -05:00
Jake S. Del Mastro
594a79c2f9 Set framebuffer_srgb_capable to the actual value obtained (#8634) 2023-11-28 05:48:19 -08:00
Sam Lantinga
8d47e3bb82 Added support for the NACON Revolution 5 Pro controller
(cherry picked from commit f0e47f8ee0)
2023-11-27 12:12:25 -08:00
Ozkan Sezer
bbcf40e811 cmake: fixed iconv detection test program
Fixes https://github.com/libsdl-org/SDL/issues/8614
2023-11-26 01:55:24 +03:00
CasualPokePlayer
0fb36f29a8 cmake: check if CMP0087 exists before setting it (#8613)
Fixes builds using < CMake 3.14
2023-11-25 21:42:55 +00:00
Ryan C. Gordon
4339647d90 render: Clip lines before Bresenham algorithm generates points.
Otherwise, a massive line might generate gigabytes worth of points to render,
which the backend would simply throw away anyhow.

Fixes #8113.
2023-11-24 19:33:04 -05:00
Ryan C. Gordon
a391dd5fef rect: Avoid numeric overflow on massive lines in SDL_IntersectRectAndLine.
Reference Issue #8301.
Reference Issue #8113.
2023-11-24 19:33:04 -05:00
Ozkan Sezer
657f5f791c autotools: fix actually wrong use of AC_MSG_RESULT 2023-11-24 14:37:40 +03:00
Ryan C. Gordon
e9b4869372 opengl: Creating a texture trashes the cached texturing state, fix it.
Reference Issue #7194.
2023-11-23 20:00:01 -05:00
Ryan C. Gordon
0a6b5abf45 render: GL-based renderers should treat adaptive vsync as vsync being enabled.
Fixes #8004.
2023-11-23 18:29:19 -05:00
Ryan C. Gordon
d8102bf660 x11: Deal with difference in GLX_EXT_swap_control_tear behavior.
Mesa and Nvidia handle it differently, and one or the other may fix their
implementation in the future, so test which way it works at runtime.

Reference Issue #8004.

(cherry picked from commit 74a2542564)
2023-11-23 18:17:25 -05:00
Ozkan Sezer
489e9b69df autotools: bump minimum needed autoconf version to 2.65.
older versions seem to output a broken configure script.
2023-11-24 01:01:20 +03:00
Anonymous Maarten
baaac5cca3 cmake: Android expects SDL programs to be built as shared libraries 2023-11-23 03:39:36 +01:00
Anonymous Maarten
5abcfdb93e SDL_stdinc.h: fix compile warning when using SDL_PR[iux]64 on Android 2023-11-23 03:38:59 +01:00
Ozkan Sezer
8cf7e9e7da autotools, cmake: set SDL_SYSTEM_ICONV to OFF for windows (like SDL3.) 2023-11-23 03:32:04 +03:00
Ryan C. Gordon
0e9d050296 psp: Hook up event subsystem init/quit.
Fixes #8554.
2023-11-22 17:59:36 -05:00
Ryan C. Gordon
87875a49b4 Removed some function declarations that don't actually exist.
Reference Issue #8554.
2023-11-22 17:54:57 -05:00
Ozkan Sezer
17e62abb6d revise iconv detection:
- check libiconv with a linkage test with iconv.h included
- check libc iconv with a linkage test with iconv.h included
  and LIBICONV_PLUG defined (in case libiconv header is in
  include path)
- add new configuration option to prefer iconv from libiconv,
  if available, over the libc version, defaults to disabled:
  SDL_LIBICONV for cmake, --enable-libiconv for autotools.
- change FreeBSD specific LIBICONV_PLUG define in SDL_iconv.c
  to configuration result.
2023-11-22 23:29:00 +03:00
Anonymous Maarten
4940b5dbc2 SDL_bsdjoystick: fix -Wundef warning on FreeBSD 2023-11-22 06:50:00 +03:00
Ozkan Sezer
3fb5124174 cmake: add openbsd wscons sources to build, if supported 2023-11-22 05:10:02 +03:00
Ozkan Sezer
59b0a2d711 kmsdrm: restrict KMSDRM_ReleaseVT/KMSDRM_AcquireVT to SDL_INPUT_LINUXEV 2023-11-22 05:10:02 +03:00
Sam Lantinga
dcd21d042f Improved GCController handling on Apple platforms
Automatically map controllers as gamepads when using the GCController framework and prefer the physicalInputProfile when possible.

Testing with macOS 13.4.1, macOS 14.1.1, iOS 15.7.4, tvOS 17.1:
* iBuffalo Classic USB Gamepad (macOS only)
* Logitech F310 (macOS only)
* Apple TV remote (tvOS only)
* Nimbus MFi controller
* PS4 DualShock controller
* PS5 DualSense controller
* Xbox Series X controller
* Xbox Elite Series 2 controller
* Nintendo Switch Pro controller
* Nintendo Switch Joy-Con controllers

(cherry picked from commit 0fe5713964)
Author: Sam Lantinga <slouken@libsdl.org>
Date:   Tue Nov 14 12:58:33 2023 -0800
2023-11-21 15:17:53 -08:00
Sam Lantinga
2d81beb819 Show the mapping used when a game controller is opened 2023-11-21 13:49:38 -08:00
Sam Lantinga
4de4b1e7a0 Don't tickle PS4 Bluetooth controllers in simple mode
The 8BitDo Zero 2 only sends reports when state changes, so trips the disconnected Bluetooth controller detection. The expected use case is that most people will have official PS4 controllers in enhanced report mode, so disconnected Bluetooth controller detection will still work for those.

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

(cherry picked from commit 75df4cc5c2)
2023-11-21 13:25:31 -08:00
Cameron Cawley
f33ab44f84 Extend blitting support for all <8bpp formats 2023-11-20 15:50:51 -08:00
Cameron Cawley
67eb03400a Add SDL_PIXELFORMAT_INDEX2LSB and SDL_PIXELFORMAT_INDEX2MSB 2023-11-20 15:50:51 -08:00
Ryan C. Gordon
cb5b8c9747 testshader: Don't make local variables with the same name as GL entry points.
Reference Issue #2706.
2023-11-20 15:10:30 -05:00
Ryan C. Gordon
c331b64d79 audio: Tighten up possession of detectionLock during device open.
We don't need it for most of the time, and holding it during the backend's
OpenDevice upsets ThreadSanitizer vs our PulseAudio code.

Fixes #7427.
2023-11-20 01:01:49 -05:00
Ryan C. Gordon
e51760e111 audio: Wait for device thread to set device->threadid before continuing.
This fixes a (likely harmless) race condition in `is_in_audio_device_thread`.

Reference Issue #7427.
2023-11-19 12:26:51 -05:00
Deve
c67ff82377 Avoid textinput events when pasting from clipboard on iOS.
I handle command+C and command+V shortcuts for copy/paste from clipboard using
SDL_GetClipboardText/SDL_SetClipboardText. But on iOS command+V shortcut is
also handled by system, so that I also get textinput event with that clipboard
text. And thus the application gets this clipboard text twice (from
SDL_GetClipboardText and from textinput event).

I assume that intended behavior is that command+V shouldn't generate textinput
events. At least as far as I know ctrl+V on other platforms does nothing. This
commit disables paste action for UITextField, so that textinput event isn't
generated anymore.

(cherry picked from commit eddaf870f5)
2023-11-19 08:20:01 -08:00
Ryan C. Gordon
42d979a231 audio: Just use the system default stack size for the device thread.
Fixes #7367.
2023-11-19 11:10:29 -05:00
Cameron Cawley
1bb5448fe8 Use the correct pixel formats for OpenGL ES on big endian 2023-11-17 15:03:37 -08:00
Ozkan Sezer
2222f44c94 use format string attributes for functions accepting va_list params, too 2023-11-17 15:56:10 +03:00
Anonymous Maarten
d81d986858 cmake: fix uses of undefined macro identifiers (-Wundef) 2023-11-17 03:06:26 +00:00
Sam Lantinga
cc7c0a2dab Fixed IOS_SupportedHIDDevice() returning SDL_FALSE before initialization
(cherry picked from commit 34392db9c3)
2023-11-14 10:58:18 -08:00
Sam Lantinga
76cc24e34a 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)
2023-11-14 10:32:52 -08:00
Sam Lantinga
0ec1209eab 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)
2023-11-14 09:29:55 -08:00
Louis M
925362a2fc Replacing SDL_SCANCODE_AUDIOMUTE by SDL_SCANCODE_MUTE on Windows 2023-11-14 09:26:15 -08:00
Sam Lantinga
1de85491e1 Fixed mouse wheel scrolling direction on iOS
(cherry picked from commit 15504da0b8)
2023-11-14 09:25:04 -08:00
Sam Lantinga
cc20d0147e 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)
2023-11-13 21:37:18 -08:00
Sam Lantinga
8c82b73027 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)
2023-11-13 21:37:06 -08:00
nia
92d70f4167 cpuinfo: Fix detection of physical memory above 2GB on NetBSD
Rework the code to clearly prefer 64-bit sysctls first, then
legacy sysctls, and eliminate a second ifdef.

Signed-off-by: Nia Alarie <nia@NetBSD.org>
(cherry picked from commit 69cae07cc1)
2023-11-13 06:50:54 -08:00
Yussuf Khalil
63e9827b90 wayland: Fix DPI calculation with scaled outputs
`driverdata->width` and `driverdata->height` represent the width and height in logical pixels on scaled outputs with xdg_output. However, to correctly calculate the display's DPI value, we need to use its native resolution.

For example, on a 27" 4K screen with 175% scaling, we have `width` == 2192 and `height` == 1233, resulting in a bogus value of 92dpi, whereas 162dpi are correct for 3840x2160 pixels at 27 inches.

Tested on GNOME mutter 45.1.
2023-11-12 09:08:31 -05:00
Sylvain Becker
f3419d8c04 Re-add SDL_assert() with non boolean ptr syntax (#8531) 2023-11-11 12:29:05 +03:00
Sam Lantinga
c29df1699e Added shortened name for "Nintendo Co., Ltd."
(cherry picked from commit 87794d03ad)
2023-11-10 17:32:34 -08:00
Sam Lantinga
4a0bd06d58 Added support for the GameSir-G7 Controller for Xbox
(cherry picked from commit 2e6c48dcb4)
2023-11-10 17:32:11 -08:00
Sam Lantinga
03f29c19dc Added support for the Dragonrise GameCube adapter with VID 0x1843
(cherry picked from commit fbb6934905)
2023-11-10 16:45:07 -08:00
Sylvain Becker
a14b948b6c [SDL2] pointer boolean (#8523) 2023-11-10 06:30:56 -08:00
Anonymous Maarten
4a3a9f3ad8 Older gcc does not support #pragma GCC diagnostic inside functions 2023-11-09 23:34:05 +01:00
Anonymous Maarten
d38ccfa88f x11: Ignore deprecated declaration of XKeycodeToKeysym 2023-11-09 18:46:27 +01:00
Anonymous Maarten
f0d65436fb ci: re-enable Intel compilers on ci 2023-11-09 18:07:10 +01:00
Sam Lantinga
dfc38ef460 Implemented VT switching for KMSDRM on Linux
Fixes https://github.com/libsdl-org/SDL/issues/3844

(cherry picked from commit f4b61fff30)
2023-11-08 20:46:13 -08:00
Anonymous Maarten
adc0880520 cmake: also install pdb files of static libraries 2023-11-09 03:23:24 +01:00
Sam Lantinga
509c70c698 Allow the application to draw while Windows is in a modal move/resize loop
SDL will send an SDL_EVENT_WINDOW_EXPOSED event for your window during the modal interaction and you can use an event watcher to redraw your window directly from the callback.

Fixes https://github.com/libsdl-org/SDL/issues/1059
Closes https://github.com/libsdl-org/SDL/pull/4836
2023-11-08 14:01:00 -08:00
Sam Lantinga
3900fca304 Fixed FreeBSD build
(cherry picked from commit a4c6b38fef)
2023-11-08 07:46:42 -08:00
Sam Lantinga
76ff25eedf Fixed FreeBSD build
(cherry picked from commit d9e6dcc650)
2023-11-08 04:45:46 -08:00
Sam Lantinga
5d29f22808 Store the requested muted state
(cherry picked from commit 7cc3e94eb2)
2023-11-08 03:37:09 -08:00
Sam Lantinga
87bb0f5bcb Don't mute the console input if we can't read the keyboard
This makes sure you can hit Ctrl-C if you don't have permission to access the raw keyboard device.

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

(cherry picked from commit ce9e1bd324)
2023-11-08 03:29:39 -08:00
Wohlstand
f9baa30270 sdlchecks.cmake: Clarified the reason why shared X11 mode doesn't work
#6778
2023-11-08 02:57:04 -08:00
Sam Lantinga
7e11bd1ac1 Removed useless branch test
Fixes https://github.com/libsdl-org/SDL/issues/8286

(cherry picked from commit e5ccc80aba)
2023-11-08 01:35:57 -08:00
Sam Lantinga
af7fe2cf9b 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)
2023-11-08 00:43:43 -08:00
Sam Lantinga
524ccf033f Assume all 8BitDo Xbox controllers have a share button
Fixes https://github.com/libsdl-org/SDL/issues/8174

(cherry picked from commit 8049af3355)
2023-11-08 00:36:27 -08:00
Sam Lantinga
b1807797a3 Make sure joysticks are locked when adding and removing them
Fixes https://github.com/libsdl-org/SDL/issues/8146

(cherry picked from commit ed1e0c1530)
2023-11-08 00:18:13 -08:00
Sam Lantinga
b07e5d38a2 Added missing calls to SDL_InvalidParamError("surface")
(cherry picked from commit 04e98d2236)
2023-11-07 21:58:39 -08:00
Sam Lantinga
624905a7f1 Destroy the window surface if we've created it for the software renderer
Fixes https://github.com/libsdl-org/SDL/issues/8011
2023-11-07 21:47:07 -08:00
Sam Lantinga
4ace02df5f 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)
2023-11-07 18:09:00 -08:00
Sam Lantinga
70adacf08a Make sure we include the null terminator in XLookupStringAsUTF8()
Fixes https://github.com/libsdl-org/SDL/issues/6728

(cherry picked from commit 4106697774)
2023-11-07 16:25:12 -08:00
Sam Lantinga
fb92d150d9 Removed unused SDL_OSEvent 2023-11-07 09:15:18 -08:00
Ivan Mogilko
d9559ce1d4 Added subsystem refcount tests to testautomation 2023-11-07 08:40:15 -08:00
Ivan Mogilko
7526a87ff2 Handle subsystem dependencies recursively
Existing code is erroneous, because it adds or removes dependency's ref count based on number of InitSubSystem/QuitSubSystem calls, while ref count diff should depend on number of inited or quit dependents.
Recursive approach seems to be simplest solution that guarantees proper ref count.
2023-11-07 08:40:15 -08:00
Sam Lantinga
171e306dbf Enable the 5th player LED on the DualSense controller
Fixes https://github.com/libsdl-org/SDL/issues/5152

(cherry picked from commit 22016b4eae)
2023-11-06 20:15:39 -08:00
Sam Lantinga
d6c725d522 Removed misleading comment
Fixes https://github.com/libsdl-org/SDL/issues/5069

(cherry picked from commit 66cf30c2de)
2023-11-06 19:34:03 -08:00
Sam Lantinga
0c85173d5b 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)
2023-11-06 17:13:16 -08:00
Ozkan Sezer
7555701def autotools: fix linux joystick breakage after commit 221d6ea8a8
Fixes https://github.com/libsdl-org/SDL/issues/8488
2023-11-06 23:25:58 +03:00
Ryan C. Gordon
065d80716b hidapi: Avoid memcpy'ing to NULL.
(This fix was originally from @themightyoarfish on GitHub. Thanks!)

Fixes #8428.
Reference PR #8431.

(cherry picked from commit c6d9fb1ad7)
2023-11-06 13:50:49 -05:00
Ryan C. Gordon
9d7feaaf9e coreaudio: If paused, clear any pending stream data.
This makes sure stuff that was still pending for conversion/resampling doesn't
pop in later when the device is unpaused again.

Fixes #8485.
2023-11-06 09:57:00 -05:00
Sam Lantinga
d5896f9010 Fixed memory leak in XInput code
Fixes https://github.com/libsdl-org/SDL/issues/3597

(cherry picked from commit 3e4d7e48b0)
2023-11-06 00:40:48 -08:00
Sam Lantinga
64a7e75dd3 Only save ibus_addr_file after we've successfully read an address from it.
Fixes https://github.com/libsdl-org/SDL/issues/3359

(cherry picked from commit bc3d9e99f3)
2023-11-05 22:13:34 -08:00
Ozkan Sezer
93e51dd33e fix a possible memory leak in SDL_vasprintf()
(cherry picked from commit 1a83bf2399)
2023-11-05 20:02:20 +03:00
Sam Lantinga
e8f4045d0b Use XINPUT_STATE instead of XINPUT_STATE_EX (thanks Andrew!)
XINPUT_STATE_EX isn't actually a thing, we can just use the normal XINPUT_STATE

Fixes https://github.com/libsdl-org/SDL/issues/2797
2023-11-04 22:24:55 -07:00
Sam Lantinga
aa129c9257 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)
2023-11-04 21:12:15 -07:00
Sam Lantinga
4c2eb6b95d Use the default UCS2/UCS4 conversion rather than non-portable INTERNAL encoding
Fxies https://github.com/libsdl-org/SDL/issues/1497

(cherry picked from commit d07a264a9b)
2023-11-04 12:02:18 -07:00
Ozkan Sezer
e226008d83 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
2023-11-02 23:33:20 +03:00
Anonymous Maarten
8b1b6734f6 cmake: fold HAVE_INPUT_EVENTS into HAVE_LINUX_INPUT_H 2023-11-02 21:28:39 +01:00
Sam Lantinga
97c2bdf256 Added patch note for SDL_GDKGetDefaultUser() 2023-11-02 09:59:25 -07:00
Sam Lantinga
20ecd2afcb 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)
2023-11-02 08:43:11 -07:00
Anonymous Maarten
517db6d887 cmake: reset check state before testing -fobjc-arc 2023-10-30 21:08:30 +01:00
Anonymous Maarten
20630b2e6c cmake: check -fobjc-arc compiler flag on Apple platforms 2023-10-30 19:56:46 +01:00
Anonymous Maarten
7774de0fe3 cmake: file(RELATIVE_PATH) needs 2 absolute paths 2023-10-30 19:45:49 +01:00
Frank Praznik
60e8ff16dc wayland: Sanity check pointers and protocols before confining
(cherry picked from commit 875e45e70b)
2023-10-29 14:28:58 -04:00
Frank Praznik
19c3e125ba 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)
2023-10-29 14:28:19 -04:00
Sam Lantinga
832afa81a1 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)
2023-10-26 17:09:13 -07:00
Ozkan Sezer
b29128994e CI: change FreeBSD CI runner to cross-platform-actions. 2023-10-26 01:03:50 +03:00
Sam Lantinga
1db0bd3fc0 Added support for the HP HyperX Clutch Gladiate controller
(cherry picked from commit f52b330ed8)
2023-10-25 09:01:46 -07:00
Ryan C. Gordon
cba6090398 n3ds: Check that audio thread name starts with "SDLAudioP"
The string has a number after it, so a basic SDL_strcmp() will never match.

Reference PR #8346.
2023-10-24 23:58:00 -04:00
Sam Lantinga
4194a902e8 Added support for "%[]" sscanf syntax
Fixes https://github.com/libsdl-org/SDL/issues/8423

(cherry picked from commit 39a961ba41)
2023-10-24 17:32:23 -07:00
ds-sloth
3823ba1ded n3ds systhread - use 80kb thread stack size as default, remove hard cap 2023-10-24 16:42:44 -07:00
ds-sloth
301ee21f33 n3ds systhread - prefer to put audio thread on system core 2023-10-24 16:42:44 -07:00
ds-sloth
6623c87d0b SDL_n3dsaudio.c - don't risk leaving current_priority uninitialized 2023-10-24 16:42:44 -07:00
ds-sloth
070f57820f SDL_n3dsaudio.h: use triple buffering 2023-10-24 16:42:44 -07:00
ds-sloth
62266dbd4f SDL_n3dsaudio.c: separate mixer locks from audio device locks 2023-10-24 16:42:44 -07:00
Sam Lantinga
d47c286b12 SDL_IsJoystickProductWheel() returns SDL_TRUE for Asetek wheelbases (thanks @IOBYTE!)
(cherry picked from commit e07f6c0a17)
2023-10-23 10:44:30 -07:00
Sam Lantinga
259009a7ea Add missing error reporting in Android_JNI_FileOpen()
Fixes https://github.com/libsdl-org/SDL/issues/8427

(cherry picked from commit a844d90942)
2023-10-23 08:28:37 -07:00
Anonymous Maarten
90255914a8 cmake: install pdb's when present 2023-10-22 18:53:34 +02:00
Sam Lantinga
e3e41b69a1 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)
2023-10-22 09:24:23 -07:00
Ozkan Sezer
44d8721087 Allow building against old Linux kernels. 2023-10-19 11:14:20 +03:00
Cameron Gutman
4aab2342e9 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)
2023-10-17 22:18:52 -05:00
Sylvain
df6db90dd4 Fix sdltest_randomAsciiStringWithMaximumLength() where it requests a string a size 0
seen with: ./testautomation --seed MILAFAP2AKVP3V4G --filter sdltest_randomAsciiStringWithMaximumLength
2023-10-13 20:23:01 +02:00
Ryan C. Gordon
d8b34b0993 pulseaudio: Stop the threaded mainloop before destroying the context.
Otherwise, we might trigger an assertion in libpulse.

Reference Issue #8348.

(cherry picked from commit 10fab3a39e)
2023-10-13 09:36:06 -04:00
Ryan C. Gordon
2849ca404e 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)
2023-10-11 01:09:46 -04:00
Anonymous Maarten
e417c6cffe ci: stop FreeBSD job after 30 minutes 2023-10-11 00:23:10 +02:00
Ryan C. Gordon
32587bd7de Sync wiki -> header 2023-10-10 10:19:51 -04:00
Ozkan Sezer
b7a0ef6bdf artsaudio: revert bad arts_init return code check from commit ce5da5d. 2023-10-10 10:40:20 +03:00
Frank Praznik
7010452062 tests: Disable mouse warp test under Wayland
Wayland does not allow warping the mouse pointer, thus these tests are unreliable and should be skipped.

(cherry picked from commit 9111c5e178)
2023-10-09 12:58:22 -04:00
Frank Praznik
e8c915dacc wayland: Try to skip the Wayland driver if not connecting to or in a Wayland session
When initializing the Wayland driver, check if the application is being started in, or trying to connect to, a Wayland session and skip to another driver if not. If neither WAYLAND_DISPLAY nor XDG_SESSION_TYPE are set, try to start anyway, and if the Wayland library is missing or no Wayland sessions are started, initialization will fail later in the process as it previously did.

This fixes the case where a Wayland session is running on a different VT, but an application wishes to run via KMSDRM on the current VT.

(cherry picked from commit 836927edf8)
2023-10-09 12:49:15 -04:00
KWottrich
25b0081367 Backport #7697 to SDL 2
Backport fixes from #8349

Include changes from #8357
2023-10-08 16:37:23 -07:00
Frank Praznik
c4a169a6fc Fix automated video tests under X11/Wayland
Backports of f30a182 and f8e8dff
2023-10-06 16:22:46 -04:00
Frank Praznik
1d8dbb2896 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:06 +02:00
Anonymous Maarten
43c57e3239 triangle: don't read destination pixel when you're going to discard it anyways 2023-10-05 13:46:28 +02:00
Anonymous Maarten
2d5c05a69c blit_slow: don't read destination pixel when you're going to discard it anyways
(cherry picked from commit 4cd0c13823)
2023-10-04 19:42:46 -07:00
Anonymous Maarten
321c2f8f24 ci: disable Intel compilers 2023-10-02 09:14:29 +02:00
Frank Praznik
f9dc49c21c Fix automated tests using the dummy video driver
Manual backport of b8d9125
2023-09-30 11:21:10 -04:00
Anonymous Maarten
71b7790be8 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:48:51 +02:00
Anonymous Maarten
933ec9e978 cmake: add qnx support
Co-authored-by: elahav <elahav@users.noreply.github.com>
2023-09-30 16:48:51 +02:00
Anonymous Maarten
a263cc2369 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:48:51 +02:00
Simon McVittie
6b5eadb10f 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)
2023-09-29 06:56:50 -07:00
Sam Lantinga
9772d0512c SDL_iconv_string() defaults to UTF-8
Fixes https://github.com/libsdl-org/SDL/issues/8287

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

(cherry picked from commit 70a1bc6973)
2023-09-24 17:18:41 -07:00
Ozkan Sezer
834e8898b9 SDL_dbus.h: define DBUS_TIMEOUT_USE_DEFAULT if not already defined.
(cherry picked from commit c521e1286b)
2023-09-21 01:32:50 +03:00
Ryan C. Gordon
60070d0b3d emscripten: Restore compatibility with existing emsdk releases.
(cherry picked from commit 5008521538)
2023-09-20 14:35:51 -04:00
Jaswant Panchumarti
330d420afc Use EM_ASM_PTR when the return value is a pointer
- closes https://github.com/libsdl-org/SDL/issues/8241

(cherry picked from commit 953b55dd6d)
2023-09-20 14:35:02 -04:00
Frank Praznik
2fcbf321fa wayland: Fix drag offer leak
The data device leave function is intended for drag offers, not selections, and the function as was previously written was a no-op.

(cherry picked from commit 52efefca04)
2023-09-20 11:13:03 -04:00
Colin Kinloch
a683ce4153 linux: Add portal drag and drop 2023-09-20 11:01:49 -04:00
Ozkan Sezer
95a6f986a0 update config.guess and config.sub from mainstream 2023-09-20 14:50:56 +03:00
Sam Lantinga
37dee79b74 Fixed sensor timestamp units for third-party PS5 controllers
(cherry picked from commit a72dfa6a5f)
2023-09-18 13:00:33 -07:00
Sam Lantinga
62e7049a4f Fixed error: array subscript 2 is above array bounds of ‘const Uint8[2]’
Smart compilers don't like dereferencing off the end of arrays

(cherry picked from commit f6756047a4)
2023-09-18 12:20:22 -07:00
Sam Lantinga
fff3c2573a Fixed sensor timestamp calculation for third-party PS5 controllers
(cherry picked from commit 7059a55ccc)
2023-09-18 11:58:39 -07:00
Guldoman
70a2ac2f1c x11: Always update clipboard owner
This allows utilities like clipboard managers to keep track of the
changes.

(cherry picked from commit 65aaf3a9ab)
2023-09-15 05:23:02 -07:00
Max Bachmann
a8b9414697 detect fanatec steering wheels
(cherry picked from commit fd1c54a004)
2023-09-12 15:36:20 -07:00
Anonymous Maarten
92dc226018 cmake: make sure SDL_GetPrefPath is run before testfilesystem
60 seconds timeout ought to be sufficient.
2023-09-10 15:33:22 +02:00
Anonymous Maarten
2adebcd6cc ci: run tests in parallel 2023-09-10 15:20:34 +02:00
Ryan C. Gordon
ce32c44b54 docs: Added Emscripten filesystem notes. 2023-09-09 21:22:45 -04:00
Ryan C. Gordon
818a26f21b docs: Corrected/improved some Emscripten docs. 2023-09-09 21:22:45 -04:00
Ryan C. Gordon
5e6a851d6c docs: Fixed some Emscripten details 2023-09-09 21:22:45 -04:00
Ryan C. Gordon
f788a671e4 docs: Remove "more on this later" comment for something already covered. 2023-09-09 21:22:45 -04:00
Ryan C. Gordon
bd77b9a0ce docs: Rewrote README-emscripten.md
Fixes #6453.
2023-09-09 21:22:45 -04:00
Simon McVittie
8ad043fc38 render: Enable clipping for zero-sized rectangles
Battle for Wesnoth apparently relies on being able to disable rendering
of UI elements by setting the clip rectangle to be empty.

Resolves: https://github.com/libsdl-org/SDL/issues/6896
Fixes: 00f05dcf "render: only enable clipping when the rectangle is valid"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-09-09 11:14:04 -07:00
Anonymous Maarten
b388f6e32d cmake: use MSVC_RUNTIME_LIBRARY to force MT 2023-09-09 19:16:31 +02:00
Ryan C. Gordon
25eca09c7e include: Replaced old Bugzilla URL.
(cherry picked from commit fb13770353)
2023-09-07 10:53:02 -04:00
Frank Praznik
88299502b4 wayland: Ensure that the toplevel window is recreated when switching decoration modes
If a compositor tries to change the decoration mode when initially creating a window, the hidden flag might not yet be unset if the decoration mode is changed during the initial roundtrip in Wayland_ShowWindow(). As hiding the window destroys the decoration manager object, the hidden flag check is unnecessary, as the decoration configuration listener will never be entered when the window is hidden.

(cherry picked from commit 37e1fc3b58)
2023-09-06 14:56:16 -04:00
Makarenko Oleg
1d495351a0 Detect Simagic wheel bases as wheels (#8198)
Simagic DirectDrive wheel bases have the same vendor + product id's

(cherry picked from commit a2c1984d37)
2023-09-04 12:12:21 -07:00
Oleg
365a36386a Detect Logitech G923 Playstation as wheel
G923 have two different versions - Xbox version is already present in the wheel list, but not the PS version.

(cherry picked from commit 266b91d2fd)
2023-09-04 11:05:52 -07:00
Oleg
242b25aba4 Detect Logitech PRO Racing Wheel for Xbox (PC mode) as wheel
Logitech PRO Racing Wheel have two different versions - for Playstation and Xbox. Vendor + Product ID for Playstation version already present in SDL sources, but not an Xbox version

(cherry picked from commit cde67ea49a)
2023-09-04 11:01:52 -07:00
Jeremy Demeule
aa7ba62978 metal: Add hint to select low power device instead of the default one (#8182)
On some system like MacBook Pro Intel with AMD card, asking for the default device will always return the AMD GPU.
This is not an issue for 99% of the case when the renderer context is here to provide the maximum performance level like for game.
However, for video application using GPU for 1 quad and 1 texture, using the discrete GPU for that lead to an important power consumption (4 to 8W), heat increase, and fan noise.
With this patch, I successfully amend ffplay to only use the integrated GPU (i.e. the Intel one), instead of the discrete GPU (i.e. the AMD one).
2023-08-31 01:55:18 -07:00
Anonymous Maarten
0b995f21e7 wayland: add SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL 2023-08-30 23:03:47 +02:00
Anonymous Maarten
bb1fe302cf wayland: don't define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_* macro's
They mess with #ifdef conditional in headers.
2023-08-30 22:46:17 +02:00
Ozkan Sezer
f032e8c191 updated dynapi after SDL_GDKGetDefaultUser addition 2023-08-25 19:03:40 +03:00
Ethan Lee
24fcb61470 – gdk: Add SDL_GDKGetDefaultUser, SDL_GetPrefPath implementation 2023-08-25 10:41:14 -04:00
Sam Lantinga
6ff48dddcb Fixed the report format for the Razer Wolverine V2 Pro
(cherry picked from commit 69aec8c915)
2023-08-24 11:38:18 -07:00
Sam Lantinga
862a654b70 Accept key events from any source
This allows TV remotes to navigate SDL applications (with source HDMI)

Fixes https://github.com/libsdl-org/SDL/issues/8137
2023-08-24 10:11:53 -07:00
Sam Lantinga
8e27a69370 Updated to Android minSdkVersion 19 and targetSdkVersion 34
This is updated to meet the latest requirements for apps on the Google Play store
2023-08-24 08:26:05 -07:00
Ryan C. Gordon
9237f8edc1 video: Fixed small memory leak when disconnecting a display. 2023-08-23 16:27:10 -04:00
Ryan C. Gordon
1f4e86d61c video: Minor cleanup in SDL_VideoQuit.
(This code changed in SDL3, no need to cherry-pick it to there.)
2023-08-23 16:27:09 -04:00
Ryan C. Gordon
04ff593bf5 emscriptenaudio: Fire the capture silence_callback at an interval.
Previously it was using setTimeout, not setInterval, so it would only fire
once, which was obviously a mistake.

(cherry picked from commit fb79211732)
2023-08-23 16:25:30 -04:00
Ryan C. Gordon
ddbbef88e3 emscriptenaudio: Don't bother undefining things about to be unreachable.
Since the top-level table is getting undefined, all the things in it will
be unreachable and eligible for garbage collection without explicitly
nulling them out.

(cherry picked from commit 5191b20541)
2023-08-23 16:24:09 -04:00
Ryan C. Gordon
ae7f54f514 emscriptenaudio: Deal with blocked audio devices better.
Now, if the AudioContext starts in a "suspended" state, because the browser
blocked it from playing by default, we we run the audio "thread" in a timer
and throw away the generated audio. Once the AudioContext is allowed to
resume, we clear this timer.

The end result is that the app will continue to drain its audio queue
instead of consuming more memory over time (and, if it relies on an audio
callback to make progress, continue to run!), with the effect that the
page is merely silent but otherwise functioning as intended.

Once the user interacts with the page and the browser permits the the
AudioContext to run for real, audio should still be in sync, instead of
just starting to play audio that might now be at least several seconds behind.

(cherry picked from commit fd75a4ca05)
2023-08-23 16:21:49 -04:00
Sam Lantinga
0b9d8e679a Quiet spurious warning
Fixes https://github.com/libsdl-org/SDL/issues/8112
2023-08-13 13:54:18 -07:00
David CARLIER
4a0f56b679 SDL_TriggerBreakppoint for riscv arch (both 32/64) version.
`ebreak` acts like int3 for x86, giving control of running process to debuggers.
(cherry picked from commit 723bcd0a8b)
2023-08-13 23:02:02 +03:00
Anonymous Maarten
10135b2d7b Fix overflow when doing SDL_sscanf("%hd", ...)
An overflow occured in the stdlib_sscanf test, when using msys2 clang32 toolchain.

(cherry picked from commit 342ec51131)
2023-08-10 15:06:57 -07:00
Mathieu Eyraud
f348370e1b Fix out of bound read of 'has_hat' array
(cherry picked from commit 94b3f78c44)
2023-08-10 08:26:45 -07:00
Sam Lantinga
951657c99b Fixed crash when running with the dummy video driver 2023-08-10 08:25:29 -07:00
Sam Lantinga
7df721d4e9 Allow running tests with the dummy video driver 2023-08-10 08:25:29 -07:00
Anonymous Maarten
0465224616 Sync -Wsign-compare warning fix from sdl2-compat 2023-08-09 02:53:48 +02:00
Anonymous Maarten
9d6b028e01 tests: build tests with fast math disabled 2023-08-09 02:53:48 +02:00
Anonymous Maarten
fcae9cd210 cmake: build with -Wdocumentation 2023-08-09 02:53:48 +02:00
Anonymous Maarten
e5f3b22d63 cmake: update cmake_minimum_required to avoid deprecated warning 2023-08-09 02:53:48 +02:00
Anonymous Maarten
64f17314a2 MSVC has __declspec(deprecated) 2023-08-09 02:53:48 +02:00
Sam Lantinga
1d8806b0fc Fixed testautomation --filter pixels_allocFreePalette
Error messages are not part of the ABI, so we can't validate those.

Hand-picked from c9323f8fac
2023-08-08 11:50:04 +03:00
Sam Lantinga
e56dc9c30e Fixed testautomation --filter pixels_allocFreeFormat
Error messages are not part of the ABI, so we can't validate those.

Technically SDL_AllocFormat() on a FOURCC format in SDL2 should fail, but SDL3 supports it and we don't expect SDL2 applications to actually do this, so skip that test.

Hand-picked from 5cf9438f88
2023-08-08 11:50:04 +03:00
Sam Lantinga
4bceea70c5 Added the Victrix Pro FS for PS4/PS5 to the controller list
(cherry picked from commit fa189d302e)
2023-08-07 14:10:56 -07:00
Ryan C. Gordon
8087c0a5d2 include: fixed a typo in SDL_RenderGetMetalCommandEncoder docs. 2023-08-06 10:45:11 -04:00
Ozkan Sezer
53d818e31c updated config.guess and config.sub from mainstream 2023-08-05 14:03:02 +03:00
Frank Praznik
f522c5380c wayland: Don't initialize OpenGL when the window flags didn't specify it
Applications that don't specify a rendering flag are likely handling Vulkan/GL themselves, so SDL loading OpenGL by default in this case is unnecessary overhead, and if a render backend requires it, the window will be recreated with the appropriate flags when the renderer is initialized.

(cherry picked from commit 9ab2025127)
2023-08-04 08:53:16 -07:00
Sam Lantinga
2304b4e86a Added a gamepad mapping for the G-Shark GS-GP702
Fixes https://github.com/libsdl-org/SDL/issues/8068

(cherry picked from commit 06bea1eb55)
2023-08-02 14:38:29 -07:00
Sam Lantinga
0f753d9794 The Flydigi Vader and Apex series controllers all have the same VID, PID, and name
(cherry picked from commit 58e3084477)
2023-08-02 14:38:23 -07:00
Sam Lantinga
805fc29ae8 Removed Flydigi Vader 2 mappings
Many of the Flydigi controllers use the same VID/PID and have different mappings, so let's revisit this once we have more data.

(cherry picked from commit 5388edd549)
2023-08-02 14:38:01 -07:00
Ozkan Sezer
57f3c41b97 adjusted coding style in SDL_os2_joystick.c to match rest of SDL better 2023-08-02 20:40:10 +03:00
Ozkan Sezer
b58557a3a6 minor os/2 stuff merged from the bitwiseworks' fork
(cosmetics only.)
2023-08-02 17:10:28 +03:00
Ozkan Sezer
6a787b8004 SDL_video.c: move ngage video before offscreen.
Reference issue: https://github.com/libsdl-org/SDL/pull/8069.
(cherry picked from commit e2e87a536c)
2023-08-02 17:00:40 +03:00
Ozkan Sezer
0deed07b3e SDL_video.c: move os2 video before offscreen.
as offscreen is enabled in CMakeLists.txt, we get a blanks window
otherwise.

From a patch by Silvan Scherrer, at Bitwiseworks' fork.
(cherry picked from commit 66d5ad19f0)
2023-08-02 17:00:40 +03:00
Sam Lantinga
ebf2c49b50 Fixed build 2023-08-02 01:37:05 -07:00
Sam Lantinga
38c63afd64 Fixed duplicate key press/release events on iOS
When a hardware keyboard is attached, it can take over 100 ms for the keyboard event to generate text input. In that case we want to record that we recently received a keyboard event so we don't synthesize duplicate virtual key press/release events for the input text.

(cherry picked from commit 648de4f9b8)
2023-08-02 01:27:54 -07:00
Sam Lantinga
030bb7282a Synchronize on-screen keyboard state with text input active state
When a hardware keyboard is attached to an iPad, you can easily trigger a set of on-screen keyboard transitions that will take place over time, and we need to track whether we're currently showing or hiding the keyboard and make sure we don't clobber the existing state during those transitions.

Testing:
* Connected a hardware keyboard to an iPad
* Launched checkkeys
* Noted the keyboard bar was active at the bottom of the screen and text input was active
* Tapped with both fingers to quickly toggle text input off and back on
* Noted the keyboard bar slid down and then back up, and text input was active
* Tapped on the keyboard bar to bring up the full on-screen keyboard and then closed it so the keyboard bar was still active, and text input was still active
* Tapped on the screen to turn text input off, noted the keyboard bar slid down
* Tapped with both fingers to quickly toggle text input on and back off
* Noted that the keyboard bar slid up and then back down, and text input was inactive
* Tapped on the screen to turn text input on, tapped on the keyboard bar to bring up the full on-screen keyboard, and text input was active
* Pressed a key on the physical keyboard, the on-screen keyboard closed, the key press and release was delivered (with no text input) and then the keyboard bar slid up, and text input was active again

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

(cherry picked from commit c3288d113e)
2023-08-02 01:17:15 -07:00
Sam Lantinga
335e9c769a Only pass keypresses up the responder chain when text input is active
This is another attempt to make sure we don't cause beeps from unhandled key presses while still allowing full text input functionalty.

If this isn't selective enough, we might need to go up the responder chain to see what's going to handle the event before passing it along.

Fixes https://github.com/libsdl-org/SDL/pull/6962

(cherry picked from commit a8abe612ed)
2023-08-02 01:14:07 -07:00
Sam Lantinga
5e9320f6b5 Revert "Stop beep when running iOS apps on ARM-based Macs"
This reverts commit bbf38bbbc3, which prevented text input from working when a hardware keyboard was connected, since key strokes don't get to the text input field.

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

(cherry picked from commit f5ea6ae18d)
2023-08-02 01:12:21 -07:00
Sam Lantinga
e2afc1f37a Fixed build 2023-08-01 18:58:21 -07:00
Sam Lantinga
2468fccf7f Fixed crash if a display is enumerated twice
This can happen if a monitor is in the process of becoming primary because another monitor was disconnected.

(cherry picked from commit 07578fde3d)
2023-08-01 18:30:24 -07:00
Ryan C. Gordon
dc5dda0f31 cocoa: Ignore first mouse motion event after enabling relative mode.
Fixes #7918.
2023-08-01 18:34:03 -04:00
Ryan C. Gordon
3030fd815c x11: Blocking for window maximization should wait 100 ms, not 1000.
Reference Issue #7070.
2023-08-01 13:55:04 -04:00
Ryan C. Gordon
5c3df60ec9 Revert "x11: check if window size/position has changed during SDL_ShowWindow."
This reverts commit aa536217b3.
2023-08-01 12:10:52 -04:00
Sam Lantinga
8825fbf713 Fall back to Xlib if XRandR isn't available
This fixes video initialization on headless systems with VNC

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

(cherry picked from commit 71099149b8)
2023-07-31 14:41:34 -07:00
Mathieu Eyraud
82cd3bfe1c Add missing break
(cherry picked from commit 0500fca00c)
2023-07-29 17:33:10 +03:00
Ozkan Sezer
7cc3248044 minor os/2 stuff merged from the bitwiseworks' fork 2023-07-28 23:55:50 +03:00
Ozkan Sezer
3e341021c3 fixed typo in prev. patch. 2023-07-28 07:35:14 +03:00
Ozkan Sezer
1ecf77d630 test/testnativecocoa.m: fixed deprecation warnings. 2023-07-28 07:21:14 +03:00
Sam Lantinga
507be6c3f8 Sorted controller list
(cherry picked from commit 3174d0b970)
2023-07-27 12:49:24 -07:00
Max Maisel
f4561db69a Add Steam Deck controller mapping to database.
This adds support for the back paddles, and the "..." key
which are not automatically detected.
* "Back" is mapped to the top left "two windows" key.
* "Start" is mapped to the top right "hambuger menu" key.
* "Guide" is mapped to the "Steam" key.
* The "..." key is just a generic button.

When looking at the screen, paddles are number
* P1: Top right
* P2: Top left
* P3: Bottom right
* P4: Botom Left

The new controller mapping was created with the SDL3 gamepadmap tool.

(cherry picked from commit 27b8abb056)
2023-07-27 12:49:24 -07:00
Anonymous Maarten
2b0ca87119 SDL_atomic.h: __ARM_ARCH is not always defined for an arm platform
e.g. riscos toolchain
(cherry picked from commit 8105f1d5b5)
2023-07-26 20:39:20 +03:00
Sam Lantinga
37d1ab83c5 Make sure the mouse and keyboard focus is cleared when a window is hidden
(cherry picked from commit a16b241b89)
2023-07-25 11:50:54 -07:00
Ozkan Sezer
e7761aec37 update docs/README-os2 after the last os/2 audio patch. 2023-07-25 20:51:32 +03:00
Ozkan Sezer
890bee64a4 os2 audio refactoring and capture support
- Fixed audio device detection and usage.
- Implemented audio capture support
- Refactored buffer handling to separate pointers to fill and drain buffers.

Based on patches by josch1710 and Lars Erdmann:
https://github.com/bitwiseworks/SDL2-os2/pull/7
2023-07-25 11:40:02 +03:00
Sam Lantinga
ba0c270c7a Removed invalid assert in testatomic
(cherry picked from commit 8adab0b88a)
2023-07-22 18:40:31 -07:00
Anonymous Maarten
322dbdde4e ci: bump mymindstorm/setup-emsdk to latest tag 2023-07-22 17:36:27 +02:00
Weng Xuetian
64294e4560 Remove the unimplemented CloseIC in fcitx module
This call is actually a left-over when porting from fcitx4 service to the new org.freedesktop.portal.Fcitx supported by both fcitx4/fcitx5. CloseIC is actually never a part of the new interface on org.freedesktop.portal.Fcitx. It cause any issue user visible effect.
2023-07-20 13:37:13 -07:00
Sam Lantinga
c4c034ca4b Don't fail to create a window if it's too large, just clamp it to the max instead
Some window is better than no window...

(cherry picked from commit 4a18893c73)
2023-07-17 17:48:56 -07:00
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 bd4f155bbb)
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 16dd5f0da4)
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 2fef0be2f6)
2023-07-17 17:36:41 -07:00
Ozkan Sezer
4b2b475ac2 remove unused vulkan/*.hpp files.
(cherry picked from commit 611b3dd1fd)
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 6c2472d459)
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 b40fb5c51e)
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 6aef14fb2d)
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 956b18f50c)
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 1903d7b1bf)
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 41882a1acb)
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 dfc5e6964e)
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 092a4b780c)
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 80e1c75e1c)
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 ea60da5b94)
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 f047e178b6)
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 efed24850a)
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 785f57eb91)
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 f4bd17deee)
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 ecbbac7c72)
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 cc254d885d)
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 c63aa9545e)
2023-07-05 22:17:15 -07:00
Sam Lantinga
2a946832ba Added GetClientScreenRect() and fixed build for C89 compilers
(cherry picked from commit 61ff86617a)
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 cc49f1e279)
2023-07-05 10:17:19 -07:00
expikr
f75c0e3204 center cursor to client area (excludes titlebar thickness)
(cherry picked from commit a7326b9396)
2023-07-05 10:12:53 -07:00
Sam Lantinga
4d4c81d438 Revert "Update SDL_windowswindow.c"
This reverts commit d0fdf6207b.

(cherry picked from commit f49f1434b9)
2023-07-05 09:22:56 -07:00
expikr
1e6c128c4c Update SDL_windowswindow.c
(cherry picked from commit d0fdf6207b)
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 619f65af0c)
2023-07-03 17:42:16 -07:00
Sam Lantinga
d65185a6a7 Made error handling more consistent in D3D12_RenderReadPixels()
(cherry picked from commit 90262f274a)
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 304d425f99)
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 c0bd18f023)
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 675fc8c38f)
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 5b5b67df20)
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 baa9c57581)
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 35292d7dba.

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 9ee1200e6f)
2023-06-27 07:50:00 -07:00
Narr the Reg
950ff0056a hidapi: switch: Handle MCU input reports
(cherry picked from commit 425062c123)
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 87e916dd21)
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 44bae1e8a9)
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 3694dabe7c)
2023-06-21 10:40:02 -07:00
Sam Lantinga
657c346556 Apply DPI scale to mouse coordinates in SDL_WarpMouseInWindow()
Fixes https://github.com/libsdl-org/SDL/issues/7855
2023-06-21 08:44:19 -07:00
Sam Lantinga
ceece918e4 Updated to version 2.29.0 for development 2023-06-20 11:50:19 -07:00
Sam Lantinga
ffa78e6bea Updated to version 2.28.0 for release 2023-06-20 11:00:20 -07:00
Simon McVittie
4ce5c3a694 ibus: Handle error when getting the D-Bus machine ID
It is possible for retrieving the machine ID to fail, either because
dbus was installed incorrectly (machine ID absent or corrupt), or in
32-bit builds, because stat() on the machine ID fails with EOVERFLOW
if it has an out-of-range timestamp or inode number.

dbus has historically treated this as a faulty installation, raising
a warning which by default causes the process to crash. Unfortunately,
dbus_get_local_machine_id() never had a way to report errors, so it has
no alternative for that (bad) error handling.

In dbus >= 1.12.0, we can use dbus_try_get_local_machine_id() to get
the same information, but with the ability to cope gracefully with
errors. ibus won't work in this situation, but that's better than
crashing.

(cherry picked from commit 91198baed4)

Mitigates: https://github.com/ValveSoftware/steam-for-linux/issues/9605
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-20 09:45:25 -07:00
Sam Lantinga
a3d4fd71c3 Added support for blitting SDL_PIXELFORMAT_INDEX1LSB
Fixes https://github.com/libsdl-org/SDL/issues/7844
2023-06-19 08:36:30 -07:00
Sam Lantinga
d97423ebab Fixed DualSense controllers not being picked up by the HIDAPI driver
The hidraw device may take additional time to get the correct permissions for us to open it. In my tests on Steam Deck hardware, this ranges between 5-8ms.

(cherry picked from commit c6ee9780df)
2023-06-18 12:22:06 -07:00
Sam Lantinga
333a03f1ec We don't know in advance whether a device is connected over Bluetooth in SDL2 2023-06-17 13:15:07 -07:00
Sam Lantinga
5b8fc907df Added support for the GameSir G4 Pro
We can't read device info or IMU calibration from this controller, and it has no gyro or accelerometer, but is otherwise perfectly functional.

(cherry picked from commit f168f9c813)
2023-06-17 13:07:03 -07:00
Eric Wasylishen
76392f4fe1 Handle DPI scaling in SDL_GetWindowSurface
Fixes DPI awareness of testdrawchessboard (previously, the surface was
being created in points instead of pixels, resulting in the demo app
only drawing in a corner of the screen on High-DPI displays)

*_CreateWindowFramebuffer()/*_UpdateWindowFramebuffer(): are updated
to use SDL_GetWindowSizeInPixels instead of SDL_GetWindowSize() or
window->w/window->h.

Most of the _CreateWindowFramebuffer backends are untested except
for Windows.

Fixes #7047

(cherry picked from commit 67c91353e0)
2023-06-14 17:23:54 -07:00
Sam Lantinga
3a5abee512 Removed unused function
(cherry picked from commit 73927b0948)
2023-06-14 15:16:44 -07:00
Sam Lantinga
e7ee375f22 Fixed third-party Nintendo Switch Pro controllers shutting down when we try to set the home LED.
This fixes the PDP Afterglow Wireless Deluxe Controller.

(cherry picked from commit 0c16f4faf0)
2023-06-14 15:15:27 -07:00
Sam Lantinga
4aec54988c Allow switching licensed Nintendo Switch Pro controllers into gyro input mode
(cherry picked from commit 8c95bd814b)
2023-06-14 15:13:11 -07:00
Sam Lantinga
271e03f0d7 Added support for the PowerA Fusion Pro Wireless Controller in Bluetooth mode
This controller shows up with a VID/PID of 0, but has full functionality over Bluetooth

(cherry picked from commit cdfc0c5a33)
2023-06-14 15:12:56 -07:00
Sam Lantinga
d4f9be4416 Updated to version 2.27.1 for release candidate 2023-06-13 19:44:26 -07:00
Sam Lantinga
1f5b21ead5 Removed more Linux Xbox mappings in favor of the automatic mapping
This fixes the Xbox Series X share button on Linux 5.x kernels.

(cherry picked from commit 0f4b15e16b)
2023-06-13 17:06:24 -07:00
Sam Lantinga
35c7884929 Use the automatic mapping instead of a hardcoded one for Xbox controllers on Linux
This is much more robust and able to dynamically create a mapping for Xbox One S, Xbox Series X, and Xbox Elite 2 controllers.

(cherry picked from commit 9567989eb3)
2023-06-13 17:06:21 -07:00
Sam Lantinga
3f6c4ec6d0 Cleanup for previous change, fixing typos, etc.
(cherry picked from commit 883b0f4071)
2023-06-13 17:04:54 -07:00
Sam Lantinga
fc72f12e7f Added automatic mapping support for Xbox controllers on the 6.x Linux kernels
This automatically adds support for the share button and paddles when present.

(cherry picked from commit db1d4d3d76)
2023-06-13 17:04:17 -07:00
Ozkan Sezer
681f67d353 fixed build after commit d2372c8538. 2023-06-14 00:25:50 +03:00
Sam Lantinga
d2372c8538 Added automatic mapping for Xbox Elite paddles using the xpadneo driver
We can't actually tell yet whether a controller has paddles, so this code isn't effective, but I'll file an upstream issue and see if we can get that resolved.

(cherry picked from commit b0677f476f)
2023-06-13 10:12:07 -07:00
Sam Lantinga
7db23f4ef1 Fixed joystick vendor detection in Linux automatic gamepad mapping
(cherry picked from commit 071d1e29dd)
2023-06-13 10:11:55 -07:00
Simon McVittie
36ff6327b0 linux: Improve gamepad mapping heuristic to accept Android conventions
This heuristic for gamepads without a more specific mapping already
tried two incompatible conventions for handling triggers: the Linux
Gamepad Specification uses hat switch 2 for the triggers (for whatever
reason), but the de facto standard set by the drivers for older Xbox
and Playstation controllers represents each trigger as the Z-axis of
the nearest analog stick.

Android documentation encourages Bluetooth gamepad manufacturers to use
a third incompatible convention where the left and right triggers are
represented as the brake and gas pedals of a driving simulator
controller. The Android convention also changes the representation of
the right stick: instead of using X and Y rotation as a second pair
of axes, Android uses Z position as a second horizontal axis, and
Z rotation as a second vertical axis.

Try to cope gracefully with all of these. This will hopefully resolve
the issue described in #5406 (when using unpatched kernels).

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit cf1dc66e2c)
2023-06-13 05:46:01 -07:00
Simon McVittie
26a38a0b20 linux: Reduce magic numbers when mapping gamepad axes
The bitfield `mapped` has two different sets of meanings, depending
whether we're setting up the triggers or the d-pad. Represent them
as symbolic constants rather than opaque integers.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit c4d49fadd4)
2023-06-13 05:45:43 -07:00
Sam Lantinga
b3e1fd97b8 Fixed enumerating Steam Controllers on iOS
(cherry picked from commit dec0dbff13)
2023-06-13 05:44:34 -07:00
Sam Lantinga
c77aaa5d99 Fixed n3ds build
(cherry picked from commit d95dbe78bb)
2023-06-12 15:41:09 -07:00
Sam Lantinga
e4e0a12901 Reduce the chance of destroying the joystick mutex while it's in use
Fixes https://github.com/libsdl-org/SDL/issues/7811

(cherry picked from commit 6390165fd4c193631d6780758a4aeec0d02b90eb)
2023-06-12 15:31:16 -07:00
Ryan C. Gordon
2afb49ba9a cocoa: Warp mouse to center of window before enabling relative mouse.
This prevents the case where the mouse might be at the edge of the
window when enabling relative mode, which confuses macOS, at it
might believe the user is attempting to resize the window.

Fixes #6994.
2023-06-11 12:47:26 -04:00
Ozkan Sezer
154ad6faa9 SDL_dynapi.c: minor cosmetics. 2023-06-10 20:50:10 +03:00
Sam Lantinga
2aa8525ecb Fixed build 2023-06-10 09:29:09 -07:00
Sam Lantinga
36033e3832 Make it clear that you can't mix 2D rendering and the window surface API
Also added functions to query and destroy the window surface so you can switch between modes if you want.

See https://github.com/pygame-community/pygame-ce/issues/2190 for more details.
2023-06-10 08:54:36 -07:00
Sam Lantinga
320f3fffbe Fixed querying device info on the MOBAPAD M073
The query packet needs to contain valid rumble data in order to be accepted by the controller.

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

(cherry picked from commit 5490873daa)
2023-06-09 18:43:14 -07:00
Sam Lantinga
30b4d90f1c Only update the serial number if it hasn't already been set
This fixes the serial number for Nintendo Switch Pro, which is queried from the hardware in device initialization, and was later clobbered by the USB string which isn't correct.

(cherry picked from commit 2042e9c4e3)
2023-06-09 17:36:06 -07:00
Sam Lantinga
1cdd6dc829 Fixed reading input from the Razer Atrox Arcade Stick using Windows Gaming Input
(cherry picked from commit 172cfca51332a845abf9c141ae56aa121fe4ada5)
2023-06-09 14:36:12 -07:00
Ozkan Sezer
f5b3247aae further mouse relative motion fix for os/2 (thanks Andrey Vasilkin) 2023-06-08 03:40:32 +03:00
Ryan C. Gordon
aa536217b3 x11: check if window size/position has changed during SDL_ShowWindow.
Fixes #4216.

(cherry picked from commit 49b5cfa6c5)
2023-06-07 15:46:59 -04:00
Anonymous Maarten
14f4fd3f11 git commit -m "cmake: set maximum policy to 3.5
This fixes the following warning when configuring with CMake 3.27+:
```
CMake Deprecation Warning at CMakeLists.txt:3190 (cmake_minimum_required):
Compatibility with CMake < 3.5 will be removed from a future version of
CMake.

Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
```
2023-06-07 20:35:32 +02:00
Ozkan Sezer
b1324fbc9f fixed os/2 mouse relative motion not working (thanks Andrey Vasilkin,)
for issue reported at https://github.com/bitwiseworks/SDL2-os2/issues/5
2023-06-05 11:50:50 +03:00
Sam Lantinga
4700fbcbdf Don't bother re-encoding Latin1 characters in the ASCII range
(cherry picked from commit 6150b5b3cb)
2023-06-04 05:40:07 -07:00
Eddy Jansson
2660da6f5c Always allocate zt in output of SDL_iconv_string()
Before this, the function could not be used on buffers,
as it would not account for the zero-termination unless
it was included in the input.

(cherry picked from commit 5f5abb6805)
2023-06-04 05:17:15 -07:00
Sam Lantinga
7c86d96e86 Fixed SDL_iconv_string() truncation when handling SDL_ICONV_E2BIG
(cherry picked from commit c369b90019)
2023-06-04 05:14:44 -07:00
Ozkan Sezer
a1dea11d32 fix MSVC build error. 2023-06-04 14:29:10 +03:00
Sam Lantinga
bfef7c302c Only convert the result of XLookupString() if it's not already UTF-8
Fixes https://github.com/libsdl-org/SDL/issues/7766

(cherry picked from commit 491ae20d96)
2023-06-04 02:54:21 -07:00
Sam Lantinga
b9d1c483b9 Fixed building with the 16.1.4479499 Android toolchain 2023-06-03 23:55:56 -07:00
Sam Lantinga
dc94cca8dd Fixed typo in cherry-pick (thanks @HadesD!) 2023-06-03 11:57:08 -07:00
Sam Lantinga
97fe777ab4 Steam uses a different VID/PID for the Steam Virtual Gamepad on Windows
(cherry picked from commit 6815e75caf)
2023-06-03 11:40:58 -07:00
Sam Lantinga
f1bad83a21 Revert "Fixed detection of the Steam Virtual Gamepad on macOS"
This reverts commit 7aa28ce279.

Steam has been updated to send a version of 1 to avoid conflicts with controllers that report a version of 0.
2023-06-03 11:36:38 -07:00
Sam Lantinga
7aa28ce279 Fixed detection of the Steam Virtual Gamepad on macOS
(cherry picked from commit 5fcd70578b)
2023-06-02 18:39:22 -07:00
Sam Lantinga
c89a460672 Fixed build if SDL_JOYSTICK_RAWINPUT_MATCHING isn't enabled
(cherry picked from commit 7c55845c80)
2023-06-02 11:20:55 -07:00
Sam Lantinga
e3bfacde3e Don't use raw input while Remote Desktop is active
Raw input will not send game controller events while Remote Desktop is active, so dynamically switch between XInput and raw input when Remote Desktop state changes.

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

(cherry picked from commit 767507fcf6)
2023-06-02 11:19:44 -07:00
Sam Lantinga
9c05098ed9 Fixed WGI immediately being correlated with raw input devices with no input
The at rest match state is 0x0000008800000000, not 0

(cherry picked from commit e8b5b4881c)
2023-06-02 09:39:57 -07:00
Alibek Omarov
c395240425 hints: clarify support for comma-separated values for QtWayland orientation that's available since 2.0.22
Signed-off-by: Alibek Omarov <a1ba.omarov@gmail.com>
2023-06-02 07:41:08 -07:00
Alibek Omarov
68e3e99087 wayland: reset orientation bitmask before reading values from hint on QtWayland
Signed-off-by: Alibek Omarov <a1ba.omarov@gmail.com>
2023-06-02 07:41:08 -07:00
Ozkan Sezer
7f7ea909bc testautomation_guid.c: fix integer warning in 32 bit builds. 2023-05-31 04:50:02 +03:00
Ryan C. Gordon
379a6f4dab x11: Attempt to wait for SDL_MaximizeWindow to complete before returning.
Fixes #7070.
2023-05-30 17:04:31 -04:00
Ryan C. Gordon
d275851dfb windows: Don't allow non-resizable windows to be maximized.
Fixes #6346.
2023-05-29 14:47:53 -04:00
Ryan C. Gordon
a9ded76dff VisualC: turn on multi-processor compilation.
This makes SDL2 build in 12 seconds, instead of 50, on my Windows
workstation, with Visual Studio.
2023-05-29 14:47:52 -04:00
Sam Lantinga
5007b96363 Fixed build warning 2023-05-28 19:23:56 -07:00
Sam Lantinga
b2e88ecfeb Disable SDL_JOYSTICK_RAWINPUT_XINPUT
Apparently when using the Xbox One Wireless Adapter, using XInput at the same time as raw input will cause the controller to turn off immediately after connecting. This appears to be a bug in the Windows 11 driver stack, but since WGI provides all the extended functionality we need, this can be turned off for now.

Fixes https://github.com/libsdl-org/SDL/issues/3468
2023-05-28 18:41:21 -07:00
Anonymous Maarten
d6cd450624 windows: SDL_Delay expects a 32-bit integer 2023-05-27 02:34:41 +02:00
Anonymous Maarten
e875775940 windows: SDL_immdevice needs SDL_timer.h include 2023-05-27 02:10:18 +02:00
Anonymous Maarten
72606d97e6 cmake: allow #include "SDL2/SDL.h.h" when using SDL2 as subproject 2023-05-27 01:48:30 +02:00
Ryan C. Gordon
48e71ae87b wasapi: Deal with HDMI or DisplayPort-based audio devices.
They can vanish for UP TO EIGHT SECONDS...!

This is for devices that connect to HDMI/DisplayPort/etc, where it
presumably has to wait for a display to get up and running before it
can play audio through it, so one can see the audio device fail when
changing display modes, or the system returning from sleep. Since this
can be triggered by a game changing video resolutions at startup (either
before or after opening the audio device!), it's important to deal with.

In normal conditions, it shouldn't take this long to open or recover an
audio device, but this is better than unexpectedly losing the device
in this situation.

Fixes #7044.
Fixes #5571.
2023-05-26 19:15:28 -04:00
Sam Lantinga
7308325559 Added support for printing wide strings using "%ls" syntax
(cherry picked from commit 128ca70160)
2023-05-26 14:59:30 -07:00
Ozkan Sezer
9dea06f5b5 fix mingw build failures in CI with clang-tidy.
(cherry-picked from commit a8a72de6fb)
2023-05-26 23:55:04 +03:00
Anonymous Maarten
c68976360d Fix -Wunused-function warning when configuring with -DSDL_X11_XINPUT2=OFF 2023-05-26 15:28:58 -04:00
Ryan C. Gordon
a535cc62a0 video: Only specify some GL context attributes if not the explicit default.
Just in case it upsets some OpenGL drivers unnecessarily.

Fixes #7730.

(cherry picked from commit d4bc393efe)
2023-05-25 10:10:03 -04:00
Sam Lantinga
63b8af3558 Disable unused local typedefs warning
This triggers on gcc 4.8.4 for compile time asserts inside of functions

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

Co-authored-by: Ozkan Sezer <sezeroz@gmail.com>
2023-05-24 04:45:40 +03:00
Sam Lantinga
3f1fd5abff Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
Sam Lantinga
92f72682e7 Document the Android SDK versions checked in Java code
(cherry picked from commit b48b1ce500)
2023-05-23 08:45:43 -07:00
Frank Praznik
891c89eeb8 Fix unused variable warnings 2023-05-23 11:15:48 -04:00
Frank Praznik
e2b8d96529 wayland: Validate surfaces and window data before sending touch events
Ensure that incoming touch events originate from valid surfaces owned by SDL and have proper window data before forwarding them to the touch subsystem, or the window focus pointer that is sent with the event may not be a pointer to an SDL window.
2023-05-23 10:31:28 -04:00
Sam Lantinga
78a92b4f9d Fixed duplicate Joy-Con controllers on macOS
If both Apple and HIDAPI drivers see the controller, HIDAPI will be preferred.

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

(cherry picked from commit 61ef4efdfa)
2023-05-22 14:52:05 -07:00
Sam Lantinga
7b2b99a996 Fixed handling the Saitek P3600, which doesn't use the Xbox 360 controller protocol
(cherry picked from commit cf0abf9911)
2023-05-22 12:42:05 -07:00
Sam Lantinga
b6d051e226 Fixed reporting backspace key if there is no text in the edit buffer (thanks @312937!)
This workaround isn't necessary at API 30 and above.

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

(cherry picked from commit c971795954)
2023-05-22 12:01:52 -07:00
Sam Lantinga
0ad0347acb Use numeric codes for Android versions, to avoid SDK dependencies
(cherry picked from commit 3f6b2d1a61)
2023-05-22 12:01:52 -07:00
Sam Lantinga
a2f4783e75 Don't map the top keyboard row to numbers when using the one-handed DVORAK layouts (thanks @tormol!)
Fixes https://github.com/libsdl-org/SDL/pull/5127
2023-05-22 11:30:42 -07:00
Caleb Cornett
2001a891c4 Fix Xbox link error from IsRectEmpty
(cherry picked from commit 376a3cd100)
2023-05-21 19:11:25 -07:00
M. P. Halpin
1ee9a437f9 Stop beep when running iOS apps on ARM-based Macs
(cherry picked from commit bbf38bbbc3)
2023-05-20 11:21:13 -07:00
Sam Lantinga
69644346ac Added the hint SDL_HINT_ENABLE_SCREEN_KEYBOARD to control whether the on-screen keyboard should be shown when text input is active
Fixes https://github.com/libsdl-org/SDL/issues/7160
2023-05-20 11:09:36 -07:00
Sam Lantinga
00b87f1ded Make sure the sentinel is at the end of the current event pump cycle
If we're waiting, it's possible to not get any events, then add the sentinel, then pump again and then add another sentinel. We want to make sure we only have one sentinel and that it's at the end of the currently pumped events.

Testing:
* Verified test case in https://github.com/libsdl-org/SDL/issues/6539
* Verified test case in https://github.com/libsdl-org/SDL/issues/5350

Fixes https://github.com/libsdl-org/SDL/issues/6539
2023-05-20 10:27:48 -07:00
Sam Lantinga
beca41480d Undo name change for the controller list
(cherry picked from commit f60622c510)
2023-05-19 14:27:06 -07:00
Sam Lantinga
43b12fd9bc Moved the controller list out so it can be included elsewhere
(cherry picked from commit 24007b00b2)
2023-05-19 14:23:57 -07:00
Sam Lantinga
e8ec8ba1d4 Added support for the Astro C40 in Xbox 360 mode
(cherry picked from commit a4b4dff4a2)
2023-05-19 14:23:57 -07:00
Ozkan Sezer
feeec90873 test/testgles2_sdf.c: type fixes from commit e26e893daf, style clean-up. 2023-05-19 17:00:24 +03:00
Anonymous Maarten
d361acdd4e testgles2_sdf: build with CMake + fix build errors/warnings 2023-05-19 15:24:52 +02:00
Ozkan Sezer
92a487f2e4 style fixes for SDL_PROC macros. 2023-05-19 14:10:02 +03:00
Ryan C. Gordon
df9d0fb332 power: On Linux, compare status strings as case-insensitive.
In case something reports "Device" when we expected "device", etc.

Reference Issue #6835.
2023-05-18 13:26:55 -04:00
Ryan C. Gordon
4a0b9522b6 audio: Load .WAV files with format->blockalign==0.
In theory this is illegal, but legit wavefiles in the field do it, and
it's easy to bump it to 1 for general purposes.

Formats with more specific alignment requirements already check for them
separately.

Fixes #7714.

(cherry picked from commit 2e646c7141)
2023-05-17 20:09:28 -04:00
Ryan C. Gordon
32999798e0 dynapi: Accept a comma-separated list of libraries to attempt to load.
First one to load and have the necessary symbol is the one we accept,
if any. Once we accept one, we won't try loading others.

Fixes #7613.
2023-05-17 20:03:17 -04:00
valid-ptr
424bc4bcf7 SDL emscripten port: preventDefault should not be called on mousedown. Otherwise mouseup will not be fired outside iframe in Chrome-based browsers 2023-05-17 12:30:32 -07:00
Ryan C. Gordon
0eea92c8fc blit: Add a case for 8-bit blits that sdl12-compat exposed.
sdl12-compat can get into a state where a color-keyed surface is
marked for blending, but wants to blend with full alpha (which
is the same as _not_ blending), so rather than fail to find a
blitter in that case, it just selects the colorkey blitter.

Reference https://github.com/libsdl-org/sdl12-compat/issues/233
2023-05-16 14:38:44 -04:00
Sam Lantinga
d42c303b24 Check to make sure the Windows joystick device has buttons and axes
This fixes incorrectly detecting the ROG CHAKRAM X mouse as a game controller on Windows 10

(cherry picked from commit 642504bc59)
2023-05-15 21:44:20 -07:00
Sam Lantinga
237348c772 Changed all variadic macros into fixed (thanks @Wohlstand!) 2023-05-10 06:29:35 -07:00
Ryan C. Gordon
86786ed544 coreaudio: Flush/stop the AudioQueue before disposing of it.
Otherwise, a CoreAudio thread lingers forever, and coreaudiod eats CPU
until the SDL process terminates.

Fixes #7689.
2023-05-08 14:25:01 -04:00
Sam Lantinga
de93728674 Removed redundant __powerpc__ check
(cherry picked from commit b6df25c334)
2023-05-06 08:44:48 -07:00
Jeremy Rand
5e74365e55 SDL_blit_N.c: Move ppc64le swizzle outside of loop
An in-place swizzle mutation was erroneously inside of a loop, which
caused each consecutive 4-pixel vector to alternate between correct and
incorrect endianness.

The bug was introduced in 715e070d29.

Thanks to RobbieAB for reporting the bug.

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

(cherry picked from commit 9142292f4a)
2023-05-06 08:39:59 -07:00
Loc(Elliot)
3e64fec9f4 Fix bug memory acess
Bitmap is not initialized before use, that cause segmentation fault on function use it. Fix by allocate memory before use.
2023-05-04 07:01:25 -07:00
Sam Lantinga
707e9397ca Removed memset_pattern4() from SDL headers
This requires including string.h, which isn't always done, so this commit simplifies dependencies on macOS

Fixes https://github.com/libsdl-org/SDL/issues/3657
2023-04-30 21:38:29 -07:00
Sam Lantinga
f72213c4ac By default, OpenBSD uses Linux controller mappings
Fixes https://github.com/libsdl-org/SDL/issues/7609

(cherry picked from commit 255c3b7c82)
2023-04-29 17:10:46 -07:00
Frank Praznik
132b88749c wayland: Destroy proxy wrappers and callbacks before event queues
Destroy any proxy wrappers and callbacks before the associated event queues to silence libwayland warnings about destroying the queues while proxies are still attached.
2023-04-27 13:08:59 -04:00
Linus Probert
8b39eb9b1f wayland: Fixes a memory leak wheere primary selection isn't freed
(cherry picked from commit 43f65a6ef0)
2023-04-24 12:00:16 -07:00
Ozkan Sezer
0f2322acfc hidapi/mac: replace sprintf uses with snprintf.
Reference issues:
-  https://github.com/libusb/hidapi/pull/509
-  https://github.com/libusb/hidapi/pull/511

(cherry picked from commit ae9119c36b)
2023-04-24 10:46:49 -07:00
Ozkan Sezer
5f344c17c2 hidapi/mac: import mainstream commit c1b9d2ad
c1b9d2ad98
Properly handle the close of run loop on macOS
(https://github.com/libusb/hidapi/pull/522)
- as per documentation `kCFRunLoopRunStopped` should be handled once the runloop is closed via `CFRunLoopStop`;
- if it is not handled - a race condition/crash may happen on the latest macOS when a device gets disconnected while being open;

(cherry picked from commit 62d1a2c836)
2023-04-24 10:46:49 -07:00
Mingjie Shen
a688ecd6fa Check return value of SDL_malloc()
(cherry picked from commit a4604cb0d6)
2023-04-23 12:28:54 -04:00
Sam Lantinga
120bc77e91 Report PS3 accelerometer values in m/s2 instead of Gs
(cherry picked from commit 0467301baf)
2023-04-19 13:12:38 -07:00
Anonymous Maarten
535ec1a921 cmake: allow users of sdl2-config.cmake to not add -mwindows to the link options 2023-04-18 14:10:12 -04:00
Sam Lantinga
7ec9a4385a More defensive coding against dangling device pointers
(cherry picked from commit acadb6f873)
2023-04-06 13:21:44 -07:00
Sam Lantinga
6d7269815b Clarified the expected sensor value when a game controller is at rest
(cherry picked from commit 1a20ccb289)
2023-04-06 09:55:43 -07:00
Sam Lantinga
cb0cf14155 The latest Armor-X Pro firmware update fixes the sign on the Z axis of the sensors
(cherry picked from commit 558bbbb07a)
2023-04-06 09:55:39 -07:00
Cyril Dubet
7914234b26 Fix key code names for ISO keyboard layouts
(cherry picked from commit 60dcaff7eb)
2023-04-05 17:03:42 -07:00
Sam Lantinga
51dcc3bb0b The macOS minimum deployment target is now 10.11
Xcode 14.3 does not allow targeting 10.9, the minimum recommended version is 10.13 and the minimum possible version is 10.11.

(cherry picked from commit 73b2faea4e)
2023-04-05 11:40:50 -07:00
Sam Lantinga
f6363fde9a Fixed crash if joystick->hwdata != NULL && device->driver == NULL
This should never happen, but we're seeing it in the wild, so make sure that we can never call into a NULL device driver.

(cherry picked from commit e13b74ccf0)
2023-04-05 11:24:55 -07:00
Ozkan Sezer
f633915443 fix build after commit 22685556e5. 2023-04-05 02:10:56 +03:00
Sam Lantinga
57043825ba Fixed crash if dbus can't be initialized
(cherry picked from commit cf2c6fa58d)
2023-04-04 12:35:30 -07:00
Sam Lantinga
22685556e5 Don't probe for PlayStation controllers when we already know the controller type
Fixes https://github.com/libsdl-org/SDL/issues/7556

(cherry picked from commit 655a07bdd8)
2023-04-04 12:35:20 -07:00
Sam Lantinga
f444eac557 Fixed analog triggers on the DualSense controller
(cherry picked from commit a67d410501)
2023-04-04 12:35:20 -07:00
Jerome Duval
eb0d214c17 Haiku: use a BLooper for events.
only create a BApplication when it doesn't already exist.
2023-03-30 10:20:11 -07:00
Frank Praznik
55f74c3285 x11: Don't allow the changing of certain scancodes
The X11 driver uses scancodes derived from keysyms to map the scancodes for extended keys to the physical keyboard, however, this can be incorrect when using certain XKB options (e.g. caps:swapescape), which changes the keysyms emitted by certain keys, but does not imply that their scancodes or positions should be altered. Mark selected scancodes as being non-remappable so that their scancodes aren't changed by toggling XKB mapping options.
2023-03-30 11:20:28 -04:00
Wohlstand
2aeac8de51 include: Fixed a C++-style single line comment.
78725dc0cd
2023-03-29 21:43:15 +00:00
Stephen Kitt
6d01ffcd94 Split up CFLAGS construction so it can be overridden
CFLAGS currently takes care of two aspects of the build: optimisation
and debug symbols on one hand, the include path on the other. The
former should be overridable by users, the latter shouldn't.

This patch moves the include path flag to CPPFLAGS, which is
appropriate for pre-processor directives. This leaves CFLAGS with only
overridable flags.

Based on a patch by Roflcopter4:
https://github.com/joncampbell123/dosbox-x/pull/3850

Signed-off-by: Stephen Kitt <steve@sk2.org>
2023-03-29 07:26:34 -07:00
Sam Lantinga
c2ee45f5ff The Xinmotek Controller is used in multiple products with different mappings
The mapping included here is for the Ultimate Atari Fight Stick

(cherry picked from commit f1099f8e70)
2023-03-28 15:16:07 -07:00
Sam Lantinga
0bf63175ab Fixed gyro values for the Armor-X Pro controller
(cherry picked from commit 8df7b4d853)
2023-03-28 14:44:59 -07:00
Sam Lantinga
d043c8535b Fixed the accelerometer and gyro axes for the Armor-X Pro controller
(cherry picked from commit 37517557ae)
2023-03-28 12:29:33 -07:00
Anonymous Maarten
d2a2787783 Fix remaining -Wimplicit-fallthrough warnings 2023-03-28 19:24:33 +02:00
Anonymous Maarten
85fecbb10b video: fix warnings about unused variables when building without duff's loop
(cherry picked from commit 0c3777d566)
2023-03-28 10:21:36 -07:00
Anonymous Maarten
ec3e333fb8 testautomation_audio: fix -Wimplicit-fallthrough warning
(cherry picked from commit 11c70406c3)
2023-03-28 10:21:36 -07:00
Anonymous Maarten
1402d13556 video/blit: fix -Wimplicit-fallthrough warnings
(cherry picked from commit f7961b7c9a)
2023-03-28 10:21:35 -07:00
Anonymous Maarten
03c239ded9 testsurround: fix channel names
Used table in include/SDL3/SDL_audio.h as reference.

(cherry picked from commit e1b8a03239)
2023-03-28 10:21:35 -07:00
Sylvain
16c9bad786 Safety fix: clear "_this->wakeup_window" when destroying the window
(cherry picked from commit c838ccf0e3)
2023-03-28 08:29:24 -07:00
Sylvain
6574e5eb57 Safety fix: clear "_this->current_glwin" when destroying the window
(cherry picked from commit 0c048d98af)
2023-03-28 08:29:23 -07:00
Sylvain
4fa21ee5ed Fixed bug #7515 - Window still grabbed after destroying 2023-03-28 09:43:34 +02:00
Sam Lantinga
8bfbda1eab Fixed the accelerometer sensitivity for the Armor-X Pro controller
(cherry picked from commit 8029a767ee)
2023-03-27 14:33:59 -07:00
Sam Lantinga
93c289b475 Increased precision for PS4 sensor data conversion
(cherry picked from commit 3340864786)
2023-03-27 14:33:56 -07:00
Pierre Wendling
ed5a343d25 SDL_hidapi_steam.c: Fix compilation under c2x.
When N2935 is implemented, the enum breaks compilation. Use a #define of
the SDL booleans instead.

(cherry picked from commit 975039ce0d)
2023-03-27 09:02:46 -07:00
Pierre Wendling
0081174689 Fix clang-tidy error on LLVM 16.
Starting LLVM 16, clang-diagnostic-implicit-function-declaration is
treated as an error.
(cherry picked from commit ea093378a2)
2023-03-27 12:51:21 +03:00
Anonymous Maarten
cd64e0b6e3 SDL_blit_copy: Don't call potentially FPU using SDL_memcpy in SDL_memcpyMMX 2023-03-27 06:13:28 +00:00
Anonymous Maarten
51c10bef0b cmake: disable warnings in libm + warning about EMMS instruction
SDL_BlitCopyMMX ends with _mm_empty(), so the MMX state should be emptied.

(_mm_empty is the intrinsic function for emms)
2023-03-27 06:13:28 +00:00
Anonymous Maarten
d1dc195208 Implement _intel_fast_(memcpy|memset)
The classic Intel compiler generates calls to these functions when
building the SDL library with SDL_LIBC=OFF.
2023-03-27 06:13:28 +00:00
Anonymous Maarten
5e5b029d6c cmake: add /Q_no-use-libirc flag when building a no-libc library
The new Intel LLVM library needs this because when building SDL2
in release mode.
2023-03-27 06:13:28 +00:00
Anonymous Maarten
b58285b7ed ci: test with (old) Intel compiler + (new) oneAPI compiler 2023-03-27 06:13:28 +00:00
Anonymous Maarten
e5ebbdafd4 cmake: add support for building with Intel C compiler 2023-03-27 06:13:28 +00:00
Anonymous Maarten
977781d3f4 testautomation_math: avoid equality tests with INFINITY
Fixes this warning:
 warning: comparison with infinity always evaluates to false in fast floating point modes [-Wtautological-constant-compare]
2023-03-27 06:13:28 +00:00
Anonymous Maarten
984af1a725 cmake: new LLVM based Intel compiler does not recognize MSVC's /MP 2023-03-27 06:13:28 +00:00
Anonymous Maarten
5aa76de35f cpuinfo: use __cpuidex instead of __cpuid
The classic Intel Compiler does not clear the ecx register prior
to executing the cpuid opcode.
2023-03-27 06:13:28 +00:00
Anonymous Maarten
1158cff9ea cmake: increase threshold for stack probes
The /Gs argument controls the number of bytes that local variables
can occupy before a stack probe is initiated.
By setting it to a huge value, no calls to __chkstk are inserted.

This change is needed for the classic Intel C compiler to build SDL
with -DSDL_LIBC=OFF.
2023-03-27 06:13:28 +00:00
Anonymous Maarten
ae3a34a388 byteswap: Don't use intrinsic byteswap functions with Intel C compiler
It reroutes intrinsic _byteswap_u(short|long|int64) call to libc function.
2023-03-27 06:13:28 +00:00
Frank Praznik
c0824cd49a events: Increase the size of the name buffer when logging events
Event names have grown in length and are occasionally truncated when being logged (e.g. SDL_EVENT_WINDOW_PIXEL_SIZE_CHA). Increase the event name buffer size to handle the longer names.

(cherry picked from commit 203a2a76fc)
2023-03-26 22:01:17 -07:00
capehill
6ed29f47c9 testgles2_sdf: Call correct function to get shader info log
(cherry picked from commit b8c88cc584)
2023-03-26 22:00:41 -07:00
Karl Hedberg
9ed1b778ed Made the Android documentation more clear and understandable (#7535)
(cherry picked from commit 11142ec256)
2023-03-25 15:11:51 -07:00
Bartłomiej Dach
b970dd1beb Android: Fix mismatching JNI method signature
Another regression from commit dca3fd8307,
which was a backport of commit de3909a190
from SDL3 to SDL2. This time the regression is much less apparent,
however, due to two reasons:

- It only appears when the SDL project is ran on an actual device
  due to magic stringage.

- More importantly, the regression was partially hidden due to
  the nature of de3909a190.

  The commit which was backported added a single `I` to the JNI method
  signature in `SDL_android.c`, representing the added `int axis_mask`
  parameter. The parameter was added to both SDL2 and SDL3.

  However, notably, that `I` was added *after* commit
  fcafe40948, which removed the
  `int nballs` parameter from the joystick API, but only from the SDL3
  branch.

  Therefore, in totality, what should really have been a merge conflict,
  was obscured by the fact that the SDL3 branch ended up having
  a net-identical JNI signature to the SDL2 branch, due to having
  one bool param removed and one added - while, in fact, the SDL2 branch
  needed one bool param added and none removed.
2023-03-25 15:08:33 -07:00
Bartłomiej Dach
576df87240 Android: Fix missing type in SDLControllerManager
The missing type in question is causing compilation failures.
The error was introduced in dca3fd8307,
which was a backport of commit de3909a190
from SDL3 to SDL2.

Because `int nballs` was removed as a parameter from the controller
API in SDL3 in revision fcafe40948,
this change is only applicable to the SDL2 branch.
2023-03-25 15:08:33 -07:00
Sylvain
2dddaa7dc9 backport x11/sdl2 fixes
4b1378f

X11: fix size/position (test video_setWindowCenteredOnDisplay)

this fix x11 backend to correctly pass video_setWindowCenteredOnDisplay()

    get border values early (eg status bar)
    wait for size/position change to get valid values

d4d26e0

testautomation_video: if SDL_SetWindowSize/Position isn't honored, we should check there is an event
x11: send the events if various occasions
2023-03-25 10:27:17 +01:00
Ozkan Sezer
45a6ad8e57 wikiheaders.pl: make it work with older perl versions, e.g. 5.10. 2023-03-24 11:56:40 +03:00
Sam Lantinga
b57a6a1adf Added gamepad mapping for Flydigi Vader 2 with the latest firmware (6.0.4.9)
(cherry picked from commit ed0937598e)
2023-03-18 11:36:50 -07:00
Ivan Mogilko
d78072fcd4 Fixed SDL_RenderSetVSync does not update flags if simulated vsync is on
This lets the user to correctly detect current vsync state by reading SDL_RendererInfo.
Also fixes SetVSync's return value check (it may be positive for error too).
2023-03-17 14:55:04 -07:00
Ryan C. Gordon
446e0943da wasapi: Force WIN_CoInitialize duing device open.
Otherwise this won't work if you open a device on a background thread.

Fixes #7478.
2023-03-17 08:44:19 -07:00
Sylvain
23bce27b26 Change SDL_BLENDMODE_MUL for gl renderers
Add FIXME for PSP and DirectFB
2023-03-16 20:27:09 +01:00
Sylvain
c078dfcf6b Refresh generation of SDL_blit_auto.c after simplifying sdlgenblit.pl 2023-03-16 20:27:09 +01:00
Sylvain
18c4db678b Simplify SDL_BLENDMODE_MUL in sdlgenblit.pl 2023-03-16 20:27:09 +01:00
Sylvain
7d26ba754a Simplify SDL_BLENDMODE_MUL 2023-03-16 20:27:09 +01:00
Sylvain
bd70ce7f94 Refresh generation of SDL_blit_auto.c 2023-03-16 20:27:09 +01:00
Anonymous Maarten
ce4c54e2b2 cmake: get_filename_component(EXT) retturns extension including leading dot 2023-03-15 14:55:56 +01:00
Sam Lantinga
57ae9f466d Ignore the PS4 packet CRC if it's not being set correctly
This fixes handling the 8BitDo SN30 Pro with the 2.00 firmware in PS4 mode

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

(cherry picked from commit 3951cae4a5)
2023-03-13 20:00:19 -07:00
Rudolf Polzer
dca3fd8307 Android: indicate gamepaddb entries where axis order changed.
Axis order was changed in 6f1f586086 to improve
default mappings.

(cherry picked from commit de3909a190)
2023-03-11 13:01:50 -08:00
Sam Lantinga
ab1670386f Added support for the trigger buttons on the Victrix Pro FS for PS5
(cherry picked from commit 8d7e61ea42364c256b76e7f6f2b6d6f90742bcb7)
2023-03-10 15:46:22 -08:00
Sam Lantinga
76e9d64b36 Removed space between sizeof and parentheses 2023-03-10 08:13:51 -08:00
Sam Lantinga
e9f9cb29fc Fixed build warning on Android
(cherry picked from commit 2af6f4a3e4)
2023-03-10 08:12:28 -08:00
Stephen Kitt
3e1d7e6a14 Specify bash for androidbuildlibs.sh
This script relies on string indexes in parameter expansions, which
aren't suppored by /bin/sh (e.g. dash).

Based on a patch by Roflcopter4:
https://github.com/joncampbell123/dosbox-x/pull/3850

Signed-off-by: Stephen Kitt <steve@sk2.org>
(cherry picked from commit bbfd5b3fb2)
2023-03-10 07:38:28 -08:00
Qrox
ef347776c2 Uses integer arithmetics in SDL_ResampleAudio
- Avoids precision loss caused by large floating point numbers.
- Adds unit test to test the signal-to-noise ratio and maximum error of resampler.
- Code cleanup

(cherry-picked from commit 20e17559e5)
2023-03-10 18:37:00 +03:00
Ozkan Sezer
5e35309913 fix bad merge of sizeof style patch 2023-03-10 08:32:24 +03:00
Sam Lantinga
71dc7169d9 Added header for SDL_Delay() 2023-03-09 17:18:40 -08:00
Sam Lantinga
1e6ffc6294 Removed a duplicate delay accidentally added during code refactor
(cherry picked from commit 926db1bd54)
2023-03-09 16:13:19 -08:00
Sam Lantinga
3f00fa16c6 Wait for the GCController framework to see IOKit devices
It occasionally takes a few millseconds for the GCController framework to handle the device notification and set up the device

Fixes the duplicate controller issue in https://github.com/libsdl-org/SDL/issues/6686

(cherry picked from commit 645823fc90)
2023-03-09 16:13:19 -08:00
Sam Lantinga
0d76380042 Code style: changed "sizeof foo" to "sizeof(foo)" (thanks @sezero!)
(cherry picked from commit c6443d86c9)
2023-03-09 15:23:59 -08:00
Sam Lantinga
46d143376a If the client rect is empty, use the last known window size
This happens on Windows 11 with fullscreen desktop windows when the desktop is brought up with the Windows+D shortcut.

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

(cherry picked from commit 2ca727aec6)
2023-03-09 10:39:43 -08:00
Ozkan Sezer
22de91a947 Removed guard around the enabled assertions support code
Otherwise, SDL_assert_always() wouldn't work.

Fixes https://github.com/libsdl-org/SDL/issues/7433
2023-03-09 20:51:50 +03:00
Deve
1c2f825230 Fixed incorrect modifier keys handling on macOS
(cherry-picked from commit 45a58b7882)
2023-03-09 20:28:51 +03:00
Sam Lantinga
d9c07d9ef7 Fixed the documentation for SDL_SetRelativeMouseMode()
(cherry picked from commit fb0c3197e0)
2023-03-08 22:33:23 -08:00
Frank Praznik
8f7427c158 tests: Always set valid dimensions for the fullscreen mode 2023-03-08 19:46:37 -05:00
Frank Praznik
6a999d16fa wayland: Always use a scale factor of 1 for exclusive fullscreen emulation 2023-03-08 19:46:37 -05:00
Lokathor
cfd6b34b8f Make mappings for "Retrolink SNES Controller" with SDL_GAMECONTROLLER_USE_BUTTON_LABELS both on and off
I've only tested this on windows, but I went ahead and made the same changes for linux and mac because I assumed it's the same there and that we'd want to keep the three platforms in sync.

(cherry picked from commit b8bc4a234b)
2023-03-08 16:44:30 -08:00
Ozkan Sezer
a70964aaf4 fix SDL_FindFreePlayerIndex so it can really return -1. 2023-03-08 20:00:50 +03:00
Sam Lantinga
35c13196f0 Fixed uninitialized variable 2023-03-08 08:40:38 -08:00
Ozkan Sezer
bc87983310 tests: added -DHAVE_SIGNAL_H to CFLAGS in watcom makefiles 2023-03-08 18:56:50 +03:00
Sam Lantinga
f5c0760c6b Disassociate the SDLOpenGLContext from the view before deleting it
If we don't do this, the view will be blanked even if another context is current and rendering from that context won't be visible.

Fixes https://github.com/libsdl-org/SDL/issues/4986
2023-03-08 01:15:21 -08:00
Sam Lantinga
63e6c19b7d Use SDL_GL_DeleteContext instead of Cocoa_GL_DeleteContext for context cleanup
That will make the current context NULL before deleting the context.
2023-03-08 01:13:00 -08:00
Sam Lantinga
1bd9ebf533 If we're not the current fullscreen window and we don't want to be fullscreen, don't touch the current video mode
Fixes an assertion in qemu on macOS, which creates multiple hidden windows:
2023-03-07 09:56:55.304 qemu-system-i386[9931:2984587] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'NSWindowStyleMaskFullScreen cleared on a window outside of a full screen transition. Called from (
	0   AppKit                              0x00000001968f77ac __25-[NSWindow setStyleMask:]_block_invoke + 140
	1   AppKit                              0x00000001968f76cc NSPerformVisuallyAtomicChange + 108
	2   AppKit                              0x00000001968f7580 -[NSWindow setStyleMask:] + 188
	3   libSDL2-2.0.0.dylib                 0x0000000106531328 Cocoa_SetWindowFullscreen + 568
	4   libSDL2-2.0.0.dylib                 0x0000000106501700 SDL_UpdateFullscreenMode + 1316
	5   libSDL2-2.0.0.dylib                 0x0000000106504270 SDL_SetWindowFullscreen_REAL + 328
	6   libSDL2-2.0.0.dylib                 0x000000010650117c SDL_FinishWindowCreation + 100
	7   libSDL2-2.0.0.dylib                 0x0000000106500998 SDL_CreateWindow_REAL + 1812
	8   libSDL2-2.0.0.dylib                 0x00000001063efd54 SDL_CreateWindow + 76
	9   qemu-system-i386                    0x00000001050aa600 sdl2_window_create + 192
	10  qemu-system-i386                    0x00000001050a9fa0 sdl2_2d_switch + 196
	11  qemu-system-i386                    0x0000000104e9c784 displaychangelistener_display_console + 524
	12  qemu-system-i386                    0x0000000104e9e36c register_displaychangelistener + 264
	13  qemu-system-i386                    0x00000001050ab6d0 sdl2_display_init + 304
	14  qemu-system-i386                    0x000000010505c870 qemu_init + 13380
2023-03-07 10:10:43 -08:00
Sam Lantinga
e0e79419b6 Fixed which window we check flags for when updating fullscreen mode 2023-03-07 10:08:55 -08:00
Sam Lantinga
8fc10ac95c Added mapping for the Xbox Elite Core controller connected via Bluetooth on Android
(cherry picked from commit d08338ddc5)
2023-03-06 15:37:52 -08:00
divVerent
91ad208d18 Fix Xbox One gamepad axis assignment on SDL_JOYSTICK_ANDROID API (#7405)
(cherry picked from commit 6f1f586086)
2023-03-06 15:37:41 -08:00
Anonymous Maarten
6c495a92f0 cmake: use compatible interface properties to disallow linking to a different version of SDL 2023-03-03 23:41:18 +01:00
Michal Suchanek
96a2a6b945 evdev_kbd: Use current keymap
keymap can change over time, caching the keymap causes wrong keys
returned when user changes keymap during runtime

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
2023-03-03 14:30:02 -08:00
Ozkan Sezer
fd4bb4154b dynapi: replace uses of deprecated SDL_assert_state and SDL_assert_data 2023-03-03 03:01:02 +03:00
Ryan C. Gordon
46945354cc dataqueue: Make thread safe.
Each data queue gets its own mutex and each function obtains it.

Fixes #7390.

(cherry picked from commit 8b9a938413)
2023-03-02 16:43:44 -05:00
Ryan C. Gordon
f5bb286b76 dataqueue: Removed non-public SDL_ReserveSpaceInDataQueue function
This wasn't used, and it was just asking for trouble.

(cherry picked from commit f833e005e1)
2023-03-02 16:41:58 -05:00
Sam Lantinga
f47a08ab84 Fixed typo in previous cherry-pick 2023-03-01 16:47:48 -08:00
Sam Lantinga
660fc89967 Don't clobber an existing entry with a different version when adding a gamepad mapping
(cherry picked from commit 727c7d4e2f)
2023-03-01 16:41:44 -08:00
Sam Lantinga
6ff3e49b6f Follow the same pattern for releasing the window data in the UIKit driver
Possible fix for https://github.com/libsdl-org/SDL/issues/7361

(cherry picked from commit ebdb320651)
2023-02-28 16:15:01 -08:00
Ryan C. Gordon
e58a8639e3 docs: Removed bogus file from wiki bridge.
That was fixed to not do that again by 7e429a13d3
2023-02-28 13:40:35 -05:00
Ryan C. Gordon
5b7b3da701 Sync wiki -> headers. 2023-02-28 12:56:01 -05:00
Ryan C. Gordon
0a0dfdb2f9 wikiheaders: Sort pages before listing them in README/FrontPage.md.
(cherry picked from commit 99c38268cd)
2023-02-28 12:29:21 -05:00
Ryan C. Gordon
8572e19327 wikiheaders: Use Windows endlines in the source, Unix in the wiki.
(cherry picked from commit 7745c9b3ae)
2023-02-28 12:29:16 -05:00
Sam Lantinga
031348d377 Fixed SDL windows getting the maximized state after leaving fullscreen on macOS
(cherry picked from commit 2df08fb1b27b721998a1380a2acdbe1494b5591e)
2023-02-28 09:03:10 -08:00
Ryan C. Gordon
462d95ab4d wikiheaders: ignore wiki's README/FrontPage.md
(cherry picked from commit 6d1e14b792)
2023-02-28 11:56:20 -05:00
Ryan C. Gordon
a48bb80ea0 wikiheaders: Bridge README files in the docs directory to wiki.
Fixes #6026.

(cherry picked from commit 2506676f34)
2023-02-28 11:46:46 -05:00
Sam Lantinga
c0fb092425 Fixed locking up the Logitech F310 with the PlayStation controller detection
(cherry picked from commit da134a3039)
2023-02-28 08:37:18 -08:00
Ryan C. Gordon
37de5d4849 wikiheaders: fixed wikilinks in Markdown code sections.
(cherry picked from commit a479633455)
2023-02-27 23:08:55 -05:00
Sam Lantinga
715749f578 Added mapping for DualSense Edge Wireless Controller on Linux
This is a mapping when using evdev, not the more advanced HIDAPI support.

(cherry picked from commit 206fa4dafb)
2023-02-27 15:21:04 -08:00
David Carlier
0c7346ec3e USE_DEV_RANDOM close the file descriptor even in the rare case it can't read it 2023-02-26 14:00:32 +03:00
Torge Matthies
711a458be5 x11: Fix duplicate Xinput2 event reception
Passing True for owner_events in the XGrabPointer call makes all
XI_RawMotion events appear in the queue twice, with the only difference
between them being the value of XGenericEventCookie::cookie. These have
always been filtered out by a check in the XI_RawMotion handler,
however with a mouse that polls at more than 1 kHz frequency, there
also exist legitimate events that appear indistinguishable from these
duplicated events. These must not be filtered out, otherwise the
pointer may move at an inconsistent speed, appearing like a bad pointer
acceleration implementation.

Change owner_events to False in the XGrabPointer and remove the
duplicate event detection code to fix this.

Signed-off-by: Torge Matthies <openglfreak@googlemail.com>
(cherry picked from commit f18b5656f6)
2023-02-25 10:05:43 -08:00
Ryan C. Gordon
171fba320f wikiheaders: Fix wikilinks inside code sections a little. Not perfect yet.
(cherry picked from commit 5b0351a672)
2023-02-24 14:30:34 -05:00
Sam Lantinga
ad09976eca Fixed relative mouse motion over remote desktop
Setting the cursor clip area to a single pixel prevents the relative mouse motion remote desktop warping from working, so the mouse is never recentered.

(cherry picked from commit daffe02b11)
2023-02-24 09:23:23 -08:00
Ryan C. Gordon
7abb748134 Sync wiki -> headers. 2023-02-24 11:47:13 -05:00
Ryan C. Gordon
858ae9900e wikiheaders: fixed see-also conversion
(cherry picked from commit d748a454a8)
2023-02-24 11:46:41 -05:00
Ryan C. Gordon
f87f0fe781 wikibridge: Fixes for manpage generation from Markdown format.
(cherry picked from commit 5ff49955ab)
2023-02-24 10:22:28 -05:00
Ryan C. Gordon
b3ea81b33f wikiheaders: Work to make the wiki exist primarily in Markdown format.
This adds a means to mass-convert the whole wiki to Markdown as a one-time
operation, and then some fixes to make --copy-to-headers correctly deal with
Markdown-formatted wiki pages.

(cherry picked from commit 936a51d5cc)
2023-02-24 09:48:37 -05:00
Sam Lantinga
3bf9c70a7c Changed the VID/PID used for the Backbone One controller on iOS
(cherry picked from commit 516e48515e)
2023-02-23 12:24:49 -08:00
Sam Lantinga
ea7103088f Added support for the Backbone One PlayStation Edition
(cherry picked from commit 59bf1c2853)
2023-02-23 11:59:10 -08:00
Sam Lantinga
a3a45f6709 Fixed view frame from flipping back and forth between landscape and portrait on iOS
(cherry picked from commit b2d913883c)
2023-02-23 11:59:00 -08:00
Ozkan Sezer
5a7ea76ed3 fix MSVC build failures in CI after commit 1e5e8e2f
(cherry picked from commit a2f8cf8fc0)
2023-02-22 13:31:44 -05:00
Ryan C. Gordon
9403c9e95a resampler: Work at double precision on x86-64 machines.
We get audio artifacts if we don't work at the higher precision, but
this is painful on CPUs that have to use a software fallback for this,
so for now (that is, until we have a better solution), get better output
on amd64 chips, where the cost is less painful.

(cherry picked from commit 1e5e8e2fda)
2023-02-22 13:29:31 -05:00
Sam Lantinga
13969f8567 De-duplicate Google Stadia controllers on macOS
(cherry picked from commit 87a83787a3)
2023-02-21 15:35:25 -08:00
Sam Lantinga
9be85b846b Rumbling the Google Stadia Controller over Bluetooth works on Linux and macOS
(cherry picked from commit 4aeec9d8c2)
2023-02-21 15:07:24 -08:00
Sam Lantinga
35c9b1042f Fixed the packet size for Xbox One controllers
(cherry picked from commit 021a7cfa13)
2023-02-21 12:48:10 -08:00
Sam Lantinga
31a57c05dc Fixed the share button on the ThrustMaster eSwap PRO Controller Xbox
(cherry picked from commit e4face7c1d)
2023-02-21 12:43:20 -08:00
Sam Lantinga
3dff5d3cbe Added support for the Turtle Beach REACT-R and Recon Xbox controllers
(cherry picked from commit 5fded632d6)
2023-02-21 11:29:45 -08:00
Sam Lantinga
4c9a79dddb Removed duplicated conditional
(cherry picked from commit 1a15d506a6)
2023-02-20 18:26:07 -08:00
Sam Lantinga
7c4f5e1def Fixed rumble caps for the Nintendo Joy-Con controllers
(cherry picked from commit 02cea5fca1)
2023-02-20 18:25:57 -08:00
Sam Lantinga
abe8dbbf1c Added support for the Razer Wolverine V2 controllers
(cherry picked from commit 4994654d4f)
2023-02-20 18:25:38 -08:00
Sam Lantinga
0efb31ef32 cocoa/gles: do not unload EGL when context is destroyed
(cherry picked from commit e8091b8983)
2023-02-20 10:43:15 -08:00
Marc-André Lureau
eb22fbc894 windows/gles: do not unload EGL when context is destroyed
It's legitimate to have multiple contexts.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
(cherry picked from commit 93861e1de0)
2023-02-20 10:42:18 -08:00
Marc-André Lureau
479bc2d5ed windows/gles: correct indentation
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
(cherry picked from commit 654965a628)
2023-02-20 10:41:45 -08:00
Ryan C. Gordon
e6e654e25c include: Fix symbols in public headers that start with an underscore.
Fixes #7352.
2023-02-20 11:38:26 -05:00
Sam Lantinga
7b06007266 Fixed typo (thanks @Iniquitatis!)
(cherry picked from commit ced02319a6)
2023-02-19 09:58:07 -08:00
Lauri Kasanen
7d55ccb8b0 Fix GetGlobalMouseState when xi2 is not available at runtime
(cherry picked from commit 0123d6311d)
2023-02-19 09:56:39 -08:00
Ozkan Sezer
da6bce4f76 SDL_x11dyn.h: include XInput2.h also for Xfixes
Fixes https://github.com/libsdl-org/SDL/issues/7343
2023-02-11 23:51:28 +03:00
Le Philousophe
74e8a6451b Fix window size in X11 when window manager refuses to resize
(cherry picked from commit a67ae8eed5)
2023-02-18 12:33:18 -08:00
Sam Lantinga
f741adc86c Added other names for the DragonRise Inc. Wired Wheel (thanks @felimwhiteley!)
(cherry picked from commit eede2066fb)
2023-02-17 11:30:49 -08:00
Anonymous Maarten
817141c162 ci: install pkg-config on Macos runner
(cherry picked from commit 86f0c69465)
2023-02-17 01:05:00 +03:00
Sam Lantinga
e86f494317 Hold the joystick lock while opening the HID device on non-Android platforms
On Windows the main thread can be enumerating DirectInput devices while the Windows.Gaming.Input thread is calling back with a new controller available, and in this case HIDAPI_IsDevicePresent() returned false since the controller initialization hadn't completed yet, creating a duplicate controller.

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

(cherry picked from commit ece8a7bb8e)
2023-02-16 09:53:33 -08:00
Sylvain
d948e6c3c5 Fix potential de-referencing null pointer in SDL_EVDEV_kbd_keycode() 2023-02-16 08:23:22 +01:00
Sam Lantinga
e7376b7b74 Fixed Steam Runtime sandbox detection
Fixes hotplug issues on Steam Deck for Proton and native games

(cherry picked from commit bcd97b36d2)
2023-02-15 13:54:50 -08:00
Sam Lantinga
69b2baec5c Map the Android MENU button back to the SDL MENU key
Thanks to @AntTheAlchemist for the investigation!

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

(cherry picked from commit beb6a2afdc)
2023-02-14 18:04:30 -08:00
Sam Lantinga
2c6995778e Fixed handling simple mode PS4 reports
Fixes https://github.com/libsdl-org/SDL/issues/7270

(cherry picked from commit 5925cd4ef3)
2023-02-14 17:53:37 -08:00
Ozkan Sezer
22df572979 look for clock_gettime() in libc first, then in librt if not found. 2023-02-13 22:28:02 +03:00
Ozkan Sezer
634705851d cmake: really fix detection of pthread_setname_np() on Apple platforms. 2023-02-13 11:56:10 +03:00
Ozkan Sezer
1194f52a5c cmake: fix detection of pthread_setname_np() on Apple platforms. 2023-02-13 11:55:40 +03:00
Sylvain
45e5f0f10b Fixed bug #7302 - Memory 'leak' in SDL_SetMouseSystemScale() 2023-02-13 09:43:13 +01:00
Knightly
a23d1af0ac Guard against _USE_MATH_DEFINES redefinition 2023-02-12 20:47:00 +03:00
Francisco Javier Trujillo Mata
2b66ef0df4 Fixed audio 2023-02-11 13:22:47 -08:00
Sam Lantinga
7285f0d441 Sorted controller list
(cherry picked from commit 68e2f23066)
2023-02-10 17:18:32 -08:00
Alfredo Escobar
ca3468cb55 Add Hori Pokken Tournament DX Pro Pad
(cherry picked from commit 76552e4780)
2023-02-10 17:17:00 -08:00
Bruce Mitchener
7d2012af87 emscripten: Update deprecated calls to EM_ASM*.
`EM_ASM_` and `EM_ASM_INT_V` are calls that have been deprecated
for a long time.

Since the return value isn't used for the call to `EM_ASM_`, it
can be replaced with `EM_ASM`.

`EM_ASM_INT_V` is now (for the last few years) `EM_ASM_INT`.

(cherry picked from commit a8e89f2567)
2023-02-10 07:11:31 -08:00
Sylvain
17515f4aef Backport simplify flags PR #7220 2023-02-09 17:19:46 -08:00
Sam Lantinga
f71178a16f Fixed MFI controller being opened while HIDAPI controller was being opened
This was the callstack:
    frame #3: 0x00000001004e1930 libSDL3.1.0.0.dylib`IOS_AddJoystickDevice(controller=0x0000600003b0c000, accelerometer=SDL_FALSE) at SDL_mfijoystick.m:528:14
    frame #4: 0x00000001004e1a54 libSDL3.1.0.0.dylib`__IOS_JoystickInit_block_invoke(.block_descriptor=0x0000000100547760, note=@"GCControllerDidConnectNotification") at SDL_mfijoystick.m:673:45
    frame #5: 0x000000018601e578 CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 128
    frame #6: 0x00000001860bc074 CoreFoundation`___CFXRegistrationPost_block_invoke + 88
    frame #7: 0x00000001860bbfbc CoreFoundation`_CFXRegistrationPost + 440
    frame #8: 0x0000000185fefbac CoreFoundation`_CFXNotificationPost + 708
    frame #9: 0x0000000186edc72c Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 88
    frame #10: 0x000000019b054a18 GameController`__60-[_GCControllerManagerAppClient _onqueue_publishController:]_block_invoke + 156
    frame #11: 0x0000000185dc19dc libdispatch.dylib`_dispatch_call_block_and_release + 32
    frame #12: 0x0000000185dc3504 libdispatch.dylib`_dispatch_client_callout + 20
    frame #13: 0x0000000185dd1d1c libdispatch.dylib`_dispatch_main_queue_drain + 928
    frame #14: 0x0000000185dd196c libdispatch.dylib`_dispatch_main_queue_callback_4CF + 44
    frame #15: 0x000000018606ad6c CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
    frame #16: 0x00000001860287ec CoreFoundation`__CFRunLoopRun + 2036
    frame #17: 0x00000001860278a4 CoreFoundation`CFRunLoopRunSpecific + 612
    frame #18: 0x00000001003b1194 libSDL3.1.0.0.dylib`process_pending_events at hid.c:509:9
    frame #19: 0x00000001003aebe8 libSDL3.1.0.0.dylib`PLATFORM_hid_open_path(path="USB_054c_05c4_0x11a104290", bExclusive=0) at hid.c:823:2
    frame #20: 0x00000001003b051c libSDL3.1.0.0.dylib`SDL_hid_open_path_REAL(path="USB_054c_05c4_0x11a104290", bExclusive=0) at SDL_hidapi.c:1419:19
    frame #21: 0x00000001004dabdc libSDL3.1.0.0.dylib`HIDAPI_SetupDeviceDriver(device=0x0000600003518000, removed=0x000000016fdfee3c) at SDL_hidapijoystick.c:399:19
    frame #22: 0x00000001004da890 libSDL3.1.0.0.dylib`HIDAPI_AddDevice(info=0x000060000212c2d0, num_children=0, children=0x0000000000000000) at SDL_hidapijoystick.c:843:5
    frame #23: 0x00000001004d9148 libSDL3.1.0.0.dylib`HIDAPI_UpdateDeviceList at SDL_hidapijoystick.c:1000:21
    frame #24: 0x00000001004d9940 libSDL3.1.0.0.dylib`HIDAPI_JoystickDetect at SDL_hidapijoystick.c:1205:13
    frame #25: 0x00000001003bc6d8 libSDL3.1.0.0.dylib`SDL_UpdateJoysticks_REAL at SDL_joystick.c:1703:9
    frame #26: 0x00000001003a13a8 libSDL3.1.0.0.dylib`SDL_PumpEventsInternal(push_sentinel=SDL_FALSE) at SDL_events.c:855:9
    frame #27: 0x00000001003a1340 libSDL3.1.0.0.dylib`SDL_PumpEvents_REAL at SDL_events.c:879:5
    frame #28: 0x000000010038b380 libSDL3.1.0.0.dylib`SDL_PumpEvents at SDL_dynapi_procs.h:572:1
    frame #29: 0x0000000100004524 testgamepad`loop + 40
    frame #30: 0x00000001000063d8 testgamepad`main + 2140

(cherry picked from commit a9650d440a)
2023-02-09 12:07:42 -08:00
Sam Lantinga
d77eb8a8d5 Make sure we synchronously re-enable USB reporting mode for Switch controllers (thanks @SortaCore!)
Fixes https://github.com/libsdl-org/SDL/issues/3450

(cherry picked from commit b7c6fec10a)
2023-02-08 14:31:05 -08:00
Sam Lantinga
3fb9118cb6 Note the Google Stadia controller doesn't support rumble over Bluetooth
(cherry picked from commit 50575ed223)
2023-02-08 14:31:05 -08:00
Sam Lantinga
71fb4e3d76 Fixed mis-detecting the share button on the Xbox controller over NDIS
(cherry picked from commit 00e02de77b)
2023-02-08 14:31:05 -08:00
Sam Lantinga
2518e32de8 Dynamically update the serial number if it isn't available at first
This happens for Xbox One controllers using newer firmware connected over NDIS

(cherry picked from commit d1c72bb0bc)
2023-02-08 14:31:01 -08:00
Sam Lantinga
e8938fc66a Enable paddles on the Xbox Elite controller when connected over USB
(cherry picked from commit c4db0725e4)
2023-02-08 14:27:05 -08:00
Ozkan Sezer
fde6323662 fix build after the Logitech ChillStream patch. 2023-02-07 01:11:02 +03:00
Sam Lantinga
7154605982 Added support for the Logitech ChillStream
(cherry picked from commit 6f7edaf8920c504ebd3e797bd04ec1d2e46c4aa9)
2023-02-06 13:28:44 -08:00
Ozkan Sezer
c68cfcdb2d make sure to not enable SDL_PASSED_BEGINTHREAD_ENDTHREAD for WinRT 2023-02-07 00:21:56 +03:00
Ozkan Sezer
7bf3e28dc6 windows/SDL_systhread.c: remove some dead code. 2023-02-07 00:21:40 +03:00
Sam Lantinga
3fa5a2f794 Fixed warning running a command queue without any vertex operations
(cherry picked from commit f8b41919da)
2023-02-06 11:25:35 -08:00
Sean Ridenour
af5efadd9f Setting the same mouse cursor twice is a no-op
This fixes extremely poor event polling performance on MacOS when using
Dear ImGui, which sets the mouse cursor every frame.
2023-02-05 14:14:54 -05:00
Sam Lantinga
5b5a72e33c Sorted controller list
(cherry picked from commit 1c03ddefc3)
2023-02-05 08:44:46 -08:00
Antonis Geralis
58fa43e7c3 Added Elecom 8button gamepad
(cherry picked from commit 52cd9fcbb0)
2023-02-05 08:44:46 -08:00
Leonardo Brondani Schenkel
4266cf8504 Add Linux mapping for 8BitDo Pro 2 Wired Controller for Xbox
Without these mappings, this controller "kinda" works out of the box:
- `SDL_GameControllerMapping()` works because it will notice "Xbox" in
  the name and use the default XInput mappings
- `SDL_GameControllerMappingForGUID()` will not find any mapping

lsusb:
```
ID 2dc8:2000 8BitDo 8BitDo Pro 2 Wired Controller for Xbox
```

In Linux this controller is supported by two drivers:
- `xpad` (built-in to the kernel), exposes the controller name from the
  USB descriptor and the GUID starts with 03 (0x03 = BUS_USB)
- `xone` (https://github.com/medusalix/xone), exposes a virtual
  controller which is always named "Microsoft X-Box One pad" and the
  GUID starts with 06 (0x06 = BUS_VIRTUAL)

This commit adds the 2 GUIDs from both drivers so mappings will always
be found and the real controller name will always be reported.
2023-02-05 08:44:37 -08:00
Ozkan Sezer
4f7f72c257 replaced line comments in public header. 2023-02-04 10:02:10 +03:00
Anonymous Maarten
c5035d8ffd include: add comment documenting the change(s) to SDL_opengl_glext.h 2023-02-04 02:44:37 +01:00
Alynne
92779a5bd8 Adds Stadia BT mapping
(cherry picked from commit 4dea13e02f)
2023-02-03 15:02:47 -08:00
Anonymous Maarten
0dc4373aad opengl: make SDL_opengl_glext.h's include compatible with macos
- Mesa defines __gl_glext_h_
- Apple defines __glext_h_
2023-02-03 21:05:54 +01:00
Ozkan Sezer
06b305d232 dynapi: cast GetProcAddress() result to void* 2023-02-03 17:40:40 +03:00
Sam Lantinga
c4a493de97 Don't accept official mappings for controllers that aren't unique
For example, the DragonRise Inc. Generic USB Joystick
See https://github.com/gabomdq/SDL_GameControllerDB/issues/202 for details

(cherry picked from commit 673bc57649)
2023-02-02 08:41:57 -08:00
Sam Lantinga
4a87abc966 Fixed sort_controllers.py and resorted game controller database
(cherry picked from commit 917607c335)
2023-02-02 08:41:36 -08:00
Sam Lantinga
2290d71338 Added gamepad mappings for the Xin-Mo Dual Arcade Fightstick
(cherry picked from commit d29e1f3632)
2023-02-01 23:07:47 -08:00
Sasha Szpakowski
17ecb11ed6 macOS: fix initial Metal drawable size in certain multi-display setups
(cherry picked from commit baca26d727)
2023-02-01 22:42:12 -08:00
Anonymous Maarten
8800d40442 cmake: assume autotools static libraries with lib prefix and .a suffix 2023-02-01 19:05:44 +01:00
Ryan C. Gordon
7ac43cfb6b Note that version.rc is public domain.
This avoids potential concerns that customizing would qualify a build
of SDL as an "altered source version" under the zlib license.
2023-01-29 11:46:22 -05:00
Matt Durgavich
dfc56cfc0e Fix For issue #6948 (#6991)
MessageBoxes attached to a window in macOS should use modal APIs and not
use a poll/sleep pattern on the main thread. Sleeping the main thread
makes the NSWindow message loop sluggish and interferes with external
applications that need to send messages to that window, such as
VoiceOver.
2023-01-28 15:49:51 -08:00
Ryan C. Gordon
c83428475d wikiheaders: Link to the SDL3 wiki in the preamble.
Reference Issue #6568.
2023-01-26 14:45:12 -05:00
Ryan C. Gordon
d5680c5d20 wikiheaders: Allow markdown in the wikipreamble string.
Reference Issue #6568.

(cherry picked from commit a089b2ea19404f6dacd083327e13cae888b58993)
2023-01-26 10:23:21 -05:00
Ryan C. Gordon
1069c8931d wikiheaders: Add a \threadsafety tag to document threading details.
Reference Issue #7140.

(cherry picked from commit 01cba48d18)
2023-01-26 10:23:08 -05:00
Jiří Malák
507fc462db SDL_atomic.h: Update SDL_CPUPauseInstruction for Watcom. (#7157)
Appropriate CPU directive can be used in #pragma aux so that it is not
necessary to hardcode instruction bytes.
2023-01-26 17:00:02 +03:00
Anonymous Maarten
d9d84c8d73 ci: test PVR_PSP2 (gles/gl) and gib (gles) 2023-01-25 00:22:50 +01:00
Anonymous Maarten
e927e5d440 vita: add missing static libraries for using gles with pib 2023-01-25 00:22:50 +01:00
Anonymous Maarten
33ec2a5e94 vita: fix reformatting error in SDL_vtagl_pvr.c 2023-01-25 00:22:50 +01:00
Anonymous Maarten
a8a5bd3d6b cmake: allow disabling OpenGL support when building with GLES using PSP2-PVR 2023-01-25 00:22:50 +01:00
ds-sloth
038ccd764a Support MIN/MAX blend on opengles2 2023-01-23 06:09:58 -08:00
Anonymous Maarten
c0445c23bf vita: PVR needs to link to sceIme_stub library 2023-01-23 05:08:59 +01:00
ds-sloth
9670f233cc Support MIN/MAX blend on OpenGL + ES 2023-01-22 13:48:13 -08:00
Frank Praznik
ea179abdb7 wayland: Enforce or override libdecor minimum window size
libdecor plugins can change the min/max window size values internally to enforce a minimum window size, and errors and crashes can result if the window size is below the internal limit.

On versions of libdecor >= 0.1.1, the minimum width and height can be queried and the minimum required window size will be enforced. The application requested window size is still respected, however, the actual window may be slightly larger than the drawable area to accommodate the required libdecor minimum size.

On version 0.1.0 of libdecor, which lacks the function to retrieve the minimum size, the internal limits are overridden before committing a frame, so that the internal limits always match the window size as a workaround, even if the window is technically smaller than the plugin would normally allow.

(cherry picked from commit 423a82cd4b)
2023-01-22 08:20:34 -08:00
raphasamp
eabd88ed28 Update SDL_vitagles_pvr.c
This was broken unintentionally during #6545.(cherry picked from commit 9211c0b639)
2023-01-22 17:32:50 +03:00
PARTY MAN X
a44b646105 Blacklist Konami Amusement Controllers From HIDAPI.
Fixes issue #7118 by adding all Konami Amusement controllers to the
blacklist.  Additionally, the blacklist is changed to exclude a whole
vendor when the PID 0x0000 is used.
2023-01-21 22:03:57 -08:00
Ozkan Sezer
880ac537a5 typo fix to config.sub,
from https://lists.gnu.org/archive/html/config-patches/2023-01/msg00001.html
2023-01-21 10:15:02 +03:00
Guldoman
7b8f0ba8b7 wayland: Set APPLICATION scancode name to Menu
This mimics the behavior of the other platforms.

(cherry picked from commit 6c06f5ce93)
2023-01-19 15:06:18 -08:00
Ozkan Sezer
73a68c6ea5 regenerated configure script. 2023-01-18 21:56:10 +03:00
Frank Praznik
44dc90dcc8 autotools: Add check for libdecor get min/max functions 2023-01-18 10:32:43 -08:00
Fabian Greffrath
8efa1f8fc6 add support for libsamplerate's "linear" resampling mode
Fixes #6998
2023-01-16 16:31:34 -05:00
Sylvain
5d1e6b28d9 SDL_test_harness: fix memory leak when generated seed 2023-01-16 10:43:28 +01:00
Sylvain
c638b4a682 SDL_CreateAudioStream: check for invalid parameters 2023-01-16 09:26:05 +01:00
Anonymous Maarten
01a4cf8a10 ci: don't require EXTRA_ prefix on input environment variables 2023-01-15 17:29:37 +01:00
Anonymous Maarten
f51f7fbb94 n3ds: fix exported libraries of n3ds 2023-01-15 17:29:37 +01:00
Jon Daniel
b47b6e02fd fix prefix path not resolving symlinks 2023-01-15 01:30:24 +01:00
Francisco Javier Trujillo Mata
381312a02a Use filesystem drivers 2023-01-13 09:58:33 -08:00
Frank Praznik
f836b465aa Revert "wayland: Don't try to restore non-resizable windows"
This reverts commit e35c3872dc.

(cherry picked from commit 180afcdf39)
2023-01-12 18:00:11 -08:00
Frank Praznik
a47a045128 wayland: Don't try to restore non-resizable windows
Libdecor can crash if attempting to un-maximize a window that was not set as resizable.

(cherry picked from commit e35c3872dc)
2023-01-12 13:35:33 -08:00
Frank Praznik
e8ae155585 wayland: Perform a round trip when maximizing and restoring windows
Perform a round trip when maximizing and restoring windows so the changes have already taken effect when the associated functions return.

(cherry picked from commit 50f2eb7d41)
2023-01-12 13:35:20 -08:00
happyharryh
2cb422360c Fixed the hat_map to avoid segmentation fault
(cherry picked from commit 57e78f4cf5)
2023-01-12 06:56:59 -08:00
Narr the Reg
fa934dd4df hidapi: switch: Add user calibration support
(cherry picked from commit 9fa55d9cab)
2023-01-12 06:38:37 -08:00
Ozkan Sezer
6a52017724 SDL_dynapi.c: add extern "C" guards, just in case.. 2023-01-12 14:01:02 +03:00
Francisco Javier Trujillo Mata
32fd45cf48 Using UV instead of STQ 2023-01-11 15:12:14 -08:00
Francisco Javier Trujillo Mata
c5a09ca7a9 Remove dummy flag 2023-01-11 15:12:14 -08:00
Wohlstand
b425036808 SDLAudioManager.java: Fixed the support for Android older than API 23 2023-01-10 20:15:35 -08:00
Sam Lantinga
0479df53ca Updated copyright for 2023 2023-01-09 09:48:21 -08:00
yuanhecai
0b0d256a69 Fix loongarch64 support
HAS_LSX/LASX is modified as HAVE_LSX/LASX.
(cherry picked from commit 50af65a7dd)
2023-01-09 11:14:28 +03:00
Ozkan Sezer
d09d0aaab6 cmake (CheckPTHREAD): remove _GNU_SOURCE define after bug #7026 fix 2023-01-09 01:30:50 +03:00
Anonymous Maarten
460b7b247f cmake: do all compile tests with -D_GNU_SOURCE=1 2023-01-08 19:21:50 +01:00
Sam Lantinga
ebc2fb411f Fixed infinite loop shutting down WGI controllers
We are guaranteed that the lock will be held during shutdown, so if we are in InvokeRemoved(), it's because we're shutting down controllers and need to remove them from our internal list.

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

(cherry picked from commit ac99db9fc8)
2023-01-08 09:35:55 -08:00
Ozkan Sezer
0d5467a6e9 cmake: check for math library functions even in the absence of libm
(Reference issue: https://github.com/libsdl-org/SDL/issues/7011)
2023-01-07 14:25:04 +03:00
Ozkan Sezer
305e7b55bd cmake: fix detection of library functions when -Werror is enabled.
(Reference issue: https://github.com/libsdl-org/SDL/issues/7011)
2023-01-07 14:25:04 +03:00
Guldoman
ad0d1e2ad5 wayland: Fallback to default cursor if chosen one wasn't found
(cherry picked from commit 5a42831345)
2023-01-06 14:55:06 -08:00
Sylvain
7bf4319eb2 fix computation of alpha in BlitRGBtoRGBPixelAlphaMMX3DNOW (see #6990)
( same as BlitRGBtoRGBPixelAlphaMMX )
2023-01-06 21:24:24 +01:00
Sylvain
0ebda87425 Fixed bug #6990: fix computation of alpha in BlitRGBtoRGBPixelAlphaMMX 2023-01-06 08:50:33 -08:00
Sam Lantinga
a099172754 Added support for the ThrustMaster eSwap PRO Controller Xbox
(cherry picked from commit 0357390fc2)
2023-01-03 15:24:32 -08:00
Sam Lantinga
988866ca4a Fixed line wrapping for HID packet dump
(cherry picked from commit e85839cd56)
2023-01-03 15:14:00 -08:00
Sam Lantinga
2cb7a0a0bb Added support for the ThrustMaster eSwap PRO Controller Xbox
(cherry picked from commit dacdb1c310)
2023-01-03 15:13:50 -08:00
Sam Lantinga
b8d5fa4aef Improved handling of binding buttons and axes
(cherry picked from commit 71f3bf90ed)
2023-01-03 12:50:20 -08:00
Sylvain
0a9f61fbf1 Wayland / Drag and Drop: find the current window 2023-01-03 19:07:28 +01:00
Ozkan Sezer
c7f22f0324 render/SDL_yuv_sw.c: fix build after commit d234f7a 2023-01-02 20:51:56 +03:00
Sylvain Becker
d234f7a498 SDL2: backport SDL_CalculateYUVSize() that checks for YUV size overflow (#6972) 2023-01-02 09:09:57 -08:00
Sylvain
2fd9e63f1a Android: orientation, check for exact match to "Portrait". (see #6959)
(Portrait is also contained in PortraitUpsideDown)
2023-01-02 09:48:26 +01:00
Sylvain
874ebed14d Android: inverse LandscapeLeft and LandscapeRight (see #6959)
LandscapeLeft has now been set to ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE and LandscapeRight to ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE in order to reflect the docs: https://wiki.libsdl.org/SDL2/SDL_HINT_ORIENTATIONS
2023-01-02 09:48:17 +01:00
Ozkan Sezer
5b904a103a windows: more HANDLE -> HMODULE changes. 2022-12-31 08:00:20 +03:00
Ozkan Sezer
0a8f9777a7 SDL_dynapi.c: LoadLibraryA() returns HMODULE. 2022-12-30 11:11:10 +03:00
Sam Lantinga
78d3a713de Fixed documentation for SDL_JoystickGetDeviceInstanceID
Fixes https://github.com/libsdl-org/SDL/issues/6946
2022-12-29 15:00:32 -08:00
Sam Lantinga
74229d4a41 Fixed keyboard scancode mapping for parenthesis
(thanks to @meyraud705 for tracking down the root cause!)

Fixes https://github.com/libsdl-org/SDL/issues/6787
Closes https://github.com/libsdl-org/SDL/pull/6937

(cherry picked from commit e1bd5bd071)
2022-12-29 14:55:46 -08:00
Sam Lantinga
29a4c5ebc2 Fixed getting the VID/PID of a virtual joystick
(cherry picked from commit e40a96155f)
2022-12-28 12:52:17 -08:00
Sam Lantinga
903df79b2d Make sure we match the same way when adding a mapping and looking up a mapping
Fixes https://github.com/libsdl-org/SDL/issues/6898

(cherry picked from commit 3db9112ef4)
2022-12-27 12:21:13 -08:00
Ozkan Sezer
d47ff8ae73 SDL_thread.h: fix SDL_CreateThreadWithStackSize macro for OS/2 2022-12-27 00:14:00 +03:00
Ozkan Sezer
738442b82a SDL_thread.h: fix beginthread param of SDL_CreateThreadWithStackSize for win32
(cherry-picked from commit 29ba5f5d64)
2022-12-27 00:11:55 +03:00
Vincent Hamm
68073c6276 Fix SDL_CreateThreadWithStackSize not passing staacksize with win32 static api 2022-12-26 11:22:41 -08:00
Sam Lantinga
920acb75c3 editorconfig: remove trailing whitespace in source code
(cherry picked from commit 7c67213cef)
2022-12-26 10:34:45 -08:00
Sam Lantinga
3dbc6a40ae render: only enable clipping when the rectangle is valid
Fixes https://github.com/libsdl-org/SDL/issues/6896

(cherry picked from commit 00f05dcf49)
2022-12-26 10:25:23 -08:00
João Henrique
af54c82138 kmsdrm: Fix wrong check on KMSDRM_CreateWindow.
A previous cleanup commit inverted a statement that checked the return value of
a KMSDRM_CreateSurfaces call during KMSDRM_CreateWindow, which causes the video
backend to always fail despite success.

This commit restores the intended behavior.

Fixes: 3c501b963d ("Clang-Tidy fixes (#6725)").
(cherry picked from commit 0187209f46)
2022-12-23 09:29:49 -08:00
Rudolf-Walter Kiss-Szakacs
232ed540db Add SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS. 2022-12-22 08:59:56 -08:00
Caleb Cornett
c542aef600 Fix GDK OpenGL build error 2022-12-20 23:22:55 -05:00
Caleb Cornett
abffa1194a Fix dynapi signature for SDL_GDKSuspendComplete 2022-12-20 23:17:50 -05:00
Caleb Cornett
3b3c141ff9 gdk: Add support for building with OpenGL on Xbox 2022-12-19 17:57:17 -05:00
Sam Lantinga
6969b3be3b Don't send Razer devices the Sony third-party query feature report
Some of them lock up or reset, and the vast majority of devices are not actually game controllers.

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

(cherry picked from commit 83b29f9ce1)
2022-12-19 09:16:59 -08:00
Maido
311b02f0b5 Android active driver check (#6850)
Check if a driver is active before attempting to handle the devices.
Otherwise an assertion will fail.
2022-12-19 16:02:42 +01:00
Sylvain Becker
36c87d9f27 Android JAVA DetectDevices: 'is_capture' is inverted (#6845)
* Android JAVA DetectDevices: 'is_capture' is inversed
* Android Audio: adding audio device. also inverted capture, from jni side
2022-12-18 16:56:43 +01:00
Sylvain Becker
4e3fc0c1dc Android: make Detect devices common between aaudio and android driver. (#6828)
remove VLA, dynamic alloc, check max length get using GetIntArrayRegion
2022-12-18 12:08:24 +01:00
Sam Lantinga
187708e542 Fixed compiler warning
```
 ./src/thread/pthread/SDL_syssem.c:140:12: warning: variable 'retval' is used uninitialized whenever 'while' loop exits because its condition is false [-Wsometimes-uninitialized]
    while (sem_trywait(&sem->sem) != 0) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/thread/pthread/SDL_syssem.c:149:12: note: uninitialized use occurs here
    return retval;
           ^~~~~~
./src/thread/pthread/SDL_syssem.c:140:12: note: remove the condition if it is always true
    while (sem_trywait(&sem->sem) != 0) {
```

This was a legitimate bug, thank you clang!

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

(cherry picked from commit b678a98024)
2022-12-17 06:59:19 -08:00
Sam Lantinga
3b0cd44158 Fixed compiler warning
```
 ./src/joystick/SDL_joystick.c:105:12: warning: no previous extern declaration for non-static variable 'SDL_joystick_lock' [-Wmissing-variable-declarations]
SDL_mutex *SDL_joystick_lock = NULL; /* This needs to support recursive locks */
           ^
./src/joystick/SDL_joystick.c:105:1: note: declare 'static' if the variable is not intended to be used outside of this translation unit
SDL_mutex *SDL_joystick_lock = NULL; /* This needs to support recursive locks */
^
```
1 warning generated.
2022-12-17 06:51:02 -08:00
Maido
741499dea7 Android audio device selection (#6824)
Make it possible to select a specific audio device for Android
2022-12-16 16:38:57 +01:00
Sam Lantinga
a53382e460 Sorted PS4 controllers, note that the NACON Wireless Controller for PS4 actually reports as an XInput device 2022-12-15 18:00:51 -08:00
Sam Lantinga
e99b9ca9c0 Note that the NACON Daija Arcade Stick is an arcade stick 2022-12-15 17:58:29 -08:00
Sylvain
8e72be3117 testime.c: fix wrong {} in switch 2022-12-15 14:39:05 +01:00
Sam Lantinga
7a9966af9d Fixed crash in SDL_PrivateGameControllerRefreshMapping() 2022-12-14 14:24:58 -08:00
Sam Lantinga
d59caffe2c Added support for clang thread-safety analysis
The annotations have been added to SDL_mutex.h and have been made public so applications can enable this for their own code.

Clang assumes that locking and unlocking can't fail, but SDL has the concept of a NULL mutex, so the mutex functions have been changed not to report errors if a mutex hasn't been initialized. We do have mutexes that might be accessed when they are NULL, notably in the event system, so this is an important change.

This commit cleans up a bunch of rare race conditions in the joystick and game controller code so now everything should be completely protected by the joystick lock.

To test this, change the compiler to "clang -Wthread-safety -Werror=thread-safety -DSDL_THREAD_SAFETY_ANALYSIS"
2022-12-14 09:29:19 -08:00
Sylvain Becker
582fb3901a DBus: add a reference to the connection
Fixed bug #6712
2022-12-14 17:46:52 +01:00
Sam Lantinga
c709741871 Detect display change when fullscreen desktop windows move displays
This happens when using Win+Alt+Left/Right on a resizable fullscreen desktop window on Windows

(cherry picked from commit 650e16a824)
2022-12-12 20:28:07 -08:00
Sam Lantinga
817454cfe6 Don't try to open the Razer Huntsman Elite keyboard as a controller 2022-12-12 18:00:57 -08:00
Ryan C. Gordon
e986c7984b wasapi: Fixed incorrect assertions.
Fixes #6795.

(cherry picked from commit 12486e144b)
2022-12-12 16:08:52 -05:00
Frank Praznik
dfd7efaf13 wayland: Set xdg surface geometry
It was previously thought that these function calls were unnecessary as the initial bug and reproduction case that necessitated their addition seemed to be fixed, but apparently there are still cases where this needs to be set explicitly. Set the xdg surface geometry at creation time and when the window size changes.

Partially reverts #6361.  This is not needed in the libdecor path, as libdecor calls this for the content surface internally.

(cherry picked from commit 90a964f132)
2022-12-12 11:22:18 -08:00
Sam Lantinga
802b5ef7dc Added support for the STRIKEPAD PS4 Grip Add-on to the HIDAPI driver
(cherry picked from commit 618340bf99)
2022-12-12 10:56:08 -08:00
Pierre Wendling
e580e087ff N3DS: Backport semaphore fixes from #6776. 2022-12-11 17:09:28 -08:00
nfarid
b79732b967 cmake: use FindALSA.cmake to find ALSA library 2022-12-11 23:23:45 +01:00
Sylvain
faa7e3cc2e Update DYNAPI SDL_WinRTRunApp() prototype which was wrong (see #6783) 2022-12-10 19:22:27 +01:00
Sylvain
5efc9bd194 SDL_dynapi_procs: fixed SDL_UIKitRunApp prototype (see #6783) 2022-12-10 19:22:08 +01:00
Ryan C. Gordon
4bae75387a docs: Note that you don't need to free SDL_GetDefaultCursor's results.
Reference Issue #6777.

(cherry picked from commit 16f8dfcef9)
2022-12-09 22:09:39 -05:00
Sam Lantinga
f57776836f Fixed build 2022-12-09 10:22:18 -08:00
Sam Lantinga
569fa3f57f Added test event logging for SDL_WINDOWEVENT_ICCPROF_CHANGED and SDL_WINDOWEVENT_DISPLAY_CHANGED 2022-12-09 10:13:18 -08:00
Sam Lantinga
be3b1cff0b Added logging for SDL_DISPLAYEVENT_MOVED 2022-12-08 17:03:29 -08:00
Sam Lantinga
ab479b4961 Make sure the display list is up to date for window placement 2022-12-08 17:01:18 -08:00
Sam Lantinga
264da8c127 Added SDL_DISPLAYEVENT_MOVED to detect when display positioning changes 2022-12-08 12:46:13 -08:00
Sam Lantinga
cfc7cac3c9 Fixed memory leak when removing existing displays 2022-12-08 12:43:23 -08:00
Frank Praznik
8b74be464f wayland: Handle the Num Lock and Caps Lock modifiers via modifier events
Num Lock and Caps Lock always need to be explicitly handled by the modifier handler function, or they won't be correctly set if active at application startup, or if the lock state is changed while the application lacks focus since a key press for these keys will never be received.  In these cases, the internal SDL modifier state can end up the inverse of the actual modifier state.

(cherry picked from commit 653e484da1)
2022-12-08 09:30:22 -08:00
Sam Lantinga
fc689a6cb3 Fixed build 2022-12-07 16:06:17 -08:00
Sam Lantinga
b4d547905d Use the correct name for the DualSense controllers
(cherry picked from commit 9a6bcca6b8)
2022-12-07 14:54:00 -08:00
Sam Lantinga
4ee36a9474 Added support for the DualSense Edge paddles
(cherry picked from commit 9339085593)
2022-12-07 14:48:36 -08:00
Sam Lantinga
c2b2f2a71e Clarified where the paddle locations are
(cherry picked from commit ea714956b6)
2022-12-07 14:47:07 -08:00
Sam Lantinga
d1b4810542 Fixed centering the D-pad on some joysticks
Fixes https://github.com/libsdl-org/SDL/issues/6767
2022-12-05 13:36:51 -08:00
Ozkan Sezer
bcccbbd894 tests: avoid redefinition warnings for MSVC _CRT_???_NO_DEPRECATE macros 2022-12-05 00:35:32 +03:00
Ozkan Sezer
4e465f25d0 reverted const removal from SDL_NewAudioStream in commit d0bbfdbfb. 2022-12-04 12:55:15 +03:00
Max Bachmann
7ac66972b7 Detect Logitech PRO Racing Wheel as wheel
(cherry picked from commit 5650046f93)
2022-12-03 08:22:05 -08:00
Sylvain
3e9ae3ea64 Fix wrong clang-tidy modification. This is an integer division. Thanks @meyraud705 (see PR #6725) 2022-12-03 13:39:03 +01:00
Sylvain
0a91a793cf Fix Conditional jump or move depends on uninitialised value(s)
eg ./testsprite2 --trackmem
2022-12-02 21:13:40 +01:00
Sam Lantinga
07d6d116ed Commented out syntax that causes Visual Studio 2019 to complain on every edit
(cherry picked from commit 4713db1484)
2022-12-02 00:43:46 -08:00
Frank Praznik
b5483f2c68 Fix formatting on Wayland and Pipewire function signatures
Fixes the formatting on some function signatures that clang-format missed.

(cherry picked from commit 378b1c286a)
2022-12-01 15:19:50 -08:00
Ozkan Sezer
b990e9145b build fixes after d0bbfdbfb8 2022-12-02 02:13:59 +03:00
Sam Lantinga
3bdc62215e Fixed Apple build after d0bbfdbfb8 2022-12-01 15:11:29 -08:00
Sam Lantinga
423c558e44 Detect the G923 (Xbox style) and PXN V900 (PS3 mode) as wheels
(cherry picked from commit 7237c56499)
2022-12-01 14:44:52 -08:00
Sam Lantinga
42238f88ea Fixed build after d0bbfdbfb8 2022-12-01 13:28:48 -08:00
Pierre Wendling
d0bbfdbfb8 Clang-Tidy fixes (#6725)
(cherry picked from commit 3c501b963d)
2022-12-01 13:08:50 -08:00
Sam Lantinga
e29c0661cc Removed check for _HAVE_STDINT_H, which nobody defines
Fixes https://github.com/libsdl-org/SDL/issues/6619
2022-12-01 12:54:02 -08:00
Ozkan Sezer
e57554ea65 SDL_main.h: added field to SDL_GDKSuspendComplete documentation. 2022-12-01 20:37:00 +03:00
Sylvain
09ee811f4b Small format changed (using clang-format 15.0.2-1)
(cherry picked from commit 778b8926b4)
2022-12-01 08:29:15 -08:00
Ozkan Sezer
b067ab9202 restore SDL_malloc.c original formatting.
(cherry picked from commit 45025799b7)
2022-11-30 18:18:06 -08:00
Sam Lantinga
6e40c7a9b8 Added support for the Logitech Cordless Precision PS3 controller 2022-11-30 17:03:29 -08:00
Sam Lantinga
01541bc350 Added support for the HORIPAD Pro for Xbox Series X 2022-11-30 16:42:00 -08:00
Sam Lantinga
4504c10f3b Re-enabled support for third party PS3 controllers 2022-11-30 16:37:20 -08:00
Sam Lantinga
7b1000013e Reverted code formatting for Apple platforms
We didn't get the merge right, and rather than tease out exactly what happened, I'm just reverting for now.
2022-11-30 15:51:17 -08:00
Sam Lantinga
9e997cc787 Fixed Victrix FS Pro V2 controller hang on reboot 2022-11-30 15:39:10 -08:00
Sam Lantinga
d87048fd5a Fixed crash if GetRectDisplayIndex() is called before SDL_VideoInit() 2022-11-30 14:37:34 -08:00
Sam Lantinga
6926d046c0 Fixed build after cherry-pick of 5750bcb174 from SDL3 2022-11-30 13:05:57 -08:00
Sam Lantinga
b8d85c6939 Update for SDL3 coding style (#6717)
I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base.

In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted.

The script I ran for the src directory is added as build-scripts/clang-format-src.sh

This fixes:
#6592
#6593
#6594

(cherry picked from commit 5750bcb174)
2022-11-30 12:57:41 -08:00
Sam Lantinga
5c4bc807f7 Revert "SDL_test_md5.h: fix MD5UINT4 type to be really 32 bits."
This reverts commit 8eeca8c7db as it's potentially an ABI break.
2022-11-30 05:59:56 -08:00
Ozkan Sezer
8eeca8c7db SDL_test_md5.h: fix MD5UINT4 type to be really 32 bits.
(cherry picked from commit 8901297437)
2022-11-30 05:59:03 -08:00
David Edmundson
d7664a6ef1 Support wayland fractional scale protocol
The new protocol adds support for more native communication of
fractional scaling.

Everything in the wayland backend already existed only our fractional
scale was calculated implicitly through a combination of output size
guesswork for fullscreen windows.

This new protocol makes that explicit, providing a more robust solution
and a solution for non-fullscreen surfaces. The fallback code is still
left in place for now whilst compositors gain support.
2022-11-29 16:37:02 -05:00
Anonymous Maarten
5df106603d cmake: move platform detection to cmake/sdl/paltform.cmake for re-use by SDL2-compat 2022-11-29 20:20:33 +01:00
Ryan C. Gordon
69f0223474 dynapi: Abstract out the environment variable name.
(cherry picked from commit cc487ffb801f862aec7e2b415e74c563c4d528d5)
2022-11-29 14:15:20 -05:00
pionere
724845110c video: fix error messages
- do not overwrite error message set by SDL_InitFormat (SDL_AllocFormat)
- set proper error message (Cocoa_Metal_CreateView)
- protect against allocation failure (UIKit_Metal_CreateView)

(cherry picked from commit cf0cb44df8)
2022-11-29 11:04:11 -08:00
Anonymous Maarten
84039e2514 cmake: use target_link_libraries to pass -Wl,--undefined=WinMain
(cherry-picked from commit e2060de714)
2022-11-29 21:15:21 +03:00
Sam Lantinga
2d24baaad4 Fixed building on Windows with SDL_VIDEO=OFF
Fixes https://github.com/libsdl-org/SDL/issues/6562
2022-11-29 09:26:29 -08:00
Sam Lantinga
b7cc4dce70 Fixed bug #6698 - VISA: wrong check sceKernelPollSema
(cherry picked from commit f077c69193)
2022-11-29 08:51:23 -08:00
pionere
0b7a9a8e9f thread: code style
(cherry picked from commit 461a38ff1a)
2022-11-29 08:47:52 -08:00
Sylvain
8cda5102fc Fixed bug #6698 - VISA: wrong check sceKernelPollSema 2022-11-29 16:16:10 +01:00
pionere
ee13e8c76b thread: return -1 from SDL_SemWaitTimeout if semaphore is NULL
(cherry picked from commit f6db1aba66)
2022-11-29 09:40:58 -05:00
pionere
fcd7d658dc thread: fix inconsistent return values
- SDL_CreateMutex returns NULL when the creation fails (ngage)
- SDL_SemValue returns 0 when the semaphore is NULL (n3ds)

(cherry picked from commit 6875e1c262)
2022-11-29 09:28:33 -05:00
Sam Lantinga
89e9f7b42b Added support for the Xbox Elite controller paddles with firmware version 5.13+ 2022-11-28 23:10:02 -08:00
Vasily Khoruzhick
b6c875a923 Add support for the 8BitDo Ultimate Wireless 2.4GHz Controller in DirectInput mode
Generated using controller map
2022-11-28 17:48:03 -08:00
Samuel Venable
a65d1bfb14 Fix broken solaris build. (missing brace).
missing brace.
2022-11-28 15:51:28 -08:00
Sam Lantinga
37d244ea81 Added support for the 8BitDo Ultimate Wired Controller in DirectInput mode, including the misc button and paddles 2022-11-28 14:49:07 -08:00
Sam Lantinga
a937b5c4ad Add 8BitDo to the list of Xbox 360 third party vendors
Allows detection of the 8BitDo Ultimate Wired Controller
2022-11-28 13:47:30 -08:00
Sylvain Becker
fb0ce375f0 Cleanup add brace (#6545)
* Add braces after if conditions

* More add braces after if conditions

* Add braces after while() conditions

* Fix compilation because of macro being modified

* Add braces to for loop

* Add braces after if/goto

* Move comments up

* Remove extra () in the 'return ...;' statements

* More remove extra () in the 'return ...;' statements

* More remove extra () in the 'return ...;' statements after merge

* Fix inconsistent patterns are xxx == NULL vs !xxx

* More "{}" for "if() break;"  and "if() continue;"

* More "{}" after if() short statement

* More "{}" after "if () return;" statement

* More fix inconsistent patterns are xxx == NULL vs !xxx

* Revert some modificaion on SDL_RLEaccel.c

* SDL_RLEaccel: no short statement

* Cleanup 'if' where the bracket is in a new line

* Cleanup 'while' where the bracket is in a new line

* Cleanup 'for' where the bracket is in a new line

* Cleanup 'else' where the bracket is in a new line

(cherry picked from commit 6a2200823c to reduce conflicts merging between SDL2 and SDL3)
2022-11-28 12:33:03 -08:00
Samuel Venable
0739d237ad [skip ci] Solaris getexecname() returns argv[0]
`argv[0]`/`getexexname()` are not always absolute paths by default and can be modified to anything the developer wants them to be.

Consider using `readSymLink("/proc/self/path/a.out")` instead and `getexecname()` as the fallback, since the symlink will always be the correct absolute path (unless /proc is ot mounted, but it is by default on Solaris and Illumos platforms).

(cherry picked from commit 4f5e9fd5bd)
2022-11-27 21:38:01 -05:00
Markus Mittendrein
8145212103 SDL_ResampleAudio: Fix float accumulation error
While 78f97108f9 reduced the accumulation error, it was still big enough to cause distortions.
Fixes #6196.
2022-11-27 21:06:52 -05:00
Joshua Root
2df39e64ab Fix build with Xcode < 7
The _Nullable attribute is not available in older versions.

(cherry picked from commit 9a64aa6f95)
2022-11-26 20:36:54 -08:00
Sam Lantinga
8fddf146bf Temporary hack to address performance issues in https://github.com/libsdl-org/SDL/issues/6581#issuecomment-1327987916 (thanks @icculus!)
(cherry picked from commit 9c8369e097)
2022-11-26 13:11:26 -08:00
Ryan C. Gordon
3f5593d613 cocoa: Patched to compile on macOS SDK < 10.10.
Fixes #6586.

(cherry picked from commit fa5adcafd5)
2022-11-26 13:59:44 -05:00
Anonymous Maarten
dcd1252368 cmake: test for lsx and lasx intrinsics for loongarch 2022-11-25 21:50:43 +01:00
Anonymous Maarten
edb75bc29e cmake: make all assembly options depend on SDL_ASSEMBLY and architecture 2022-11-25 21:50:25 +01:00
Anonymous Maarten
660cec69b1 cmake: find libudev library so it gets priority 2022-11-25 21:37:42 +01:00
Anonymous Maarten
a2611edcf3 cmake: add support for some BSD's wscons input 2022-11-25 21:37:36 +01:00
Michael Fitzmayer
e19c532ebf Add bitdraw.h, remove non-working stub class
(cherry picked from commit 67f31a19a8)
2022-11-24 13:13:08 -08:00
Anonymous Maarten
e426617c9c cmake: add X11 include dir to check dirs 2022-11-24 21:00:26 +01:00
Sylvain Becker
192cdf3d04 SDL_mfijoystick.m: remove VLA, so that projects can be built with error on vla 2022-11-24 18:33:50 +03:00
Ozkan Sezer
64a5e7be98 added missing FGREP to Makefile.in. fixed syntax. regenerated configure. 2022-11-24 17:00:20 +03:00
Frank Praznik
66bd15555c wayland: Fix build when not using the shared Wayland libraries
Explicitly include the Wayland protocol headers when statically linking against the Wayland libraries or older system headers might be used instead of the local versions.

(cherry picked from commit 836eb22442)
2022-11-24 03:01:42 -08:00
Sam James
4c7156c1e6 Avoid use of deprecated egrep/fgrep
GNU grep 3.8 emits a deprecation warning on use of egrep/fgrep.

Signed-off-by: Sam James <sam@gentoo.org>
(cherry picked from commit 3e7952ce8a)
2022-11-24 02:59:41 -08:00
Joshua Root
33e5de31d8 vulkan_metal.h: Make compatible with ObjC ARC
Fixes #6598

(cherry picked from commit 239423e205)
2022-11-23 17:39:26 -08:00
Frank Praznik
3eaf56894e wayland: Fix libdecor_dispatch signature
The function returns an int, not a bool.

(cherry picked from commit f47169fcba)
2022-11-23 15:17:52 -08:00
Joshua Root
242ce20cbf SDL_mfijoystick.m: fix build with Xcode < 9
Fixes #6601.

(cherry picked from commit 53ca1f7702)
2022-11-23 12:48:26 -08:00
Joshua Root
f52e7199df Check build-time SDK in LoadMainMenuNibIfAvailable
Fixes building against OS X 10.7 SDK.

(cherry picked from commit f8cebeea59)
2022-11-23 12:28:43 -08:00
Joshua Root
e12c831b15 SDL_cocoaopengl.h: ensure CVDisplayLinkRef is defined
The typedef seems to be pulled in coincidentally with newer SDKs, but
older ones need to import the header explicitly.

(cherry picked from commit d2910904fb)
2022-11-23 12:22:40 -08:00
Ozkan Sezer
cd399caf6f fix dynapi after SDL_GDKSuspendComplete addition. 2022-11-23 22:50:10 +03:00
Ciro Mondueri
f6144dfe03 adds GDK suspend/resume basic handling (#6596) 2022-11-23 11:41:14 -08:00
SDL Wiki Bot
ac2fcfcb62 Sync SDL2 wiki -> header 2022-11-22 23:21:36 +00:00
Ryan C. Gordon
4ac2d45a06 Testing the wiki, disregard this commit. 2022-11-22 18:12:43 -05:00
Sam Lantinga
dce6ed56d7 Removed G29 from controller_type.c
We don't want the G29 to show up as a gamepad, Steam will create a virtual Xbox controller for it, which breaks racing games.
2022-11-22 10:56:44 -08:00
Sam Lantinga
e3d430b83e Revert "Added Linux mappings for the Logitech G29 in PS3 and PS4 modes"
This reverts commit 33a68f575f.

We don't want the G29 to show up as a gamepad, Steam will create a virtual Xbox controller for it, which breaks racing games.
2022-11-22 10:53:28 -08:00
Ryan C. Gordon
511bab5bbf .wikiheaders-options: Move SDL2 documentation to a subdirectory.
SDL3 will be the main thing now.
2022-11-22 13:05:08 -05:00
Anonymous Maarten
156bf7e6aa android.mk: LOCAL_EXPORT_C_INCLUDES does not need to add include subfolder 2022-11-22 09:41:23 -08:00
Sam Lantinga
938b720a9e Update SDL info and Xcode marketing version to 2.27.0 2022-11-22 09:19:21 -08:00
Sam Lantinga
44975d40ef Update SDL info and Xcode marketing version with version update scripts 2022-11-22 09:18:05 -08:00
Sam Lantinga
ea8f8b6dc3 Updated to version 2.27.0 for development 2022-11-21 16:36:10 -08:00
1349 changed files with 106802 additions and 291540 deletions

View File

@@ -16,8 +16,8 @@ AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: All
AlwaysBreakAfterReturnType: AllDefinitions
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
@@ -35,7 +35,7 @@ BraceWrapping:
AfterUnion: true
AfterExternBlock: false
BeforeElse: false
BeforeWhile: true
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
@@ -62,7 +62,8 @@ IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: NoIndent
SpaceAfterCStyleCast: true
PointerAlignment: Right
SpaceAfterCStyleCast: false
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true

View File

@@ -7,6 +7,8 @@ root = true
[*.{c,cg,cpp,gradle,h,java,m,metal,pl,py,S,sh,txt}]
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.{html,js,json,m4,yml,yaml,vcxproj,vcxproj.filters}]
indent_size = 2

View File

@@ -0,0 +1,82 @@
name: 'Setup GDK (Game Development Kit) for Windows Desktop'
description: 'Download GDK and install into MSBuild'
inputs:
# Keep edition and ref in sync!
edition:
description: 'GDK edition'
default: '240601' # YYMMUU (Year Month Update)
ref:
description: 'Git reference'
default: 'June_2024_Update_1'
folder:
description: 'Folder where to create Directory.Build.props'
required: true
default: '${{ github.workspace }}'
runs:
using: 'composite'
steps:
- uses: actions/setup-python@main
with:
python-version: 3.x
- name: 'Calculate variables'
id: calc
shell: pwsh
run: |
$vs_folder=@(vswhere -latest -property installationPath)
echo "vs-folder=${vs_folder}" >> $Env:GITHUB_OUTPUT
echo "gdk-path=${{ runner.temp }}\GDK-${{ inputs.edition }}" >> $Env:GITHUB_OUTPUT
echo "cache-key=gdk-${{ inputs.ref }}-${{ inputs.edition }}" >> $Env:GITHUB_OUTPUT
- name: 'Restore cached GDK'
id: cache-restore
uses: actions/cache/restore@v4
with:
path: '${{ steps.calc.outputs.gdk-path }}'
key: ${{ steps.calc.outputs.cache-key }}
- name: 'Download GDK'
if: ${{ !steps.cache-restore.outputs.cache-hit }}
shell: pwsh
run: |
python build-scripts/setup-gdk-desktop.py `
--download `
--temp-folder "${{ runner.temp }}" `
--gdk-path="${{ steps.calc.outputs.gdk-path }}" `
--ref-edition "${{ inputs.ref }},${{ inputs.edition }}" `
--vs-folder="${{ steps.calc.outputs.vs-folder }}" `
--no-user-props
- name: 'Extract GDK'
if: ${{ !steps.cache-restore.outputs.cache-hit }}
shell: pwsh
run: |
python build-scripts/setup-gdk-desktop.py `
--extract `
--ref-edition "${{ inputs.ref }},${{ inputs.edition }}" `
--temp-folder "${{ runner.temp }}" `
--gdk-path="${{ steps.calc.outputs.gdk-path }}" `
--vs-folder="${{ steps.calc.outputs.vs-folder }}" `
--no-user-props
- name: 'Cache GDK'
if: ${{ !steps.cache-restore.outputs.cache-hit }}
uses: actions/cache/save@v4
with:
path: '${{ steps.calc.outputs.gdk-path }}'
key: ${{ steps.calc.outputs.cache-key }}
- name: 'Copy MSBuild files into GDK'
shell: pwsh
run: |
python build-scripts/setup-gdk-desktop.py `
--ref-edition "${{ inputs.ref }},${{ inputs.edition }}" `
--gdk-path="${{ steps.calc.outputs.gdk-path }}" `
--vs-folder="${{ steps.calc.outputs.vs-folder }}" `
--copy-msbuild `
--no-user-props
- name: 'Write user props'
shell: pwsh
run: |
python build-scripts/setup-gdk-desktop.py `
--ref-edition "${{ inputs.ref }},${{ inputs.edition }}" `
--temp-folder "${{ runner.temp }}" `
--vs-folder="${{ steps.calc.outputs.vs-folder }}" `
--gdk-path="${{ steps.calc.outputs.gdk-path }}" `
"--props-folder=${{ inputs.folder }}"

62
.github/actions/setup-ninja/action.yml vendored Normal file
View File

@@ -0,0 +1,62 @@
name: 'Setup ninja'
description: 'Download ninja and add it to the PATH environment variable'
inputs:
version:
description: 'Ninja version'
default: '1.12.1'
runs:
using: 'composite'
steps:
- name: 'Calculate variables'
id: calc
shell: sh
run: |
case "${{ runner.os }}-${{ runner.arch }}" in
"Linux-X86" | "Linux-X64")
archive="ninja-linux.zip"
;;
"Linux-ARM64")
archive="ninja-linux-aarch64.zip"
;;
"macOS-X86" | "macOS-X64" | "macOS-ARM64")
archive="ninja-mac.zip"
;;
"Windows-X86" | "Windows-X64")
archive="ninja-win.zip"
;;
"Windows-ARM64")
archive="ninja-winarm64.zip"
;;
*)
echo "Unsupported ${{ runner.os }}-${{ runner.arch }}"
exit 1;
;;
esac
echo "archive=${archive}" >> ${GITHUB_OUTPUT}
echo "cache-key=${archive}-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}" >> ${GITHUB_OUTPUT}
- name: 'Restore cached ${{ steps.calc.outputs.archive }}'
id: cache-restore
uses: actions/cache/restore@v4
with:
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
key: ${{ steps.calc.outputs.cache-key }}
- name: 'Download ninja ${{ inputs.version }} for ${{ runner.os }} (${{ runner.arch }})'
if: ${{ !steps.cache-restore.outputs.cache-hit }}
shell: pwsh
run: |
Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v${{ inputs.version }}/${{ steps.calc.outputs.archive }}" -OutFile "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"
- name: 'Cache ${{ steps.calc.outputs.archive }}'
if: ${{ !steps.cache-restore.outputs.cache-hit }}
uses: actions/cache/save@v4
with:
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
key: ${{ steps.calc.outputs.cache-key }}
- name: 'Extract libusb'
shell: pwsh
run: |
7z "-o${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" x "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"
- name: 'Set output variables'
id: final
shell: pwsh
run: |
echo "${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" >> $env:GITHUB_PATH

View File

@@ -0,0 +1,93 @@
name: 'Setup GLES for PlayStation Vita'
description: 'Download GLES for VITA (PVR or PIB), and copy it into the vita sdk'
inputs:
pib-version:
description: 'PIB version'
default: '1.1.4'
pvr-version:
description: 'PVR_PSP2 version'
default: '3.9'
type:
description: '"pib" or "pvr"'
default: ''
runs:
using: 'composite'
steps:
- name: 'Calculate variables'
id: calc
shell: sh
run: |
if test "x${VITASDK}" = "x"; then
echo "VITASDK must be defined"
exit 1;
fi
case "x${{ inputs.type }}" in
"xpvr")
echo "cache-key=SDL-vita-gles-pvr-${{ inputs.pvr-version}}" >> ${GITHUB_OUTPUT}
;;
"xpib")
echo "cache-key=SDL-vita-gles-pib-${{ inputs.pib-version}}" >> ${GITHUB_OUTPUT}
;;
*)
echo "Invalid type. Must be 'pib' or 'pvr'."
exit 1
;;
esac
- uses: actions/cache/restore@v4
id: restore-cache
with:
path: /vita/dependencies
key: '${{ steps.calc.outputs.cache-key }}'
- name: 'Download PVR_PSP2 (GLES)'
if: ${{ !steps.restore-cache.outputs.cache-hit && inputs.type == 'pvr' }}
shell: sh
run: |
pvr_psp2_version=${{ inputs.pvr-version }}
mkdir -p /vita/dependencies/include
mkdir -p /vita/dependencies/lib
# Configure PVR_PSP2 headers
wget https://github.com/GrapheneCt/PVR_PSP2/archive/refs/tags/v$pvr_psp2_version.zip -P/tmp
unzip /tmp/v$pvr_psp2_version.zip -d/tmp
cp -r /tmp/PVR_PSP2-$pvr_psp2_version/include/* /vita/dependencies/include
rm /tmp/v$pvr_psp2_version.zip
# include guard of PVR_PSP2's khrplatform.h does not match the usual one
sed -i -e s/__drvkhrplatform_h_/__khrplatform_h_/ /vita/dependencies/include/KHR/khrplatform.h
# Configure PVR_PSP2 stub libraries
wget https://github.com/GrapheneCt/PVR_PSP2/releases/download/v$pvr_psp2_version/vitasdk_stubs.zip -P/tmp
unzip /tmp/vitasdk_stubs.zip -d/tmp/pvr_psp2_stubs
find /tmp/pvr_psp2_stubs -type f -name "*.a" -exec cp {} /vita/dependencies/lib \;
rm /tmp/vitasdk_stubs.zip
rm -rf /tmp/pvr_psp2_stubs
- name: 'Download gl4es4vita (OpenGL)'
if: ${{ !steps.restore-cache.outputs.cache-hit && inputs.type == 'pib' }}
shell: sh
run: |
gl4es4vita_version=${{ inputs.pib-version }}
mkdir -p /vita/dependencies/include
mkdir -p /vita/dependencies/lib
# Configure gl4es4vita headers
wget https://github.com/SonicMastr/gl4es4vita/releases/download/v$gl4es4vita_version-vita/include.zip -P/tmp
unzip -o /tmp/include.zip -d/vita/dependencies/include
rm /tmp/include.zip
# Configure gl4es4vita stub libraries
wget https://github.com/SonicMastr/gl4es4vita/releases/download/v$gl4es4vita_version-vita/vitasdk_stubs.zip -P/tmp
unzip /tmp/vitasdk_stubs.zip -d/vita/dependencies/lib
- uses: actions/cache/save@v4
if: ${{ !steps.restore-cache.outputs.cache-hit }}
with:
path: /vita/dependencies
key: '${{ steps.calc.outputs.cache-key }}'
- name: Copy PVR_PSP2 (GLES) or gl4es4vita (OpenGL) to vita toolchain dir
shell: sh
run: |
cp -rv /vita/dependencies/* ${VITASDK}/arm-vita-eabi

16
.github/cmake/CMakeLists.txt vendored Normal file
View File

@@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.0...3.5)
project(ci_utils C CXX)
set(txt "CC=${CMAKE_C_COMPILER}
CXX=${CMAKE_CXX_COMPILER}
CFLAGS=${CMAKE_C_FLAGS}
CXXFLAGS=${CMAKE_CXX_FLAGS}
LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_C_STANDARD_LIBRARIES}
")
message("${txt}")
set(VAR_PATH "/tmp/env.txt" CACHE PATH "Where to write environment file")
message(STATUS "Writing CC/CXX/CFLAGS/CXXFLAGS/LDFLAGS environment to ${VAR_PATH}")
file(WRITE "${VAR_PATH}" "${txt}")

View File

@@ -1,81 +0,0 @@
name: Build (Android)
on: [push, pull_request]
jobs:
android:
name: ${{ matrix.platform.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- { name: Android.mk }
- { name: CMake, cmake: 1, android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64" }
steps:
- uses: actions/checkout@v3
- uses: nttld/setup-ndk@v1
id: setup_ndk
with:
ndk-version: r21e
- name: Build (Android.mk)
if: ${{ matrix.platform.name == 'Android.mk' }}
run: |
./build-scripts/androidbuildlibs.sh
- name: Setup (CMake)
if: ${{ matrix.platform.name == 'CMake' }}
run: |
sudo apt-get update
sudo apt-get install ninja-build pkg-config
- name: Configure (CMake)
if: ${{ matrix.platform.name == 'CMake' }}
run: |
cmake -B build \
-DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
-DSDL_WERROR=ON \
-DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
-DANDROID_ABI=${{ matrix.platform.android_abi }} \
-DSDL_STATIC_PIC=ON \
-DSDL_VENDOR_INFO="Github Workflow" \
-DCMAKE_INSTALL_PREFIX=prefix \
-DCMAKE_BUILD_TYPE=Release \
-GNinja
- name: Build (CMake)
if: ${{ matrix.platform.name == 'CMake' }}
run: |
cmake --build build --config Release --parallel --verbose
- name: Install (CMake)
if: ${{ matrix.platform.name == 'CMake' }}
run: |
cmake --install build --config Release
echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV
( cd prefix; find ) | LC_ALL=C sort -u
- name: Verify CMake configuration files
if: ${{ matrix.platform.name == 'CMake' }}
run: |
cmake -S cmake/test -B cmake_config_build -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
-DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
-DANDROID_ABI=${{ matrix.platform.android_abi }} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }}
cmake --build cmake_config_build --verbose
- name: Verify sdl2-config
if: ${{ matrix.platform.name == 'CMake' }}
run: |
export CC="${{ steps.setup_ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${{ matrix.platform.arch }}-none-linux-androideabi${{ matrix.platform.android_platform }}"
export PATH=${{ env.SDL2_DIR }}/bin:$PATH
cmake/test/test_sdlconfig.sh
- name: Verify sdl2.pc
if: ${{ matrix.platform.name == 'CMake' }}
run: |
export CC="${{ steps.setup_ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${{ matrix.platform.arch }}-none-linux-androideabi${{ matrix.platform.android_platform }}"
export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
cmake/test/test_pkgconfig.sh
- name: Verify Android.mk
if: ${{ matrix.platform.name == 'CMake' }}
run: |
export NDK_MODULE_PATH=${{ env.SDL2_DIR }}/share/ndk-modules
ndk-build -C ${{ github.workspace }}/cmake/test APP_PLATFORM=android-${{ matrix.platform.android_platform }} APP_ABI=${{ matrix.platform.android_abi }} NDK_OUT=$PWD NDK_LIBS_OUT=$PWD V=1

48
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,48 @@
name: 'Build (All)'
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
controller:
name: 'Create test plan'
runs-on: 'ubuntu-latest'
outputs:
platforms-level1: ${{ steps.plan.outputs.platforms-level1 }}
platforms-others: ${{ steps.plan.outputs.platforms-others }}
steps:
- uses: actions/setup-python@main
with:
python-version: 3.x
- uses: actions/checkout@main
with:
sparse-checkout: '.github/workflows/create-test-plan.py'
- name: 'Create plan'
id: plan
run: |
# Adding [sdl-ci-filter GLOB] to the commit message will limit the jobs
# e.g. [sdl-ci-filter msvc-*]
EOF=$(openssl rand -hex 32)
cat >/tmp/commit_message.txt <<$EOF
${{ github.event.head_commit.message }}
$EOF
python .github/workflows/create-test-plan.py \
--github-variable-prefix platforms \
--github-ci \
--verbose \
${{ (github.repository_owner != 'libsdl-org' && '--no-artifact') || '' }} \
--commit-message-file /tmp/commit_message.txt
level1:
needs: [controller]
uses: './.github/workflows/generic.yml'
with:
platforms: ${{ needs.controller.outputs.platforms-level1 }}
level2:
needs: [controller, level1]
uses: './.github/workflows/generic.yml'
with:
platforms: ${{ needs.controller.outputs.platforms-others }}

801
.github/workflows/create-test-plan.py vendored Executable file
View File

@@ -0,0 +1,801 @@
#!/usr/bin/env python
import argparse
import dataclasses
import fnmatch
from enum import Enum
import json
import logging
import os
import re
from typing import Optional
logger = logging.getLogger(__name__)
class AppleArch(Enum):
ARM64 = "arm64"
X86_64 = "x86_64"
class MsvcArch(Enum):
X86 = "x86"
X64 = "x64"
Arm32 = "arm"
Arm64 = "arm64"
class JobOs(Enum):
WindowsLatest = "windows-latest"
UbuntuLatest = "ubuntu-latest"
MacosLatest = "macos-latest"
Ubuntu20_04 = "ubuntu-20.04"
Ubuntu22_04 = "ubuntu-22.04"
Ubuntu24_04 = "ubuntu-24.04"
Macos13 = "macos-13"
class SdlPlatform(Enum):
Android = "android"
Emscripten = "emscripten"
Haiku = "haiku"
Msys2 = "msys2"
Linux = "linux"
MacOS = "macos"
Ios = "ios"
Tvos = "tvos"
Msvc = "msvc"
N3ds = "n3ds"
Ps2 = "ps2"
Psp = "psp"
Vita = "vita"
Riscos = "riscos"
FreeBSD = "freebsd"
NetBSD = "netbsd"
Watcom = "watcom"
class Msys2Platform(Enum):
Mingw32 = "mingw32"
Mingw64 = "mingw64"
Clang32 = "clang32"
Clang64 = "clang64"
Ucrt64 = "ucrt64"
class IntelCompiler(Enum):
Icc = "icc"
Icx = "icx"
class VitaGLES(Enum):
Pib = "pib"
Pvr = "pvr"
class WatcomPlatform(Enum):
Windows = "windows"
OS2 = "OS/2"
@dataclasses.dataclass(slots=True)
class JobSpec:
name: str
os: JobOs
platform: SdlPlatform
artifact: Optional[str]
container: Optional[str] = None
autotools: bool = False
no_cmake: bool = False
xcode: bool = False
android_mk: bool = False
lean: bool = False
android_arch: Optional[str] = None
android_abi: Optional[str] = None
android_platform: Optional[int] = None
msys2_platform: Optional[Msys2Platform] = None
intel: Optional[IntelCompiler] = None
apple_archs: Optional[set[AppleArch]] = None
msvc_project: Optional[str] = None
msvc_arch: Optional[MsvcArch] = None
msvc_static_crt: bool = False
clang_cl: bool = False
gdk: bool = False
uwp: bool = False
vita_gles: Optional[VitaGLES] = None
watcom_platform: Optional[WatcomPlatform] = None
JOB_SPECS = {
"msys2-mingw32": JobSpec(name="Windows (msys2, mingw32)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw32", msys2_platform=Msys2Platform.Mingw32, ),
"msys2-mingw64": JobSpec(name="Windows (msys2, mingw64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64", msys2_platform=Msys2Platform.Mingw64, ),
"msys2-clang32": JobSpec(name="Windows (msys2, clang32)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw32-clang", msys2_platform=Msys2Platform.Clang32, ),
"msys2-clang64": JobSpec(name="Windows (msys2, clang64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-clang", msys2_platform=Msys2Platform.Clang64, ),
"msys2-ucrt64": JobSpec(name="Windows (msys2, ucrt64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-ucrt", msys2_platform=Msys2Platform.Ucrt64, ),
"msvc-x64": JobSpec(name="Windows (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x64", msvc_arch=MsvcArch.X64, msvc_project="VisualC/SDL.sln", ),
"msvc-x86": JobSpec(name="Windows (MSVC, x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x86", msvc_arch=MsvcArch.X86, msvc_project="VisualC/SDL.sln", ),
"msvc-static-x86": JobSpec(name="Windows (MSVC, static VCRT, x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x86", msvc_arch=MsvcArch.X86, msvc_static_crt=True, ),
"msvc-static-x64": JobSpec(name="Windows (MSVC, static VCRT, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x64", msvc_arch=MsvcArch.X64, msvc_static_crt=True, ),
"msvc-clang-x64": JobSpec(name="Windows (MSVC, clang-cl x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x64", msvc_arch=MsvcArch.X64, clang_cl=True, ),
"msvc-clang-x86": JobSpec(name="Windows (MSVC, clang-cl x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x86", msvc_arch=MsvcArch.X86, clang_cl=True, ),
"msvc-arm32": JobSpec(name="Windows (MSVC, ARM)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm32", msvc_arch=MsvcArch.Arm32, ),
"msvc-arm64": JobSpec(name="Windows (MSVC, ARM64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm64", msvc_arch=MsvcArch.Arm64, ),
"msvc-uwp-x64": JobSpec(name="UWP (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-UWP", msvc_arch=MsvcArch.X64, msvc_project="VisualC-WinRT/SDL-UWP.sln", uwp=True, ),
"msvc-gdk-x64": JobSpec(name="GDK (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-GDK", msvc_arch=MsvcArch.X64, msvc_project="VisualC-GDK/SDL.sln", gdk=True, no_cmake=True, ),
"ubuntu-20.04": JobSpec(name="Ubuntu 20.04", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04", autotools=True),
"ubuntu-22.04": JobSpec(name="Ubuntu 22.04", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04", autotools=True),
"steamrt-sniper": JobSpec(name="Steam Linux Runtime (Sniper)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Linux, artifact="SDL-slrsniper", container="registry.gitlab.steamos.cloud/steamrt/sniper/sdk:beta", ),
"ubuntu-intel-icx": JobSpec(name="Ubuntu 20.04 (Intel oneAPI)", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04-oneapi", intel=IntelCompiler.Icx, ),
"ubuntu-intel-icc": JobSpec(name="Ubuntu 20.04 (Intel Compiler)", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04-icc", intel=IntelCompiler.Icc, ),
"macos-gnu-arm64-x64": JobSpec(name="MacOS (GNU prefix)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact="SDL-macos-arm64-x64-gnu",autotools=True, apple_archs={AppleArch.X86_64, AppleArch.ARM64, }, ),
"ios": JobSpec(name="iOS (CMake & xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Ios, artifact="SDL-ios-arm64", xcode=True, ),
"tvos": JobSpec(name="tvOS (CMake & xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Tvos, artifact="SDL-tvos-arm64", xcode=True, ),
"android-cmake": JobSpec(name="Android (CMake)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact="SDL-android-arm64", android_abi="arm64-v8a", android_arch="aarch64", android_platform=23, ),
"android-mk": JobSpec(name="Android (Android.mk)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact=None, no_cmake=True, android_mk=True, ),
"emscripten": JobSpec(name="Emscripten", os=JobOs.UbuntuLatest, platform=SdlPlatform.Emscripten, artifact="SDL-emscripten", ),
"haiku": JobSpec(name="Haiku", os=JobOs.UbuntuLatest, platform=SdlPlatform.Haiku, artifact="SDL-haiku-x64", container="ghcr.io/haiku/cross-compiler:x86_64-r1beta5", ),
"n3ds": JobSpec(name="Nintendo 3DS", os=JobOs.UbuntuLatest, platform=SdlPlatform.N3ds, artifact="SDL-n3ds", container="devkitpro/devkitarm:latest", ),
"ps2": JobSpec(name="Sony PlayStation 2", os=JobOs.UbuntuLatest, platform=SdlPlatform.Ps2, artifact="SDL-ps2", container="ps2dev/ps2dev:latest", ),
"psp": JobSpec(name="Sony PlayStation Portable", os=JobOs.UbuntuLatest, platform=SdlPlatform.Psp, artifact="SDL-psp", container="pspdev/pspdev:latest", ),
"vita-pib": JobSpec(name="Sony PlayStation Vita (GLES w/ pib)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Vita, artifact="SDL-vita-pib", container="vitasdk/vitasdk:latest", vita_gles=VitaGLES.Pib, ),
"vita-pvr": JobSpec(name="Sony PlayStation Vita (GLES w/ PVR_PSP2)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Vita, artifact="SDL-vita-pvr", container="vitasdk/vitasdk:latest", vita_gles=VitaGLES.Pvr, ),
"riscos": JobSpec(name="RISC OS", os=JobOs.UbuntuLatest, platform=SdlPlatform.Riscos, artifact="SDL-riscos", container="riscosdotinfo/riscos-gccsdk-4.7:latest", ),
"netbsd": JobSpec(name="NetBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.NetBSD, artifact="SDL-netbsd-x64", autotools=True, ),
"freebsd": JobSpec(name="FreeBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.FreeBSD, artifact="SDL-freebsd-x64", autotools=True, ),
"watcom-win32": JobSpec(name="Watcom (Windows)", os=JobOs.WindowsLatest, platform=SdlPlatform.Watcom, artifact="SDL-watcom-win32", no_cmake=True, watcom_platform=WatcomPlatform.Windows ),
"watcom-os2": JobSpec(name="Watcom (OS/2)", os=JobOs.WindowsLatest, platform=SdlPlatform.Watcom, artifact="SDL-watcom-win32", no_cmake=True, watcom_platform=WatcomPlatform.OS2 ),
# "watcom-win32"
# "watcom-os2"
}
class StaticLibType(Enum):
MSVC = "SDL2-static.lib"
A = "libSDL2.a"
class SharedLibType(Enum):
WIN32 = "SDL2.dll"
SO_0 = "libSDL2-2.0.so.0"
SO = "libSDL2.so"
DYLIB = "libSDL2-2.0.0.dylib"
FRAMEWORK = "SDL2.framework/Versions/A/SDL2"
@dataclasses.dataclass(slots=True)
class JobDetails:
name: str
key: str
os: str
platform: str
artifact: str
no_autotools: bool
no_cmake: bool
build_autotools_tests: bool = True
build_tests: bool = True
container: str = ""
cmake_build_type: str = "RelWithDebInfo"
shell: str = "sh"
sudo: str = "sudo"
cmake_config_emulator: str = ""
apk_packages: list[str] = dataclasses.field(default_factory=list)
apt_packages: list[str] = dataclasses.field(default_factory=list)
brew_packages: list[str] = dataclasses.field(default_factory=list)
cmake_toolchain_file: str = ""
cmake_arguments: list[str] = dataclasses.field(default_factory=list)
cmake_build_arguments: list[str] = dataclasses.field(default_factory=list)
cppflags: list[str] = dataclasses.field(default_factory=list)
cc: str = ""
cxx: str = ""
cflags: list[str] = dataclasses.field(default_factory=list)
cxxflags: list[str] = dataclasses.field(default_factory=list)
ldflags: list[str] = dataclasses.field(default_factory=list)
pollute_directories: list[str] = dataclasses.field(default_factory=list)
use_cmake: bool = True
shared: bool = True
static: bool = True
shared_lib: Optional[SharedLibType] = None
static_lib: Optional[StaticLibType] = None
run_tests: bool = True
test_pkg_config: bool = True
cc_from_cmake: bool = False
source_cmd: str = ""
pretest_cmd: str = ""
android_apks: list[str] = dataclasses.field(default_factory=list)
android_ndk: bool = False
android_mk: bool = False
minidump: bool = False
intel: bool = False
msys2_msystem: str = ""
msys2_env: str = ""
msys2_no_perl: bool = False
werror: bool = True
msvc_vcvars_arch: str = ""
msvc_vcvars_sdk: str = ""
msvc_project: str = ""
msvc_project_flags: list[str] = dataclasses.field(default_factory=list)
setup_ninja: bool = False
setup_libusb_arch: str = ""
xcode_sdk: str = ""
xcode_target: str = ""
setup_gdk_folder: str = ""
cpactions: bool = False
cpactions_os: str = ""
cpactions_version: str = ""
cpactions_arch: str = ""
cpactions_setup_cmd: str = ""
cpactions_install_cmd: str = ""
setup_vita_gles_type: str = ""
check_sources: bool = False
watcom_makefile: str = ""
def to_workflow(self, enable_artifacts: bool) -> dict[str, str|bool]:
data = {
"name": self.name,
"key": self.key,
"os": self.os,
"container": self.container if self.container else "",
"platform": self.platform,
"artifact": self.artifact,
"enable-artifacts": enable_artifacts,
"shell": self.shell,
"msys2-msystem": self.msys2_msystem,
"msys2-env": self.msys2_env,
"msys2-no-perl": self.msys2_no_perl,
"android-ndk": self.android_ndk,
"intel": self.intel,
"apk-packages": my_shlex_join(self.apk_packages),
"apt-packages": my_shlex_join(self.apt_packages),
"test-pkg-config": self.test_pkg_config,
"brew-packages": my_shlex_join(self.brew_packages),
"pollute-directories": my_shlex_join(self.pollute_directories),
"no-autotools": self.no_autotools,
"no-cmake": self.no_cmake,
"build-autotools-tests": self.build_autotools_tests,
"build-tests": self.build_tests,
"source-cmd": self.source_cmd,
"pretest-cmd": self.pretest_cmd,
"cmake-config-emulator": self.cmake_config_emulator,
"cc": self.cc,
"cxx": self.cxx,
"cflags": my_shlex_join(self.cppflags + self.cflags),
"cxxflags": my_shlex_join(self.cppflags + self.cxxflags),
"ldflags": my_shlex_join(self.ldflags),
"cmake-toolchain-file": self.cmake_toolchain_file,
"cmake-arguments": my_shlex_join(self.cmake_arguments),
"cmake-build-arguments": my_shlex_join(self.cmake_build_arguments),
"shared": self.shared,
"static": self.static,
"shared-lib": self.shared_lib.value if self.shared_lib else None,
"static-lib": self.static_lib.value if self.static_lib else None,
"cmake-build-type": self.cmake_build_type,
"run-tests": self.run_tests,
"android-apks": my_shlex_join(self.android_apks),
"android-mk": self.android_mk,
"werror": self.werror,
"sudo": self.sudo,
"msvc-vcvars-arch": self.msvc_vcvars_arch,
"msvc-vcvars-sdk": self.msvc_vcvars_sdk,
"msvc-project": self.msvc_project,
"msvc-project-flags": my_shlex_join(self.msvc_project_flags),
"setup-ninja": self.setup_ninja,
"setup-libusb-arch": self.setup_libusb_arch,
"cc-from-cmake": self.cc_from_cmake,
"xcode-sdk": self.xcode_sdk,
"xcode-target": self.xcode_target,
"cpactions": self.cpactions,
"cpactions-os": self.cpactions_os,
"cpactions-version": self.cpactions_version,
"cpactions-arch": self.cpactions_arch,
"cpactions-setup-cmd": self.cpactions_setup_cmd,
"cpactions-install-cmd": self.cpactions_install_cmd,
"setup-vita-gles-type": self.setup_vita_gles_type,
"setup-gdk-folder": self.setup_gdk_folder,
"check-sources": self.check_sources,
"watcom-makefile": self.watcom_makefile,
}
return {k: v for k, v in data.items() if v != ""}
def my_shlex_join(s):
def escape(s):
if s[:1] == "'" and s[-1:] == "'":
return s
if set(s).intersection(set("; \t")):
s = s.replace("\\", "\\\\").replace("\"", "\\\"")
return f'"{s}"'
return s
return " ".join(escape(e) for e in s)
def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDetails:
job = JobDetails(
name=spec.name,
key=key,
os=spec.os.value,
artifact=spec.artifact or "",
container=spec.container or "",
platform=spec.platform.value,
sudo="sudo",
no_autotools=not spec.autotools,
no_cmake=spec.no_cmake,
)
if job.os.startswith("ubuntu"):
job.apt_packages.extend([
"ninja-build",
"pkg-config",
])
if spec.msvc_static_crt:
job.cmake_arguments.append("-DSDL_FORCE_STATIC_VCRT=ON")
pretest_cmd = []
if trackmem_symbol_names:
pretest_cmd.append("export SDL_TRACKMEM_SYMBOL_NAMES=1")
else:
pretest_cmd.append("export SDL_TRACKMEM_SYMBOL_NAMES=0")
win32 = spec.platform in (SdlPlatform.Msys2, SdlPlatform.Msvc)
fpic = None
build_parallel = True
if spec.lean:
job.cppflags.append("-DSDL_LEAN_AND_MEAN=1")
if win32:
job.cmake_arguments.append("-DSDLTEST_PROCDUMP=ON")
job.minidump = True
if spec.intel is not None:
match spec.intel:
case IntelCompiler.Icx:
job.cc = "icx"
job.cxx = "icpx"
case IntelCompiler.Icc:
job.cc = "icc"
job.cxx = "icpc"
job.cppflags.append("-diag-disable=10441")
case _:
raise ValueError(f"Invalid intel={spec.intel}")
job.source_cmd = f"source /opt/intel/oneapi/setvars.sh;"
job.intel = True
job.shell = "bash"
job.cmake_arguments.extend((
f"-DCMAKE_C_COMPILER={job.cc}",
f"-DCMAKE_CXX_COMPILER={job.cxx}",
"-DCMAKE_SYSTEM_NAME=Linux",
))
match spec.platform:
case SdlPlatform.Msvc:
job.setup_ninja = not spec.gdk
job.msvc_project = spec.msvc_project if spec.msvc_project else ""
job.msvc_project_flags.append("-p:TreatWarningsAsError=true")
job.test_pkg_config = False
job.shared_lib = SharedLibType.WIN32
job.static_lib = StaticLibType.MSVC
job.cmake_arguments.extend((
"-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=ProgramDatabase",
"-DCMAKE_EXE_LINKER_FLAGS=-DEBUG",
"-DCMAKE_SHARED_LINKER_FLAGS=-DEBUG",
))
if spec.uwp:
job.cmake_arguments.append("'-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>DLL'")
else:
job.cmake_arguments.append("'-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>'")
if spec.clang_cl:
job.cmake_arguments.extend((
"-DCMAKE_C_COMPILER=clang-cl",
"-DCMAKE_CXX_COMPILER=clang-cl",
))
match spec.msvc_arch:
case MsvcArch.X86:
job.cflags.append("/clang:-m32")
job.ldflags.append("/MACHINE:X86")
case MsvcArch.X64:
job.cflags.append("/clang:-m64")
job.ldflags.append("/MACHINE:X64")
case _:
raise ValueError(f"Unsupported clang-cl architecture (arch={spec.msvc_arch})")
if spec.msvc_project:
match spec.msvc_arch:
case MsvcArch.X86:
msvc_platform = "Win32"
case MsvcArch.X64:
msvc_platform = "x64"
case _:
raise ValueError(f"Unsupported vcxproj architecture (arch={spec.msvc_arch})")
if spec.gdk:
msvc_platform = f"Gaming.Desktop.{msvc_platform}"
job.msvc_project_flags.append(f"-p:Platform={msvc_platform}")
match spec.msvc_arch:
case MsvcArch.X86:
job.msvc_vcvars_arch = "x64_x86"
case MsvcArch.X64:
job.msvc_vcvars_arch = "x64"
case MsvcArch.Arm32:
job.msvc_vcvars_arch = "x64_arm"
job.msvc_vcvars_sdk = "10.0.22621.0" # 10.0.26100.0 dropped ARM32 um and ucrt libraries
job.run_tests = False
case MsvcArch.Arm64:
job.msvc_vcvars_arch = "x64_arm64"
job.run_tests = False
if spec.uwp:
job.build_tests = False
job.cmake_arguments.extend((
"-DCMAKE_SYSTEM_NAME=WindowsStore",
"-DCMAKE_SYSTEM_VERSION=10.0",
))
job.msvc_project_flags.append("-p:WindowsTargetPlatformVersion=10.0.17763.0")
elif spec.gdk:
job.setup_gdk_folder = "VisualC-GDK"
else:
match spec.msvc_arch:
case MsvcArch.X86:
job.setup_libusb_arch = "x86"
case MsvcArch.X64:
job.setup_libusb_arch = "x64"
case SdlPlatform.Linux:
if spec.name.startswith("Ubuntu"):
assert spec.os.value.startswith("ubuntu-")
job.apt_packages.extend((
"gnome-desktop-testing",
"libasound2-dev",
"libpulse-dev",
"libaudio-dev",
"libjack-dev",
"libsndio-dev",
"libusb-1.0-0-dev",
"libx11-dev",
"libxext-dev",
"libxrandr-dev",
"libxcursor-dev",
"libxfixes-dev",
"libxi-dev",
"libxss-dev",
"libwayland-dev",
"libxkbcommon-dev",
"libdrm-dev",
"libgbm-dev",
"libgl1-mesa-dev",
"libgles2-mesa-dev",
"libegl1-mesa-dev",
"libdbus-1-dev",
"libibus-1.0-dev",
"libudev-dev",
"fcitx-libs-dev",
))
ubuntu_year, ubuntu_month = [int(v) for v in spec.os.value.removeprefix("ubuntu-").split(".", 1)]
if ubuntu_year >= 22:
job.apt_packages.extend(("libpipewire-0.3-dev", "libdecor-0-dev"))
job.apt_packages.extend((
"libunwind-dev", # For SDL_test memory tracking
))
if trackmem_symbol_names:
# older libunwind is slow
job.cmake_arguments.append("-DSDLTEST_TIMEOUT_MULTIPLIER=2")
job.shared_lib = SharedLibType.SO_0
job.static_lib = StaticLibType.A
fpic = True
case SdlPlatform.Ios | SdlPlatform.Tvos:
job.brew_packages.extend([
"ninja",
])
job.run_tests = False
job.test_pkg_config = False
job.shared_lib = SharedLibType.DYLIB
job.static_lib = StaticLibType.A
match spec.platform:
case SdlPlatform.Ios:
if spec.xcode:
job.xcode_sdk = "iphoneos"
job.xcode_target = "Static Library-iOS"
job.cmake_arguments.extend([
"-DCMAKE_SYSTEM_NAME=iOS",
"-DCMAKE_OSX_ARCHITECTURES=\"arm64\"",
"-DCMAKE_OSX_DEPLOYMENT_TARGET=9.0",
])
case SdlPlatform.Tvos:
if spec.xcode:
job.xcode_sdk = "appletvos"
job.xcode_target = "Static Library-tvOS"
job.cmake_arguments.extend([
"-DCMAKE_SYSTEM_NAME=tvOS",
"-DCMAKE_OSX_ARCHITECTURES=\"arm64\"",
"-DCMAKE_OSX_DEPLOYMENT_TARGET=9.0",
])
case SdlPlatform.MacOS:
osx_arch = ";".join(e.value for e in spec.apple_archs) if spec.apple_archs else "arm64"
job.cmake_arguments.extend((
f"'-DCMAKE_OSX_ARCHITECTURES={osx_arch}'",
"-DCMAKE_OSX_DEPLOYMENT_TARGET=10.11",
))
job.build_autotools_tests = False
job.shared_lib = SharedLibType.DYLIB
job.static_lib = StaticLibType.A
job.apt_packages = []
job.brew_packages.extend((
"autoconf",
"ninja",
))
if spec.xcode:
job.xcode_sdk = "macosx"
case SdlPlatform.Android:
job.android_mk = spec.android_mk
job.run_tests = False
job.shared_lib = SharedLibType.SO
job.static_lib = StaticLibType.A
if spec.android_mk or not spec.no_cmake:
job.android_ndk = True
if spec.android_mk:
job.apt_packages = []
if not spec.no_cmake:
job.cmake_arguments.extend((
f"-DANDROID_PLATFORM={spec.android_platform}",
f"-DANDROID_ABI={spec.android_abi}",
))
job.cmake_toolchain_file = "${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake"
job.cc = f"${{ANDROID_NDK_HOME}}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target={spec.android_arch}-none-linux-androideabi{spec.android_platform}"
job.android_apks = [
"testaudiorecording-apk",
"testautomation-apk",
"testcontroller-apk",
"testmultiaudio-apk",
"testsprite-apk",
]
case SdlPlatform.Emscripten:
job.run_tests = False
job.shared = False
job.cmake_config_emulator = "emcmake"
job.cmake_build_type = "Debug"
job.test_pkg_config = False
job.cmake_arguments.extend((
"-DSDLTEST_BROWSER=chrome",
"-DSDLTEST_TIMEOUT_MULTIPLIER=4",
"-DSDLTEST_CHROME_BINARY=${CHROME_BINARY}",
))
job.static_lib = StaticLibType.A
case SdlPlatform.Ps2:
build_parallel = False
job.shared = False
job.sudo = ""
job.apt_packages = []
job.apk_packages = ["cmake", "gmp", "mpc1", "mpfr4", "ninja", "pkgconf", "git", ]
job.cmake_toolchain_file = "${PS2DEV}/ps2sdk/ps2dev.cmake"
job.run_tests = False
job.shared = False
job.cc = "mips64r5900el-ps2-elf-gcc"
job.ldflags = ["-L${PS2DEV}/ps2sdk/ee/lib", "-L${PS2DEV}/gsKit/lib", "-L${PS2DEV}/ps2sdk/ports/lib", ]
job.static_lib = StaticLibType.A
case SdlPlatform.Psp:
build_parallel = False
job.sudo = ""
job.apt_packages = []
job.apk_packages = ["cmake", "gmp", "mpc1", "mpfr4", "ninja", "pkgconf", ]
job.cmake_toolchain_file = "${PSPDEV}/psp/share/pspdev.cmake"
job.run_tests = False
job.shared = False
job.cc = "psp-gcc"
job.ldflags = ["-L${PSPDEV}/lib", "-L${PSPDEV}/psp/lib", "-L${PSPDEV}/psp/sdk/lib", ]
job.pollute_directories = ["${PSPDEV}/include", "${PSPDEV}/psp/include", "${PSPDEV}/psp/sdk/include", ]
job.static_lib = StaticLibType.A
case SdlPlatform.Vita:
job.sudo = ""
job.apt_packages = []
job.apk_packages = ["cmake", "ninja", "pkgconf", "bash", "tar"]
job.cmake_toolchain_file = "${VITASDK}/share/vita.toolchain.cmake"
assert spec.vita_gles is not None
job.setup_vita_gles_type = {
VitaGLES.Pib: "pib",
VitaGLES.Pvr: "pvr",
}[spec.vita_gles]
job.cmake_arguments.extend((
f"-DVIDEO_VITA_PIB={ 'true' if spec.vita_gles == VitaGLES.Pib else 'false' }",
f"-DVIDEO_VITA_PVR={ 'true' if spec.vita_gles == VitaGLES.Pvr else 'false' }",
"-DSDL_ARMNEON=ON",
"-DSDL_ARMSIMD=ON",
))
# Fix vita.toolchain.cmake (https://github.com/vitasdk/vita-toolchain/pull/253)
job.source_cmd = r"""sed -i -E "s#set\\( PKG_CONFIG_EXECUTABLE \"\\$\\{VITASDK}/bin/arm-vita-eabi-pkg-config\" \\)#set\\( PKG_CONFIG_EXECUTABLE \"${VITASDK}/bin/arm-vita-eabi-pkg-config\" CACHE PATH \"Path of pkg-config executable\" \\)#" ${VITASDK}/share/vita.toolchain.cmake"""
job.run_tests = False
job.shared = False
job.cc = "arm-vita-eabi-gcc"
job.static_lib = StaticLibType.A
case SdlPlatform.Haiku:
fpic = False
job.build_autotools_tests = False
job.run_tests = False
job.cc = "x86_64-unknown-haiku-gcc"
job.cxx = "x86_64-unknown-haiku-g++"
job.sudo = ""
job.cmake_arguments.extend((
f"-DCMAKE_C_COMPILER={job.cc}",
f"-DCMAKE_CXX_COMPILER={job.cxx}",
"-DSDL_UNIX_CONSOLE_BUILD=ON",
))
job.shared_lib = SharedLibType.SO_0
job.static_lib = StaticLibType.A
case SdlPlatform.N3ds:
job.shared = False
job.apt_packages = ["ninja-build", "binutils"]
job.run_tests = False
job.cc_from_cmake = True
job.cmake_toolchain_file = "${DEVKITPRO}/cmake/3DS.cmake"
job.static_lib = StaticLibType.A
case SdlPlatform.Msys2:
job.shell = "msys2 {0}"
assert spec.msys2_platform
job.msys2_msystem = spec.msys2_platform.value
job.msys2_env = {
"mingw32": "mingw-w64-i686",
"mingw64": "mingw-w64-x86_64",
"clang32": "mingw-w64-clang-i686",
"clang64": "mingw-w64-clang-x86_64",
"ucrt64": "mingw-w64-ucrt-x86_64",
}[spec.msys2_platform.value]
job.msys2_no_perl = spec.msys2_platform in (Msys2Platform.Mingw32, Msys2Platform.Clang32)
job.shared_lib = SharedLibType.WIN32
job.static_lib = StaticLibType.A
case SdlPlatform.Riscos:
# FIXME: Enable SDL_WERROR
job.werror = False
job.build_autotools_tests = False
job.apt_packages = ["cmake", "ninja-build"]
job.test_pkg_config = False
job.shared = False
job.run_tests = False
job.sudo = ""
job.cmake_arguments.extend((
"-DRISCOS:BOOL=ON",
"-DCMAKE_DISABLE_PRECOMPILE_HEADERS:BOOL=ON",
"-DSDL_GCC_ATOMICS:BOOL=OFF",
))
job.cmake_toolchain_file = "/home/riscos/env/toolchain-riscos.cmake"
job.static_lib = StaticLibType.A
case SdlPlatform.FreeBSD | SdlPlatform.NetBSD:
job.build_autotools_tests = False
job.cpactions = True
job.no_cmake = True
job.run_tests = False
job.apt_packages = []
job.shared_lib = SharedLibType.SO_0
job.static_lib = StaticLibType.A
match spec.platform:
case SdlPlatform.FreeBSD:
job.cpactions_os = "freebsd"
job.cpactions_version = "14.2"
job.cpactions_arch = "x86-64"
job.cpactions_setup_cmd = "sudo pkg update"
job.cpactions_install_cmd = "sudo pkg install -y cmake ninja pkgconf libXcursor libXext libXinerama libXi libXfixes libXrandr libXScrnSaver libXxf86vm wayland wayland-protocols libxkbcommon mesa-libs libglvnd evdev-proto libinotify alsa-lib jackit pipewire pulseaudio sndio dbus zh-fcitx ibus libudev-devd"
job.cmake_arguments.extend((
"-DSDL_CHECK_REQUIRED_INCLUDES=/usr/local/include",
"-DSDL_CHECK_REQUIRED_LINK_OPTIONS=-L/usr/local/lib",
))
case SdlPlatform.NetBSD:
job.cpactions_os = "netbsd"
job.cpactions_version = "10.1"
job.cpactions_arch = "x86-64"
job.cpactions_setup_cmd = "export PATH=\"/usr/pkg/sbin:/usr/pkg/bin:/sbin:$PATH\"; export PKG_CONFIG_PATH=\"/usr/pkg/lib/pkgconfig\";export PKG_PATH=\"https://cdn.netBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r|cut -f \"1 2\" -d.)/All/\";echo \"PKG_PATH=$PKG_PATH\";echo \"uname -a -> \"$(uname -a)\"\";sudo -E sysctl -w security.pax.aslr.enabled=0;sudo -E sysctl -w security.pax.aslr.global=0;sudo -E pkgin clean;sudo -E pkgin update"
job.cpactions_install_cmd = "sudo -E pkgin -y install cmake dbus pkgconf ninja-build pulseaudio libxkbcommon wayland wayland-protocols libinotify libusb1"
case SdlPlatform.Watcom:
match spec.watcom_platform:
case WatcomPlatform.OS2:
job.watcom_makefile = "Makefile.os2"
job.run_tests = False
case WatcomPlatform.Windows:
job.watcom_makefile = "Makefile.w32"
job.run_tests = True
case _:
raise ValueError(f"Unsupported watcom_platform=${spec.watcom_platform}")
case _:
raise ValueError(f"Unsupported platform={spec.platform}")
if "ubuntu" in spec.name.lower():
job.check_sources = True
if not build_parallel:
job.cmake_build_arguments.append("-j1")
if job.cflags:
job.cmake_arguments.append(f"-DCMAKE_C_FLAGS={my_shlex_join(job.cflags)}")
if job.cxxflags:
job.cmake_arguments.append(f"-DCMAKE_CXX_FLAGS={my_shlex_join(job.cxxflags)}")
if job.ldflags:
job.cmake_arguments.append(f"-DCMAKE_SHARED_LINKER_FLAGS={my_shlex_join(job.ldflags)}")
job.cmake_arguments.append(f"-DCMAKE_EXE_LINKER_FLAGS={my_shlex_join(job.ldflags)}")
job.pretest_cmd = "\n".join(pretest_cmd)
def tf(b):
return "ON" if b else "OFF"
if fpic is not None:
job.cmake_arguments.append(f"-DCMAKE_POSITION_INDEPENDENT_CODE={tf(fpic)}")
if job.no_cmake:
job.cmake_arguments = []
return job
def spec_to_platform(spec: JobSpec, key: str, enable_artifacts: bool, trackmem_symbol_names: bool) -> dict[str, str|bool]:
logger.info("spec=%r", spec)
job = spec_to_job(spec, key=key, trackmem_symbol_names=trackmem_symbol_names)
logger.info("job=%r", job)
platform = job.to_workflow(enable_artifacts=enable_artifacts)
logger.info("platform=%r", platform)
return platform
def main():
parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument("--github-variable-prefix", default="platforms")
parser.add_argument("--github-ci", action="store_true")
parser.add_argument("--verbose", action="store_true")
parser.add_argument("--commit-message-file")
parser.add_argument("--no-artifact", dest="enable_artifacts", action="store_false")
parser.add_argument("--trackmem-symbol-names", dest="trackmem_symbol_names", action="store_true")
args = parser.parse_args()
logging.basicConfig(level=logging.INFO if args.verbose else logging.WARNING)
remaining_keys = set(JOB_SPECS.keys())
all_level_keys = (
# Level 1
(
"haiku",
),
)
filters = []
if args.commit_message_file:
with open(args.commit_message_file, "r") as f:
commit_message = f.read()
for m in re.finditer(r"\[sdl-ci-filter (.*)]", commit_message, flags=re.M):
filters.append(m.group(1).strip(" \t\n\r\t'\""))
if re.search(r"\[sdl-ci-artifacts?]", commit_message, flags=re.M):
args.enable_artifacts = True
if re.search(r"\[sdl-ci-(full-)?trackmem(-symbol-names)?]", commit_message, flags=re.M):
args.trackmem_symbol_names = True
if not filters:
filters.append("*")
logger.info("filters: %r", filters)
all_level_platforms = {}
all_platforms = {key: spec_to_platform(spec, key=key, enable_artifacts=args.enable_artifacts, trackmem_symbol_names=args.trackmem_symbol_names) for key, spec in JOB_SPECS.items()}
for level_i, level_keys in enumerate(all_level_keys, 1):
level_key = f"level{level_i}"
logger.info("Level %d: keys=%r", level_i, level_keys)
assert all(k in remaining_keys for k in level_keys)
level_platforms = tuple(all_platforms[key] for key in level_keys)
remaining_keys.difference_update(level_keys)
all_level_platforms[level_key] = level_platforms
logger.info("=" * 80)
logger.info("Keys before filter: %r", remaining_keys)
filtered_remaining_keys = set()
for filter in filters:
filtered_remaining_keys.update(fnmatch.filter(remaining_keys, filter))
logger.info("Keys after filter: %r", filtered_remaining_keys)
remaining_keys = filtered_remaining_keys
logger.info("Remaining: %r", remaining_keys)
all_level_platforms["others"] = tuple(all_platforms[key] for key in remaining_keys)
if args.github_ci:
for level, platforms in all_level_platforms.items():
platforms_json = json.dumps(platforms)
txt = f"{args.github_variable_prefix}-{level}={platforms_json}"
logger.info("%s", txt)
if "GITHUB_OUTPUT" in os.environ:
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
f.write(txt)
f.write("\n")
else:
logger.warning("GITHUB_OUTPUT not defined")
return 0
if __name__ == "__main__":
raise SystemExit(main())

View File

@@ -1,45 +0,0 @@
name: Build (Emscripten)
on: [push, pull_request]
jobs:
emscripten:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: mymindstorm/setup-emsdk@v10
with:
version: 2.0.32
- name: Install ninja
run: |
sudo apt-get -y update
sudo apt-get install -y ninja-build
- name: Configure CMake
run: |
emcmake cmake -S . -B build \
-DSDL_WERROR=ON \
-DSDL_TESTS=ON \
-DSDL_INSTALL_TESTS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=prefix \
-GNinja
- name: Build
run: cmake --build build/ --verbose
- name: Run build-time tests
run: |
set -eu
export SDL_TESTS_QUICK=1
# FIXME: enable Emscripten build time tests
# ctest -VV --test-dir build/
- name: Install
run: |
echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV
cmake --install build/
- name: Verify CMake configuration files
run: |
emcmake cmake -S cmake/test -B cmake_config_build \
-DCMAKE_BUILD_TYPE=Release \
-DSDL_VENDOR_INFO="Github Workflow" \
-DTEST_SHARED=FALSE \
-DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }}
cmake --build cmake_config_build --verbose

352
.github/workflows/generic.yml vendored Normal file
View File

@@ -0,0 +1,352 @@
name: 'Build'
run-name: 'Configure, Build and Test SDL'
on:
workflow_call:
inputs:
platforms:
description: 'JSON-encoded test properties'
type: string
required: true
jobs:
build:
name: ${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.os }}
container: ${{ matrix.platform.container }}
defaults:
run:
shell: ${{ matrix.platform.shell }}
strategy:
fail-fast: false
matrix:
platform: ${{ fromJSON(inputs.platforms) }}
steps:
- name: 'Set up MSYS2'
if: ${{ matrix.platform.platform == 'msys2' }}
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.platform.msys2-msystem }}
install: >-
${{ matrix.platform.msys2-env }}-cc
${{ matrix.platform.msys2-env }}-cmake
${{ matrix.platform.msys2-env }}-ninja
${{ (!matrix.platform.msys2-no-perl && format('{0}-perl', matrix.platform.msys2-env)) || '' }}
${{ matrix.platform.msys2-env }}-pkg-config
${{ matrix.platform.msys2-env }}-clang-tools-extra
- name: 'About this job'
run: |
echo "key=${{ matrix.platform.key }}"
echo "name=${{ matrix.platform.name }}"
echo "os=${{ matrix.platform.os }}"
echo ""
echo "Add [sdl-ci-filter ${{ matrix.platform.key }}] to your commit message to reduce the number of jobs."
- uses: actions/checkout@v4
- name: 'Set up ninja'
if: ${{ matrix.platform.setup-ninja }}
uses: ./.github/actions/setup-ninja
- uses: mymindstorm/setup-emsdk@v14
if: ${{ matrix.platform.platform == 'emscripten' }}
with:
version: 3.1.35
- uses: nttld/setup-ndk@v1
if: ${{ matrix.platform.android-ndk }}
id: setup-ndk
with:
local-cache: true
ndk-version: r21e
- uses: ilammy/msvc-dev-cmd@v1
if: ${{ matrix.platform.platform == 'msvc' }}
with:
arch: ${{ matrix.platform.msvc-vcvars-arch }}
sdk: ${{ matrix.platform.msvc-vcvars-sdk }}
- name: 'Set up Windows GDK Desktop'
uses: ./.github/actions/setup-gdk-desktop
if: ${{ matrix.platform.setup-gdk-folder != '' }}
with:
folder: '${{ matrix.platform.setup-gdk-folder }}'
- name: 'Setup Intel oneAPI toolchain'
id: intel
if: ${{ matrix.platform.intel }}
run: |
# Download the key to system keyring
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
| gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
# Add signed entry to apt sources and configure the APT client to use Intel repository:
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
# Update package list
sudo apt-get update -y
# Install oneAPI
sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
- name: 'Install apk packages'
if: ${{ matrix.platform.apk-packages != '' }}
run: |
${{ matrix.platform.sudo }} apk update
${{ matrix.platform.sudo }} apk add ${{ matrix.platform.apk-packages }}
- name: 'Install apt packages'
if: ${{ matrix.platform.apt-packages != '' }}
run: |
${{ matrix.platform.sudo }} apt-get update
${{ matrix.platform.sudo }} apt-get install -y ${{ matrix.platform.apt-packages }}
- name: 'Install brew packages'
if: ${{ matrix.platform.brew-packages != '' }}
run: |
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
brew update
brew install ${{ matrix.platform.brew-packages }}
- name: 'Set up GLES for VITA' # Must be after apk
if: ${{ matrix.platform.setup-vita-gles-type != '' }}
uses: ./.github/actions/setup-vita-gles
with:
type: ${{ matrix.platform.setup-vita-gles-type }}
- name: 'Configure (Autotools)'
if: ${{ !matrix.platform.no-autotools }}
run: |
${{ matrix.platform.source_cmd }}
set -eu
rm -rf build-autotools
mkdir build-autotools
./autogen.sh
(
cd build-autotools
../configure \
--enable-vendor-info="Github Workflow" \
--enable-werror \
--prefix=${{ github.workspace }}/autotools_prefix \
)
if test "x${{ (matrix.platform.build-autotools-tests && 'yes') || 'no' }}" = "xyes" ; then
curdir="$(pwd)"
multiarch="$(dpkg-architecture -qDEB_HOST_MULTIARCH)"
(
mkdir -p build-autotools/test
cd build-autotools/test
../../test/configure \
--enable-werror \
--x-includes=/usr/include \
--x-libraries="/usr/lib/${multiarch}" \
--prefix=${{ github.workspace }}/autotools_prefix \
SDL_CFLAGS="-I${curdir}/include" \
SDL_LIBS="-L${curdir}/build-autotools/build/.libs -lSDL2" \
ac_cv_lib_SDL2_ttf_TTF_Init=no \
${NULL+}
)
fi
- name: 'Build (Autotools)'
if: ${{ !matrix.platform.no-autotools }}
run: |
${{ matrix.platform.source_cmd }}
set -eu
parallel="$(getconf _NPROCESSORS_ONLN)"
make -j"${parallel}" -C build-autotools V=1
if test "x${{ (matrix.platform.build-autotools-tests && 'yes') || 'no' }}" = "xyes" ; then
make -j"${parallel}" -C build-autotools/test V=1
fi
- name: 'Run build-time tests (Autotools)'
if: ${{ !matrix.platform.no-autotools && matrix.platform.build-autotools-tests && matrix.platform.run-tests }}
run: |
${{ matrix.platform.source_cmd }}
set -eu
curdir="$(pwd)"
parallel="$(getconf _NPROCESSORS_ONLN)"
export SDL_TESTS_QUICK=1
make -j"${parallel}" -C build-autotools/test check LD_LIBRARY_PATH="${curdir}/build-autotools/build/.libs"
if test "${{ runner.os }}" = "Linux"; then
# This should show us the SDL_REVISION
strings "${curdir}/build-autotools/build/.libs/libSDL2-2.0.so.0" | grep SDL-
fi
- name: 'Install (Autotools)'
if: ${{ !matrix.platform.no-autotools }}
run: |
${{ matrix.platform.source_cmd }}
set -eu
curdir="$(pwd)"
parallel="$(getconf _NPROCESSORS_ONLN)"
make -j"${parallel}" -C build-autotools install V=1
if test "x${{ (matrix.platform.build-autotools-tests && 'yes') || 'no' }}" = "xyes" ; then
make -j"${parallel}" -C build-autotools/test install V=1
fi
( cd autotools_prefix; find . ) | LC_ALL=C sort -u
echo "prefix=$(pwd)/autotools_prefix" >> $GITHUB_OUTPUT
- name: 'Configure (CMake)'
if: ${{ !matrix.platform.no-cmake }}
#shell: ${{ matrix.platform.shell }}
run: |
${{ matrix.platform.source-cmd }}
${{ matrix.platform.cmake-config-emulator }} cmake -S . -B build -GNinja \
-Wdeprecated -Wdev -Werror \
${{ matrix.platform.cmake-toolchain-file != '' && format('-DCMAKE_TOOLCHAIN_FILE={0}', matrix.platform.cmake-toolchain-file) || '' }} \
-DSDL_WERROR=${{ matrix.platform.werror }} \
-DSDL_TESTS=${{ matrix.platform.build-tests }} \
-DSDLTEST_TRACKMEM=OFF \
-DSDL_INSTALL_TESTS=${{ matrix.platform.build-tests }} \
-DSDL_DISABLE_INSTALL_DOCS=OFF \
-DSDL_DISABLE_INSTALL_DOCS=OFF \
${{ matrix.platform.cmake-arguments }} \
-DSDL_SHARED=${{ matrix.platform.shared }} \
-DSDL_STATIC=${{ matrix.platform.static }} \
-DSDL_TEST=ON \
-DSDL_VENDOR_INFO="Github Workflow" \
-DCMAKE_INSTALL_PREFIX=prefix \
-DCMAKE_INSTALL_LIBDIR=lib \
-DSDL_CMAKE_DEBUG_POSTFIX="" \
-DCMAKE_BUILD_TYPE=${{ matrix.platform.cmake-build-type }}
- name: 'Build (CMake)'
id: cmake-build
if: ${{ !matrix.platform.no-cmake }}
# shell: ${{ matrix.platform.shell }}
run: |
${{ matrix.platform.source-cmd }}
cmake --build build --config ${{ matrix.platform.cmake-build-type }} --verbose -- ${{ matrix.platform.cmake-build-arguments }}
- name: 'Verify SDL_REVISION'
if: ${{ !matrix.platform.no-cmake }}
run: |
echo "This should show us the SDL_REVISION"
echo "Shared library:"
${{ (matrix.platform.shared-lib && format('strings build/{0} | grep "Github Workflow"', matrix.platform.shared-lib)) || 'echo "<Shared library not supported by platform>"' }}
echo "Static library:"
${{ (matrix.platform.static-lib && format('strings build/{0} | grep "Github Workflow"', matrix.platform.static-lib)) || 'echo "<Static library not supported by platform>"' }}
- name: 'Run build-time tests (CMake)'
id: cmake-tests
if: ${{ !matrix.platform.no-cmake && matrix.platform.run-tests }}
# shell: ${{ matrix.platform.shell }}
run: |
${{ matrix.platform.source-cmd }}
${{ matrix.platform.pretest-cmd }}
set -eu
export SDL_TESTS_QUICK=1
ctest -VV --test-dir build/ -j2
- name: 'Install (CMake)'
id: cmake-install
if: ${{ steps.build.outcome == 'success' }}
# shell: ${{ matrix.platform.shell }}
run: |
${{ matrix.platform.source-cmd }}
cmake --install build --config ${{ matrix.platform.cmake-build-type }}
echo "prefix=$(pwd)/prefix" >> $GITHUB_OUTPUT
( cd prefix; find . ) | LC_ALL=C sort -u
- name: 'Verify CMake configuration files (CMake)'
if: ${{ steps.cmake-install.outcome == 'success' }}
# shell: ${{ matrix.platform.shell }}
run: |
${{ matrix.platform.source-cmd }}
${{ matrix.platform.cmake-config-emulator }} cmake -S cmake/test -B cmake_test_build -GNinja \
${{ matrix.platform.cmake-toolchain-file != '' && format('-DCMAKE_TOOLCHAIN_FILE={0}', matrix.platform.cmake-toolchain-file) || '' }} \
-DTEST_SHARED=${{ matrix.platform.shared }} \
-DTEST_STATIC=${{ matrix.platform.static }} \
${{ matrix.platform.cmake-arguments }} \
-DCMAKE_BUILD_TYPE=${{ matrix.platform.cmake-build-type }} \
-DCMAKE_PREFIX_PATH="${{ steps.cmake-install.outputs.prefix }}"
cmake --build cmake_test_build --verbose --config ${{ matrix.platform.cmake-build-type }} -- ${{ matrix.platform.cmake-build-arguments }}
- name: 'Extract CC/CXX/CFLAGS/CXXFLAGS from CMake toolchain'
if: ${{ steps.cmake-install.outcome == 'success' && matrix.platform.cc-from-cmake }}
# shell: ${{ matrix.platform.shell }}
run: |
cmake -S .github/cmake -B /tmp/cmake_extract \
${{ matrix.platform.cmake-toolchain-file != '' && format('-DCMAKE_TOOLCHAIN_FILE={0}', matrix.platform.cmake-toolchain-file) || '' }} \
-DCMAKE_BUILD_TYPE=${{ matrix.platform.cmake-build-type }} \
-DVAR_PATH=/tmp/env.txt
cat /tmp/env.txt >> $GITHUB_ENV
- name: 'Verify sdl2.pc (CMake)'
# shell: ${{ matrix.platform.shell }}
if: ${{ steps.cmake-install.outcome == 'success' && matrix.platform.test-pkg-config }}
run: |
${{ matrix.platform.source-cmd }}
${{ matrix.platform.cc && format('export CC="{0}"', matrix.platform.cc) || '' }}
${{ matrix.platform.cflags && format('export CFLAGS="{0}"', matrix.platform.cflags) || '' }}
${{ matrix.platform.ldflags && format('export LDFLAGS="{0}"', matrix.platform.ldflags) || '' }}
export PKG_CONFIG_PATH=${{ steps.cmake-install.outputs.prefix }}/lib/pkgconfig
cmake/test/test_pkgconfig.sh
- name: 'Build (cross-platform-actions, BSD)'
id: cpactions
if: ${{ matrix.platform.cpactions }}
uses: cross-platform-actions/action@v0.27.0
with:
operating_system: '${{ matrix.platform.cpactions-os }}'
architecture: '${{ matrix.platform.cpactions-arch }}'
version: '${{ matrix.platform.cpactions-version }}'
run: |
${{ matrix.platform.cpactions-setup-cmd }}
${{ matrix.platform.cpactions-install-cmd }}
cmake -S . -B build -GNinja \
${{ matrix.platform.cmake-toolchain-file != '' && format('-DCMAKE_TOOLCHAIN_FILE={0}', matrix.platform.cmake-toolchain-file) || '' }} \
-Wdeprecated -Wdev -Werror \
-DSDL_WERROR=${{ matrix.platform.werror }} \
-DSDL_DISABLE_INSTALL_DOCS=OFF \
${{ matrix.platform.cmake-arguments }} \
-DSDL_SHARED=${{ matrix.platform.shared }} \
-DSDL_STATIC=${{ matrix.platform.static }} \
-DSDL_TEST=ON \
-DSDL_VENDOR_INFO="Github Workflow" \
-DCMAKE_INSTALL_PREFIX=prefix \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_BUILD_TYPE=${{ matrix.platform.cmake-build-type }}
cmake --build build/ --config ${{ matrix.platform.cmake-build-type }} --verbose
cmake --build build/ --config ${{ matrix.platform.cmake-build-type }} --target clean
rm -rf build/CMakeFiles
rm -rf build/docs
- name: 'Set up Watcom'
uses: open-watcom/setup-watcom@v0
if: ${{ matrix.platform.watcom-makefile != '' }}
- name: 'Build (Watcom)'
if: ${{ matrix.platform.watcom-makefile != '' }}
run: |
wmake -f ${{ matrix.platform.watcom-makefile }} ENABLE_WERROR=1
- name: 'Build tests (Watcom)'
if: ${{ matrix.platform.watcom-makefile != '' }}
run: |
cd test
wmake -f ${{ matrix.platform.watcom-makefile }} ENABLE_WERROR=1
- name: 'Run tests (Watcom)'
if: ${{ matrix.platform.watcom-makefile != '' && matrix.platform.run-tests }}
run: |
cd test
wmake -f ${{ matrix.platform.watcom-makefile }} check-quick
- name: 'Distclean (Watcom)'
if: ${{ matrix.platform.watcom-makefile != '' }}
run: |
wmake -f ${{ matrix.platform.watcom-makefile }} distclean
cd test
wmake -f ${{ matrix.platform.watcom-makefile }} distclean
- name: 'Add msbuild to PATH'
id: setup-msbuild
if: ${{ matrix.platform.msvc-project != '' }}
uses: microsoft/setup-msbuild@v2
- name: Build msbuild
if: ${{ matrix.platform.msvc-project != '' }}
run: |
"$(cygpath -u '${{ steps.setup-msbuild.outputs.msbuildPath }}\msbuild.exe')" ${{ matrix.platform.msvc-project }} -m -p:BuildInParallel=true -p:Configuration=Release ${{ matrix.platform.msvc-project-flags }}
- name: 'Build (Android.mk)'
if: ${{ matrix.platform.android-mk }}
run: |
./build-scripts/androidbuildlibs.sh
- name: 'Build (xcode)'
if: ${{ matrix.platform.xcode-sdk != '' }}
run: |
xcodebuild -project Xcode/SDL/SDL.xcodeproj -target "${{ matrix.platform.xcode-target }}" -configuration Release -sdk ${{ matrix.platform.xcode-sdk }} clean build
- name: 'Setup Python'
uses: 'actions/setup-python@main'
if: ${{ matrix.platform.check-sources }}
with:
python-version: '3.x'
- name: 'Check Sources'
if: ${{ matrix.platform.check-sources }}
run: |
set -e
build-scripts/test-versioning.sh
- name: 'Upload binary package'
uses: actions/upload-artifact@v4
if: ${{ always() && steps.cmake-tests.outcome == 'failure' }}
with:
if-no-files-found: ignore
name: '${{ matrix.platform.artifact }}-minidumps'
path: |
build/**/*.dmp
build/**/*.exe
build/**/*.dll
build/**/*.pdb

View File

@@ -1,20 +0,0 @@
name: Build (iOS/tvOS)
on: [push, pull_request]
jobs:
Build:
name: ${{ matrix.platform.name }}
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
platform:
- { name: iOS, target: Static Library-iOS, sdk: iphoneos }
- { name: tvOS, target: Static Library-tvOS, sdk: appletvos }
steps:
- uses: actions/checkout@v3
- name: Build
run: xcodebuild -project Xcode/SDL/SDL.xcodeproj -target '${{ matrix.platform.target }}' -configuration Release -sdk ${{ matrix.platform.sdk }} clean build

View File

@@ -1,206 +0,0 @@
name: Build
on: [push, pull_request]
jobs:
Build:
name: ${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.os }}
defaults:
run:
shell: ${{ matrix.platform.shell }}
strategy:
fail-fast: false
matrix:
platform:
- { name: Windows (mingw32), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686 }
- { name: Windows (mingw64), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64 }
- { name: Windows (clang32), os: windows-latest, shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686 }
- { name: Windows (clang64), os: windows-latest, shell: 'msys2 {0}', msystem: clang64, msys-env: mingw-w64-clang-x86_64 }
- { name: Windows (ucrt64), os: windows-latest, shell: 'msys2 {0}', msystem: ucrt64, msys-env: mingw-w64-ucrt-x86_64 }
- { name: Ubuntu 20.04 (CMake), os: ubuntu-20.04, shell: sh }
- { name: Ubuntu 20.04 (autotools), os: ubuntu-20.04, shell: sh, autotools: true }
- { name: Ubuntu 22.04 (CMake), os: ubuntu-22.04, shell: sh }
- { name: Ubuntu 22.04 (autotools), os: ubuntu-22.04, shell: sh, autotools: true }
- { name: MacOS (CMake), os: macos-latest, shell: sh, cmake: '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"' }
- { name: MacOS (autotools), os: macos-latest, shell: sh, autotools: true }
steps:
- name: Set up MSYS2
if: matrix.platform.shell == 'msys2 {0}'
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.platform.msystem }}
install: >-
${{ matrix.platform.msys-env }}-cc
${{ matrix.platform.msys-env }}-cmake
${{ matrix.platform.msys-env }}-ninja
${{ matrix.platform.msys-env }}-pkg-config
- name: Setup Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install build-essential git make autoconf automake libtool \
pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \
libaudio-dev libjack-dev libsndio-dev libsamplerate0-dev libx11-dev libxext-dev \
libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev \
libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
- name: Setup extra Ubuntu 22.04 dependencies
if: matrix.platform.os == 'ubuntu-22.04'
run: |
sudo apt-get install libpipewire-0.3-dev libdecor-0-dev
- name: Setup Macos dependencies
if: runner.os == 'macOS'
run: |
brew install \
ninja
- uses: actions/checkout@v3
- name: Check that versioning is consistent
# We only need to run this once: arbitrarily use the Linux/CMake build
if: "runner.os == 'Linux' && ! matrix.platform.autotools"
run: ./build-scripts/test-versioning.sh
- name: Configure (CMake)
if: "! matrix.platform.autotools"
run: |
cmake -S . -B build -G Ninja \
-DSDL_TESTS=ON \
-DSDL_WERROR=ON \
-DSDL_INSTALL_TESTS=ON \
-DSDL_VENDOR_INFO="Github Workflow" \
-DCMAKE_INSTALL_PREFIX=cmake_prefix \
-DCMAKE_BUILD_TYPE=Release \
${{ matrix.platform.cmake }}
- name: Build (CMake)
if: "! matrix.platform.autotools"
run: |
cmake --build build/ --config Release --verbose --parallel
- name: Run build-time tests (CMake)
if: "! matrix.platform.autotools"
run: |
set -eu
export SDL_TESTS_QUICK=1
ctest -VV --test-dir build/
if test "${{ runner.os }}" = "Linux"; then
# This should show us the SDL_REVISION
strings build/libSDL2-2.0.so.0 | grep SDL-
fi
- name: Install (CMake)
if: "! matrix.platform.autotools"
run: |
set -eu
cmake --install build/ --config Release
echo "SDL2_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV
( cd cmake_prefix; find ) | LC_ALL=C sort -u
- name: Configure (Autotools)
if: matrix.platform.autotools
run: |
set -eu
rm -fr build-autotools
mkdir build-autotools
./autogen.sh
(
cd build-autotools
${{ github.workspace }}/configure \
--enable-vendor-info="Github Workflow" \
--enable-werror \
--prefix=${{ github.workspace }}/autotools_prefix \
)
if test "${{ runner.os }}" != "macOS" ; then
curdir="$(pwd)"
multiarch="$(dpkg-architecture -qDEB_HOST_MULTIARCH)"
(
mkdir -p build-autotools/test
cd build-autotools/test
${{ github.workspace }}/test/configure \
--enable-werror \
--x-includes=/usr/include \
--x-libraries="/usr/lib/${multiarch}" \
--prefix=${{ github.workspace }}/autotools_prefix \
SDL_CFLAGS="-I${curdir}/include" \
SDL_LIBS="-L${curdir}/build-autotools/build/.libs -lSDL2" \
ac_cv_lib_SDL2_ttf_TTF_Init=no \
${NULL+}
)
fi
- name: Build (Autotools)
if: matrix.platform.autotools
run: |
set -eu
parallel="$(getconf _NPROCESSORS_ONLN)"
make -j"${parallel}" -C build-autotools V=1
if test "${{ runner.os }}" != "macOS" ; then
make -j"${parallel}" -C build-autotools/test V=1
fi
- name: Run build-time tests (Autotools)
if: ${{ matrix.platform.autotools && (runner.os != 'macOS') }}
run: |
set -eu
curdir="$(pwd)"
parallel="$(getconf _NPROCESSORS_ONLN)"
export SDL_TESTS_QUICK=1
make -j"${parallel}" -C build-autotools/test check LD_LIBRARY_PATH="${curdir}/build-autotools/build/.libs"
if test "${{ runner.os }}" = "Linux"; then
# This should show us the SDL_REVISION
strings "${curdir}/build-autotools/build/.libs/libSDL2-2.0.so.0" | grep SDL-
fi
- name: Install (Autotools)
if: matrix.platform.autotools
run: |
set -eu
curdir="$(pwd)"
parallel="$(getconf _NPROCESSORS_ONLN)"
make -j"${parallel}" -C build-autotools install V=1
if test "${{ runner.os }}" != "macOS" ; then
make -j"${parallel}" -C build-autotools/test install V=1
fi
( cd autotools_prefix; find . ) | LC_ALL=C sort -u
echo "SDL2_DIR=$(pwd)/autotools_prefix" >> $GITHUB_ENV
- name: Verify CMake configuration files
run: |
cmake -S cmake/test -B cmake_config_build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }}
cmake --build cmake_config_build --verbose
- name: Verify sdl2-config
run: |
export PATH=${{ env.SDL2_DIR }}/bin:$PATH
cmake/test/test_sdlconfig.sh
- name: Verify sdl2.pc
run: |
export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
cmake/test/test_pkgconfig.sh
- name: Distcheck (Autotools)
if: matrix.platform.autotools
run: |
set -eu
parallel="$(getconf _NPROCESSORS_ONLN)"
make -j"${parallel}" -C build-autotools dist V=1
# Similar to Automake `make distcheck`: check that the tarball
# release is sufficient to do a new build
mkdir distcheck
tar -C distcheck -zxf build-autotools/SDL2-*.tar.gz
( cd distcheck/SDL2-* && ./configure )
make -j"${parallel}" -C distcheck/SDL2-*
- name: Run installed-tests (Autotools)
if: "runner.os == 'Linux' && matrix.platform.autotools"
run: |
set -eu
parallel="$(getconf _NPROCESSORS_ONLN)"
sudo make -j"${parallel}" -C build-autotools install
sudo make -j"${parallel}" -C build-autotools/test install
export SDL_TESTS_QUICK=1
# We need to set LD_LIBRARY_PATH because it isn't in the default
# linker search path. We don't need to set XDG_DATA_DIRS for
# ginsttest-runner, because /usr/local/share *is* in the default
# search path for that.
env --chdir=/ \
LD_LIBRARY_PATH=/usr/local/lib \
SDL_AUDIODRIVER=dummy \
SDL_VIDEODRIVER=dummy \
ginsttest-runner --tap SDL2

View File

@@ -1,74 +0,0 @@
name: Build (MSVC)
on: [push, pull_request]
jobs:
Build:
name: ${{ matrix.platform.name }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
platform:
- { name: Windows (x64), flags: -A x64, project: VisualC/SDL.sln, projectflags: '/p:Platform=x64' }
- { name: Windows (x86), flags: -A Win32, project: VisualC/SDL.sln, projectflags: '/p:Platform=Win32' }
- { name: Windows static VCRT (x64), flags: -A x64 -DSDL_FORCE_STATIC_VCRT=ON }
- { name: Windows static VCRT (x86), flags: -A Win32 -DSDL_FORCE_STATIC_VCRT=ON }
- { name: Windows (clang-cl x64), flags: -T ClangCL -A x64 }
- { name: Windows (clang-cl x86), flags: -T ClangCL -A Win32 }
- { name: Windows (ARM), flags: -A ARM }
- { name: Windows (ARM64), flags: -A ARM64 }
- { name: UWP (x64), flags: -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" -DSDL_TESTS=OFF, nowerror: true,
project: VisualC-WinRT/SDL-UWP.sln, projectflags: '/p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17763.0' }
steps:
- uses: actions/checkout@v3
- name: Create CMake project using SDL as a subproject
shell: python
run: |
import os
import textwrap
srcdir = r"${{ github.workspace }}".replace("\\", "/")
builddir = f"{ srcdir }/build"
os.makedirs(builddir)
with open(f"{ builddir }/CMakeLists.txt", "w") as f:
f.write(textwrap.dedent(f"""\
cmake_minimum_required(VERSION 3.0)
project(sdl_user)
add_subdirectory("{ srcdir }" SDL)
"""))
- name: Configure (CMake)
run: cmake -S build -B build `
-DSDL_WERROR=${{ !matrix.platform.nowerror }} `
-DSDL_TESTS=ON `
-DSDL_INSTALL_TESTS=ON `
-DSDL_VENDOR_INFO="Github Workflow" `
-DSDL2_DISABLE_INSTALL=OFF `
${{ matrix.platform.flags }} `
-DCMAKE_INSTALL_PREFIX=prefix
- name: Build (CMake)
run: cmake --build build/ --config Release --parallel
- name: Run build-time tests
if: "! contains(matrix.platform.name, 'ARM')"
run: |
$env:SDL_TESTS_QUICK=1
ctest -VV --test-dir build/ -C Release
- name: Install (CMake)
run: |
echo "SDL2_DIR=$Env:GITHUB_WORKSPACE/prefix" >> $Env:GITHUB_ENV
cmake --install build/
- name: Verify CMake configuration files
if: ${{ !contains(matrix.platform.name, 'UWP') }} # FIXME: cmake/test/CMakeLists.txt should support UWP
run: |
cmake -S cmake/test -B cmake_config_build `
-DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} `
${{ matrix.platform.flags }}
cmake --build cmake_config_build --config Release
- name: Add msbuild to PATH
if: ${{ matrix.platform.project != '' }}
uses: microsoft/setup-msbuild@v1.1.3
- name: Build msbuild
if: ${{ matrix.platform.project != '' }}
run: msbuild ${{ matrix.platform.project }} /m /p:BuildInParallel=true /p:Configuration=Release ${{ matrix.platform.projectflags }}

View File

@@ -1,42 +0,0 @@
name: Build (Nintendo 3DS)
on: [push, pull_request]
jobs:
n3ds:
runs-on: ubuntu-latest
container:
image: devkitpro/devkitarm:latest
steps:
- uses: actions/checkout@v3
- name: Install build requirements
run: |
apt update
apt install ninja-build
- name: Configure CMake
run: |
cmake -S . -B build -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=${DEVKITPRO}/cmake/3DS.cmake \
-DSDL_WERROR=ON \
-DSDL_TESTS=ON \
-DSDL_INSTALL_TESTS=ON \
-DSDL_VENDOR_INFO="Github Workflow" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=prefix
- name: Build
run: cmake --build build --verbose
- name: Install CMake
run: |
echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV
cmake --install build/
( cd prefix; find ) | LC_ALL=C sort -u
- name: Verify CMake configuration files
run: |
cmake -S cmake/test -B cmake_config_build -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=${DEVKITPRO}/cmake/3DS.cmake \
-DTEST_SHARED=FALSE \
-DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \
-DCMAKE_BUILD_TYPE=Release
cmake --build cmake_config_build --verbose
# Not running test_pkgconfig.sh and test_sdlconfig.sh
# as invoking the compiler manually is not supported

View File

@@ -1,73 +0,0 @@
name: Build (Sony Playstation 2)
on: [push, pull_request]
jobs:
ps2:
runs-on: ubuntu-latest
container: ps2dev/ps2dev:latest
steps:
- uses: actions/checkout@v3
- name: Setup dependencies
run: |
apk update
apk add cmake gmp mpc1 mpfr4 ninja pkgconf make git
# To be removed once ps2_drivers is part of PS2DEV
- name: Install ps2_drivers lib
run: |
git clone https://github.com/fjtrujy/ps2_drivers.git
cd ps2_drivers
make -j $(getconf _NPROCESSORS_ONLN) clean
make -j $(getconf _NPROCESSORS_ONLN)
make -j $(getconf _NPROCESSORS_ONLN) install
- name: Configure (CMake)
run: |
cmake -S . -B build -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake \
-DSDL_WERROR=ON \
-DSDL_TESTS=ON \
-DCMAKE_INSTALL_PREFIX=cmake_prefix \
-DCMAKE_BUILD_TYPE=Release
- name: Build
run: cmake --build build --config Release --verbose --parallel
- name: Install (CMake)
run: |
set -eu
cmake --install build/ --config Release
echo "SDL2_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV
( cd cmake_prefix; find ) | LC_ALL=C sort -u
- name: Verify CMake configuration files
run: |
cmake -S cmake/test -B cmake_config_build -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake \
-DTEST_SHARED=FALSE \
-DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \
-DCMAKE_BUILD_TYPE=Release
cmake --build cmake_config_build --verbose
- name: Verify sdl2-config
run: |
export CC=mips64r5900el-ps2-elf-gcc
export PATH=${{ env.SDL2_DIR }}/bin:$PATH
export EXTRA_LDFLAGS="-L$PS2DEV/ps2sdk/ee/lib -L$PS2DEV/gsKit/lib -L$PS2DEV/ps2sdk/ports/lib"
cmake/test/test_sdlconfig.sh
- name: Verify sdl2.pc
run: |
export CC=mips64r5900el-ps2-elf-gcc
export EXTRA_LDFLAGS="-L$PS2DEV/ps2sdk/ee/lib -L$PS2DEV/gsKit/lib -L$PS2DEV/ps2sdk/ports/lib"
export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
cmake/test/test_pkgconfig.sh
- name: Get short SHA
id: slug
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"
- name: Upload artifacts
if: ${{ success() }}
uses: actions/upload-artifact@v3
with:
name: tests-${{ steps.slug.outputs.sha8 }}
path: |
build/test

View File

@@ -1,50 +0,0 @@
name: Build (Sony Playstation Portable)
on: [push, pull_request]
jobs:
psp:
runs-on: ubuntu-latest
container: pspdev/pspdev:latest
steps:
- uses: actions/checkout@v3
- name: Setup dependencies
run: |
apk update
apk add cmake gmp mpc1 mpfr4 make pkgconf
- name: Configure CMake
run: |
cmake -S . -B build \
-DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake \
-DSDL_WERROR=ON \
-DSDL_TESTS=ON \
-DSDL_INSTALL_TESTS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=prefix
- name: Build
run: cmake --build build --config Release
- name: Install
run: |
echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV
cmake --install build --config Release
( cd prefix; find ) | LC_ALL=C sort -u
- name: Verify CMake configuration files
run: |
cmake -S cmake/test -B cmake_config_build \
-DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake \
-DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \
-DTEST_SHARED=FALSE \
-DCMAKE_BUILD_TYPE=Release
cmake --build cmake_config_build --verbose
- name: Verify sdl2-config
run: |
export CC=psp-gcc
export PATH=${{ env.SDL2_DIR }}/bin:$PATH
export EXTRA_LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib"
cmake/test/test_sdlconfig.sh
- name: Verify sdl2.pc
run: |
export CC=psp-gcc
export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
export EXTRA_LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib"
cmake/test/test_pkgconfig.sh

403
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,403 @@
name: 'release'
run-name: 'Create SDL release artifacts for ${{ inputs.commit }}'
on:
workflow_dispatch:
inputs:
commit:
description: 'Commit of SDL'
required: true
jobs:
src:
runs-on: ubuntu-latest
outputs:
project: ${{ steps.releaser.outputs.project }}
version: ${{ steps.releaser.outputs.version }}
src-tar-gz: ${{ steps.releaser.outputs.src-tar-gz }}
src-tar-xz: ${{ steps.releaser.outputs.src-tar-xz }}
src-zip: ${{ steps.releaser.outputs.src-zip }}
steps:
- name: 'Set up Python'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: 'Fetch build-release.py'
uses: actions/checkout@v4
with:
sparse-checkout: 'build-scripts/build-release.py'
- name: 'Set up SDL sources'
uses: actions/checkout@v4
with:
path: 'SDL'
fetch-depth: 0
- name: 'Build Source archive'
id: releaser
shell: bash
run: |
python build-scripts/build-release.py \
--actions source \
--commit ${{ inputs.commit }} \
--root "${{ github.workspace }}/SDL" \
--github \
--debug
- name: 'Store source archives'
uses: actions/upload-artifact@v4
with:
name: sources
path: '${{ github.workspace}}/dist'
linux-verify:
needs: [src]
runs-on: ubuntu-latest
steps:
- name: 'Download source archives'
uses: actions/download-artifact@v4
with:
name: sources
path: '${{ github.workspace }}'
- name: 'Unzip ${{ needs.src.outputs.src-zip }}'
id: zip
run: |
mkdir /tmp/zipdir
cd /tmp/zipdir
unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
echo "path=/tmp/zipdir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
id: tar
run: |
mkdir -p /tmp/tardir
tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
- name: 'Compare contents of ${{ needs.src.outputs.src-zip }} and ${{ needs.src.outputs.src-tar-gz }}'
run: |
diff /tmp/zipdir /tmp/tardir
- name: 'Test versioning'
shell: bash
run: |
${{ steps.tar.outputs.path }}/build-scripts/test-versioning.sh
- name: 'CMake (configure + build + tests + examples)'
run: |
cmake -S ${{ steps.tar.outputs.path }} -B /tmp/build -DSDL_TEST_LIBRARY=TRUE -DSDL_TESTS=TRUE -DSDL_EXAMPLES=TRUE
cmake --build /tmp/build --verbose
ctest --test-dir /tmp/build --no-tests=error --output-on-failure
dmg:
needs: [src]
runs-on: macos-latest
outputs:
dmg: ${{ steps.releaser.outputs.dmg }}
steps:
- name: 'Set up Python'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: 'Fetch build-release.py'
uses: actions/checkout@v4
with:
sparse-checkout: 'build-scripts/build-release.py'
- name: 'Download source archives'
uses: actions/download-artifact@v4
with:
name: sources
path: '${{ github.workspace }}'
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
id: tar
run: |
mkdir -p "${{ github.workspace }}/tardir"
tar -C "${{ github.workspace }}/tardir" -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
echo "path=${{ github.workspace }}/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
- name: 'Build SDL2.dmg'
id: releaser
shell: bash
run: |
python build-scripts/build-release.py \
--actions dmg \
--commit ${{ inputs.commit }} \
--root "${{ steps.tar.outputs.path }}" \
--github \
--debug
- name: 'Store DMG image file'
uses: actions/upload-artifact@v4
with:
name: dmg
path: '${{ github.workspace }}/dist'
dmg-verify:
needs: [dmg, src]
runs-on: macos-latest
steps:
- name: 'Download source archives'
uses: actions/download-artifact@v4
with:
name: sources
path: '${{ github.workspace }}'
- name: 'Download ${{ needs.dmg.outputs.dmg }}'
uses: actions/download-artifact@v4
with:
name: dmg
path: '${{ github.workspace }}'
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
id: src
run: |
mkdir -p /tmp/tardir
tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
- name: 'Mount ${{ needs.dmg.outputs.dmg }}'
id: mount
run: |
hdiutil attach '${{ github.workspace }}/${{ needs.dmg.outputs.dmg }}'
mount_point="/Volumes/${{ needs.src.outputs.project }}"
if [ ! -d "$mount_point/${{ needs.src.outputs.project }}.framework" ]; then
echo "Cannot find ${{ needs.src.outputs.project }}.framework!"
exit 1
fi
echo "mount_point=$mount_point">>$GITHUB_OUTPUT
- name: 'CMake (configure + build) Darwin'
run: |
set -e
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
-DTEST_FULL=FALSE \
-DTEST_STATIC=FALSE \
-DTEST_TEST=FALSE \
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
-DCMAKE_SYSTEM_NAME=Darwin \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
-Werror=dev \
-B build_darwin
cmake --build build_darwin --config Release --verbose
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
-DTEST_FULL=FALSE \
-DTEST_STATIC=FALSE \
-DTEST_TEST=FALSE \
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
-DCMAKE_SYSTEM_NAME=Darwin \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
-Werror=dev \
-B build_darwin_2
cmake --build build_darwin --config Release --verbose
msvc:
needs: [src]
runs-on: windows-2019
outputs:
VC-x86: ${{ steps.releaser.outputs.VC-x86 }}
VC-x64: ${{ steps.releaser.outputs.VC-x64 }}
VC-devel: ${{ steps.releaser.outputs.VC-devel }}
steps:
- name: 'Set up Python'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: 'Fetch build-release.py'
uses: actions/checkout@v4
with:
sparse-checkout: 'build-scripts/build-release.py'
- name: 'Download source archives'
uses: actions/download-artifact@v4
with:
name: sources
path: '${{ github.workspace }}'
- name: 'Unzip ${{ needs.src.outputs.src-zip }}'
id: zip
run: |
New-Item C:\temp -ItemType Directory -ErrorAction SilentlyContinue
cd C:\temp
unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
echo "path=C:\temp\${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$Env:GITHUB_OUTPUT
- name: 'Build MSVC binary archives'
id: releaser
run: |
python build-scripts/build-release.py `
--actions msvc `
--commit ${{ inputs.commit }} `
--root "${{ steps.zip.outputs.path }}" `
--github `
--debug
- name: 'Store MSVC archives'
uses: actions/upload-artifact@v4
with:
name: win32
path: '${{ github.workspace }}/dist'
msvc-verify:
needs: [msvc, src]
runs-on: windows-latest
steps:
- name: 'Fetch .github/actions/setup-ninja/action.yml'
uses: actions/checkout@v4
with:
sparse-checkout: '.github/actions/setup-ninja/action.yml'
- name: 'Download source archives'
uses: actions/download-artifact@v4
with:
name: sources
path: '${{ github.workspace }}'
- name: 'Download MSVC binaries'
uses: actions/download-artifact@v4
with:
name: win32
path: '${{ github.workspace }}'
- name: 'Unzip ${{ needs.src.outputs.src-zip }}'
id: src
run: |
mkdir '${{ github.workspace }}/sources'
cd '${{ github.workspace }}/sources'
unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
echo "path=${{ github.workspace }}/sources/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
- name: 'Unzip ${{ needs.msvc.outputs.VC-devel }}'
id: bin
run: |
mkdir '${{ github.workspace }}/vc'
cd '${{ github.workspace }}/vc'
unzip "${{ github.workspace }}/${{ needs.msvc.outputs.VC-devel }}"
echo "path=${{ github.workspace }}/vc/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
- name: Set up ninja
uses: ./.github/actions/setup-ninja
- name: 'Configure vcvars x86'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64_x86
- name: 'CMake (configure + build + tests) x86'
run: |
cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
-B build_x86 `
-GNinja `
-DCMAKE_BUILD_TYPE=Debug `
-Werror=dev `
-DTEST_FULL=FALSE `
-DTEST_STATIC=FALSE `
-DTEST_SHARED=TRUE `
-DTEST_TEST=TRUE `
-DCMAKE_SUPPRESS_REGENERATION=TRUE `
-DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}"
Start-Sleep -Seconds 2
cmake --build build_x86 --config Release --verbose
#ctest --test-dir build_x86 --no-tests=error -C Release --output-on-failure
- name: 'Configure vcvars x64'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: 'CMake (configure + build + tests) x64'
run: |
cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
-B build_x64 `
-GNinja `
-DCMAKE_BUILD_TYPE=Debug `
-Werror=dev `
-DTEST_FULL=FALSE `
-DTEST_STATIC=FALSE `
-DTEST_SHARED=TRUE `
-DTEST_TEST=TRUE `
-DCMAKE_SUPPRESS_REGENERATION=TRUE `
-DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}"
Start-Sleep -Seconds 2
cmake --build build_x64 --config Release --verbose
#ctest --test-dir build_x64 --no-tests=error -C Release --output-on-failure
mingw:
needs: [src]
runs-on: ubuntu-24.04 # FIXME: current ubuntu-latest ships an outdated mingw, replace with ubuntu-latest once 24.04 becomes the new default
outputs:
mingw-devel-tar-gz: ${{ steps.releaser.outputs.mingw-devel-tar-gz }}
mingw-devel-tar-xz: ${{ steps.releaser.outputs.mingw-devel-tar-xz }}
steps:
- name: 'Set up Python'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: 'Fetch build-release.py'
uses: actions/checkout@v4
with:
sparse-checkout: 'build-scripts/build-release.py'
- name: 'Install Mingw toolchain'
run: |
sudo apt-get update -y
sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
- name: 'Download source archives'
uses: actions/download-artifact@v4
with:
name: sources
path: '${{ github.workspace }}'
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
id: tar
run: |
mkdir -p /tmp/tardir
tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
- name: 'Build MinGW binary archives'
id: releaser
run: |
python build-scripts/build-release.py \
--actions mingw \
--commit ${{ inputs.commit }} \
--root "${{ steps.tar.outputs.path }}" \
--github \
--debug
- name: 'Store MinGW archives'
uses: actions/upload-artifact@v4
with:
name: mingw
path: '${{ github.workspace }}/dist'
mingw-verify:
needs: [mingw, src]
runs-on: ubuntu-latest
steps:
- name: 'Install Mingw toolchain'
run: |
sudo apt-get update -y
sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
- name: 'Download source archives'
uses: actions/download-artifact@v4
with:
name: sources
path: '${{ github.workspace }}'
- name: 'Download MinGW binaries'
uses: actions/download-artifact@v4
with:
name: mingw
path: '${{ github.workspace }}'
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
id: src
run: |
mkdir -p /tmp/tardir
tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
- name: 'Untar and install ${{ needs.mingw.outputs.mingw-devel-tar-gz }}'
id: bin
run: |
mkdir -p /tmp/mingw-tardir
tar -C /tmp/mingw-tardir -v -x -f "${{ github.workspace }}/${{ needs.mingw.outputs.mingw-devel-tar-gz }}"
make -C /tmp/mingw-tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }} cross CROSS_PATH=/tmp/deps-mingw
echo "path=/tmp/deps-mingw" >>$GITHUB_OUTPUT
- name: 'CMake (configure + build) i686'
run: |
set -e
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
-DCMAKE_BUILD_TYPE="Release" \
-DTEST_FULL=FALSE \
-DTEST_STATIC=TRUE \
-DTEST_TEST=TRUE \
-DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" \
-DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-i686.cmake" \
-DCMAKE_C_FLAGS="-DSDL_DISABLE_SSE4_2" \
-Werror=dev \
-B build_x86
cmake --build build_x86 --config Release --verbose
- name: 'CMake (configure + build) x86_64'
run: |
set -e
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
-DCMAKE_BUILD_TYPE="Release" \
-DTEST_FULL=FALSE \
-DTEST_STATIC=TRUE \
-DTEST_TEST=TRUE \
-DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }}" \
-DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-x86_64.cmake" \
-DCMAKE_C_FLAGS="-DSDL_DISABLE_SSE4_2" \
-Werror=dev \
-B build_x64
cmake --build build_x64 --config Release --verbose

View File

@@ -1,68 +0,0 @@
name: Build (RISC OS)
on: [push, pull_request]
jobs:
Build:
name: ${{ matrix.platform.name }}
runs-on: ubuntu-latest
container: riscosdotinfo/riscos-gccsdk-4.7:latest
strategy:
fail-fast: false
matrix:
platform:
- { name: autotools, test_args: '-DTEST_SHARED=FALSE' } # FIXME: autotools should build and install shared libraries
- { name: CMake }
steps:
- name: Setup dependencies
run: apt-get update && apt-get install -y cmake ninja-build
- uses: actions/checkout@v3
- name: Configure (autotools)
if: ${{ contains(matrix.platform.name, 'autotools') }}
run: |
mkdir build_autotools
cd build_autotools
../configure \
--host=arm-unknown-riscos \
--disable-gcc-atomics \
--prefix=${{ github.workspace }}/prefix_autotools
- name: Build (autotools)
if: ${{ contains(matrix.platform.name, 'autotools') }}
run: make -C build_autotools -j`nproc` V=1
- name: Install (autotools)
if: ${{ contains(matrix.platform.name, 'autotools') }}
run: |
echo "SDL2_DIR=${{ github.workspace }}/prefix_autotools" >> $GITHUB_ENV
make -C build_autotools install
( cd ${{ github.workspace }}/prefix_autotools; find ) | LC_ALL=C sort -u
- name: Configure (CMake)
if: ${{ contains(matrix.platform.name, 'CMake') }}
run: |
cmake -S . -B build -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=/home/riscos/env/toolchain-riscos.cmake \
-DRISCOS=ON \
-DSDL_GCC_ATOMICS=OFF \
-DSDL_TESTS=ON \
-DSDL_INSTALL_TESTS=ON \
-DSDL_VENDOR_INFO="Github Workflow" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/prefix_cmake
- name: Build (CMake)
if: ${{ contains(matrix.platform.name, 'CMake') }}
run: cmake --build build --verbose
- name: Install (CMake)
if: ${{ contains(matrix.platform.name, 'CMake') }}
run: |
echo "SDL2_DIR=${{ github.workspace }}/prefix_cmake" >> $GITHUB_ENV
cmake --install build/
( cd ${{ github.workspace }}/prefix_cmake; find ) | LC_ALL=C sort -u
- name: Verify CMake configuration files
run: |
cmake -S cmake/test -B cmake_config_build -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=/home/riscos/env/toolchain-riscos.cmake \
-DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \
-DCMAKE_BUILD_TYPE=Release \
${{ matrix.platform.test_args }}
cmake --build cmake_config_build --verbose

View File

@@ -1,53 +0,0 @@
name: Build (Sony Playstation Vita)
on: [push, pull_request]
defaults:
run:
shell: sh
jobs:
vita:
runs-on: ubuntu-latest
container:
image: vitasdk/vitasdk:latest
steps:
- uses: actions/checkout@v3
- name: Install build requirements
run: |
apk update
apk add cmake ninja pkgconf bash
- name: Configure CMake
run: |
cmake -S . -B build -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \
-DSDL_WERROR=ON \
-DSDL_TESTS=ON \
-DSDL_INSTALL_TESTS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=prefix
- name: Build
run: cmake --build build --verbose
- name: Install CMake
run: |
echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV
cmake --install build/
( cd prefix; find ) | LC_ALL=C sort -u
- name: Verify CMake configuration files
run: |
cmake -S cmake/test -B cmake_config_build -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \
-DTEST_SHARED=FALSE \
-DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \
-DCMAKE_BUILD_TYPE=Release
cmake --build cmake_config_build --verbose
- name: Verify sdl2-config
run: |
export CC=arm-vita-eabi-gcc
export PATH=${{ env.SDL2_DIR }}/bin:$PATH
cmake/test/test_sdlconfig.sh
- name: Verify sdl2.pc
run: |
export CC=arm-vita-eabi-gcc
export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
cmake/test/test_pkgconfig.sh

View File

@@ -1,49 +0,0 @@
name: Build (VM Actions)
on: [push, pull_request]
jobs:
freebsd:
runs-on: macos-12
name: FreeBSD
steps:
- uses: actions/checkout@v3
- name: Build
uses: vmactions/freebsd-vm@v0
with:
usesh: true
prepare: |
pkg install -y \
gmake \
pkgconf \
libXcursor \
libXext \
libXinerama \
libXi \
libXfixes \
libXrandr \
libXScrnSaver \
libXxf86vm \
wayland \
wayland-protocols \
libxkbcommon \
mesa-libs \
libglvnd \
evdev-proto \
libinotify \
alsa-lib \
jackit \
nas \
pipewire \
pulseaudio \
sndio \
dbus \
zh-fcitx \
ibus \
libsamplerate \
libudev-devd
run: |
mkdir build_autotools
(cd build_autotools && CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" ../configure)
gmake -C build_autotools -j`sysctl -n hw.ncpu` V=1

View File

@@ -1,35 +0,0 @@
name: Build (OpenWatcom)
on: [push, pull_request]
jobs:
os2:
name: ${{ matrix.platform.name }}
runs-on: windows-latest
strategy:
matrix:
platform:
- { name: Windows, makefile: Makefile.w32 }
- { name: OS/2, makefile: Makefile.os2 }
steps:
- uses: actions/checkout@v3
- uses: open-watcom/setup-watcom@v0
- name: Build SDL2
run: |
wmake -f ${{ matrix.platform.makefile }} ENABLE_WERROR=1
- name: Build tests
run: |
cd test && wmake -f ${{ matrix.platform.makefile }} ENABLE_WERROR=1
cd ..
- name: Run tests
if: "matrix.platform.makefile == 'Makefile.w32'"
run: |
cd test && wmake -f ${{ matrix.platform.makefile }} check-quick
cd ..
- name: distclean
run: |
wmake -f ${{ matrix.platform.makefile }} distclean
cd test && wmake -f ${{ matrix.platform.makefile }} distclean
cd ..

10
.gitignore vendored
View File

@@ -15,7 +15,8 @@ build
gen
Build
buildbot
/VERSION.txt
/REVISION.txt
dist
*.so
*.so.*
@@ -62,6 +63,11 @@ cmake-build-*
xcuserdata
*.xcworkspace
# for QtCreator
CMakeLists.txt.user
build*/
*.pro.user*
# for Visual C++
.vs
Debug
@@ -98,6 +104,7 @@ VisualC/visualtest/testsprite2_sample.actions
VisualC/visualtest/testsprite2_sample.config
VisualC/visualtest/testsprite2_sample.parameters
VisualC-GDK/**/Layout
VisualC-GDK/shaders/*.h
# for Android
android-project/local.properties
@@ -173,6 +180,7 @@ test/testyuv
test/torturethread
builddir/
!build-scripts/
debian/*.debhelper.log
debian/*.substvars
debian/*.tar.gz

View File

@@ -1,8 +1,9 @@
projectfullname = SDL_mixer
projectshortname = SDL_mixer
projectfullname = Simple Directmedia Layer
projectshortname = SDL
incsubdir = include
wikisubdir =
apiprefixregex = (SDL_|SDLK_|KMOD_|AUDIO_)
wikisubdir = SDL2
readmesubdir = docs
apiprefixregex = (SDL_|SDLK_|KMOD_|AUDIO_|[US]int\d+)
mainincludefname = SDL.h
versionfname = include/SDL_version.h
versionmajorregex = \A\#define\s+SDL_MAJOR_VERSION\s+(\d+)\Z
@@ -10,6 +11,21 @@ versionminorregex = \A\#define\s+SDL_MINOR_VERSION\s+(\d+)\Z
versionpatchregex = \A\#define\s+SDL_PATCHLEVEL\s+(\d+)\Z
selectheaderregex = \ASDL.*?\.h\Z
projecturl = https://libsdl.org/
wikiurl = https://wiki.libsdl.org
wikiurl = https://wiki.libsdl.org/SDL2
bugreporturl = https://github.com/libsdl-org/sdlwiki/issues/new
warn_about_missing = 0
#wikipreamble = (This is the legacy documentation for SDL2, the previous stable version; [SDL3](https://wiki.libsdl.org/SDL3/) is the current stable version.)
wikiheaderfiletext = Defined in [%fname%](https://github.com/libsdl-org/SDL/blob/SDL2/include/%fname%)
manpageheaderfiletext = Defined in %fname%
# All SDL_config_*.h headers are uncategorized, in case something slips in from them.
# All SDL_test_* headers become uncategorized, everything else just converts like SDL_audio.h -> Audio
# A handful of others we fix up in the header itself with /* WIKI CATEGORY: x */ comments.
headercategoryeval = s/\ASDL_config_.*?\.h\Z//; s/\ASDL_test_.*?\.h\Z//; s/\ASDL_?(.*?)\.h\Z/$1/; ucfirst();
quickrefenabled = 0 # !!! FIXME: maybe later, but there are probably documentation gaps to fix first.
quickrefcategoryorder = Init,Hints,Error,Version,Properties,Log,Video,Events,Keyboard,Mouse,Touch,Gesture,GameController,Joystick,Haptic,Audio,Timer,Render,LoadSO,Thread,Mutex,Atomic,Filesystem,RWOPS,Pixels,Surface,Blendmode,Rect,Clipboard,Messagebox,Vulkan,Metal,Platform,Power,Sensor,Bits,Endian,Assert,CPUInfo,Locale,System,Misc,GUID,Main,Stdinc
quickreftitle = SDL2 API Quick Reference
quickrefurl = https://libsdl.org/
quickrefdesc = The latest version of this document can be found at https://wiki.libsdl.org/SDL2/QuickReference
quickrefmacroregex = \A(SDL_Atomic...Ref|SDL_assert.*?|SDL_arraysize|SDL_Swap[BL]E\d\d|SDL_[a-z]+_cast|SDL_Load...)\Z

View File

@@ -12,7 +12,7 @@ LOCAL_MODULE := SDL2
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)/include
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
LOCAL_SRC_FILES := \
$(subst $(LOCAL_PATH)/,, \
@@ -35,6 +35,7 @@ LOCAL_SRC_FILES := \
$(wildcard $(LOCAL_PATH)/src/hidapi/android/*.cpp) \
$(wildcard $(LOCAL_PATH)/src/joystick/*.c) \
$(wildcard $(LOCAL_PATH)/src/joystick/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/joystick/dummy/*.c) \
$(wildcard $(LOCAL_PATH)/src/joystick/hidapi/*.c) \
$(wildcard $(LOCAL_PATH)/src/joystick/virtual/*.c) \
$(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \
@@ -63,7 +64,6 @@ LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
LOCAL_CFLAGS += \
-Wall -Wextra \
-Wdocumentation \
-Wdocumentation-unknown-command \
-Wmissing-prototypes \
-Wunreachable-code-break \
-Wunneeded-internal-declaration \
@@ -78,6 +78,8 @@ LOCAL_CFLAGS += \
# Warnings we haven't fixed (yet)
LOCAL_CFLAGS += -Wno-unused-parameter -Wno-sign-compare
LOCAL_CXXFLAGS += -std=gnu++11
LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -lOpenSLES -llog -landroid
LOCAL_LDFLAGS := -Wl,--no-undefined

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View File

@@ -27,6 +27,7 @@ LDFLAGS = @BUILD_LDFLAGS@
EXTRA_LDFLAGS = @EXTRA_LDFLAGS@
LIBTOOL = @LIBTOOL@
INSTALL = @INSTALL@
FGREP = @FGREP@
AR = @AR@
RANLIB = @RANLIB@
RC = @RC@
@@ -51,7 +52,7 @@ WAYLAND_SCANNER_CODE_MODE = @WAYLAND_SCANNER_CODE_MODE@
INSTALL_SDL2_CONFIG = @INSTALL_SDL2_CONFIG@
SRC_DIST = *.md *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.ac docs include Makefile.* mingw sdl2-config.cmake.in sdl2-config-version.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake.in src test VisualC VisualC-WinRT Xcode Xcode-iOS wayland-protocols
SRC_DIST = *.md *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.ac docs include Makefile.* mingw sdl2-config.cmake.in sdl2-config-version.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake.in src test VisualC VisualC-GDK VisualC-WinRT Xcode Xcode-iOS wayland-protocols
GEN_DIST = SDL2.spec
ifneq ($V,1)
@@ -130,7 +131,7 @@ HDRS = \
begin_code.h \
close_code.h
SDLTEST_HDRS = $(shell ls $(srcdir)/include | fgrep SDL_test)
SDLTEST_HDRS = $(shell ls $(srcdir)/include | $(FGREP) SDL_test)
LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@

View File

@@ -1,7 +1,7 @@
# Makefile to build the SDL library
INCLUDE = -I./include
CFLAGS = -g -O2 $(INCLUDE)
CPPFLAGS = -I./include
CFLAGS = -g -O2
AR = ar
RANLIB = ranlib

View File

@@ -1,4 +1,4 @@
# Open Watcom makefile to build SDL2.dll for OS/2
# Open Watcom makefile to build SDL2.dll for OS/2:
# wmake -f Makefile.os2
#
# If you have GNU libiconv installed (iconv2.dll), you
@@ -14,7 +14,7 @@
LIBNAME = SDL2
MAJOR_VERSION = 2
MINOR_VERSION = 26
MINOR_VERSION = 32
MICRO_VERSION = 0
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
DESCRIPTION = Simple DirectMedia Layer 2
@@ -56,7 +56,7 @@ CFLAGS_DLL+= -bd
# iconv:
LIBICONV_LIB=iconv2.lib
!ifeq LIBICONV 1
CFLAGS_DLL+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1
CFLAGS_DLL+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 -DSDL_USE_LIBICONV
LIBS+= $(ICONVLIB)
!else
LIBS+= libuls.lib libconv.lib
@@ -81,7 +81,7 @@ SRCS+= SDL_events.c SDL_quit.c SDL_keyboard.c SDL_mouse.c SDL_windowevents.c &
SDL_clipboardevents.c SDL_dropevents.c SDL_displayevents.c SDL_gesture.c &
SDL_sensor.c SDL_touch.c
SRCS+= SDL_haptic.c SDL_hidapi.c SDL_gamecontroller.c SDL_joystick.c controller_type.c
SRCS+= SDL_render.c yuv_rgb.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c &
SRCS+= SDL_render.c yuv_rgb_sse.c yuv_rgb_std.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c &
SDL_blendline.c SDL_blendpoint.c SDL_drawline.c SDL_drawpoint.c &
SDL_render_sw.c SDL_rotate.c SDL_triangle.c
SRCS+= SDL_blit.c SDL_blit_0.c SDL_blit_1.c SDL_blit_A.c SDL_blit_auto.c &
@@ -94,7 +94,7 @@ SRCS+= SDL_systimer.c
SRCS+= SDL_sysloadso.c
SRCS+= SDL_sysfilesystem.c
SRCS+= SDL_os2joystick.c SDL_syshaptic.c SDL_sysjoystick.c SDL_virtualjoystick.c
SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c
SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c SDL_hidapi_steamdeck.c SDL_steam_virtual_gamepad.c
SRCS+= SDL_dummyaudio.c SDL_diskaudio.c
SRCS+= SDL_nullvideo.c SDL_nullframebuffer.c SDL_nullevents.c
SRCS+= SDL_dummysensor.c
@@ -152,6 +152,8 @@ SDL_blendpoint.obj: SDL_blendpoint.c
wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $<
SDL_RLEaccel.obj: SDL_RLEaccel.c
wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $<
yuv_rgb_sse.obj: yuv_rgb_sse.c
wcc386 $(CFLAGS_DLL) -wcd=202 -fo=$^@ $<
!ifeq HIDAPI 1
# c99 mode needed because of structs with flexible array members in libusb.h
SDL_hidapi.obj: SDL_hidapi.c

View File

@@ -1,11 +1,11 @@
# Open Watcom makefile to build SDL2.dll for Win32
# Open Watcom makefile to build SDL2.dll for Win32:
# wmake -f Makefile.w32
#
# To error out upon warnings: wmake -f Makefile.w32 ENABLE_WERROR=1
LIBNAME = SDL2
MAJOR_VERSION = 2
MINOR_VERSION = 26
MINOR_VERSION = 32
MICRO_VERSION = 0
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
@@ -60,7 +60,7 @@ SRCS+= SDL_events.c SDL_quit.c SDL_keyboard.c SDL_mouse.c SDL_windowevents.c &
SDL_clipboardevents.c SDL_dropevents.c SDL_displayevents.c SDL_gesture.c &
SDL_sensor.c SDL_touch.c
SRCS+= SDL_haptic.c SDL_hidapi.c SDL_gamecontroller.c SDL_joystick.c controller_type.c
SRCS+= SDL_render.c yuv_rgb.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c &
SRCS+= SDL_render.c yuv_rgb_sse.c yuv_rgb_std.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c &
SDL_blendline.c SDL_blendpoint.c SDL_drawline.c SDL_drawpoint.c &
SDL_render_sw.c SDL_rotate.c SDL_triangle.c
SRCS+= SDL_blit.c SDL_blit_0.c SDL_blit_1.c SDL_blit_A.c SDL_blit_auto.c &
@@ -73,7 +73,7 @@ SRCS+= SDL_systimer.c
SRCS+= SDL_sysloadso.c
SRCS+= SDL_sysfilesystem.c
SRCS+= SDL_syshaptic.c SDL_sysjoystick.c SDL_virtualjoystick.c
SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c
SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c SDL_hidapi_steamdeck.c
SRCS+= SDL_dummyaudio.c SDL_diskaudio.c
SRCS+= SDL_nullvideo.c SDL_nullframebuffer.c SDL_nullevents.c
SRCS+= SDL_dummysensor.c
@@ -93,7 +93,7 @@ SRCS+= SDL_render_gl.c SDL_shaders_gl.c
SRCS+= SDL_render_gles2.c SDL_shaders_gles2.c
SRCS+= SDL_windowssensor.c
SRCS+= SDL_syscond_cv.c
SRCS+= SDL_windowsclipboard.c SDL_windowsevents.c SDL_windowsframebuffer.c SDL_windowskeyboard.c SDL_windowsmessagebox.c SDL_windowsmodes.c SDL_windowsmouse.c SDL_windowsopengl.c SDL_windowsopengles.c SDL_windowsshape.c SDL_windowsvideo.c SDL_windowsvulkan.c SDL_windowswindow.c
SRCS+= SDL_windowsclipboard.c SDL_windowsevents.c SDL_windowsframebuffer.c SDL_windowskeyboard.c SDL_windowsmessagebox.c SDL_windowsmodes.c SDL_windowsmouse.c SDL_windowsopengl.c SDL_windowsopengles.c SDL_windowsshape.c SDL_windowsvideo.c SDL_windowsvulkan.c SDL_windowswindow.c SDL_steam_virtual_gamepad.c
SRCS+= SDL_dynapi.c
@@ -147,6 +147,9 @@ SDL_RLEaccel.obj: SDL_RLEaccel.c
SDL_malloc.obj: SDL_malloc.c
wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $<
yuv_rgb_sse.obj: yuv_rgb_sse.c
wcc386 $(CFLAGS_DLL) -wcd=202 -fo=$^@ $<
# SDL2libm
MSRCS= e_atan2.c e_exp.c e_fmod.c e_log10.c e_log.c e_pow.c e_rem_pio2.c e_sqrt.c &
k_cos.c k_rem_pio2.c k_sin.c k_tan.c &

View File

@@ -30,6 +30,18 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2testTargets.cmake")
set(SDL2_SDL2test_FOUND TRUE)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/sdlfind.cmake")
set(SDL_ALSA @SDL_ALSA@)
set(SDL_ALSA_SHARED @SDL_ALSA_SHARED@)
if(SDL_ALSA AND NOT SDL_ALSA_SHARED AND TARGET SDL2::SDL2-static)
sdlFindALSA()
endif()
unset(SDL_ALSA)
unset(SDL_ALSA_SHARED)
check_required_components(SDL2)
# Create SDL2::SDL2 alias for static-only builds
@@ -62,4 +74,4 @@ if(TARGET SDL2::SDL2main)
list(INSERT SDL2_STATIC_LIBRARIES 0 SDL2::SDL2main)
endif()
set(SDL2TEST_LIBRARY SDL2::SDL2test)
set(SDL2TEST_LIBRARY SDL2::SDL2test)

View File

@@ -173,6 +173,12 @@
<SubSystem>Windows</SubSystem>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Link>
<PreBuildEvent>
<Command>$(ProjectDir)..\shaders\buildshaders.bat $(ProjectDir)..\</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Building shader blobs (Xbox Series)</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">
<Midl>
@@ -201,6 +207,12 @@
<SubSystem>Windows</SubSystem>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Link>
<PreBuildEvent>
<Command>$(ProjectDir)..\shaders\buildshaders.bat $(ProjectDir)..\ one</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Building shader blobs (Xbox One)</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">
<Midl>
@@ -259,6 +271,12 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Link>
<PreBuildEvent>
<Command>$(ProjectDir)..\shaders\buildshaders.bat $(ProjectDir)..\</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Building shader blobs (Xbox Series)</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">
<Midl>
@@ -288,6 +306,12 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Link>
<PreBuildEvent>
<Command>$(ProjectDir)..\shaders\buildshaders.bat $(ProjectDir)..\ one</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Building shader blobs (Xbox One)</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\..\include\begin_code.h" />
@@ -412,6 +436,7 @@
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.h" />
<ClInclude Include="..\..\src\joystick\SDL_gamecontrollerdb.h" />
<ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
<ClInclude Include="..\..\src\joystick\SDL_steam_virtual_gamepad.h" />
<ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
<ClInclude Include="..\..\src\joystick\usb_ids.h" />
<ClInclude Include="..\..\src\joystick\virtual\SDL_virtualjoystick_c.h" />
@@ -474,7 +499,6 @@
<ClInclude Include="..\..\src\video\khronos\vulkan\vk_platform.h" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vk_sdk_platform.h" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan.h" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan.hpp" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan_android.h" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan_beta.h" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan_core.h" />
@@ -519,7 +543,13 @@
<ClInclude Include="..\..\src\video\windows\SDL_windowswindow.h" />
<ClInclude Include="..\..\src\video\windows\wmmsg.h" />
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h" />
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_common.h" />
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_internal.h" />
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_lsx.h" />
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_lsx_func.h" />
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_sse.h" />
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_sse_func.h" />
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_std.h" />
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_std_func.h" />
</ItemGroup>
<ItemGroup>
@@ -563,7 +593,7 @@
<ClCompile Include="..\..\src\events\SDL_touch.c" />
<ClCompile Include="..\..\src\events\SDL_windowevents.c" />
<ClCompile Include="..\..\src\file\SDL_rwops.c" />
<ClCompile Include="..\..\src\filesystem\windows\SDL_sysfilesystem.c" />
<ClCompile Include="..\..\src\filesystem\gdk\SDL_sysfilesystem.cpp" />
<ClCompile Include="..\..\src\haptic\dummy\SDL_syshaptic.c" />
<ClCompile Include="..\..\src\haptic\SDL_haptic.c" />
<ClCompile Include="..\..\src\haptic\windows\SDL_dinputhaptic.c" />
@@ -601,6 +631,7 @@
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_shield.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_stadia.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_steam.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_steamdeck.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_switch.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_wii.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xbox360.c" />
@@ -608,6 +639,7 @@
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xboxone.c" />
<ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c" />
<ClCompile Include="..\..\src\joystick\SDL_joystick.c" />
<ClCompile Include="..\..\src\joystick\SDL_steam_virtual_gamepad.c" />
<ClCompile Include="..\..\src\joystick\virtual\SDL_virtualjoystick.c" />
<ClCompile Include="..\..\src\joystick\windows\SDL_dinputjoystick.c" />
<ClCompile Include="..\..\src\joystick\windows\SDL_rawinputjoystick.c" />
@@ -752,7 +784,9 @@
<ClCompile Include="..\..\src\video\windows\SDL_windowsvideo.c" />
<ClCompile Include="..\..\src\video\windows\SDL_windowsvulkan.c" />
<ClCompile Include="..\..\src\video\windows\SDL_windowswindow.c" />
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c" />
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb_lsx.c" />
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb_sse.c" />
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb_std.c" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\src\main\windows\version.rc" />

View File

@@ -31,7 +31,7 @@
<Filter Include="filesystem">
<UniqueIdentifier>{377061e4-3856-4f05-b916-0d3b360df0f6}</UniqueIdentifier>
</Filter>
<Filter Include="filesystem\windows">
<Filter Include="filesystem\gdk">
<UniqueIdentifier>{226a6643-1c65-4c7f-92aa-861313d974bb}</UniqueIdentifier>
</Filter>
<Filter Include="haptic">
@@ -501,6 +501,9 @@
<ClInclude Include="..\..\src\joystick\SDL_joystick_c.h">
<Filter>joystick</Filter>
</ClInclude>
<ClInclude Include="..\..\src\joystick\SDL_steam_virtual_gamepad.h">
<Filter>joystick</Filter>
</ClInclude>
<ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h">
<Filter>joystick</Filter>
</ClInclude>
@@ -777,9 +780,6 @@
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan.h">
<Filter>video\khronos\vulkan</Filter>
</ClInclude>
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan.hpp">
<Filter>video\khronos\vulkan</Filter>
</ClInclude>
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan_android.h">
<Filter>video\khronos\vulkan</Filter>
</ClInclude>
@@ -925,8 +925,8 @@
<ClCompile Include="..\..\src\file\SDL_rwops.c">
<Filter>file</Filter>
</ClCompile>
<ClCompile Include="..\..\src\filesystem\windows\SDL_sysfilesystem.c">
<Filter>filesystem\windows</Filter>
<ClCompile Include="..\..\src\filesystem\gdk\SDL_sysfilesystem.cpp">
<Filter>filesystem\gdk</Filter>
</ClCompile>
<ClCompile Include="..\..\src\haptic\SDL_haptic.c">
<Filter>haptic</Filter>
@@ -943,6 +943,9 @@
<ClCompile Include="..\..\src\joystick\SDL_joystick.c">
<Filter>joystick</Filter>
</ClCompile>
<ClCompile Include="..\..\src\joystick\SDL_steam_virtual_gamepad.c">
<Filter>joystick</Filter>
</ClCompile>
<ClCompile Include="..\..\src\libm\e_atan2.c">
<Filter>libm</Filter>
</ClCompile>
@@ -1081,6 +1084,9 @@
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_steam.c">
<Filter>joystick\hidapi</Filter>
</ClCompile>
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_steamdeck.c">
<Filter>joystick\hidapi</Filter>
</ClCompile>
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_switch.c">
<Filter>joystick\hidapi</Filter>
</ClCompile>

View File

@@ -4,3 +4,4 @@ find . -type f \( -name '*.bmp' -o -name '*.wav' -o -name '*.dat' \) -print -del
find . -depth -type d \( -name Gaming.Desktop.x64 \) -exec rm -rv {} \;
find . -depth -type d \( -name Gaming.Xbox.Scarlett.x64 \) -exec rm -rv {} \;
find . -depth -type d \( -name Gaming.Xbox.XboxOne.x64 \) -exec rm -rv {} \;
rm shaders/*.h

View File

@@ -0,0 +1,19 @@
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define ColorRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
"DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
"DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
"DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0)"
[RootSignature(ColorRS)]
float4 main(PixelShaderInput input) : SV_TARGET0
{
return input.color;
}

View File

@@ -0,0 +1,43 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define NVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(NVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.1644, 0.0000, 1.5960};
const float3 Gcoeff = {1.1644, -0.3918, -0.8130};
const float3 Bcoeff = {1.1644, 2.0172, 0.0000};
float4 Output;
float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;
yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;
return Output * input.color;
}

View File

@@ -0,0 +1,43 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define NVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(NVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.1644, 0.0000, 1.7927};
const float3 Gcoeff = {1.1644, -0.2132, -0.5329};
const float3 Bcoeff = {1.1644, 2.1124, 0.0000};
float4 Output;
float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;
yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;
return Output * input.color;
}

View File

@@ -0,0 +1,43 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define NVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(NVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {0.0, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.0000, 0.0000, 1.4020};
const float3 Gcoeff = {1.0000, -0.3441, -0.7141};
const float3 Bcoeff = {1.0000, 1.7720, 0.0000};
float4 Output;
float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;
yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;
return Output * input.color;
}

View File

@@ -0,0 +1,43 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define NVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(NVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.1644, 0.0000, 1.5960};
const float3 Gcoeff = {1.1644, -0.3918, -0.8130};
const float3 Bcoeff = {1.1644, 2.0172, 0.0000};
float4 Output;
float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr;
yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;
return Output * input.color;
}

View File

@@ -0,0 +1,43 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define NVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(NVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.1644, 0.0000, 1.7927};
const float3 Gcoeff = {1.1644, -0.2132, -0.5329};
const float3 Bcoeff = {1.1644, 2.1124, 0.0000};
float4 Output;
float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr;
yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;
return Output * input.color;
}

View File

@@ -0,0 +1,43 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define NVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(NVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {0.0, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.0000, 0.0000, 1.4020};
const float3 Gcoeff = {1.0000, -0.3441, -0.7141};
const float3 Bcoeff = {1.0000, 1.7720, 0.0000};
float4 Output;
float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr;
yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;
return Output * input.color;
}

View File

@@ -0,0 +1,24 @@
Texture2D theTexture : register(t0);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define TextureRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(TextureRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
return theTexture.Sample(theSampler, input.tex) * input.color;
}

View File

@@ -0,0 +1,46 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureU : register(t1);
Texture2D theTextureV : register(t2);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define YUVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t2), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(YUVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.1644, 0.0000, 1.5960};
const float3 Gcoeff = {1.1644, -0.3918, -0.8130};
const float3 Bcoeff = {1.1644, 2.0172, 0.0000};
float4 Output;
float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.y = theTextureU.Sample(theSampler, input.tex).r;
yuv.z = theTextureV.Sample(theSampler, input.tex).r;
yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;
return Output * input.color;
}

View File

@@ -0,0 +1,46 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureU : register(t1);
Texture2D theTextureV : register(t2);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define YUVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t2), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(YUVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.1644, 0.0000, 1.7927};
const float3 Gcoeff = {1.1644, -0.2132, -0.5329};
const float3 Bcoeff = {1.1644, 2.1124, 0.0000};
float4 Output;
float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.y = theTextureU.Sample(theSampler, input.tex).r;
yuv.z = theTextureV.Sample(theSampler, input.tex).r;
yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;
return Output * input.color;
}

View File

@@ -0,0 +1,46 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureU : register(t1);
Texture2D theTextureV : register(t2);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define YUVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t2), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(YUVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {0.0, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.0000, 0.0000, 1.4020};
const float3 Gcoeff = {1.0000, -0.3441, -0.7141};
const float3 Bcoeff = {1.0000, 1.7720, 0.0000};
float4 Output;
float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.y = theTextureU.Sample(theSampler, input.tex).r;
yuv.z = theTextureV.Sample(theSampler, input.tex).r;
yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;
return Output * input.color;
}

View File

@@ -0,0 +1,95 @@
#pragma pack_matrix( row_major )
struct VertexShaderConstants
{
matrix model;
matrix projectionAndView;
};
ConstantBuffer<VertexShaderConstants> Constants : register(b0);
struct VertexShaderInput
{
float3 pos : POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
struct VertexShaderOutput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define ColorRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
"DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
"DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
"DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0)"
#define TextureRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
#define YUVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t2), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
#define NVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(ColorRS)]
VertexShaderOutput mainColor(VertexShaderInput input)
{
VertexShaderOutput output;
float4 pos = float4(input.pos, 1.0f);
// Transform the vertex position into projected space.
pos = mul(pos, Constants.model);
pos = mul(pos, Constants.projectionAndView);
output.pos = pos;
// Pass through texture coordinates and color values without transformation
output.tex = input.tex;
output.color = input.color;
return output;
}
[RootSignature(TextureRS)]
VertexShaderOutput mainTexture(VertexShaderInput input)
{
return mainColor(input);
}
[RootSignature(YUVRS)]
VertexShaderOutput mainYUV(VertexShaderInput input)
{
return mainColor(input);
}
[RootSignature(NVRS)]
VertexShaderOutput mainNV(VertexShaderInput input)
{
return mainColor(input);
}

View File

@@ -0,0 +1,35 @@
if %2.==one. goto setxboxone
rem Xbox Series compile
set XBOXDXC="%GameDKLatest%\GXDK\bin\Scarlett\DXC.exe"
set SUFFIX=_Series.h
goto startbuild
:setxboxone
set XBOXDXC="%GameDKLatest%\GXDK\bin\XboxOne\DXC.exe"
set SUFFIX=_One.h
:startbuild
echo Building with %XBOXDXC%
cd "%1\shaders"
rem Root Signatures
%XBOXDXC% -E ColorRS -T rootsig_1_1 -rootsig-define ColorRS -Fh D3D12_RootSig_Color%SUFFIX% -Vn D3D12_RootSig_Color D3D12_VertexShader.hlsl
%XBOXDXC% -E TextureRS -T rootsig_1_1 -rootsig-define TextureRS -Fh D3D12_RootSig_Texture%SUFFIX% -Vn D3D12_RootSig_Texture D3D12_VertexShader.hlsl
%XBOXDXC% -E YUVRS -T rootsig_1_1 -rootsig-define YUVRS -Fh D3D12_RootSig_YUV%SUFFIX% -Vn D3D12_RootSig_YUV D3D12_VertexShader.hlsl
%XBOXDXC% -E NVRS -T rootsig_1_1 -rootsig-define NVRS -Fh D3D12_RootSig_NV%SUFFIX% -Vn D3D12_RootSig_NV D3D12_VertexShader.hlsl
rem Vertex Shaders
%XBOXDXC% -E mainColor -T vs_6_0 -Fh D3D12_VertexShader_Color%SUFFIX% -Vn D3D12_VertexShader_Color D3D12_VertexShader.hlsl
%XBOXDXC% -E mainTexture -T vs_6_0 -Fh D3D12_VertexShader_Texture%SUFFIX% -Vn D3D12_VertexShader_Texture D3D12_VertexShader.hlsl
%XBOXDXC% -E mainNV -T vs_6_0 -Fh D3D12_VertexShader_NV%SUFFIX% -Vn D3D12_VertexShader_NV D3D12_VertexShader.hlsl
%XBOXDXC% -E mainYUV -T vs_6_0 -Fh D3D12_VertexShader_YUV%SUFFIX% -Vn D3D12_VertexShader_YUV D3D12_VertexShader.hlsl
rem Pixel Shaders
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_Colors%SUFFIX% -Vn D3D12_PixelShader_Colors D3D12_PixelShader_Colors.hlsl
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_NV12_BT601%SUFFIX% -Vn D3D12_PixelShader_NV12_BT601 D3D12_PixelShader_NV12_BT601.hlsl
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_NV12_BT709%SUFFIX% -Vn D3D12_PixelShader_NV12_BT709 D3D12_PixelShader_NV12_BT709.hlsl
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_NV12_JPEG%SUFFIX% -Vn D3D12_PixelShader_NV12_JPEG D3D12_PixelShader_NV12_JPEG.hlsl
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_NV21_BT601%SUFFIX% -Vn D3D12_PixelShader_NV21_BT601 D3D12_PixelShader_NV21_BT601.hlsl
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_NV21_BT709%SUFFIX% -Vn D3D12_PixelShader_NV21_BT709 D3D12_PixelShader_NV21_BT709.hlsl
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_NV21_JPEG%SUFFIX% -Vn D3D12_PixelShader_NV21_JPEG D3D12_PixelShader_NV21_JPEG.hlsl
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_Textures%SUFFIX% -Vn D3D12_PixelShader_Textures D3D12_PixelShader_Textures.hlsl
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_YUV_BT601%SUFFIX% -Vn D3D12_PixelShader_YUV_BT601 D3D12_PixelShader_YUV_BT601.hlsl
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_YUV_BT709%SUFFIX% -Vn D3D12_PixelShader_YUV_BT709 D3D12_PixelShader_YUV_BT709.hlsl
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_YUV_JPEG%SUFFIX% -Vn D3D12_PixelShader_YUV_JPEG D3D12_PixelShader_YUV_JPEG.hlsl

View File

@@ -139,7 +139,7 @@
</ResourceCompile>
<Link>
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>xgameruntime.lib;../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>xgameruntime.lib;../Microsoft.Xbox.Services.GDK.C.Thunks.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">
@@ -211,7 +211,7 @@
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>xgameruntime.lib;../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>xgameruntime.lib;../Microsoft.Xbox.Services.GDK.C.Thunks.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">
@@ -409,7 +409,7 @@
<CopyFileToFolders Include="..\..\logos\Logo480x480.png" />
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll">
<CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.GDK.C.Thunks.dll">
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>

View File

@@ -21,7 +21,7 @@
<CopyFileToFolders Include="..\..\logos\Logo480x480.png">
<Filter>logos</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll">
<CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.GDK.C.Thunks.dll">
<Filter>wingdk</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="wingdk\MicrosoftGame.config">

View File

@@ -1,5 +1,5 @@
/*
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -239,17 +239,17 @@ LoadSprite(const char *file)
/* This does the SDL_LoadBMP step repeatedly, but that's OK for test code. */
sprites[i] = LoadTexture(state->renderers[i], file, SDL_TRUE, &sprite_w, &sprite_h);
if (!sprites[i]) {
return (-1);
return -1;
}
if (SDL_SetTextureBlendMode(sprites[i], blendMode) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError());
SDL_DestroyTexture(sprites[i]);
return (-1);
return -1;
}
}
/* We're ready to roll. :) */
return (0);
return 0;
}
void
@@ -364,8 +364,9 @@ loop()
#endif
}
for (i = 0; i < state->num_windows; ++i) {
if (state->windows[i] == NULL)
if (state->windows[i] == NULL) {
continue;
}
DrawSprites(state->renderers[i], sprites[i]);
}
}
@@ -460,7 +461,7 @@ main(int argc, char *argv[])
soundname = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav");
if (soundname == NULL) {
if (!soundname) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError());
quit(1);
}

View File

@@ -139,7 +139,7 @@
</ResourceCompile>
<Link>
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>xgameruntime.lib;../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>xgameruntime.lib;../Microsoft.Xbox.Services.GDK.C.Thunks.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>
@@ -223,7 +223,7 @@
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>xgameruntime.lib;../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>xgameruntime.lib;../Microsoft.Xbox.Services.GDK.C.Thunks.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>
@@ -352,7 +352,7 @@ copy "%(FullPath)" "$(OutDir)\"</Command>
</CopyFileToFolders>
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll">
<CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.GDK.C.Thunks.dll">
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>

View File

@@ -18,7 +18,7 @@
<CopyFileToFolders Include="..\..\logos\Logo480x480.png">
<Filter>logos</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll">
<CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.GDK.C.Thunks.dll">
<Filter>wingdk</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="wingdk\MicrosoftGame.config">

View File

@@ -139,7 +139,7 @@
</ResourceCompile>
<Link>
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>xgameruntime.lib;../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>xgameruntime.lib;../Microsoft.Xbox.Services.GDK.C.Thunks.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>
@@ -223,7 +223,7 @@
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>xgameruntime.lib;../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>xgameruntime.lib;../Microsoft.Xbox.Services.GDK.C.Thunks.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>
@@ -352,7 +352,7 @@ copy "%(FullPath)" "$(OutDir)\"</Command>
</CopyFileToFolders>
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll">
<CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.GDK.C.Thunks.dll">
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>

View File

@@ -18,7 +18,7 @@
<CopyFileToFolders Include="..\..\logos\Logo480x480.png">
<Filter>logos</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll">
<CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.GDK.C.Thunks.dll">
<Filter>wingdk</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="xboxseries\MicrosoftGame.config">

View File

@@ -125,6 +125,7 @@
<ClInclude Include="..\src\joystick\controller_type.h" />
<ClInclude Include="..\src\joystick\SDL_gamecontrollerdb.h" />
<ClInclude Include="..\src\joystick\SDL_joystick_c.h" />
<ClInclude Include="..\src\joystick\SDL_steam_virtual_gamepad.h" />
<ClInclude Include="..\src\joystick\SDL_sysjoystick.h" />
<ClInclude Include="..\src\joystick\virtual\SDL_virtualjoystick_c.h" />
<ClInclude Include="..\src\joystick\windows\SDL_dinputjoystick_c.h" />
@@ -184,6 +185,14 @@
<ClInclude Include="..\src\video\winrt\SDL_winrtopengles.h" />
<ClInclude Include="..\src\video\winrt\SDL_winrtvideo_cpp.h" />
<ClInclude Include="..\src\video\yuv2rgb\yuv_rgb.h" />
<ClInclude Include="..\src\video\yuv2rgb\yuv_rgb_common.h" />
<ClInclude Include="..\src\video\yuv2rgb\yuv_rgb_internal.h" />
<ClInclude Include="..\src\video\yuv2rgb\yuv_rgb_lsx.h" />
<ClInclude Include="..\src\video\yuv2rgb\yuv_rgb_lsx_func.h" />
<ClInclude Include="..\src\video\yuv2rgb\yuv_rgb_sse.h" />
<ClInclude Include="..\src\video\yuv2rgb\yuv_rgb_sse_func.h" />
<ClInclude Include="..\src\video\yuv2rgb\yuv_rgb_std.h" />
<ClInclude Include="..\src\video\yuv2rgb\yuv_rgb_std_func.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\atomic\SDL_atomic.c" />
@@ -237,6 +246,7 @@
<ClCompile Include="..\src\joystick\controller_type.c" />
<ClCompile Include="..\src\joystick\SDL_gamecontroller.c" />
<ClCompile Include="..\src\joystick\SDL_joystick.c" />
<ClCompile Include="..\src\joystick\SDL_steam_virtual_gamepad.c" />
<ClCompile Include="..\src\joystick\virtual\SDL_virtualjoystick.c" />
<ClCompile Include="..\src\joystick\windows\SDL_dinputjoystick.c" />
<ClCompile Include="..\src\joystick\windows\SDL_windowsjoystick.c" />
@@ -344,7 +354,9 @@
<ClCompile Include="..\src\video\winrt\SDL_winrtvideo.cpp">
<CompileAsWinRT>true</CompileAsWinRT>
</ClCompile>
<ClCompile Include="..\src\video\yuv2rgb\yuv_rgb.c" />
<ClCompile Include="..\src\video\yuv2rgb\yuv_rgb_lsx.c" />
<ClCompile Include="..\src\video\yuv2rgb\yuv_rgb_sse.c" />
<ClCompile Include="..\src\video\yuv2rgb\yuv_rgb_std.c" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{89e9b32e-a86a-47c3-a948-d2b1622925ce}</ProjectGuid>

View File

@@ -255,6 +255,9 @@
<ClInclude Include="..\src\joystick\SDL_joystick_c.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\src\joystick\SDL_steam_virtual_gamepad.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\src\joystick\SDL_sysjoystick.h">
<Filter>Source Files</Filter>
</ClInclude>
@@ -558,6 +561,9 @@
<ClCompile Include="..\src\joystick\SDL_joystick.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\joystick\SDL_steam_virtual_gamepad.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\joystick\virtual\SDL_virtualjoystick.c">
<Filter>Source Files</Filter>
</ClCompile>
@@ -846,4 +852,4 @@
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
</Project>

View File

@@ -44,22 +44,6 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
@@ -137,6 +121,7 @@
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<OmitDefaultLibName>true</OmitDefaultLibName>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -335,6 +320,7 @@
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.h" />
<ClInclude Include="..\..\src\joystick\SDL_gamecontrollerdb.h" />
<ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
<ClInclude Include="..\..\src\joystick\SDL_steam_virtual_gamepad.h" />
<ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
<ClInclude Include="..\..\src\joystick\usb_ids.h" />
<ClInclude Include="..\..\src\joystick\virtual\SDL_virtualjoystick_c.h" />
@@ -392,7 +378,6 @@
<ClInclude Include="..\..\src\video\khronos\vulkan\vk_platform.h" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vk_sdk_platform.h" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan.h" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan.hpp" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan_android.h" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan_beta.h" />
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan_core.h" />
@@ -437,7 +422,13 @@
<ClInclude Include="..\..\src\video\windows\SDL_windowswindow.h" />
<ClInclude Include="..\..\src\video\windows\wmmsg.h" />
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h" />
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_common.h" />
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_internal.h" />
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_lsx.h" />
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_lsx_func.h" />
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_sse.h" />
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_sse_func.h" />
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_std.h" />
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_std_func.h" />
</ItemGroup>
<ItemGroup>
@@ -492,6 +483,7 @@
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_shield.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_stadia.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_steam.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_steamdeck.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_switch.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_wii.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xbox360.c" />
@@ -499,6 +491,7 @@
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xboxone.c" />
<ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c" />
<ClCompile Include="..\..\src\joystick\SDL_joystick.c" />
<ClCompile Include="..\..\src\joystick\SDL_steam_virtual_gamepad.c" />
<ClCompile Include="..\..\src\joystick\virtual\SDL_virtualjoystick.c" />
<ClCompile Include="..\..\src\joystick\windows\SDL_dinputjoystick.c" />
<ClCompile Include="..\..\src\joystick\windows\SDL_rawinputjoystick.c" />
@@ -620,7 +613,9 @@
<ClCompile Include="..\..\src\video\windows\SDL_windowsvideo.c" />
<ClCompile Include="..\..\src\video\windows\SDL_windowsvulkan.c" />
<ClCompile Include="..\..\src\video\windows\SDL_windowswindow.c" />
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c" />
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb_lsx.c" />
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb_sse.c" />
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb_std.c" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\src\main\windows\version.rc" />

View File

@@ -501,6 +501,9 @@
<ClInclude Include="..\..\src\joystick\SDL_joystick_c.h">
<Filter>joystick</Filter>
</ClInclude>
<ClInclude Include="..\..\src\joystick\SDL_steam_virtual_gamepad.h">
<Filter>joystick</Filter>
</ClInclude>
<ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h">
<Filter>joystick</Filter>
</ClInclude>
@@ -777,9 +780,6 @@
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan.h">
<Filter>video\khronos\vulkan</Filter>
</ClInclude>
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan.hpp">
<Filter>video\khronos\vulkan</Filter>
</ClInclude>
<ClInclude Include="..\..\src\video\khronos\vulkan\vulkan_android.h">
<Filter>video\khronos\vulkan</Filter>
</ClInclude>
@@ -934,6 +934,9 @@
<ClCompile Include="..\..\src\joystick\SDL_joystick.c">
<Filter>joystick</Filter>
</ClCompile>
<ClCompile Include="..\..\src\joystick\SDL_steam_virtual_gamepad.c">
<Filter>joystick</Filter>
</ClCompile>
<ClCompile Include="..\..\src\libm\e_atan2.c">
<Filter>libm</Filter>
</ClCompile>
@@ -1072,6 +1075,9 @@
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_steam.c">
<Filter>joystick\hidapi</Filter>
</ClCompile>
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_steamdeck.c">
<Filter>joystick\hidapi</Filter>
</ClCompile>
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_switch.c">
<Filter>joystick\hidapi</Filter>
</ClCompile>

View File

@@ -1,7 +1,7 @@
# SDL2 CMake configuration file:
# This file is meant to be placed in a cmake subfolder of SDL2-devel-2.x.y-VC
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.0...3.28)
include(FeatureSummary)
set_package_properties(SDL2 PROPERTIES
@@ -68,6 +68,8 @@ if(EXISTS "${_sdl2_library}" AND EXISTS "${_sdl2_dll_library}")
IMPORTED_LOCATION "${_sdl2_dll_library}"
COMPATIBLE_INTERFACE_BOOL "SDL2_SHARED"
INTERFACE_SDL2_SHARED "ON"
COMPATIBLE_INTERFACE_STRING "SDL_VERSION"
INTERFACE_SDL_VERSION "SDL2"
)
endif()
set(SDL2_SDL2_FOUND TRUE)
@@ -77,6 +79,8 @@ endif()
unset(_sdl2_library)
unset(_sdl2_dll_library)
set(SDL2_SDL2-static_FOUND FALSE)
set(_sdl2main_library "${SDL2_LIBDIR}/SDL2main.lib")
if(EXISTS "${_sdl2main_library}")
if(NOT TARGET SDL2::SDL2main)
@@ -84,11 +88,13 @@ if(EXISTS "${_sdl2main_library}")
set_target_properties(SDL2::SDL2main
PROPERTIES
IMPORTED_LOCATION "${_sdl2main_library}"
COMPATIBLE_INTERFACE_STRING "SDL_VERSION"
INTERFACE_SDL_VERSION "SDL2"
)
endif()
set(SDL2_SDL2main_FOUND TRUE)
else()
set(SDL2_SDL2_FOUND FALSE)
set(SDL2_SDL2main_FOUND FALSE)
endif()
unset(_sdl2main_library)
@@ -100,11 +106,13 @@ if(EXISTS "${_sdl2test_library}")
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}"
IMPORTED_LOCATION "${_sdl2test_library}"
COMPATIBLE_INTERFACE_STRING "SDL_VERSION"
INTERFACE_SDL_VERSION "SDL2"
)
endif()
set(SDL2_SDL2test_FOUND TRUE)
else()
set(SDL2_SDL2_FOUND FALSE)
set(SDL2_SDL2test_FOUND FALSE)
endif()
unset(_sdl2test_library)

View File

@@ -188,6 +188,12 @@
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\..\SDLtest\SDLtest.vcxproj">
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
<Private>false</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\..\SDLmain\SDLmain.vcxproj">
<Project>{da956fd3-e142-46f2-9dd5-c78bebb56b7a}</Project>
<Private>false</Private>

View File

@@ -210,6 +210,7 @@
<ClCompile Include="..\..\..\test\testautomation_hints.c" />
<ClCompile Include="..\..\..\test\testautomation_joystick.c" />
<ClCompile Include="..\..\..\test\testautomation_keyboard.c" />
<ClCompile Include="..\..\..\test\testautomation_log.c" />
<ClCompile Include="..\..\..\test\testautomation_main.c" />
<ClCompile Include="..\..\..\test\testautomation_math.c" />
<ClCompile Include="..\..\..\test\testautomation_mouse.c" />
@@ -224,6 +225,7 @@
<ClCompile Include="..\..\..\test\testautomation_syswm.c" />
<ClCompile Include="..\..\..\test\testautomation_timer.c" />
<ClCompile Include="..\..\..\test\testautomation_video.c" />
<ClCompile Include="..\..\..\test\testautomation_subsystems.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\test\testautomation_suites.h" />
@@ -231,4 +233,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@@ -216,6 +216,12 @@
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\..\SDLtest\SDLtest.vcxproj">
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
<Private>false</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\..\SDLmain\SDLmain.vcxproj">
<Project>{da956fd3-e142-46f2-9dd5-c78bebb56b7a}</Project>
<Private>false</Private>

View File

@@ -188,6 +188,12 @@
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\..\SDLtest\SDLtest.vcxproj">
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
<Private>false</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\..\SDLmain\SDLmain.vcxproj">
<Project>{da956fd3-e142-46f2-9dd5-c78bebb56b7a}</Project>
<Private>false</Private>

View File

@@ -194,6 +194,12 @@
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\..\SDLtest\SDLtest.vcxproj">
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
<Private>false</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\..\SDLmain\SDLmain.vcxproj">
<Project>{da956fd3-e142-46f2-9dd5-c78bebb56b7a}</Project>
<Private>false</Private>

View File

@@ -1,6 +1,42 @@
This is a list of major changes in SDL's version history.
---------------------------------------------------------------------------
2.30.0:
---------------------------------------------------------------------------
General:
* Added support for 2 bits-per-pixel indexed surface formats
* Added the function SDL_GameControllerGetSteamHandle() to get the Steam API handle for a controller, if available
* Added the event SDL_CONTROLLERSTEAMHANDLEUPDATED which is sent when the Steam API handle for a controller changes. This could also change the name, VID, and PID of the controller.
* Added the environment variable SDL_LOGGING to control default log output
macOS:
* Added the hint SDL_HINT_JOYSTICK_IOKIT to control whether the IOKit controller driver should be used
* Added the hint SDL_HINT_JOYSTICK_MFI to control whether the GCController controller driver should be used
* Added the hint SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE to choose whether high or low power GPU should be used for rendering, in the case where there are multiple GPUs available
Xbox:
* Added the function SDL_GDKGetDefaultUser()
---------------------------------------------------------------------------
2.28.2:
---------------------------------------------------------------------------
General:
* Added the hint SDL_HINT_JOYSTICK_WGI to control whether to use Windows.Gaming.Input for controllers
---------------------------------------------------------------------------
2.28.0:
---------------------------------------------------------------------------
General:
* Added SDL_HasWindowSurface() and SDL_DestroyWindowSurface() to switch between the window surface and rendering APIs
* Added a display event SDL_DISPLAYEVENT_MOVED which is sent when the primary monitor changes or displays change position relative to each other
* Added the hint SDL_HINT_ENABLE_SCREEN_KEYBOARD to control whether the on-screen keyboard should be shown when text input is active
---------------------------------------------------------------------------
2.26.0:
---------------------------------------------------------------------------
@@ -24,7 +60,7 @@ General:
* Added access to the individual left and right gyro sensors of the combined Joy-Cons controller
* Added a microsecond timestamp to SDL_SensorEvent and SDL_ControllerSensorEvent, when the hardware provides that information
* Added SDL_SensorGetDataWithTimestamp() and SDL_GameControllerGetSensorDataWithTimestamp() to retrieve the last sensor data with the associated microsecond timestamp
* Added the hint SDL_HINT_HIDAPI_IGNORE_DEVICES to have the SDL HID API ignore specific devices
* Added the hint SDL_HINT_HIDAPI_IGNORE_DEVICES to have the SDL HID API ignore specific devices
* SDL_GetRevision() now includes more information about the SDL build, including the git commit hash if available
Windows:
@@ -645,7 +681,7 @@ iOS:
tvOS:
* Added support for Apple TV
* Added a hint SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION to control whether he Apple TV remote's joystick axes will automatically match the rotation of the remote.
* Added a hint SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION to control whether he Apple TV remote's joystick axes will automatically match the rotation of the remote.
Android:
* Fixed SDL not resizing window when Android screen resolution changes
@@ -790,8 +826,8 @@ Linux:
* Added experimental Wayland and Mir support, disabled by default
Android:
* Joystick support (minimum SDK version required to build SDL is now 12,
the required runtime version remains at 10, but on such devices joystick
* Joystick support (minimum SDK version required to build SDL is now 12,
the required runtime version remains at 10, but on such devices joystick
support won't be available).
* Hotplugging support for joysticks
* Added a hint SDL_HINT_ACCELEROMETER_AS_JOYSTICK to control whether the accelerometer should be listed as a 3 axis joystick, which it will by default.
@@ -844,7 +880,7 @@ iOS:
Android:
IMPORTANT: You MUST get the updated SDLActivity.java to match C code
* Moved EGL initialization to native code
* Moved EGL initialization to native code
* Fixed the accelerometer axis rotation relative to the device rotation
* Fixed race conditions when handling the EGL context on pause/resume
* Touch devices are available for enumeration immediately after init

View File

@@ -118,7 +118,7 @@ initializeTextures(SDL_Renderer *renderer)
/* load the ship */
bmp_surface = SDL_LoadBMP("ship.bmp");
if (bmp_surface == NULL) {
if (!bmp_surface) {
fatalError("could not ship.bmp");
}
/* set blue to transparent on the ship */
@@ -140,7 +140,7 @@ initializeTextures(SDL_Renderer *renderer)
/* load the space background */
bmp_surface = SDL_LoadBMP("space.bmp");
if (bmp_surface == NULL) {
if (!bmp_surface) {
fatalError("could not load space.bmp");
}
/* create space texture from surface */
@@ -179,7 +179,7 @@ main(int argc, char *argv[])
printf("There are %d joysticks available\n", SDL_NumJoysticks());
printf("Default joystick (index 0) is %s\n", SDL_JoystickName(0));
accelerometer = SDL_JoystickOpen(0);
if (accelerometer == NULL) {
if (!accelerometer) {
fatalError("Could not open joystick (accelerometer)");
}
printf("joystick number of axis = %d\n",

View File

@@ -52,9 +52,9 @@ void spawnTrailFromEmitter(struct particle *emitter);
void spawnEmitterParticle(GLfloat x, GLfloat y);
void explodeEmitter(struct particle *emitter);
void initializeParticles(void);
void initializeTexture();
void initializeTexture(void);
int nextPowerOfTwo(int x);
void drawParticles();
void drawParticles(void);
void stepParticles(double deltaTime);
/* helper function (used in texture loading)
@@ -84,14 +84,16 @@ stepParticles(double deltaTime)
/* is the particle actually active, or is it marked for deletion? */
if (curr->isActive) {
/* is the particle off the screen? */
if (curr->y > screen_h)
if (curr->y > screen_h) {
curr->isActive = 0;
else if (curr->y < 0)
} else if (curr->y < 0) {
curr->isActive = 0;
if (curr->x > screen_w)
}
if (curr->x > screen_w) {
curr->isActive = 0;
else if (curr->x < 0)
} else if (curr->x < 0) {
curr->isActive = 0;
}
/* step velocity, then step position */
curr->yvel += ACCEL * deltaMilliseconds;
@@ -133,15 +135,17 @@ stepParticles(double deltaTime)
}
/* if we're a dust particle, shrink our size */
if (curr->type == dust)
if (curr->type == dust) {
curr->size -= deltaMilliseconds * 0.010f;
}
}
/* if we're still active, pack ourselves in the array next
to the last active guy (pack the array tightly) */
if (curr->isActive)
if (curr->isActive) {
*(slot++) = *curr;
}
} /* endif (curr->isActive) */
curr++;
}
@@ -155,7 +159,7 @@ stepParticles(double deltaTime)
This draws all the particles shown on screen
*/
void
drawParticles()
drawParticles(void)
{
/* draw the background */
@@ -188,8 +192,9 @@ explodeEmitter(struct particle *emitter)
int i;
for (i = 0; i < 200; i++) {
if (num_active_particles >= MAX_PARTICLES)
if (num_active_particles >= MAX_PARTICLES) {
return;
}
/* come up with a random angle and speed for new particle */
float theta = randomFloat(0, 2.0f * 3.141592);
@@ -226,8 +231,9 @@ void
spawnTrailFromEmitter(struct particle *emitter)
{
if (num_active_particles >= MAX_PARTICLES)
if (num_active_particles >= MAX_PARTICLES) {
return;
}
/* select the particle at the slot at the end of our array */
struct particle *p = &particles[num_active_particles];
@@ -262,8 +268,9 @@ void
spawnEmitterParticle(GLfloat x, GLfloat y)
{
if (num_active_particles >= MAX_PARTICLES)
if (num_active_particles >= MAX_PARTICLES) {
return;
}
/* find particle at endpoint of array */
struct particle *p = &particles[num_active_particles];
@@ -317,7 +324,7 @@ initializeParticles(void)
loads the particle texture
*/
void
initializeTexture()
initializeTexture(void)
{
int bpp; /* texture bits per pixel */
@@ -327,7 +334,7 @@ initializeTexture()
to format passed into OpenGL */
bmp_surface = SDL_LoadBMP("stroke.bmp");
if (bmp_surface == NULL) {
if (!bmp_surface) {
fatalError("could not load stroke.bmp");
}

View File

@@ -108,7 +108,7 @@ initializeTexture(SDL_Renderer *renderer)
SDL_Surface *bmp_surface;
/* load the bmp */
bmp_surface = SDL_LoadBMP("icon.bmp");
if (bmp_surface == NULL) {
if (!bmp_surface) {
fatalError("could not load bmp");
}
/* set white to transparent on the happyface */

View File

@@ -196,7 +196,7 @@ loadFont(void)
}
void
draw()
draw(void)
{
SDL_SetRenderDrawColor(renderer, bg_color.r, bg_color.g, bg_color.b, bg_color.a);
SDL_RenderClear(renderer);

View File

@@ -207,9 +207,9 @@ playSound(struct sound *s)
break;
}
/* if this channel's sound is older than the oldest so far, set it to oldest */
if (mixer.channels[i].timestamp <
mixer.channels[oldest_channel].timestamp)
if (mixer.channels[i].timestamp < mixer.channels[oldest_channel].timestamp) {
oldest_channel = i;
}
}
/* no empty channels, take the oldest one */

View File

@@ -57,7 +57,7 @@ initializeTexture(SDL_Renderer *renderer)
{
SDL_Surface *bmp_surface;
bmp_surface = SDL_LoadBMP("stroke.bmp");
if (bmp_surface == NULL) {
if (!bmp_surface) {
fatalError("could not load stroke.bmp");
}
brush =

View File

@@ -19,10 +19,10 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.26.0</string>
<string>2.32.0</string>
<key>CFBundleSignature</key>
<string>SDLX</string>
<key>CFBundleVersion</key>
<string>2.26.0</string>
<string>2.32.0</string>
</dict>
</plist>

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
Title SDL 2.0.0
Title SDL 2.32.0
Version 1
Description SDL Library for Mac OS X (http://www.libsdl.org)
DefaultLocation /Library/Frameworks

View File

@@ -31,8 +31,15 @@ endmacro()
set(SDL2_FOUND TRUE)
string(REGEX REPLACE "SDL2\\.framework.*" "SDL2.framework" SDL2_FRAMEWORK_PATH "${CMAKE_CURRENT_LIST_DIR}")
string(REGEX REPLACE "SDL2\\.framework.*" "" SDL2_FRAMEWORK_PARENT_PATH "${CMAKE_CURRENT_LIST_DIR}")
# Compute the installation prefix relative to this file.
set(SDL2_FRAMEWORK_PATH "${CMAKE_CURRENT_LIST_DIR}") # > /SDL2.framework/Resources/CMake/
get_filename_component(SDL2_FRAMEWORK_PATH "${SDL2_FRAMEWORK_PATH}" REALPATH) # > /SDL2.framework/Versions/Current/Resources/CMake
get_filename_component(SDL2_FRAMEWORK_PATH "${SDL2_FRAMEWORK_PATH}" REALPATH) # > /SDL2.framework/Versions/A/Resources/CMake/
get_filename_component(SDL2_FRAMEWORK_PATH "${SDL2_FRAMEWORK_PATH}" PATH) # > /SDL2.framework/Versions/A/Resources/
get_filename_component(SDL2_FRAMEWORK_PATH "${SDL2_FRAMEWORK_PATH}" PATH) # > /SDL2.framework/Versions/A/
get_filename_component(SDL2_FRAMEWORK_PATH "${SDL2_FRAMEWORK_PATH}" PATH) # > /SDL2.framework/Versions/
get_filename_component(SDL2_FRAMEWORK_PATH "${SDL2_FRAMEWORK_PATH}" PATH) # > /SDL2.framework/
get_filename_component(SDL2_FRAMEWORK_PARENT_PATH "${SDL2_FRAMEWORK_PATH}" PATH) # > /
# For compatibility with autotools sdl2-config.cmake, provide SDL2_* variables.
@@ -49,14 +56,16 @@ set(SDL2_LIBRARIES "SDL2::SDL2")
# This is done for compatibility with CMake generated SDL2-target.cmake files.
if(NOT TARGET SDL2::SDL2)
add_library(SDL2::SDL2 INTERFACE IMPORTED)
add_library(SDL2::SDL2 SHARED IMPORTED)
set_target_properties(SDL2::SDL2
PROPERTIES
INTERFACE_COMPILE_OPTIONS "SHELL:-F \"${SDL2_FRAMEWORK_PARENT_PATH}\""
FRAMEWORK "TRUE"
IMPORTED_LOCATION "${SDL2_FRAMEWORK_PATH}/Versions/A/SDL2"
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}"
INTERFACE_LINK_OPTIONS "SHELL:-F \"${SDL2_FRAMEWORK_PARENT_PATH}\";SHELL:-framework SDL2"
COMPATIBLE_INTERFACE_BOOL "SDL2_SHARED"
INTERFACE_SDL2_SHARED "ON"
COMPATIBLE_INTERFACE_STRING "SDL_VERSION"
INTERFACE_SDL_VERSION "SDL2"
)
endif()
set(SDL2_SDL2_FOUND TRUE)

View File

@@ -1,6 +1,6 @@
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

File diff suppressed because it is too large Load Diff

163
acinclude/libtool.m4 vendored
View File

@@ -219,8 +219,8 @@ esac
ofile=libtool
can_build_shared=yes
# All known linkers require a '.a' archive for static linking (except MSVC,
# which needs '.lib').
# All known linkers require a '.a' archive for static linking (except MSVC and
# ICC, which need '.lib').
libext=a
with_gnu_ld=$lt_cv_prog_gnu_ld
@@ -1023,6 +1023,21 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
rm -f conftest.*
fi])
# Feature test to disable chained fixups since it is not
# compatible with '-undefined dynamic_lookup'
AC_CACHE_CHECK([for -no_fixup_chains linker flag],
[lt_cv_support_no_fixup_chains],
[ save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-no_fixup_chains"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([],[])],
lt_cv_support_no_fixup_chains=yes,
lt_cv_support_no_fixup_chains=no
)
LDFLAGS=$save_LDFLAGS
]
)
AC_CACHE_CHECK([for -exported_symbols_list linker flag],
[lt_cv_ld_exported_symbols_list],
[lt_cv_ld_exported_symbols_list=no
@@ -1047,7 +1062,7 @@ _LT_EOF
echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
$RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
cat > conftest.c << _LT_EOF
int main() { return 0;}
int main(void) { return 0;}
_LT_EOF
echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
@@ -1072,7 +1087,12 @@ _LT_EOF
10.[[012]],*|,*powerpc*-darwin[[5-8]]*)
_lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
*)
_lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
if test yes = "$lt_cv_support_no_fixup_chains"; then
_lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup $wl-no_fixup_chains'
else
_lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup'
fi
;;
esac
;;
esac
@@ -1365,7 +1385,7 @@ mips64*-*linux*)
;;
x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
s390*-*linux*|s390*-*tpf*|sparc*-*linux*|x86_64-gnu*)
# Find out what ABI is being produced by ac_compile, and set linker
# options accordingly. Note that the listed cases only cover the
# situations where additional linker options are needed (such as when
@@ -1380,7 +1400,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
x86_64-*linux*)
x86_64-*linux*|x86_64-gnu*)
case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
@@ -1409,7 +1429,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
x86_64-*linux*)
x86_64-*linux*|x86_64-gnu*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*linux*|powerpc64le-*linux*)
@@ -1540,15 +1560,8 @@ old_postinstall_cmds='chmod 644 $oldlib'
old_postuninstall_cmds=
if test -n "$RANLIB"; then
case $host_os in
bitrig* | openbsd*)
old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
;;
*)
old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
;;
esac
old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
fi
case $host_os in
@@ -1687,7 +1700,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
lt_cv_sys_max_cmd_len=-1;
;;
cygwin* | mingw* | cegcc*)
cygwin* | mingw* | windows* | cegcc*)
# On Win9x/ME, this test blows up -- it succeeds, but takes
# about 5 minutes as the teststring grows exponentially.
# Worse, since 9x/ME are not pre-emptively multitasking,
@@ -1869,11 +1882,11 @@ else
/* When -fvisibility=hidden is used, assume the code has been annotated
correspondingly for the symbols needed. */
#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
int fnord () __attribute__((visibility("default")));
int fnord (void) __attribute__((visibility("default")));
#endif
int fnord () { return 42; }
int main ()
int fnord (void) { return 42; }
int main (void)
{
void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
int status = $lt_dlunknown;
@@ -1930,7 +1943,7 @@ else
lt_cv_dlopen_self=yes
;;
mingw* | pw32* | cegcc*)
mingw* | windows* | pw32* | cegcc*)
lt_cv_dlopen=LoadLibrary
lt_cv_dlopen_libs=
;;
@@ -2298,7 +2311,7 @@ if test yes = "$GCC"; then
*) lt_awk_arg='/^libraries:/' ;;
esac
case $host_os in
mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;;
mingw* | windows* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;;
*) lt_sed_strip_eq='s|=/|/|g' ;;
esac
lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
@@ -2356,7 +2369,7 @@ BEGIN {RS = " "; FS = "/|\n";} {
# AWK program above erroneously prepends '/' to C:/dos/paths
# for these hosts.
case $host_os in
mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
mingw* | windows* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
$SED 's|/\([[A-Za-z]]:\)|\1|g'` ;;
esac
sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
@@ -2525,7 +2538,7 @@ bsdi[[45]]*)
# libtool to hard-code these into programs
;;
cygwin* | mingw* | pw32* | cegcc*)
cygwin* | mingw* | windows* | pw32* | cegcc*)
version_type=windows
shrext_cmds=.dll
need_version=no
@@ -2554,14 +2567,14 @@ cygwin* | mingw* | pw32* | cegcc*)
cygwin*)
# Cygwin DLLs use 'cyg' prefix rather than 'lib'
#soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
soname_spec='`echo $libname | sed -e 's/^lib//'`$shared_ext' # SDL customization
soname_spec='`echo $libname | sed -e 's/^lib//'`$shared_ext' # SDL customization.
m4_if([$1], [],[
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
;;
mingw* | cegcc*)
mingw* | windows* | cegcc*)
# MinGW DLLs use traditional 'lib' prefix
#soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
soname_spec='`echo $libname | $SED -e 's/^lib//'`$shared_ext' # SDL customization
soname_spec='`echo $libname | $SED -e 's/^lib//'`$shared_ext' # SDL customization.
;;
pw32*)
# pw32 DLLs use 'pw' prefix rather than 'lib'
@@ -2571,14 +2584,14 @@ m4_if([$1], [],[
dynamic_linker='Win32 ld.exe'
;;
*,cl*)
# Native MSVC
*,cl* | *,icl*)
# Native MSVC or ICC
libname_spec='$name'
soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
library_names_spec='$libname.dll.lib'
case $build_os in
mingw*)
mingw* | windows*)
sys_lib_search_path_spec=
lt_save_ifs=$IFS
IFS=';'
@@ -2628,7 +2641,7 @@ m4_if([$1], [],[
;;
*)
# Assume MSVC wrapper
# Assume MSVC and ICC wrapper
library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib'
dynamic_linker='Win32 ld.exe'
;;
@@ -3267,7 +3280,7 @@ if test yes = "$GCC"; then
# Check if gcc -print-prog-name=ld gives a path.
AC_MSG_CHECKING([for ld used by $CC])
case $host in
*-*-mingw*)
*-*-mingw* | *-*-windows*)
# gcc leaves a trailing carriage return, which upsets mingw
ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
*)
@@ -3376,7 +3389,7 @@ case $reload_flag in
esac
reload_cmds='$LD$reload_flag -o $output$reload_objs'
case $host_os in
cygwin* | mingw* | pw32* | cegcc*)
cygwin* | mingw* | windows* | pw32* | cegcc*)
if test yes != "$GCC"; then
reload_cmds=false
fi
@@ -3473,10 +3486,10 @@ cygwin*)
# func_win32_libid is a shell function defined in ltmain.sh
lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
lt_cv_file_magic_cmd='func_win32_libid'
lt_cv_deplibs_check_method=pass_all # SDL customization
lt_cv_deplibs_check_method=pass_all # SDL customization.
;;
mingw* | pw32*)
mingw* | windows* | pw32*)
# Base MSYS/MinGW do not provide the 'file' command needed by
# func_win32_libid shell function, so use a weaker test based on 'objdump',
# unless we find 'file', for example because we are cross-compiling.
@@ -3485,10 +3498,10 @@ mingw* | pw32*)
lt_cv_file_magic_cmd='func_win32_libid'
else
# Keep this pattern in sync with the one in func_win32_libid.
lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64|pe-aarch64)'
lt_cv_file_magic_cmd='$OBJDUMP -f'
fi
lt_cv_deplibs_check_method=pass_all # SDL customization
lt_cv_deplibs_check_method=pass_all # SDL customization.
;;
cegcc*)
@@ -3641,7 +3654,7 @@ file_magic_glob=
want_nocaseglob=no
if test "$build" = "$host"; then
case $host_os in
mingw* | pw32*)
mingw* | windows* | pw32*)
if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
want_nocaseglob=yes
else
@@ -3693,7 +3706,7 @@ else
# Tru64's nm complains that /dev/null is an invalid object file
# MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty
case $build_os in
mingw*) lt_bad_file=conftest.nm/nofile ;;
mingw* | windows*) lt_bad_file=conftest.nm/nofile ;;
*) lt_bad_file=/dev/null ;;
esac
case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in
@@ -3784,7 +3797,7 @@ lt_cv_sharedlib_from_linklib_cmd,
[lt_cv_sharedlib_from_linklib_cmd='unknown'
case $host_os in
cygwin* | mingw* | pw32* | cegcc*)
cygwin* | mingw* | windows* | pw32* | cegcc*)
# two different shell functions defined in ltmain.sh;
# decide which one to use based on capabilities of $DLLTOOL
case `$DLLTOOL --help 2>&1` in
@@ -3929,7 +3942,7 @@ case $host_os in
aix*)
symcode='[[BCDT]]'
;;
cygwin* | mingw* | pw32* | cegcc*)
cygwin* | mingw* | windows* | pw32* | cegcc*)
symcode='[[ABCDGISTW]]'
;;
hpux*)
@@ -4008,7 +4021,7 @@ $lt_c_name_lib_hook\
# Handle CRLF in mingw tool chain
opt_cr=
case $build_os in
mingw*)
mingw* | windows*)
opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
;;
esac
@@ -4023,7 +4036,7 @@ for ac_symprfx in "" "_"; do
if test "$lt_cv_nm_interface" = "MS dumpbin"; then
# Fake it for dumpbin and say T for any non-static function,
# D for any global variable and I for any imported variable.
# Also find C++ and __fastcall symbols from MSVC++,
# Also find C++ and __fastcall symbols from MSVC++ or ICC,
# which start with @ or ?.
lt_cv_sys_global_symbol_pipe="$AWK ['"\
" {last_section=section; section=\$ 3};"\
@@ -4059,7 +4072,7 @@ void nm_test_func(void){}
#ifdef __cplusplus
}
#endif
int main(){nm_test_var='a';nm_test_func();return(0);}
int main(void){nm_test_var='a';nm_test_func();return(0);}
_LT_EOF
if AC_TRY_EVAL(ac_compile); then
@@ -4235,7 +4248,7 @@ m4_if([$1], [CXX], [
beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
mingw* | cygwin* | os2* | pw32* | cegcc*)
mingw* | windows* | cygwin* | os2* | pw32* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
# Although the cygwin gcc ignores -fPIC, still need this for old-style
@@ -4311,7 +4324,7 @@ m4_if([$1], [CXX], [
;;
esac
;;
mingw* | cygwin* | os2* | pw32* | cegcc*)
mingw* | windows* | cygwin* | os2* | pw32* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
m4_if([$1], [GCJ], [],
@@ -4559,7 +4572,7 @@ m4_if([$1], [CXX], [
# PIC is the default for these OSes.
;;
mingw* | cygwin* | pw32* | os2* | cegcc*)
mingw* | windows* | cygwin* | pw32* | os2* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
# Although the cygwin gcc ignores -fPIC, still need this for old-style
@@ -4663,7 +4676,7 @@ m4_if([$1], [CXX], [
esac
;;
mingw* | cygwin* | pw32* | os2* | cegcc*)
mingw* | windows* | cygwin* | pw32* | os2* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
m4_if([$1], [GCJ], [],
@@ -4938,9 +4951,9 @@ m4_if([$1], [CXX], [
pw32*)
_LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds
;;
cygwin* | mingw* | cegcc*)
cygwin* | mingw* | windows* | cegcc*)
case $cc_basename in
cl*)
cl* | icl*)
_LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
;;
*)
@@ -4996,16 +5009,16 @@ dnl Note also adjust exclude_expsyms for C++ above.
extract_expsyms_cmds=
case $host_os in
cygwin* | mingw* | pw32* | cegcc*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
cygwin* | mingw* | windows* | pw32* | cegcc*)
# FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# Microsoft Visual C++ or Intel C++ Compiler.
if test yes != "$GCC"; then
with_gnu_ld=no
fi
;;
interix*)
# we just hope/assume this is gcc and not c89 (= MSVC++)
# we just hope/assume this is gcc and not c89 (= MSVC++ or ICC)
with_gnu_ld=yes
;;
openbsd* | bitrig*)
@@ -5111,7 +5124,7 @@ _LT_EOF
fi
;;
cygwin* | mingw* | pw32* | cegcc*)
cygwin* | mingw* | windows* | pw32* | cegcc*)
# _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
# as there is no search path for DLLs.
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
@@ -5568,14 +5581,14 @@ _LT_EOF
_LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
;;
cygwin* | mingw* | pw32* | cegcc*)
cygwin* | mingw* | windows* | pw32* | cegcc*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# Microsoft Visual C++ or Intel C++ Compiler.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
case $cc_basename in
cl*)
# Native MSVC
cl* | icl*)
# Native MSVC or ICC
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
_LT_TAGVAR(always_export_symbols, $1)=yes
@@ -5585,14 +5598,14 @@ _LT_EOF
# Tell ltmain to make .dll files, not .so files.
shrext_cmds=.dll
# FIXME: Setting linknames here is a bad hack.
_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
_LT_TAGVAR(archive_cmds, $1)='$CC -Fe $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
_LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
cp "$export_symbols" "$output_objdir/$soname.def";
echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
else
$SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
fi~
$CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
$CC -Fe $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
linknames='
# The linker will not automatically build a static lib if we build a DLL.
# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
@@ -5616,7 +5629,7 @@ _LT_EOF
fi'
;;
*)
# Assume MSVC wrapper
# Assume MSVC and ICC wrapper
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
# Tell ltmain to make .lib files, not .a files.
@@ -6225,7 +6238,7 @@ _LT_TAGVAR(objext, $1)=$objext
lt_simple_compile_test_code="int some_variable = 0;"
# Code to be used in simple link tests
lt_simple_link_test_code='int main(){return(0);}'
lt_simple_link_test_code='int main(void){return(0);}'
_LT_TAG_COMPILER
# Save the default compiler, since it gets overwritten when the other
@@ -6435,7 +6448,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "[[-]]L"'
else
GXX=no
@@ -6644,10 +6657,10 @@ if test yes != "$_lt_caught_CXX_error"; then
esac
;;
cygwin* | mingw* | pw32* | cegcc*)
cygwin* | mingw* | windows* | pw32* | cegcc*)
case $GXX,$cc_basename in
,cl* | no,cl*)
# Native MSVC
,cl* | no,cl* | ,icl* | no,icl*)
# Native MSVC or ICC
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
@@ -6811,7 +6824,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "[[-]]L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
;;
*)
if test yes = "$GXX"; then
@@ -6876,7 +6889,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "[[-]]L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
;;
*)
if test yes = "$GXX"; then
@@ -7215,7 +7228,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "[[-]]L"'
else
# FIXME: insert proper C++ library support
@@ -7299,7 +7312,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "[[-]]L"'
else
# g++ 2.7 appears to require '-G' NOT '-shared' on this
# platform.
@@ -7310,7 +7323,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "[[-]]L"'
fi
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir'
@@ -8331,7 +8344,7 @@ AC_CACHE_VAL(lt_cv_to_host_file_cmd,
[case $host in
*-*-mingw* )
case $build in
*-*-mingw* ) # actually msys
*-*-mingw* | *-*-windows* ) # actually msys
lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
;;
*-*-cygwin* )
@@ -8344,7 +8357,7 @@ AC_CACHE_VAL(lt_cv_to_host_file_cmd,
;;
*-*-cygwin* )
case $build in
*-*-mingw* ) # actually msys
*-*-mingw* | *-*-windows* ) # actually msys
lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
;;
*-*-cygwin* )
@@ -8370,9 +8383,9 @@ AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
[#assume ordinary cross tools, or native build.
lt_cv_to_tool_file_cmd=func_convert_file_noop
case $host in
*-*-mingw* )
*-*-mingw* | *-*-windows* )
case $build in
*-*-mingw* ) # actually msys
*-*-mingw* | *-*-windows* ) # actually msys
lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
;;
esac

View File

@@ -128,7 +128,7 @@ LT_OPTION_DEFINE([LT_INIT], [win32-dll],
[enable_win32_dll=yes
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
*-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-cegcc*)
AC_CHECK_TOOL(AS, as, false)
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(OBJDUMP, objdump, false)

View File

@@ -8,22 +8,22 @@ else {
}
android {
compileSdkVersion 31
if (buildAsApplication) {
namespace "org.libsdl.app"
}
compileSdkVersion 34
defaultConfig {
if (buildAsApplication) {
applicationId "org.libsdl.app"
}
minSdkVersion 16
targetSdkVersion 31
minSdkVersion 19
targetSdkVersion 34
versionCode 1
versionName "1.0"
externalNativeBuild {
ndkBuild {
arguments "APP_PLATFORM=android-16"
arguments "APP_PLATFORM=android-19"
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}
// cmake {
// arguments "-DANDROID_APP_PLATFORM=android-16", "-DANDROID_STL=c++_static"
// arguments "-DANDROID_APP_PLATFORM=android-19", "-DANDROID_STL=c++_static"
// // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
// abiFilters 'arm64-v8a'
// }
@@ -53,10 +53,10 @@ android {
}
}
lintOptions {
lint {
abortOnError false
}
if (buildAsLibrary) {
libraryVariants.all { variant ->
variant.outputs.each { output ->

View File

@@ -15,3 +15,84 @@
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLInputConnection {
void nativeCommitText(java.lang.String, int);
void nativeGenerateScancodeForUnichar(char);
}
-keep,includedescriptorclasses class org.libsdl.app.SDLActivity {
# for some reason these aren't compatible with allowoptimization modifier
boolean supportsRelativeMouse();
void setWindowStyle(boolean);
}
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLActivity {
java.lang.String nativeGetHint(java.lang.String); # Java-side doesn't use this, so it gets minified, but C-side still tries to register it
boolean onNativeSoftReturnKey();
void onNativeKeyboardFocusLost();
boolean isScreenKeyboardShown();
android.util.DisplayMetrics getDisplayDPI();
java.lang.String clipboardGetText();
boolean clipboardHasText();
void clipboardSetText(java.lang.String);
int createCustomCursor(int[], int, int, int, int);
void destroyCustomCursor(int);
android.content.Context getContext();
boolean getManifestEnvironmentVariables();
android.view.Surface getNativeSurface();
void initTouch();
boolean isAndroidTV();
boolean isChromebook();
boolean isDeXMode();
boolean isTablet();
void manualBackButton();
int messageboxShowMessageBox(int, java.lang.String, java.lang.String, int[], int[], java.lang.String[], int[]);
void minimizeWindow();
int openURL(java.lang.String);
void requestPermission(java.lang.String, int);
int showToast(java.lang.String, int, int, int, int);
boolean sendMessage(int, int);
boolean setActivityTitle(java.lang.String);
boolean setCustomCursor(int);
void setOrientation(int, int, boolean, java.lang.String);
boolean setRelativeMouseEnabled(boolean);
boolean setSystemCursor(int);
boolean shouldMinimizeOnFocusLoss();
boolean showTextInput(int, int, int, int);
}
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.HIDDeviceManager {
boolean initialize(boolean, boolean);
boolean openDevice(int);
int sendOutputReport(int, byte[]);
int sendFeatureReport(int, byte[]);
boolean getFeatureReport(int, byte[]);
void closeDevice(int);
}
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLAudioManager {
int[] getAudioOutputDevices();
int[] getAudioInputDevices();
int[] audioOpen(int, int, int, int, int);
void audioWriteFloatBuffer(float[]);
void audioWriteShortBuffer(short[]);
void audioWriteByteBuffer(byte[]);
void audioClose();
int[] captureOpen(int, int, int, int, int);
int captureReadFloatBuffer(float[], boolean);
int captureReadShortBuffer(short[], boolean);
int captureReadByteBuffer(byte[], boolean);
void captureClose();
void audioSetThreadPriority(boolean, int);
native int nativeSetupJNI();
native void removeAudioDevice(boolean, int);
native void addAudioDevice(boolean, int);
}
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLControllerManager {
void pollInputDevices();
void pollHapticDevices();
void hapticRun(int, float, int);
void hapticStop(int);
}

View File

@@ -3,7 +3,6 @@
com.gamemaker.game
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.libsdl.app"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="auto">
@@ -63,7 +62,7 @@
<application android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:allowBackup="true"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:theme="@style/AppTheme"
android:hardwareAccelerated="true" >
<!-- Example of setting SDL hints from AndroidManifest.xml:

View File

@@ -186,7 +186,7 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
// Because on Chromebooks we show up as a dual-mode device, it will attempt to connect TRANSPORT_AUTO, which will use TRANSPORT_BREDR instead
// of TRANSPORT_LE. Let's force ourselves to connect low energy.
private BluetoothGatt connectGatt(boolean managed) {
if (Build.VERSION.SDK_INT >= 23) {
if (Build.VERSION.SDK_INT >= 23 /* Android 6.0 (M) */) {
try {
return mDevice.connectGatt(mManager.getContext(), managed, this, TRANSPORT_LE);
} catch (Exception e) {
@@ -429,7 +429,7 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
}
});
}
}
}
else if (newState == 0) {
mIsConnected = false;
}

View File

@@ -170,7 +170,7 @@ public class HIDDeviceManager {
Log.i(TAG," Interface protocol: " + mUsbInterface.getInterfaceProtocol());
Log.i(TAG," Endpoint count: " + mUsbInterface.getEndpointCount());
// Get endpoint details
// Get endpoint details
for (int epi = 0; epi < mUsbInterface.getEndpointCount(); epi++)
{
UsbEndpoint mEndpoint = mUsbInterface.getEndpoint(epi);
@@ -251,6 +251,8 @@ public class HIDDeviceManager {
0x20d6, // PowerA
0x24c6, // PowerA
0x2c22, // Qanba
0x2dc8, // 8BitDo
0x9886, // ASTRO Gaming
};
if (usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_VENDOR_SPEC &&
@@ -271,15 +273,20 @@ public class HIDDeviceManager {
final int XB1_IFACE_SUBCLASS = 71;
final int XB1_IFACE_PROTOCOL = 208;
final int[] SUPPORTED_VENDORS = {
0x03f0, // HP
0x044f, // Thrustmaster
0x045e, // Microsoft
0x0738, // Mad Catz
0x0b05, // ASUS
0x0e6f, // PDP
0x0f0d, // Hori
0x10f5, // Turtle Beach
0x1532, // Razer Wildcat
0x20d6, // PowerA
0x24c6, // PowerA
0x2dc8, /* 8BitDo */
0x2dc8, // 8BitDo
0x2e24, // Hyperkin
0x3537, // GameSir
};
if (usbInterface.getId() == 0 &&
@@ -353,13 +360,19 @@ public class HIDDeviceManager {
private void initializeBluetooth() {
Log.d(TAG, "Initializing Bluetooth");
if (Build.VERSION.SDK_INT <= 30 &&
if (Build.VERSION.SDK_INT >= 31 /* Android 12 */ &&
mContext.getPackageManager().checkPermission(android.Manifest.permission.BLUETOOTH_CONNECT, mContext.getPackageName()) != PackageManager.PERMISSION_GRANTED) {
Log.d(TAG, "Couldn't initialize Bluetooth, missing android.permission.BLUETOOTH_CONNECT");
return;
}
if (Build.VERSION.SDK_INT <= 30 /* Android 11.0 (R) */ &&
mContext.getPackageManager().checkPermission(android.Manifest.permission.BLUETOOTH, mContext.getPackageName()) != PackageManager.PERMISSION_GRANTED) {
Log.d(TAG, "Couldn't initialize Bluetooth, missing android.permission.BLUETOOTH");
return;
}
if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE) || (Build.VERSION.SDK_INT < 18)) {
if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE) || (Build.VERSION.SDK_INT < 18 /* Android 4.3 (JELLY_BEAN_MR2) */)) {
Log.d(TAG, "Couldn't initialize Bluetooth, this version of Android does not support Bluetooth LE");
return;
}
@@ -524,7 +537,7 @@ public class HIDDeviceManager {
for (HIDDevice device : mDevicesById.values()) {
device.setFrozen(frozen);
}
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -573,12 +586,18 @@ public class HIDDeviceManager {
try {
final int FLAG_MUTABLE = 0x02000000; // PendingIntent.FLAG_MUTABLE, but don't require SDK 31
int flags;
if (Build.VERSION.SDK_INT >= 31) {
if (Build.VERSION.SDK_INT >= 31 /* Android 12.0 (S) */) {
flags = FLAG_MUTABLE;
} else {
flags = 0;
}
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), flags));
if (Build.VERSION.SDK_INT >= 33 /* Android 14.0 (U) */) {
Intent intent = new Intent(HIDDeviceManager.ACTION_USB_PERMISSION);
intent.setPackage(mContext.getPackageName());
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, intent, flags));
} else {
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), flags));
}
} catch (Exception e) {
Log.v(TAG, "Couldn't request permission for USB device " + usbDevice);
HIDDeviceOpenResult(deviceID, false);

View File

@@ -52,7 +52,7 @@ class HIDDeviceUSB implements HIDDevice {
@Override
public String getSerialNumber() {
String result = null;
if (Build.VERSION.SDK_INT >= 21) {
if (Build.VERSION.SDK_INT >= 21 /* Android 5.0 (LOLLIPOP) */) {
try {
result = mDevice.getSerialNumber();
}
@@ -74,7 +74,7 @@ class HIDDeviceUSB implements HIDDevice {
@Override
public String getManufacturerName() {
String result = null;
if (Build.VERSION.SDK_INT >= 21) {
if (Build.VERSION.SDK_INT >= 21 /* Android 5.0 (LOLLIPOP) */) {
result = mDevice.getManufacturerName();
}
if (result == null) {
@@ -86,7 +86,7 @@ class HIDDeviceUSB implements HIDDevice {
@Override
public String getProductName() {
String result = null;
if (Build.VERSION.SDK_INT >= 21) {
if (Build.VERSION.SDK_INT >= 21 /* Android 5.0 (LOLLIPOP) */) {
result = mDevice.getProductName();
}
if (result == null) {

View File

@@ -29,6 +29,7 @@ public class SDL {
// This function stores the current activity (SDL or not)
public static void setContext(Context context) {
SDLAudioManager.setContext(context);
mContext = context;
}
@@ -37,6 +38,10 @@ public class SDL {
}
public static void loadLibrary(String libraryName) throws UnsatisfiedLinkError, SecurityException, NullPointerException {
loadLibrary(libraryName, mContext);
}
public static void loadLibrary(String libraryName, Context context) throws UnsatisfiedLinkError, SecurityException, NullPointerException {
if (libraryName == null) {
throw new NullPointerException("No library name provided.");
@@ -52,10 +57,10 @@ public class SDL {
// To use ReLinker, just add it as a dependency. For more information, see
// https://github.com/KeepSafe/ReLinker for ReLinker's repository.
//
Class<?> relinkClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker");
Class<?> relinkListenerClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker$LoadListener");
Class<?> contextClass = mContext.getClassLoader().loadClass("android.content.Context");
Class<?> stringClass = mContext.getClassLoader().loadClass("java.lang.String");
Class<?> relinkClass = context.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker");
Class<?> relinkListenerClass = context.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker$LoadListener");
Class<?> contextClass = context.getClassLoader().loadClass("android.content.Context");
Class<?> stringClass = context.getClassLoader().loadClass("java.lang.String");
// Get a 'force' instance of the ReLinker, so we can ensure libraries are reinstalled if
// they've changed during updates.
@@ -65,7 +70,7 @@ public class SDL {
// Actually load the library!
Method loadMethod = relinkInstanceClass.getDeclaredMethod("loadLibrary", contextClass, stringClass, stringClass, relinkListenerClass);
loadMethod.invoke(relinkInstance, mContext, libraryName, null, null);
loadMethod.invoke(relinkInstance, context, libraryName, null, null);
}
catch (final Throwable e) {
// Fall back

View File

@@ -60,7 +60,7 @@ import java.util.Locale;
public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener {
private static final String TAG = "SDL";
private static final int SDL_MAJOR_VERSION = 2;
private static final int SDL_MINOR_VERSION = 26;
private static final int SDL_MINOR_VERSION = 32;
private static final int SDL_MICRO_VERSION = 0;
/*
// Display InputType.SOURCE/CLASS of events and devices
@@ -89,11 +89,11 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
| InputDevice.SOURCE_CLASS_POSITION
| InputDevice.SOURCE_CLASS_TRACKBALL);
if (s2 != 0) cls += "Some_Unkown";
if (s2 != 0) cls += "Some_Unknown";
s2 = s_copy & InputDevice.SOURCE_ANY; // keep source only, no class;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (Build.VERSION.SDK_INT >= 23) {
tst = InputDevice.SOURCE_BLUETOOTH_STYLUS;
if ((s & tst) == tst) src += " BLUETOOTH_STYLUS";
s2 &= ~tst;
@@ -107,7 +107,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
if ((s & tst) == tst) src += " GAMEPAD";
s2 &= ~tst;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (Build.VERSION.SDK_INT >= 21) {
tst = InputDevice.SOURCE_HDMI;
if ((s & tst) == tst) src += " HDMI";
s2 &= ~tst;
@@ -146,7 +146,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
if ((s & tst) == tst) src += " TOUCHSCREEN";
s2 &= ~tst;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
if (Build.VERSION.SDK_INT >= 18) {
tst = InputDevice.SOURCE_TOUCH_NAVIGATION;
if ((s & tst) == tst) src += " TOUCH_NAVIGATION";
s2 &= ~tst;
@@ -163,14 +163,14 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
if (s == FLAG_TAINTED) src += " FLAG_TAINTED";
s2 &= ~FLAG_TAINTED;
if (s2 != 0) src += " Some_Unkown";
if (s2 != 0) src += " Some_Unknown";
Log.v(TAG, prefix + "int=" + s_copy + " CLASS={" + cls + " } source(s):" + src);
}
*/
public static boolean mIsResumedCalled, mHasFocus;
public static final boolean mHasMultiWindow = (Build.VERSION.SDK_INT >= 24);
public static final boolean mHasMultiWindow = (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */);
// Cursor types
// private static final int SDL_SYSTEM_CURSOR_NONE = -1;
@@ -224,9 +224,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
protected static SDLGenericMotionListener_API12 getMotionListener() {
if (mMotionListener == null) {
if (Build.VERSION.SDK_INT >= 26) {
if (Build.VERSION.SDK_INT >= 26 /* Android 8.0 (O) */) {
mMotionListener = new SDLGenericMotionListener_API26();
} else if (Build.VERSION.SDK_INT >= 24) {
} else if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
mMotionListener = new SDLGenericMotionListener_API24();
} else {
mMotionListener = new SDLGenericMotionListener_API12();
@@ -281,7 +281,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
// Load the .so
public void loadLibraries() {
for (String lib : getLibraries()) {
SDL.loadLibrary(lib);
SDL.loadLibrary(lib, this);
}
}
@@ -393,7 +393,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
mHIDDeviceManager = HIDDeviceManager.acquire(this);
// Set up the surface
mSurface = createSDLSurface(getApplication());
mSurface = createSDLSurface(this);
mLayout = new RelativeLayout(this);
mLayout.addView(mSurface);
@@ -404,7 +404,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
SDLActivity.onNativeOrientationChanged(mCurrentOrientation);
try {
if (Build.VERSION.SDK_INT < 24) {
if (Build.VERSION.SDK_INT < 24 /* Android 7.0 (N) */) {
mCurrentLocale = getContext().getResources().getConfiguration().locale;
} else {
mCurrentLocale = getContext().getResources().getConfiguration().getLocales().get(0);
@@ -588,6 +588,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
mHIDDeviceManager = null;
}
SDLAudioManager.release(this);
if (SDLActivity.mBrokenLibraries) {
super.onDestroy();
return;
@@ -766,7 +768,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
}
break;
case COMMAND_CHANGE_WINDOW_STYLE:
if (Build.VERSION.SDK_INT >= 19) {
if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) {
if (context instanceof Activity) {
Window window = ((Activity) context).getWindow();
if (window != null) {
@@ -788,6 +790,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
SDLActivity.mFullscreenModeActive = false;
}
if (Build.VERSION.SDK_INT >= 28 /* Android 9 (Pie) */) {
window.getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
}
}
} else {
Log.e(TAG, "error handling message, getContext() returned no Activity");
@@ -841,7 +846,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
msg.obj = data;
boolean result = commandHandler.sendMessage(msg);
if (Build.VERSION.SDK_INT >= 19) {
if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) {
if (command == COMMAND_CHANGE_WINDOW_STYLE) {
// Ensure we don't return until the resize has actually happened,
// or 500ms have passed.
@@ -969,15 +974,18 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
/* If set, hint "explicitly controls which UI orientations are allowed". */
if (hint.contains("LandscapeRight") && hint.contains("LandscapeLeft")) {
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
} else if (hint.contains("LandscapeRight")) {
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
} else if (hint.contains("LandscapeLeft")) {
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
} else if (hint.contains("LandscapeRight")) {
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
}
if (hint.contains("Portrait") && hint.contains("PortraitUpsideDown")) {
/* exact match to 'Portrait' to distinguish with PortraitUpsideDown */
boolean contains_Portrait = hint.contains("Portrait ") || hint.endsWith("Portrait");
if (contains_Portrait && hint.contains("PortraitUpsideDown")) {
orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
} else if (hint.contains("Portrait")) {
} else if (contains_Portrait) {
orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
} else if (hint.contains("PortraitUpsideDown")) {
orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
@@ -990,8 +998,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
/* No valid hint, nothing is explicitly allowed */
if (!is_portrait_allowed && !is_landscape_allowed) {
if (resizable) {
/* All orientations are allowed */
req = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
/* All orientations are allowed, respecting user orientation lock setting */
req = ActivityInfo.SCREEN_ORIENTATION_FULL_USER;
} else {
/* Fixed window and nothing specified. Get orientation from w/h of created window */
req = (w > h ? ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
@@ -1000,8 +1008,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
/* At least one orientation is allowed */
if (resizable) {
if (is_portrait_allowed && is_landscape_allowed) {
/* hint allows both landscape and portrait, promote to full sensor */
req = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
/* hint allows both landscape and portrait, promote to full user */
req = ActivityInfo.SCREEN_ORIENTATION_FULL_USER;
} else {
/* Use the only one allowed "orientation" */
req = (is_landscape_allowed ? orientation_landscape : orientation_portrait);
@@ -1090,7 +1098,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
// thus SDK version 27. If we are in DeX mode and not API 27 or higher, as a result,
// we should stick to relative mode.
//
if ((Build.VERSION.SDK_INT < 27) && isDeXMode()) {
if (Build.VERSION.SDK_INT < 27 /* Android 8.1 (O_MR1) */ && isDeXMode()) {
return false;
}
@@ -1180,7 +1188,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
* This method is called by SDL using JNI.
*/
public static boolean isDeXMode() {
if (Build.VERSION.SDK_INT < 24) {
if (Build.VERSION.SDK_INT < 24 /* Android 7.0 (N) */) {
return false;
}
try {
@@ -1340,23 +1348,6 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
}
}
if ((source & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
if (isTextInputEvent(event)) {
if (ic != null) {
ic.commitText(String.valueOf((char) event.getUnicodeChar()), 1);
} else {
SDLInputConnection.nativeCommitText(String.valueOf((char) event.getUnicodeChar()), 1);
}
}
onNativeKeyDown(keyCode);
return true;
} else if (event.getAction() == KeyEvent.ACTION_UP) {
onNativeKeyUp(keyCode);
return true;
}
}
if ((source & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE) {
// on some devices key events are sent for mouse BUTTON_BACK/FORWARD presses
// they are ignored here because sending them as mouse input to SDL is messy
@@ -1371,6 +1362,21 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
}
}
if (event.getAction() == KeyEvent.ACTION_DOWN) {
if (isTextInputEvent(event)) {
if (ic != null) {
ic.commitText(String.valueOf((char) event.getUnicodeChar()), 1);
} else {
SDLInputConnection.nativeCommitText(String.valueOf((char) event.getUnicodeChar()), 1);
}
}
onNativeKeyDown(keyCode);
return true;
} else if (event.getAction() == KeyEvent.ACTION_UP) {
onNativeKeyUp(keyCode);
return true;
}
return false;
}
@@ -1617,7 +1623,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
private final Runnable rehideSystemUi = new Runnable() {
@Override
public void run() {
if (Build.VERSION.SDK_INT >= 19) {
if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) {
int flags = View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
@@ -1670,7 +1676,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
Bitmap bitmap = Bitmap.createBitmap(colors, width, height, Bitmap.Config.ARGB_8888);
++mLastCursorID;
if (Build.VERSION.SDK_INT >= 24) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
try {
mCursors.put(mLastCursorID, PointerIcon.create(bitmap, hotSpotX, hotSpotY));
} catch (Exception e) {
@@ -1686,7 +1692,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
* This method is called by SDL using JNI.
*/
public static void destroyCustomCursor(int cursorID) {
if (Build.VERSION.SDK_INT >= 24) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
try {
mCursors.remove(cursorID);
} catch (Exception e) {
@@ -1700,7 +1706,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
*/
public static boolean setCustomCursor(int cursorID) {
if (Build.VERSION.SDK_INT >= 24) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
try {
mSurface.setPointerIcon(mCursors.get(cursorID));
} catch (Exception e) {
@@ -1755,7 +1761,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
cursor_type = 1002; //PointerIcon.TYPE_HAND;
break;
}
if (Build.VERSION.SDK_INT >= 24) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
try {
mSurface.setPointerIcon(PointerIcon.getSystemIcon(SDL.getContext(), cursor_type));
} catch (Exception e) {
@@ -1769,7 +1775,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
* This method is called by SDL using JNI.
*/
public static void requestPermission(String permission, int requestCode) {
if (Build.VERSION.SDK_INT < 23) {
if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) {
nativePermissionResult(requestCode, true);
return;
}
@@ -1798,7 +1804,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
i.setData(Uri.parse(url));
int flags = Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
if (Build.VERSION.SDK_INT >= 21) {
if (Build.VERSION.SDK_INT >= 21 /* Android 5.0 (LOLLIPOP) */) {
flags |= Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
} else {
flags |= Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET;
@@ -2002,6 +2008,18 @@ class SDLInputConnection extends BaseInputConnection {
@Override
public boolean deleteSurroundingText(int beforeLength, int afterLength) {
if (Build.VERSION.SDK_INT <= 29 /* Android 10.0 (Q) */) {
// Workaround to capture backspace key. Ref: http://stackoverflow.com/questions>/14560344/android-backspace-in-webview-baseinputconnection
// and https://bugzilla.libsdl.org/show_bug.cgi?id=2265
if (beforeLength > 0 && afterLength == 0) {
// backspace(s)
while (beforeLength-- > 0) {
nativeGenerateScancodeForUnichar('\b');
}
return true;
}
}
if (!super.deleteSurroundingText(beforeLength, afterLength)) {
return false;
}

View File

@@ -1,5 +1,8 @@
package org.libsdl.app;
import android.content.Context;
import android.media.AudioDeviceCallback;
import android.media.AudioDeviceInfo;
import android.media.AudioFormat;
import android.media.AudioManager;
import android.media.AudioRecord;
@@ -8,34 +11,67 @@ import android.media.MediaRecorder;
import android.os.Build;
import android.util.Log;
public class SDLAudioManager
{
import java.util.Arrays;
public class SDLAudioManager {
protected static final String TAG = "SDLAudio";
protected static AudioTrack mAudioTrack;
protected static AudioRecord mAudioRecord;
protected static Context mContext;
private static final int[] NO_DEVICES = {};
private static AudioDeviceCallback mAudioDeviceCallback;
public static void initialize() {
mAudioTrack = null;
mAudioRecord = null;
mAudioDeviceCallback = null;
if(Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */)
{
mAudioDeviceCallback = new AudioDeviceCallback() {
@Override
public void onAudioDevicesAdded(AudioDeviceInfo[] addedDevices) {
Arrays.stream(addedDevices).forEach(deviceInfo -> addAudioDevice(deviceInfo.isSink(), deviceInfo.getId()));
}
@Override
public void onAudioDevicesRemoved(AudioDeviceInfo[] removedDevices) {
Arrays.stream(removedDevices).forEach(deviceInfo -> removeAudioDevice(deviceInfo.isSink(), deviceInfo.getId()));
}
};
}
}
public static void setContext(Context context) {
mContext = context;
if (context != null) {
registerAudioDeviceCallback();
}
}
public static void release(Context context) {
unregisterAudioDeviceCallback(context);
}
// Audio
protected static String getAudioFormatString(int audioFormat) {
switch (audioFormat) {
case AudioFormat.ENCODING_PCM_8BIT:
return "8-bit";
case AudioFormat.ENCODING_PCM_16BIT:
return "16-bit";
case AudioFormat.ENCODING_PCM_FLOAT:
return "float";
default:
return Integer.toString(audioFormat);
case AudioFormat.ENCODING_PCM_8BIT:
return "8-bit";
case AudioFormat.ENCODING_PCM_16BIT:
return "16-bit";
case AudioFormat.ENCODING_PCM_FLOAT:
return "float";
default:
return Integer.toString(audioFormat);
}
}
protected static int[] open(boolean isCapture, int sampleRate, int audioFormat, int desiredChannels, int desiredFrames) {
protected static int[] open(boolean isCapture, int sampleRate, int audioFormat, int desiredChannels, int desiredFrames, int deviceId) {
int channelConfig;
int sampleSize;
int frameSize;
@@ -43,14 +79,14 @@ public class SDLAudioManager
Log.v(TAG, "Opening " + (isCapture ? "capture" : "playback") + ", requested " + desiredFrames + " frames of " + desiredChannels + " channel " + getAudioFormatString(audioFormat) + " audio at " + sampleRate + " Hz");
/* On older devices let's use known good settings */
if (Build.VERSION.SDK_INT < 21) {
if (Build.VERSION.SDK_INT < 21 /* Android 5.0 (LOLLIPOP) */) {
if (desiredChannels > 2) {
desiredChannels = 2;
}
}
/* AudioTrack has sample rate limitation of 48000 (fixed in 5.0.2) */
if (Build.VERSION.SDK_INT < 22) {
if (Build.VERSION.SDK_INT < 22 /* Android 5.1 (LOLLIPOP_MR1) */) {
if (sampleRate < 8000) {
sampleRate = 8000;
} else if (sampleRate > 48000) {
@@ -59,7 +95,7 @@ public class SDLAudioManager
}
if (audioFormat == AudioFormat.ENCODING_PCM_FLOAT) {
int minSDKVersion = (isCapture ? 23 : 21);
int minSDKVersion = (isCapture ? 23 /* Android 6.0 (M) */ : 21 /* Android 5.0 (LOLLIPOP) */);
if (Build.VERSION.SDK_INT < minSDKVersion) {
audioFormat = AudioFormat.ENCODING_PCM_16BIT;
}
@@ -120,7 +156,7 @@ public class SDLAudioManager
channelConfig = AudioFormat.CHANNEL_OUT_5POINT1 | AudioFormat.CHANNEL_OUT_BACK_CENTER;
break;
case 8:
if (Build.VERSION.SDK_INT >= 23) {
if (Build.VERSION.SDK_INT >= 23 /* Android 6.0 (M) */) {
channelConfig = AudioFormat.CHANNEL_OUT_7POINT1_SURROUND;
} else {
Log.v(TAG, "Requested " + desiredChannels + " channels, getting 5.1 surround");
@@ -201,6 +237,10 @@ public class SDLAudioManager
return null;
}
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */ && deviceId != 0) {
mAudioRecord.setPreferredDevice(getOutputAudioDeviceInfo(deviceId));
}
mAudioRecord.startRecording();
}
@@ -224,6 +264,10 @@ public class SDLAudioManager
return null;
}
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */ && deviceId != 0) {
mAudioTrack.setPreferredDevice(getInputAudioDeviceInfo(deviceId));
}
mAudioTrack.play();
}
@@ -238,11 +282,73 @@ public class SDLAudioManager
return results;
}
private static AudioDeviceInfo getInputAudioDeviceInfo(int deviceId) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_INPUTS))
.filter(deviceInfo -> deviceInfo.getId() == deviceId)
.findFirst()
.orElse(null);
} else {
return null;
}
}
private static AudioDeviceInfo getOutputAudioDeviceInfo(int deviceId) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS))
.filter(deviceInfo -> deviceInfo.getId() == deviceId)
.findFirst()
.orElse(null);
} else {
return null;
}
}
private static void registerAudioDeviceCallback() {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
audioManager.registerAudioDeviceCallback(mAudioDeviceCallback, null);
}
}
private static void unregisterAudioDeviceCallback(Context context) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
audioManager.unregisterAudioDeviceCallback(mAudioDeviceCallback);
}
}
/**
* This method is called by SDL using JNI.
*/
public static int[] audioOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames) {
return open(false, sampleRate, audioFormat, desiredChannels, desiredFrames);
public static int[] getAudioOutputDevices() {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS)).mapToInt(AudioDeviceInfo::getId).toArray();
} else {
return NO_DEVICES;
}
}
/**
* This method is called by SDL using JNI.
*/
public static int[] getAudioInputDevices() {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_INPUTS)).mapToInt(AudioDeviceInfo::getId).toArray();
} else {
return NO_DEVICES;
}
}
/**
* This method is called by SDL using JNI.
*/
public static int[] audioOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames, int deviceId) {
return open(false, sampleRate, audioFormat, desiredChannels, desiredFrames, deviceId);
}
/**
@@ -254,6 +360,11 @@ public class SDLAudioManager
return;
}
if (android.os.Build.VERSION.SDK_INT < 21 /* Android 5.0 (LOLLIPOP) */) {
Log.e(TAG, "Attempted to make an incompatible audio call with uninitialized audio! (floating-point output is supported since Android 5.0 Lollipop)");
return;
}
for (int i = 0; i < buffer.length;) {
int result = mAudioTrack.write(buffer, i, buffer.length - i, AudioTrack.WRITE_BLOCKING);
if (result > 0) {
@@ -326,18 +437,22 @@ public class SDLAudioManager
/**
* This method is called by SDL using JNI.
*/
public static int[] captureOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames) {
return open(true, sampleRate, audioFormat, desiredChannels, desiredFrames);
public static int[] captureOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames, int deviceId) {
return open(true, sampleRate, audioFormat, desiredChannels, desiredFrames, deviceId);
}
/** This method is called by SDL using JNI. */
public static int captureReadFloatBuffer(float[] buffer, boolean blocking) {
return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) {
return 0;
} else {
return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
}
}
/** This method is called by SDL using JNI. */
public static int captureReadShortBuffer(short[] buffer, boolean blocking) {
if (Build.VERSION.SDK_INT < 23) {
if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) {
return mAudioRecord.read(buffer, 0, buffer.length);
} else {
return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
@@ -346,7 +461,7 @@ public class SDLAudioManager
/** This method is called by SDL using JNI. */
public static int captureReadByteBuffer(byte[] buffer, boolean blocking) {
if (Build.VERSION.SDK_INT < 23) {
if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) {
return mAudioRecord.read(buffer, 0, buffer.length);
} else {
return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
@@ -391,4 +506,9 @@ public class SDLAudioManager
}
public static native int nativeSetupJNI();
public static native void removeAudioDevice(boolean isCapture, int deviceId);
public static native void addAudioDevice(boolean isCapture, int deviceId);
}

View File

@@ -24,7 +24,7 @@ public class SDLControllerManager
public static native int nativeAddJoystick(int device_id, String name, String desc,
int vendor_id, int product_id,
boolean is_accelerometer, int button_mask,
int naxes, int nhats, int nballs);
int naxes, int axis_mask, int nhats, int nballs);
public static native int nativeRemoveJoystick(int device_id);
public static native int nativeAddHaptic(int device_id, String name);
public static native int nativeRemoveHaptic(int device_id);
@@ -42,7 +42,7 @@ public class SDLControllerManager
public static void initialize() {
if (mJoystickHandler == null) {
if (Build.VERSION.SDK_INT >= 19) {
if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) {
mJoystickHandler = new SDLJoystickHandler_API19();
} else {
mJoystickHandler = new SDLJoystickHandler_API16();
@@ -50,7 +50,7 @@ public class SDLControllerManager
}
if (mHapticHandler == null) {
if (Build.VERSION.SDK_INT >= 26) {
if (Build.VERSION.SDK_INT >= 26 /* Android 8.0 (O) */) {
mHapticHandler = new SDLHapticHandler_API26();
} else {
mHapticHandler = new SDLHapticHandler();
@@ -168,6 +168,32 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler {
arg1Axis = MotionEvent.AXIS_GAS;
}
// Make sure the AXIS_Z is sorted between AXIS_RY and AXIS_RZ.
// This is because the usual pairing are:
// - AXIS_X + AXIS_Y (left stick).
// - AXIS_RX, AXIS_RY (sometimes the right stick, sometimes triggers).
// - AXIS_Z, AXIS_RZ (sometimes the right stick, sometimes triggers).
// This sorts the axes in the above order, which tends to be correct
// for Xbox-ish game pads that have the right stick on RX/RY and the
// triggers on Z/RZ.
//
// Gamepads that don't have AXIS_Z/AXIS_RZ but use
// AXIS_LTRIGGER/AXIS_RTRIGGER are unaffected by this.
//
// References:
// - https://developer.android.com/develop/ui/views/touch-and-input/game-controllers/controller-input
// - https://www.kernel.org/doc/html/latest/input/gamepad.html
if (arg0Axis == MotionEvent.AXIS_Z) {
arg0Axis = MotionEvent.AXIS_RZ - 1;
} else if (arg0Axis > MotionEvent.AXIS_Z && arg0Axis < MotionEvent.AXIS_RZ) {
--arg0Axis;
}
if (arg1Axis == MotionEvent.AXIS_Z) {
arg1Axis = MotionEvent.AXIS_RZ - 1;
} else if (arg1Axis > MotionEvent.AXIS_Z && arg1Axis < MotionEvent.AXIS_RZ) {
--arg1Axis;
}
return arg0Axis - arg1Axis;
}
}
@@ -210,7 +236,7 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler {
mJoysticks.add(joystick);
SDLControllerManager.nativeAddJoystick(joystick.device_id, joystick.name, joystick.desc,
getVendorId(joystickDevice), getProductId(joystickDevice), false,
getButtonMask(joystickDevice), joystick.axes.size(), joystick.hats.size()/2, 0);
getButtonMask(joystickDevice), joystick.axes.size(), getAxisMask(joystick.axes), joystick.hats.size()/2, 0);
}
}
}
@@ -291,6 +317,9 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler {
public int getVendorId(InputDevice joystickDevice) {
return 0;
}
public int getAxisMask(List<InputDevice.MotionRange> ranges) {
return -1;
}
public int getButtonMask(InputDevice joystickDevice) {
return -1;
}
@@ -308,6 +337,43 @@ class SDLJoystickHandler_API19 extends SDLJoystickHandler_API16 {
return joystickDevice.getVendorId();
}
@Override
public int getAxisMask(List<InputDevice.MotionRange> ranges) {
// For compatibility, keep computing the axis mask like before,
// only really distinguishing 2, 4 and 6 axes.
int axis_mask = 0;
if (ranges.size() >= 2) {
// ((1 << SDL_GAMEPAD_AXIS_LEFTX) | (1 << SDL_GAMEPAD_AXIS_LEFTY))
axis_mask |= 0x0003;
}
if (ranges.size() >= 4) {
// ((1 << SDL_GAMEPAD_AXIS_RIGHTX) | (1 << SDL_GAMEPAD_AXIS_RIGHTY))
axis_mask |= 0x000c;
}
if (ranges.size() >= 6) {
// ((1 << SDL_GAMEPAD_AXIS_LEFT_TRIGGER) | (1 << SDL_GAMEPAD_AXIS_RIGHT_TRIGGER))
axis_mask |= 0x0030;
}
// Also add an indicator bit for whether the sorting order has changed.
// This serves to disable outdated gamecontrollerdb.txt mappings.
boolean have_z = false;
boolean have_past_z_before_rz = false;
for (InputDevice.MotionRange range : ranges) {
int axis = range.getAxis();
if (axis == MotionEvent.AXIS_Z) {
have_z = true;
} else if (axis > MotionEvent.AXIS_Z && axis < MotionEvent.AXIS_RZ) {
have_past_z_before_rz = true;
}
}
if (have_z && have_past_z_before_rz) {
// If both these exist, the compare() function changed sorting order.
// Set a bit to indicate this fact.
axis_mask |= 0x8000;
}
return axis_mask;
}
@Override
public int getButtonMask(InputDevice joystickDevice) {
int button_mask = 0;
@@ -480,13 +546,15 @@ class SDLHapticHandler {
if (haptic == null) {
InputDevice device = InputDevice.getDevice(deviceIds[i]);
Vibrator vib = device.getVibrator();
if (vib.hasVibrator()) {
haptic = new SDLHaptic();
haptic.device_id = deviceIds[i];
haptic.name = device.getName();
haptic.vib = vib;
mHaptics.add(haptic);
SDLControllerManager.nativeAddHaptic(haptic.device_id, haptic.name);
if (vib != null) {
if (vib.hasVibrator()) {
haptic = new SDLHaptic();
haptic.device_id = deviceIds[i];
haptic.name = device.getName();
haptic.vib = vib;
mHaptics.add(haptic);
SDLControllerManager.nativeAddHaptic(haptic.device_id, haptic.name);
}
}
}
}
@@ -743,7 +811,7 @@ class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 {
@Override
public boolean supportsRelativeMouse() {
return (!SDLActivity.isDeXMode() || (Build.VERSION.SDK_INT >= 27));
return (!SDLActivity.isDeXMode() || Build.VERSION.SDK_INT >= 27 /* Android 8.1 (O_MR1) */);
}
@Override
@@ -753,7 +821,7 @@ class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 {
@Override
public boolean setRelativeMouseEnabled(boolean enabled) {
if (!SDLActivity.isDeXMode() || (Build.VERSION.SDK_INT >= 27)) {
if (!SDLActivity.isDeXMode() || Build.VERSION.SDK_INT >= 27 /* Android 8.1 (O_MR1) */) {
if (enabled) {
SDLActivity.getContentView().requestPointerCapture();
} else {

View File

@@ -116,7 +116,7 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
int nDeviceHeight = height;
try
{
if (Build.VERSION.SDK_INT >= 17) {
if (Build.VERSION.SDK_INT >= 17 /* Android 4.2 (JELLY_BEAN_MR1) */) {
DisplayMetrics realMetrics = new DisplayMetrics();
mDisplay.getRealMetrics( realMetrics );
nDeviceWidth = realMetrics.widthPixels;
@@ -163,7 +163,7 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
// Don't skip in MultiWindow.
if (skip) {
if (Build.VERSION.SDK_INT >= 24) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
if (SDLActivity.mSingleton.isInMultiWindowMode()) {
Log.v("SDL", "Don't skip in Multi-Window");
skip = false;

View File

@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<style name="AppTheme" parent="android:Theme.NoTitleBar.Fullscreen">
<!-- Customize your theme here. -->
</style>
</resources>

View File

@@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
classpath 'com.android.tools.build:gradle:8.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@@ -1,6 +1,6 @@
#Thu Nov 11 18:20:34 PST 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

View File

@@ -126,8 +126,8 @@ if $cygwin ; then
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
CHECK=`echo "$arg"|grep -E -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|grep -E -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`

View File

@@ -80,7 +80,8 @@ do
cd $folder
done
ACTIVITY="${folder}Activity"
# Uppercase the first char in the activity class name because it's Java
ACTIVITY="$(echo $folder | awk '{$1=toupper(substr($1,0,1))substr($1,2)}1')Activity"
sed -i -e "s|\"SDLActivity\"|\"$ACTIVITY\"|g" $BUILDPATH/app/src/main/AndroidManifest.xml
# Fill in a default Activity

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
# Build the Android libraries without needing a project
# (AndroidManifest.xml, jni/{Application,Android}.mk, etc.)

1470
build-scripts/build-release.py Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,32 @@
#!/bin/sh
cd "$(dirname $0)/../src"
echo "Running clang-format in $(pwd)"
find . -regex '.*\.[chm]p*' -exec clang-format -i {} \;
# Revert third-party code
git checkout \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
libm \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
video/arm \
video/khronos \
video/x11/edid-parse.c \
video/yuv2rgb
clang-format -i hidapi/SDL_hidapi.c
# Revert generated code
git checkout dynapi/SDL_dynapi_overrides.h
git checkout dynapi/SDL_dynapi_procs.h
git checkout render/metal/SDL_shaders_metal_*.h
echo "clang-format complete!"

View File

@@ -0,0 +1,18 @@
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR x86)
find_program(CMAKE_C_COMPILER NAMES i686-w64-mingw32-gcc)
find_program(CMAKE_CXX_COMPILER NAMES i686-w64-mingw32-g++)
find_program(CMAKE_RC_COMPILER NAMES i686-w64-mingw32-windres windres)
if(NOT CMAKE_C_COMPILER)
message(FATAL_ERROR "Failed to find CMAKE_C_COMPILER.")
endif()
if(NOT CMAKE_CXX_COMPILER)
message(FATAL_ERROR "Failed to find CMAKE_CXX_COMPILER.")
endif()
if(NOT CMAKE_RC_COMPILER)
message(FATAL_ERROR "Failed to find CMAKE_RC_COMPILER.")
endif()

Some files were not shown because too many files have changed in this diff Show More