Compare commits

...

1117 Commits

Author SHA1 Message Date
Sam Lantinga
ba2f78a006 Updated to version 2.30.6 for release 2024-08-01 14:16:41 -07:00
Sam Lantinga
dcbdf09709 Fixed macOS build
(cherry picked from commit 230f1debd0)
2024-08-01 14:15:16 -07:00
Sam Lantinga
a9b11980d2 Fixed building on macOS with OpenGL disabled
Fixes https://github.com/libsdl-org/SDL/issues/6226

(cherry picked from commit 0b6eff4167)
2024-08-01 14:04:27 -07:00
Sam Lantinga
906d0e9c03 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)
(cherry picked from commit 7fdf794377)
2024-07-29 13:51:22 -07:00
Sam Lantinga
0952ab1ab9 Fixed whitespace
(cherry picked from commit 67b973b5fa)
(cherry picked from commit 15c73f5bfe)
2024-07-29 12:52:54 -07:00
Charles Cross
7635776ca4 Updates CheckLibUDev() to match main, fixing missing HAVE_LIBUDEV
(cherry picked from commit e306cbcbee)
2024-07-29 07:22:29 -07:00
Ozkan Sezer
76a3457ad5 SDL_mslibc.c: revert PR/10303 changes
(cherry picked from commit 2cb2897e50)
2024-07-28 22:50:00 +03:00
Frank Praznik
881c4cb49e 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)
(cherry picked from commit 5d1ca1c8c7)
2024-07-27 20:32:33 -04:00
Ozkan Sezer
0406d1c316 testshader.c: include stdlib.h for exit() 2024-07-22 17:40:56 +03:00
Ozkan Sezer
1ca76a29d9 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)
(cherry picked from commit 86b4d035db)
2024-07-22 16:02:50 +03:00
Anonymous Maarten
e53df5b07e stdinc: c23 deprecated _Static_assert in favor of static_assert
(cherry picked from commit 22bfbdbc02)
(cherry picked from commit 5d606eaae2)
2024-07-21 13:18:55 -07:00
Amir
e7a47e783b 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.

(cherry picked from commit ccade50587)
2024-07-17 14:48:06 -07:00
Ryan C. Gordon
279eb89ce5 README-macos: Typo fixes.
(Manually cherry-picked from 199e6929e5284b8573f02dcb655d3803ed436615.)
2024-07-16 08:32:29 -04:00
Anonymous Maarten
fe9020dcb8 pthread: timespec.tv_nsec must be less then 1000000000 ns
(cherry picked from commit 1ef041a2ca)
2024-07-14 17:29:33 +02:00
ceski
4927836b2d Add a Windows mapping for SplitFish Game Controller
(cherry picked from commit 68cf17d0d4)
(cherry picked from commit 3b7eafedb3)
2024-07-12 22:04:47 -07:00
Anonymous Maarten
5a072d38db cmake: only add SDL_LIBC=0 compile options to SDL2 libraries 2024-07-12 23:18:06 +02:00
Sam Lantinga
2d1ebf4850 Make sure SDL subsystems are initialized before starting threads
(cherry picked from commit b057159db7)
2024-07-12 09:11:38 -07:00
Sam Lantinga
44ec2027f3 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.

(cherry picked from commit b378bc5c83)
2024-07-12 08:02:09 -07:00
Sam Lantinga
000da98663 Fixed OS/2 build
(cherry picked from commit b13dcf24d6)
2024-07-11 13:56:11 -07:00
Sam Lantinga
87ba287f81 Added TLS initialization and shutdown functions
Fixes https://github.com/libsdl-org/SDL/issues/8576

(cherry picked from commit b517043936)
(cherry picked from commit 551164812a)
2024-07-11 13:10:40 -07:00
Ozkan Sezer
d133701a72 ci: bump FreeBSD
Reference issue: https://github.com/libsdl-org/SDL/issues/10224.

(cherry picked from commit 956a8bf6c0)
2024-07-11 18:55:56 +03:00
Substring
4635f8597d KMSDRM: fix unsupported modifiers
(cherry picked from commit 9548bba63a)
(cherry picked from commit a2215ff81c)
2024-07-10 14:43:06 -07:00
Sam Lantinga
802351be25 Fixed build
(cherry picked from commit 026dfc6305)
2024-07-08 11:39:25 -07:00
Sam Lantinga
d3765b27c2 Make sure we're actually running on Windows before using D3D renderers
(cherry picked from commit e22c89536a)
2024-07-08 11:29:29 -07:00
mariob92
7b11fff2ee 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)
(cherry picked from commit 58e179c8b5)
2024-07-06 11:57:23 -07:00
Sam Lantinga
de4573275a Improved detection of Nintendo Switch Pro controller report mode
Fixes https://github.com/libsdl-org/SDL/issues/10182

(cherry picked from commit 4ba2e9f4f4)
(cherry picked from commit 4c44450258)
2024-07-06 05:30:41 -07:00
Ozkan Sezer
275c94c900 SDL_hidapi.c: work-around watcom build error when libusb is enabled
(cherry picked from commit 6a10309568)
2024-07-05 18:56:20 +03:00
Max Maisel
c084e647ed 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.

(cherry picked from commit 22770e6496)
2024-07-05 08:29:01 -07:00
Sam Lantinga
2cdb419a21 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)
(cherry picked from commit a4cbba1276)
2024-07-05 08:23:39 -07:00
Sam Lantinga
2eef7ca475 Updated to version 2.30.5 for release 2024-07-03 14:21:42 -07:00
Sam Lantinga
d126e7bbba Added support for the ROG RAIKIRI
(cherry picked from commit a04596c9a7)
(cherry picked from commit 845ebbbe96)
2024-07-03 13:54:52 -07:00
Sam Lantinga
e5024fae3d 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)
(cherry picked from commit b8daf14fe5)
2024-07-03 13:25:13 -07:00
Ryan C. Gordon
eb053c7f3f 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

(cherry picked from commit 7d60ff9965)
2024-07-03 13:24:19 -07:00
Sam Lantinga
ed441c8289 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)
(cherry picked from commit 66054a6515)
2024-07-03 13:23:04 -07:00
Wouter Wijsman
59b0a1dc65 PSP: send initial SDL_JOYDEVICEADDED event
(cherry picked from commit 5d80179954)
2024-07-03 13:22:03 -07:00
Sam Lantinga
80d36aba5b 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)
(cherry picked from commit cd8ea5e3f1)
2024-07-03 11:47:46 -07:00
Sam Lantinga
e1e36d213b Fixed build
(cherry picked from commit 288aea3b40)
2024-06-29 11:22:48 -07:00
Sam Lantinga
5c8d92e4d0 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)
(cherry picked from commit 0d9e54237c)
2024-06-29 11:13:50 -07:00
Sam Lantinga
8a39054b54 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)
(cherry picked from commit a3f0c373d3)
2024-06-29 11:13:36 -07:00
1F616EMO
c60e2704c8 Remove the inconsistent and lag-causing usleep call in SDL_fcitx.c
(cherry picked from commit 3bf2b90da0)
2024-06-29 00:09:34 -07:00
Sam Lantinga
a9fdbf7f21 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)
(cherry picked from commit ee3b2b7de1)
2024-06-26 15:56:21 -07:00
Sam Lantinga
ed86b02df8 Fixed building with older libdrm headers
(cherry picked from commit 8949de3978)
(cherry picked from commit 88bbab275f)
2024-06-26 15:56:20 -07:00
Sam Lantinga
0811b4dc51 Fixed building with the steamrt/scout SDK
(cherry picked from commit 4b82bed259)
(cherry picked from commit ecde0ca6b6)
2024-06-26 15:56:20 -07:00
Sam Lantinga
d9901e0b85 Fix building with the steamrt/scout SDK
(cherry picked from commit b552f26e6a)
(cherry picked from commit 64d4baccb5)
2024-06-26 15:56:20 -07:00
Frank Praznik
0f5752b0fc 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.

(cherry picked from commit 20f1061cc8)
2024-06-26 12:32:07 -04:00
Frank Praznik
31f77182d0 wayland: Fix double free when deleting an output display
(cherry picked from commit 3b88d4f46f)
2024-06-26 12:31:51 -04:00
Cecill Etheredge
620e875335 fix: Use drmModeAddFB2WithModifiers instead of drmModeAddFB to allow using GBM modifiers.
This fixes corrupt framebuffers on platforms that require the use of modifiers.
2024-06-25 14:20:36 -07:00
Edoardo Lolletti
c18173c260 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)
(cherry picked from commit 99d7b9e626)
2024-06-24 11:51:40 -07:00
Ganael Laplanche
f08f458896 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

(cherry picked from commit ab5740bde2)
2024-06-23 00:07:35 -07:00
Blaž Tomažič
53cf48f505 android: add an option to manually pass the context when loading a native library
(cherry picked from commit b444e656cd)
2024-06-20 10:40:05 -07:00
Blaž Tomažič
c32a1a5023 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.

(cherry picked from commit 6a2dd96ac7)
2024-06-20 09:35:58 -07:00
expikr
8b204815cc Add SDL_MOUSE_RELATIVE_CURSOR_VISIBLE (#7947)
(cherry picked from commit ee559d51be)
(cherry picked from commit 194d72bb29)
2024-06-20 09:32:27 -07:00
Aikawa Yataro
a9bb92b3ae Update qsort implementation
(cherry picked from commit 0fe9f5da54)
(cherry picked from commit 4800edfa0c)
2024-06-19 05:50:00 +03:00
Sam Lantinga
630272eb55 Fixed requesting USB permission on Android 14 (thanks @ikhoeyZX!)
Fixes https://github.com/libsdl-org/SDL/issues/9831

(cherry picked from commit 8ab1ffca8a)
(cherry picked from commit 5a26b26880)
2024-06-17 15:12:05 -07:00
Sam Lantinga
92fe3b19c8 Updated to version 2.30.4 for release 2024-06-17 12:32:13 -07:00
Sam Lantinga
30e2b03a65 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)
(cherry picked from commit a6fdd155fb)
2024-06-17 12:15:18 -07:00
Miku AuahDark
f8943854fd 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)
(cherry picked from commit 77285b6c3f)
2024-06-17 09:55:23 -07:00
Ozkan Sezer
325465935d SDL_events.c: remove long long casts an the override of SDL_PRIs64
(cherry picked from commit a4d240d295)
2024-06-14 21:37:24 +03:00
Ozkan Sezer
1cdd37b32c 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)
(cherry picked from commit 863670c0a8)
2024-06-14 21:37:10 +03:00
Ozkan Sezer
499bff9c3a SDL_qsort.c: fix calling conventions of private functions' compare args 2024-06-14 14:50:10 +03:00
Sam Lantinga
bd06e43b87 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)
(cherry picked from commit 169f77ed5e)
2024-06-13 00:02:52 -07:00
Sam Lantinga
72e5620202 Try to guess the type of a Nintendo Switch controller if we can't read the device info
(cherry picked from commit 6619de8f24)
(cherry picked from commit 6b9bf71133)
2024-06-13 00:02:52 -07:00
Sam Lantinga
fbb9646806 Ignore spurious reply packets when reading Nintendo Switch controller reports
(cherry picked from commit 5ee9a840b1)
(cherry picked from commit f1b19aa744)
2024-06-13 00:02:52 -07:00
Sam Lantinga
4b91f0793c Fixed build
(cherry picked from commit 2e8bd8f1f3)
2024-06-07 09:14:33 -07:00
Fabrice Desclaux
6243a80b3f Fix spurious LCtrl on RAlt key pressed
(cherry picked from commit 22c14442e2)
2024-06-07 08:46:29 -07:00
Oleg
e0b0a98c8e Added VRS DirectForce Pro wheelbase VID/PID to wheel devices list
(cherry picked from commit 7529b4bed5)
(cherry picked from commit 0f9191a643)
2024-06-06 09:55:35 -07:00
Frank Praznik
785eac863b 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.

(cherry picked from commit fc6bbde525)
2024-06-06 09:52:08 -04:00
Sam Lantinga
ab8659922d 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)
(cherry picked from commit f520062ad1)
2024-06-05 19:30:10 -07:00
Sam Lantinga
d48f9c4af4 Added support for the Saitek Cyborg V.3 Rumble Pad in PS3 mode
(cherry picked from commit b6ca360228)
(cherry picked from commit e2f597de84)
2024-06-05 19:30:07 -07:00
Sam Lantinga
5cc0644aa0 Added support for the Razer Kitsune in PS5 mode
(cherry picked from commit e3beaa1972)
(cherry picked from commit 35d719ef25)
2024-05-31 15:19:13 -07:00
mechakotik
91accc391d 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)
(cherry picked from commit 1568501dd6)
2024-05-31 11:33:17 -07:00
Anonymous Maarten
3ee20388c5 autotools needs to check d3d12sdklayers.h too
(cherry picked from commit 5e876db89f)
2024-05-28 17:02:49 +02:00
Ozkan Sezer
2449510673 Makefile.in: add VisualC-GDK to SRC_DIST
Fixes https://github.com/libsdl-org/SDL/issues/9913

(cherry picked from commit 0439fc6007)
2024-05-28 14:10:28 +03:00
Ozkan Sezer
2c07ed320e SDL_config_os2.h: remove duplicated HAVE_WCSL* defines.
(cherry picked from commit 6825a4aabb)
2024-05-28 08:01:04 +03:00
Sam Lantinga
607f37dafd Fixed compiling SDL_platform_defines.h on macOS with older compilers (thanks @sezero!)
Fixes #9632

(cherry picked from commit 36015ad5e5)
(cherry picked from commit 8bc47dc3f1)
2024-05-27 14:39:22 -07:00
Anonymous Maarten
acc2e040ce VC+d3d12: use __has_include to detect presence of d3d12 headers
backport of 4fa5006247

(cherry picked from commit 6c29778826)
2024-05-27 02:43:59 +02:00
Anonymous Maarten
faa9bbdc8e cmake: direct3d12 renderer needs d3d12.h and d3d12sdklayers.h
Older MinGW releases don't ship d3d12sdklayers.h

backport of 3af4f120d0

(cherry picked from commit 6c10201e58)
2024-05-27 02:43:29 +02:00
Anonymous Maarten
cf6c760cd3 d3d12: older Windows SDK headers contain wrong function prototypes
Declare correct function pointers ourselves.

Backport of:
- 98fcf112e7
- 89a4d9ae67

(cherry picked from commit c79e616806)
2024-05-25 00:43:46 +02:00
Anonymous Maarten
e49349ac0c d3d12: xbox has no DXGI_PRESENT flags
(cherry picked from commit 54c435409b)
2024-05-25 00:43:41 +02:00
Sam Lantinga
1e5db996ff Added Linux bindings for the Qanba Drone 2 Arcade Joystick
(cherry picked from commit 98a9ca5e32)
(cherry picked from commit 964e0c9b47)
2024-05-23 15:35:17 -07:00
Phena Ildanach
793a0681a9 hidapi: Use a whitelist for libusb when other backends are available
(cherry picked from commit fdf28471c0)
2024-05-17 11:18:45 -07:00
APGR22
825ffaa168 Added NULL pointer check
(cherry picked from commit 961488b0dc)
(cherry picked from commit e4fc07cad0)
2024-05-17 09:01:26 -07:00
Oleg
9ad6a36b7b Added Moza wheelbases VID/PID to wheel devices list
(cherry picked from commit 79cabeef18)
(cherry picked from commit 96e3799495)
2024-05-15 19:43:15 -07:00
Oleg
c3b53c72c7 Added Simucube wheelbases VID/PID to wheel devices list
(cherry picked from commit dc9d9dd85a)
(cherry picked from commit 1f54ee1da6)
2024-05-15 19:43:15 -07:00
Oleg
0800d81fb4 Added Cammus C5 wheelbase VID/PID to wheel devices list
(cherry picked from commit ce9177b64f)
(cherry picked from commit 0c7a83ecd5)
2024-05-15 19:43:15 -07:00
Sam Lantinga
c27219695a 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)
(cherry picked from commit efaa58732a)
2024-05-10 12:19:33 -07:00
Ozkan Sezer
9dcfc308ef 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)
(cherry picked from commit b6899f82fb)
2024-05-10 09:10:48 -07:00
Sam Lantinga
77b3a6afaf Added a Windows mapping for the SPEEDLINK STRIKE Gamepad
Fixes https://github.com/libsdl-org/SDL/issues/9705

(cherry picked from commit 01d560df50)
(cherry picked from commit 8c92af5e54)
2024-05-06 10:11:58 -07:00
Ozkan Sezer
dd42795131 autotools, cmake, macOS: Do not use the system iconv() by default
backport from PR #9676 by @flibitijibibo

(cherry picked from commit d8fbeec096)
2024-05-03 09:52:59 -07:00
Sam Lantinga
fb1497566c Updated to version 2.30.3 for release 2024-05-01 09:14:37 -07:00
Ozkan Sezer
cc6c0fe230 test, watcom.mif: revert f9a46a319b
%copy isn't recognized by older wmake versions.
2024-05-01 17:37:10 +03:00
Ozkan Sezer
f9a46a319b test, watcom.mif: revert 48a0592a4 and use %copy instead
Ref.: https://github.com/open-watcom/open-watcom-v2/issues/1281.
2024-05-01 17:02:28 +03:00
Ozkan Sezer
48a0592a45 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:04 +03:00
Sam Lantinga
1c74a8b5ae Fixed building with GDK (thanks @Romans-I-XVI!)
(cherry picked from commit 1caa427035)
2024-04-30 10:21:38 -07:00
Austin Sojka
3d18043005 Added GDK app constrained/unconstrained events (#9608)
(cherry picked from commit 7554e82ec3)
2024-04-30 10:21:32 -07:00
Tyson Whitehead
6e1e00701e 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.

(cherry picked from commit 0963c11af8)
2024-04-26 12:15:52 -07:00
yuanhecai
5570d846ea loongarch: Delete the configuration of the compilation option "mlasx"
(cherry picked from commit 75340b827d)
2024-04-25 20:33:53 -07:00
Anonymous Maarten
f5dcb8f7ad stdinc: modify default alloca prototype
For compatibilty with TinyCC.

Backport of 06758685a5

(cherry picked from commit 9216b7a5ee)
2024-04-25 21:39:23 +03:00
Sam Lantinga
f6f1b09b69 Fixed build error (thanks @sezero!)
(cherry picked from commit ac5a61cd60)
(cherry picked from commit 67c60e0b9c)
2024-04-25 09:45:52 -07:00
Tyson Whitehead
bf540985aa 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.

(cherry picked from commit 45b804c158)
2024-04-25 08:48:57 -07:00
Frank Praznik
c39f86c28a 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)
(cherry picked from commit 863d4a0f2a)
2024-04-25 08:42:04 -07:00
Sam Lantinga
b5da8ad00d Fixed Win+V handling (pasting from clipboard history) on Windows (thanks @ocornut!)
Fixes https://github.com/libsdl-org/SDL/issues/9613

(cherry picked from commit 33af02ae68)
2024-04-24 09:24:41 -07:00
Ozkan Sezer
f62b86263a CI, macOS: install autoconf.
Reference issue: https://github.com/libsdl-org/SDL/issues/9606 .

(cherry picked from commit 26e3d65ea8)
2024-04-24 00:39:00 +03:00
yassineimounachen
3449c734d5 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)
(cherry picked from commit 8f18e2f52d)
2024-04-22 11:36:52 -07:00
Sam Lantinga
3f29d985fe Fixed compilation with C89 (thanks @d-s-a!)
Closes https://github.com/libsdl-org/SDL/pull/9564

(cherry picked from commit 4e29be814e)
2024-04-17 07:50:28 -07:00
Clownacy
2f4a7bbced 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.

(cherry picked from commit 1fa6142903)
2024-04-02 12:05:09 -07:00
Zhuoran
a0522e4c21 Fix Caps Lock and Backspace mapping for Colemak
(cherry picked from commit 906ad64d7b)
2024-04-02 07:49:41 -07:00
Sam Lantinga
f461d91cd2 Updated to version 2.30.2 for release 2024-04-01 16:56:15 -07:00
Brian Collins
ef54e0c4f4 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.

(cherry picked from commit f1690e265e)
2024-04-01 16:22:03 -07:00
Ryan C. Gordon
863f39fb9f 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.

(cherry picked from commit 0d8ce4a761)
2024-03-28 09:48:03 -04:00
Sam Lantinga
d33b28c9fe Don't fail joystick initialization if udev isn't available
(cherry picked from commit 5fff9bc1e3)
2024-03-25 12:55:50 -07:00
Ozkan Sezer
c15a87a614 remove non-existent vulkan.hpp and vulkan_mir.h from Xcode project
(cherry picked from commit 358a80a473)
2024-03-25 22:02:40 +03:00
Anonymous Maarten
45de0635ac VisualC: remove vulkan.hpp
(cherry picked from commit eb185e8d88)
2024-03-25 22:02:20 +03:00
Alynne
bca314c339 Add Yawman Arrow flightstick controller
(cherry picked from commit 2b4c75690c)
(cherry picked from commit cbc9bd9804)
2024-03-25 06:36:09 -07:00
Tyson Whitehead
f05490d0e2 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.

(cherry picked from commit 6e1611cc77)
2024-03-24 11:49:50 -07:00
Sylvain
442e201705 Fix bug #9331 - SDL3 Android crash getVibrator() == null
(cherry picked from commit 1855ce68af)
(cherry picked from commit 763d768f7d)
2024-03-23 16:32:17 -07:00
Marcel Hild
9c346b2321 Add support for MadCatz Saitek Side Panel Control Deck
Signed-off-by: Marcel Hild <hild@b4mad.net>
(cherry picked from commit 67e425bcf8)
(cherry picked from commit fa18c9bf4a)
2024-03-22 09:16:39 -07:00
Frank Praznik
a6b684d05a wayland: Check the returned display pointer before dereferencing
Fixes a crash when all displays are disconnected.

(cherry picked from commit 5df737bb3c)
2024-03-20 15:45:58 -04:00
Sam Lantinga
8fb82da226 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)
(cherry picked from commit a9ac349846)
2024-03-20 10:42:39 -07:00
Pierre Wendling
0949f89028 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)
(cherry picked from commit 4a79fe44ff)
2024-03-19 16:54:46 -07:00
rofl0r
350a49e1cc PSP/Joystick: fix formatting
(cherry picked from commit c17d2246fb)
2024-03-17 13:24:12 -07:00
rofl0r
bc19e38728 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.

(cherry picked from commit 86f223d664)
2024-03-17 13:24:11 -07:00
Sam Lantinga
228a2954d7 Added a mapping for the Defender Joystick Cobra R4 (thanks @kotenok2000!)
(cherry picked from commit d972244d3a)
(cherry picked from commit 2d6c100058)
2024-03-17 12:15:38 -07:00
Sam Lantinga
3d6d4ca2cd Use the CRC as part of the unique key for mappings
(cherry picked from commit 4697153d1e)
(cherry picked from commit 07f04bb35e)
2024-03-17 12:15:31 -07:00
Frank Praznik
4c3e5cf1d1 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.

(cherry picked from commit 24aedc1439)
2024-03-17 10:48:07 -04:00
Frank Praznik
27b1b6d4eb Add checks for memfd_create() and posix_fallocate() to the autotools build
(cherry picked from commit 59d4a39456)
2024-03-13 11:45:41 -04:00
Frank Praznik
24269007d8 Fix build (C90 declaration order)
(cherry picked from commit 88bdc028ec)
2024-03-12 21:17:29 -07:00
Frank Praznik
d849036927 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)
(cherry picked from commit d3c89bb479)
2024-03-12 21:17:29 -07:00
Sam Lantinga
5be47255ba 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)
(cherry picked from commit e54774faca)
2024-03-11 17:14:26 -07:00
Sam Lantinga
8f860b3698 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]
(cherry picked from commit cd197be53b)
2024-03-09 08:41:16 -08:00
Sam Lantinga
35992597ae Added support for the 6-button SEGA Mega Drive Control Pad for Nintendo Online
(cherry picked from commit 528b71284f)
2024-03-08 13:08:27 -08:00
Sam Lantinga
3f0d7a2937 Fixed mapping for the Sanwa Supply JY-P76USV controller
(cherry picked from commit 57a160c9ab)
(cherry picked from commit 26054d9934)
2024-03-06 20:54:55 -08:00
Jade Macho
dae1232489 GDK: Partially revert 2670eb44af
MsgWaitForMultipleObjects is desktop-only.

(cherry picked from commit e1e5d33420)
(cherry picked from commit da9bfc43e7)
2024-03-06 21:28:24 +03:00
Ozkan Sezer
8e388843b8 SDL_RWFromFile, stdio: allow named pipes along with regular files.
Fixes https://github.com/libsdl-org/SDL/issues/9174

(cherry picked from commit 177a836653)
2024-03-06 18:50:28 +03:00
Sam Lantinga
5adbf3765a Updated to version 2.30.1 for release 2024-03-05 14:33:57 -08:00
Sam Lantinga
e910e6f13d 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)
(cherry picked from commit bdc7ad8f56)
2024-03-05 13:55:12 -08:00
Sam Lantinga
2f2cca8ac6 Added a mapping for the Sanwa Supply JY-P76USV controller
Fixes https://github.com/libsdl-org/SDL/issues/8644

(cherry picked from commit ccd309c433)
(cherry picked from commit d35dee76c7)
2024-03-03 12:24:15 -08:00
Sam Lantinga
a2f39399a1 SDL_GameControllerGetAppleSFSymbolsNameForAxis() returns NULL if the symbol isn't found
(cherry picked from commit 627e15871a)
2024-03-03 11:56:53 -08:00
Sam Lantinga
c1149f88b6 SDL_GameControllerGetAppleSFSymbolsNameForButton() returns NULL if the symbol isn't found
Fixes https://github.com/libsdl-org/SDL/issues/9071

(cherry picked from commit b87116ff03)
2024-03-03 11:13:04 -08:00
Sam Lantinga
54adba6a31 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)
(cherry picked from commit 05f6709617)
2024-03-03 11:13:04 -08:00
Sam Lantinga
b48106f8a8 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-03-03 00:01:20 +03:00
scribam
f345428367 ci: update deprecated node.js 16 actions
(cherry picked from commit 38d24778ed)
2024-02-23 23:42:56 +01:00
scribam
e4287595c1 ci: bump cross-platform-actions/action version to v0.23.0
(cherry picked from commit cbe330befd)
2024-02-23 23:21:40 +03:00
Sam Lantinga
73efbf2e14 Fixed Visual Studio warning 4459
(cherry picked from commit d135daad5b)
2024-02-21 23:33:28 +03:00
Ryan C. Gordon
ad342dfca9 audio: fix SSE conversion of Sint8 audio to Float32.
Fixes #9099.

(cherry picked from commit 4316c5ec02)
2024-02-21 15:16:46 -05:00
Sam Lantinga
f13d6d4b0f Convert mouse wheel coordinates to renderer view
Fixes https://github.com/libsdl-org/SDL/issues/9097

(cherry picked from commit 903d888cc3)
2024-02-20 15:45:04 -08:00
Frank Praznik
dfb8241317 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.

(cherry picked from commit f24216c2ba)
2024-02-18 12:35:47 -05:00
Ryan C. Gordon
c67f10e43f x11: Cleaned up system cursor code to match previous Wayland change.
(cherry picked from commit df00a7dd4c)
2024-02-16 08:38:13 -05:00
Ryan C. Gordon
932eea513e 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.

(cherry picked from commit 827917ea60)
2024-02-16 08:38:08 -05:00
Simon McVittie
5e51a37518 emscripten, wayland, x11: Share the table of CSS cursor names
As suggested in #8939.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 271df2fdd8)
2024-02-16 08:12:59 -05:00
Simon McVittie
372564299e 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>
(cherry picked from commit aa6c390bbd)
2024-02-16 08:12:54 -05:00
Ryan C. Gordon
c397fe0c51 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>

(cherry picked from commit 67827c0b00)
2024-02-16 08:12:47 -05:00
Simon McVittie
95227e2732 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>
(cherry picked from commit e2535ba547)
2024-02-16 08:12:41 -05:00
Ryan C. Gordon
6f8d6da77f 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:13:30 -05:00
Ozkan Sezer
6f15aec644 don't let SDL_render.c:render_drivers[] have an empty initializer list.
(cherry picked from commit bc30fb295d)
2024-02-15 22:51:50 +03:00
Ozkan Sezer
9bed177f10 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
(cherry picked from commit d0731ab9a3)
2024-02-15 22:51:37 +03:00
Frank Praznik
7de4f16710 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

(cherry picked from commit 699cec1a8d)
2024-02-14 11:53:07 -05:00
Sam Lantinga
beac43f41f 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

(cherry picked from commit 120b8d4189)
2024-02-12 16:03:14 -08:00
Sam Lantinga
8538d5dcf1 Fixed error: unused variable 'axes' [-Werror,-Wunused-variable]
(cherry picked from commit 814a94c349)
(cherry picked from commit 6669d04ea6)
2024-02-12 11:18:54 -08:00
Sam Lantinga
0fb294ade4 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)
(cherry picked from commit 971c5c2610)
2024-02-12 10:21:59 -08:00
Chris Collins
0f6a682ea6 Wayland: Avoid SEGV if a modifier notification comes before the keymap
(cherry picked from commit 0f81598e9f)
(cherry picked from commit de0cb94e72)
2024-02-10 07:05:16 -08:00
Hans-Kristian Arntzen
c4fc20a033 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)
(cherry picked from commit 4ae87e215e)
2024-02-10 07:03:21 -08:00
Sam Lantinga
a24e2bfc76 Guarded ElementAlreadyHandled with #ifdef ENABLE_PHYSICAL_INPUT_PROFILE (thanks @Donione!)
Fixes https://github.com/libsdl-org/SDL/issues/9033

(cherry picked from commit 3ebbf0f409)
(cherry picked from commit 646cccede7)
2024-02-09 16:13:14 -08:00
Sam Lantinga
6a83588fdd 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)
(cherry picked from commit 93d7b6e50c)
2024-02-09 01:28:48 -08:00
Sam Lantinga
0092b3629e Added VIDPID for OpenFFBoard wheel (thanks @groybe!)
Closes https://github.com/libsdl-org/SDL/pull/7987

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

Fixed crash after 594a79c2f9

(cherry picked from commit a29f37c14a)
2024-02-03 06:19:26 -08:00
Wohlstand
384fcea585 SDL_audiotypecvt.c: Fixed memory corruption when resampling S16 t F32
(cherry picked from commit ca01016577)
2024-02-03 06:14:37 -08:00
Joshua Root
2f2b44a1bd 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)
(cherry picked from commit c53c351921)
2024-02-02 22:25:49 -08:00
Sam Lantinga
8386daddcb 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)
(cherry picked from commit fc787a41dc)
2024-02-02 18:31:27 -08:00
Simon McVittie
739a23e506 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>
(cherry picked from commit 58907d2c27)
2024-02-02 07:45:57 -08:00
Simon McVittie
5a59155a05 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>
(cherry picked from commit a7bd18c0d5)
2024-02-02 07:45:57 -08:00
Simon McVittie
1ad917e2f6 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>
(cherry picked from commit f73abd49c3)
2024-02-02 07:45:57 -08:00
Sam Lantinga
859844eae3 Updated to version 2.30.0 for release 2024-02-01 16:02:20 -08:00
Sam Lantinga
857b9848d2 Don't use the system iconv on Apple mobile platforms
Fixes https://github.com/libsdl-org/SDL/issues/8964

(cherry picked from commit d6a48e4958)
(cherry picked from commit 8eed915dfa)
2024-02-01 15:55:20 -08:00
Sam Lantinga
5f98fcf00b 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

(cherry picked from commit 8ce6fb2513)
2024-01-30 11:13:44 -08:00
Francisco Javier Trujillo Mata
5a492e8196 Fixing viewport
(cherry picked from commit d34a7c5ed2)
2024-01-29 20:44:07 -08:00
Francisco Javier Trujillo Mata
80cb52c944 Fix scissor usage
(cherry picked from commit 36b8438280)
2024-01-29 20:44:07 -08:00
Francisco Javier Trujillo Mata
4436c09c9d Fix color
(cherry picked from commit faa8fc2917)
2024-01-29 20:44:07 -08:00
Ozkan Sezer
23cf7a2e0d autotools: a few libtool updates from mainstream
(cherry picked from commit 971508c0d7)
2024-01-28 21:50:42 +03:00
Sam Lantinga
4a62e1c0ca Updated to version 2.29.3 for RC build 2024-01-27 22:50:08 -08:00
Sam Lantinga
173afd8564 Fixed testautomation log callback calling convention
(cherry picked from commit 9f7eb6c4c1)
(cherry picked from commit c55bd24827)
2024-01-27 22:45:13 -08:00
Ryan C. Gordon
f6b9ebb838 wasapi: If GetDeviceBuf can't get a full buffer, go back to waiting.
Reference Issue #8924.

(cherry picked from commit f931b25f4c)
2024-01-28 00:23:40 -05:00
Ryan C. Gordon
f1b109005c aaudio: Backport headphone hotplugging support from SDL3.
Fixes #4985.

(cherry picked from commit ec25d6b1e8)
2024-01-28 00:20:34 -05:00
Sam Lantinga
0bd58cd727 Fixed Watcom build
(cherry picked from commit bb30a35364)
2024-01-27 20:29:06 -08:00
Sam Lantinga
de1292f8ac Fixed build
(cherry picked from commit 11c932bf1d)
2024-01-27 20:18:59 -08:00
Sam Lantinga
a6d5c1fe05 Added the environment variable SDL_LOGGING to control default log output
(cherry picked from commit 12bdb2b4d0)
(cherry picked from commit f0b8fee88f)
2024-01-27 19:46:59 -08:00
Sam Lantinga
fc5bd11dac Simplified the default log category logic
Now it's much clearer and easier to tweak the defaults

(cherry picked from commit 4fba663368)
(cherry picked from commit 6ec3f5a28e)
2024-01-27 19:46:59 -08:00
Sam Lantinga
e767840874 Document that the default log priority is error, not critical
(cherry picked from commit a7a98d8bbb)
(cherry picked from commit 2c11068569)
2024-01-27 19:46:58 -08:00
Ozkan Sezer
fd08ca3823 SDL_rwops.c (SDL_IsRegularFile): fix WinRT build failure due to S_ISREG
(cherry picked from commit fcd1c155cc)
2024-01-28 02:21:01 +03:00
Ozkan Sezer
3bf60755cb SDL_RWFromFile, stdio: reject if the file is not a regular file.
Fixes https://github.com/libsdl-org/SDL/issues/8935
(cherry picked from commit 230ae797a7)
2024-01-28 01:45:10 +03:00
Sam Lantinga
aac7d1c2ae Report out of memory instead of crashing in SDL_LoadFile_RW()
Fixes https://github.com/libsdl-org/SDL/issues/8935

(cherry picked from commit 5297596132)
2024-01-27 12:17:04 -08:00
Sam Lantinga
55caed2011 Fixed N3DS build
(cherry picked from commit 332213163c)
2024-01-27 11:56:51 -08:00
Sam Lantinga
53058af284 Enable text input on video initialization without popping up an on-screen keyboard
Fixes https://github.com/libsdl-org/SDL/issues/8561

(cherry picked from commit 4ff3b28273)
2024-01-27 11:54:50 -08:00
Ryan C. Gordon
ad1a11164c wasapi: Clamp device->spec.samples to the hardware buffer size.
Reference Issue #8924.
2024-01-26 13:58:38 -05:00
Ryan C. Gordon
5f6a4fe643 blendmode: Corrected docs for SDL_BLENDOPERATION_[REV_]SUBTRACT.
They were documented backwards.

Fixes #8910.

(cherry picked from commit ecbbef8b8d)
2024-01-25 17:49:55 -05:00
Sam Lantinga
c85ea238ca 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)
(cherry picked from commit 08caafe2f1)
2024-01-25 06:37:34 -08:00
Ningyuan Li
5c0b2d04f4 mayflash adapter PS4 support
(cherry picked from commit d6ebbc2fa4)
(cherry picked from commit 138fe3d43d)
2024-01-24 19:26:44 -08:00
Sam Lantinga
76e64053c3 Make sure we include the matching copy of vk_video headers
(cherry picked from commit 1ac9602909)
(cherry picked from commit b16ef14c7c)
2024-01-24 09:42:22 -08:00
Sam Lantinga
ddfa59a52b Update to the latest version of the Khronos headers
(cherry picked from commit fc74bf8455)
(cherry picked from commit 0f5a815657)
2024-01-24 09:42:22 -08:00
Sam Lantinga
e3fb974fc7 Fixed ambiguity between std::byte and byte in rpcndr.h
Fixes https://github.com/libsdl-org/SDL/issues/8911

(cherry picked from commit a71f99c71f)
(cherry picked from commit 9196584773)
2024-01-23 09:05:29 -08:00
Ozkan Sezer
9120fbd501 make video/pandora to actually compile somehow.
no one ever maintained it for years..
(cherry picked from commit 48b62e2e57)
2024-01-23 17:50:20 +03:00
Ozkan Sezer
52181848da 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
(cherry picked from commit 9e352e61db)
2024-01-23 04:12:32 +03:00
Ryan C. Gordon
10cbe04fc5 SDL_ShowMessageBox: Remove #ifdefs and respect SDL_VIDEO_DRIVER hint.
Fixes #8892.

(cherry picked from commit c5c0b2cb34)
2024-01-22 19:46:23 -05:00
Ryan C. Gordon
8367b00e8c 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.

(cherry picked from commit 1e016fd5ea)
2024-01-22 18:28:10 -05:00
Ozkan Sezer
4a4f289adc testhaptic.c: include stdlib.h for exit()
(cherry picked from commit aaf426e280)
2024-01-23 01:20:40 +03:00
Frank Praznik
467f1d52e4 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

(cherry picked from commit a8eeb181b6)
2024-01-22 13:02:58 -05: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
Sam Lantinga
0bfeed061b Updated to version 2.26.0 for release 2022-11-21 16:15:58 -08:00
Sam Lantinga
d167cd6715 Added the Gunfighter Mk.III ‘Space Combat Edition’ as a flight stick 2022-11-21 09:02:10 -08:00
Sam Lantinga
8b20b568b0 Don't report battery level for disconnected batteries
Fixes https://github.com/libsdl-org/SDL/issues/6536
2022-11-21 07:42:14 -08:00
Sam Lantinga
8ae46a49ea Save the version in VERSION.txt instead of VERSION
Fixes https://github.com/libsdl-org/SDL/issues/6558
2022-11-21 06:57:02 -08:00
Sam Lantinga
802c624ab3 Strip trailing newline when reading the VERSION file 2022-11-20 14:37:05 -08:00
Ozkan Sezer
3bc4bad8fb add missing strcasestr checks to cmake and autotools build systems,
and update config files.
2022-11-20 14:20:33 -08:00
Frank Praznik
fe396e306e wayland: Use the cached window size when switching from non-floating to floating window state
When changing the window state from non-floating to floating (e.g. leaving fullscreen), libdecor can send bogus content sizes that are +/- the height of the window title bar and start 'walking' the window height in one direction or the other with every transition.

The floating window size is known, so use the cached value instead of the size reported by libdecor when restoring the floating state.
2022-11-19 09:15:27 -08:00
Sam Lantinga
509939b1b6 Disable the third party PS3 HIDAPI driver by default, the L3/R3 buttons are unknown 2022-11-18 18:20:53 -08:00
Sam Lantinga
ff99e56d3a Fixed KMSDRM window creation failing if OpenGL libraries are not available, but GLES 2.0 libraries are 2022-11-18 12:54:55 -08:00
Sam Lantinga
da9ba3a2a1 If a CRTC doesn't have a mode configured, use the preferred or largest mode as the default mode
Fixes https://github.com/libsdl-org/SDL/issues/6421
2022-11-18 12:17:27 -08:00
Sam Lantinga
ea4ea27a59 Don't trigger an error if we try to delete a touch device after shutting down the touch system
This can happen on Raspberry Pi if the display system fails to initialize.
2022-11-18 11:14:14 -08:00
David Gow
81479d8784 wayland: keyboard: Cache text input parameters.
Some applications (and embarrassingly, testime is one of them) call
SDL_StartTextInput() or SDL_SetTextInputRect() every frame. On KDE/KWin
with fcitx5, this causes there to be several preedit events every frame
(particularly given some of the workarounds in Wayland_StartTextInput),
which slows testime down to an unusable crawl.

Instead, make SDL_StartTextInput() a no-op if text input is already
enabled, and cache the input rect, only changing it when the new rect is
actually different.

With these changes, we only get preedit events (and hence
SDL_TEXTEDITING events) when the preedit string actually changes. This
matches the behaviour under XWayland, and works very smoothly.
2022-11-18 07:18:36 -08:00
Ozkan Sezer
6dc96aa745 SDL_UDEV_DelCallback: return early if _this is NULL
Fixes https://github.com/libsdl-org/SDL/issues/6548
2022-11-18 18:02:10 +03:00
Sylvain
16824865c2 Cleanup of SDL_SetError that already return -1 value 2022-11-18 06:59:10 -08:00
Sylvain
3e70553c48 Unneed test before calling SDL_FreeSurface 2022-11-18 06:58:34 -08:00
Sam Lantinga
9209942949 Revert "sdl2-config.in: Deprecate sdl2-config"
This reverts commit e0d904e90b.

SDL 3 will have the recommended path forward, we don't need to nag in SDL 2.
2022-11-18 06:53:13 -08:00
Sam Lantinga
769ae185d6 Revert "sdl2.m4: Deprecate AM_PATH_SDL2 in favour of PKG_CHECK_MODULES"
This reverts commit a66cb8cf21.

SDL 3 will have the recommended path forward, we don't need to nag in SDL 2.
2022-11-18 06:52:12 -08:00
1312 changed files with 90193 additions and 283472 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

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

@@ -15,7 +15,7 @@ jobs:
- { name: CMake, cmake: 1, android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64" }
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: nttld/setup-ndk@v1
id: setup_ndk
with:

View File

@@ -1,19 +1,23 @@
name: Build (VM Actions)
name: Build (C/P Actions)
on: [push, pull_request]
jobs:
freebsd:
runs-on: macos-12
runs-on: ubuntu-latest
name: FreeBSD
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
uses: vmactions/freebsd-vm@v0
uses: cross-platform-actions/action@v0.24.0
with:
usesh: true
prepare: |
pkg install -y \
operating_system: freebsd
version: '13.3'
shell: bash
run: |
sudo pkg update
sudo pkg install -y \
gmake \
pkgconf \
libXcursor \
@@ -33,17 +37,15 @@ jobs:
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)
export CPPFLAGS="-I/usr/local/include"
export LDFLAGS="-L/usr/local/lib"
(cd build_autotools && ../configure --disable-static)
gmake -C build_autotools -j`sysctl -n hw.ncpu` V=1

View File

@@ -6,10 +6,10 @@ jobs:
emscripten:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: mymindstorm/setup-emsdk@v10
- uses: actions/checkout@v4
- uses: mymindstorm/setup-emsdk@v14
with:
version: 2.0.32
version: 3.1.35
- name: Install ninja
run: |
sudo apt-get -y update

View File

@@ -15,6 +15,6 @@ jobs:
- { name: tvOS, target: Static Library-tvOS, sdk: appletvos }
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: xcodebuild -project Xcode/SDL/SDL.xcodeproj -target '${{ matrix.platform.target }}' -configuration Release -sdk ${{ matrix.platform.sdk }} clean build

View File

@@ -15,17 +15,22 @@ jobs:
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 }
- { 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: Intel oneAPI (Ubuntu 20.04), os: ubuntu-20.04, shell: bash, artifact: 'SDL-ubuntu20.04-oneapi', intel: true,
source_cmd: 'source /opt/intel/oneapi/setvars.sh; export CC=icx; export CXX=icx;'}
- { name: Intel Compiler (Ubuntu 20.04), os: ubuntu-20.04, shell: bash, artifact: 'SDL-ubuntu20.04-icc', intel: true, cmake: '-DSDL_CLANG_TIDY=OFF',
source_cmd: 'source /opt/intel/oneapi/setvars.sh; export CC=icc; export CXX=icpc; export CFLAGS=-diag-disable=10441; export CXXFLAGS=-diag-disable=10441; '}
- { 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
@@ -59,8 +64,27 @@ jobs:
if: runner.os == 'macOS'
run: |
brew install \
ninja
- uses: actions/checkout@v3
autoconf \
ninja \
pkg-config
- name: Setup Intel oneAPI
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
- uses: actions/checkout@v4
- 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"
@@ -68,6 +92,7 @@ jobs:
- name: Configure (CMake)
if: "! matrix.platform.autotools"
run: |
${{ matrix.platform.source_cmd }}
cmake -S . -B build -G Ninja \
-DSDL_TESTS=ON \
-DSDL_WERROR=ON \
@@ -79,13 +104,15 @@ jobs:
- name: Build (CMake)
if: "! matrix.platform.autotools"
run: |
${{ matrix.platform.source_cmd }}
cmake --build build/ --config Release --verbose --parallel
- name: Run build-time tests (CMake)
if: "! matrix.platform.autotools"
run: |
${{ matrix.platform.source_cmd }}
set -eu
export SDL_TESTS_QUICK=1
ctest -VV --test-dir build/
ctest -VV --test-dir build/ -j2
if test "${{ runner.os }}" = "Linux"; then
# This should show us the SDL_REVISION
strings build/libSDL2-2.0.so.0 | grep SDL-
@@ -100,6 +127,7 @@ jobs:
- name: Configure (Autotools)
if: matrix.platform.autotools
run: |
${{ matrix.platform.source_cmd }}
set -eu
rm -fr build-autotools
mkdir build-autotools
@@ -131,6 +159,7 @@ jobs:
- name: Build (Autotools)
if: matrix.platform.autotools
run: |
${{ matrix.platform.source_cmd }}
set -eu
parallel="$(getconf _NPROCESSORS_ONLN)"
make -j"${parallel}" -C build-autotools V=1
@@ -140,6 +169,7 @@ jobs:
- name: Run build-time tests (Autotools)
if: ${{ matrix.platform.autotools && (runner.os != 'macOS') }}
run: |
${{ matrix.platform.source_cmd }}
set -eu
curdir="$(pwd)"
parallel="$(getconf _NPROCESSORS_ONLN)"
@@ -152,6 +182,7 @@ jobs:
- name: Install (Autotools)
if: matrix.platform.autotools
run: |
${{ matrix.platform.source_cmd }}
set -eu
curdir="$(pwd)"
parallel="$(getconf _NPROCESSORS_ONLN)"
@@ -163,16 +194,19 @@ jobs:
echo "SDL2_DIR=$(pwd)/autotools_prefix" >> $GITHUB_ENV
- name: Verify CMake configuration files
run: |
${{ matrix.platform.source_cmd }}
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: |
${{ matrix.platform.source_cmd }}
export PATH=${{ env.SDL2_DIR }}/bin:$PATH
cmake/test/test_sdlconfig.sh
- name: Verify sdl2.pc
run: |
${{ matrix.platform.source_cmd }}
export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
cmake/test/test_pkgconfig.sh
- name: Distcheck (Autotools)
@@ -190,6 +224,7 @@ jobs:
- name: Run installed-tests (Autotools)
if: "runner.os == 'Linux' && matrix.platform.autotools"
run: |
${{ matrix.platform.source_cmd }}
set -eu
parallel="$(getconf _NPROCESSORS_ONLN)"
sudo make -j"${parallel}" -C build-autotools install

View File

@@ -23,7 +23,7 @@ jobs:
project: VisualC-WinRT/SDL-UWP.sln, projectflags: '/p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17763.0' }
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Create CMake project using SDL as a subproject
shell: python
run: |
@@ -34,8 +34,14 @@ jobs:
os.makedirs(builddir)
with open(f"{ builddir }/CMakeLists.txt", "w") as f:
f.write(textwrap.dedent(f"""\
cmake_minimum_required(VERSION 3.0)
# Always build .PDB symbol file
set(CMAKE_POLICY_DEFAULT_CMP0141 "NEW" CACHE STRING "MSVC debug information format flags are selected by an abstraction")
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase" CACHE STRING "MSVC debug information format")
set(CMAKE_EXE_LINKER_FLAGS "-DEBUG" CACHE STRING "Linker flags for executables")
set(CMAKE_SHARED_LINKER_FLAGS "-DEBUG" CACHE STRING "Linker flag for shared libraries")
cmake_minimum_required(VERSION 3.0...3.25)
project(sdl_user)
enable_testing()
add_subdirectory("{ srcdir }" SDL)
"""))
- name: Configure (CMake)
@@ -53,7 +59,7 @@ jobs:
if: "! contains(matrix.platform.name, 'ARM')"
run: |
$env:SDL_TESTS_QUICK=1
ctest -VV --test-dir build/ -C Release
ctest -VV --test-dir build/ -C Release -j2
- name: Install (CMake)
run: |
echo "SDL2_DIR=$Env:GITHUB_WORKSPACE/prefix" >> $Env:GITHUB_ENV
@@ -68,7 +74,7 @@ jobs:
- name: Add msbuild to PATH
if: ${{ matrix.platform.project != '' }}
uses: microsoft/setup-msbuild@v1.1.3
uses: microsoft/setup-msbuild@v2
- name: Build msbuild
if: ${{ matrix.platform.project != '' }}
run: msbuild ${{ matrix.platform.project }} /m /p:BuildInParallel=true /p:Configuration=Release ${{ matrix.platform.projectflags }}

View File

@@ -8,7 +8,7 @@ jobs:
container:
image: devkitpro/devkitarm:latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install build requirements
run: |
apt update
@@ -38,5 +38,18 @@ jobs:
-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
- name: Extract CC/CXX/CFLAGS/CXXFLAGS from CMake toolchain
run: |
cmake -S .github/cmake -B /tmp/cmake_extract \
-DCMAKE_TOOLCHAIN_FILE=${DEVKITPRO}/cmake/3DS.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DVAR_PATH=/tmp/n3ds_env.txt
cat /tmp/n3ds_env.txt >> $GITHUB_ENV
- 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

View File

@@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
container: ps2dev/ps2dev:latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup dependencies
run: |
apk update
@@ -50,13 +50,13 @@ jobs:
- name: Verify sdl2-config
run: |
export CC=mips64r5900el-ps2-elf-gcc
export LDFLAGS="-L$PS2DEV/ps2sdk/ee/lib -L$PS2DEV/gsKit/lib -L$PS2DEV/ps2sdk/ports/lib"
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 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

View File

@@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
container: pspdev/pspdev:latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup dependencies
run: |
apk update
@@ -39,12 +39,12 @@ jobs:
- name: Verify sdl2-config
run: |
export CC=psp-gcc
export LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib"
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 LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib"
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

View File

@@ -18,7 +18,7 @@ jobs:
steps:
- name: Setup dependencies
run: apt-get update && apt-get install -y cmake ninja-build
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Configure (autotools)
if: ${{ contains(matrix.platform.name, 'autotools') }}
run: |

View File

@@ -8,19 +8,61 @@ defaults:
jobs:
vita:
name: ${{ matrix.platform.name }}
runs-on: ubuntu-latest
container:
image: vitasdk/vitasdk:latest
strategy:
fail-fast: false
matrix:
platform:
- { name: GLES (pib), os: windows-latest, pib: true }
- { name: GLES (PVR_PSP2 + gl4es4vita), os: windows-latest, pvr: true }
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install build requirements
run: |
apk update
apk add cmake ninja pkgconf bash
- name: Configure PVR_PSP2 (GLES)
if: ${{ !!matrix.platform.pvr }}
run: |
pvr_psp2_version=3.9
# 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/* ${VITASDK}/arm-vita-eabi/include
rm /tmp/v$pvr_psp2_version.zip
# 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 {} ${VITASDK}/arm-vita-eabi/lib \;
rm /tmp/vitasdk_stubs.zip
rm -rf /tmp/pvr_psp2_stubs
- name: Configure gl4es4vita (OpenGL)
if: ${{ !!matrix.platform.pvr }}
run: |
gl4es4vita_version=1.1.4
# 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${VITASDK}/arm-vita-eabi/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${VITASDK}/arm-vita-eabi/lib
- name: Configure CMake
run: |
cmake -S . -B build -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \
-DVIDEO_VITA_PIB=${{ !!matrix.platform.pib }} \
-DVIDEO_VITA_PVR=${{ !!matrix.platform.pvr }} \
-DSDL_WERROR=ON \
-DSDL_TESTS=ON \
-DSDL_INSTALL_TESTS=ON \

View File

@@ -14,7 +14,7 @@ jobs:
- { name: OS/2, makefile: Makefile.os2 }
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: open-watcom/setup-watcom@v0
- name: Build SDL2
run: |

9
.gitignore vendored
View File

@@ -15,7 +15,7 @@ build
gen
Build
buildbot
/VERSION
/VERSION.txt
*.so
*.so.*
@@ -62,6 +62,11 @@ cmake-build-*
xcuserdata
*.xcworkspace
# for QtCreator
CMakeLists.txt.user
build*/
*.pro.user*
# for Visual C++
.vs
Debug
@@ -98,6 +103,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 +179,7 @@ test/testyuv
test/torturethread
builddir/
!build-scripts/
debian/*.debhelper.log
debian/*.substvars
debian/*.tar.gz

View File

@@ -1,7 +1,8 @@
projectfullname = SDL_mixer
projectshortname = SDL_mixer
projectfullname = SDL2
projectshortname = SDL2
incsubdir = include
wikisubdir =
wikisubdir = SDL2
readmesubdir = docs
apiprefixregex = (SDL_|SDLK_|KMOD_|AUDIO_)
mainincludefname = SDL.h
versionfname = include/SDL_version.h
@@ -10,6 +11,7 @@ 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 stable SDL2, the current stable version; [SDL3](https://wiki.libsdl.org/SDL3/) is the current development version.)

View File

@@ -63,7 +63,6 @@ LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
LOCAL_CFLAGS += \
-Wall -Wextra \
-Wdocumentation \
-Wdocumentation-unknown-command \
-Wmissing-prototypes \
-Wunreachable-code-break \
-Wunneeded-internal-declaration \
@@ -78,6 +77,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-2024 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,8 +14,8 @@
LIBNAME = SDL2
MAJOR_VERSION = 2
MINOR_VERSION = 25
MICRO_VERSION = 1
MINOR_VERSION = 30
MICRO_VERSION = 6
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,12 +1,12 @@
# 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 = 25
MICRO_VERSION = 1
MINOR_VERSION = 30
MICRO_VERSION = 6
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
LIBHOME = .
@@ -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>$(SolutionDir)\shaders\buildshaders.bat $(SolutionDir)</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>$(SolutionDir)\shaders\buildshaders.bat $(SolutionDir) 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>$(SolutionDir)\shaders\buildshaders.bat $(SolutionDir)</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>$(SolutionDir)\shaders\buildshaders.bat $(SolutionDir) 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

@@ -1,5 +1,5 @@
/*
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2024 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

@@ -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

@@ -137,6 +137,7 @@
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<OmitDefaultLibName>true</OmitDefaultLibName>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -335,6 +336,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 +394,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 +438,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 +499,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 +507,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 +629,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.5)
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)
@@ -84,6 +86,8 @@ 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)
@@ -100,6 +104,8 @@ 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)

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

@@ -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.25.1</string>
<string>2.30.6</string>
<key>CFBundleSignature</key>
<string>SDLX</string>
<key>CFBundleVersion</key>
<string>2.25.1</string>
<string>2.30.6</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.30.6
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-2024 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

119
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
@@ -1365,7 +1365,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 +1380,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 +1409,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 +1540,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 +1680,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,
@@ -1930,7 +1923,7 @@ else
lt_cv_dlopen_self=yes
;;
mingw* | pw32* | cegcc*)
mingw* | windows* | pw32* | cegcc*)
lt_cv_dlopen=LoadLibrary
lt_cv_dlopen_libs=
;;
@@ -2298,7 +2291,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 +2349,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 +2518,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
@@ -2558,7 +2551,7 @@ cygwin* | mingw* | pw32* | cegcc*)
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
@@ -2571,14 +2564,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 +2621,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 +3260,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 +3369,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
@@ -3476,7 +3469,7 @@ cygwin*)
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.
@@ -3641,7 +3634,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 +3686,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 +3777,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 +3922,7 @@ case $host_os in
aix*)
symcode='[[BCDT]]'
;;
cygwin* | mingw* | pw32* | cegcc*)
cygwin* | mingw* | windows* | pw32* | cegcc*)
symcode='[[ABCDGISTW]]'
;;
hpux*)
@@ -4008,7 +4001,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 +4016,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};"\
@@ -4235,7 +4228,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 +4304,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 +4552,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 +4656,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 +4931,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 +4989,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 +5104,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 +5561,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 +5578,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 +5609,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.
@@ -6435,7 +6428,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 +6637,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 +6804,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 +6869,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 +7208,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 +7292,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 +7303,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 +8324,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 +8337,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 +8363,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

@@ -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,8 +60,8 @@ 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 = 25;
private static final int SDL_MICRO_VERSION = 1;
private static final int SDL_MINOR_VERSION = 30;
private static final int SDL_MICRO_VERSION = 6;
/*
// Display InputType.SOURCE/CLASS of events and devices
//
@@ -93,7 +93,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
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;
@@ -170,7 +170,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
*/
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) {
@@ -841,7 +843,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 +971,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 +995,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 +1005,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 +1095,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 +1185,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 +1345,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 +1359,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 +1620,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 +1673,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 +1689,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 +1703,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 +1758,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 +1772,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 +1801,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 +2005,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

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

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

@@ -1,10 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright 1992-2022 Free Software Foundation, Inc.
# Copyright 1992-2024 Free Software Foundation, Inc.
# shellcheck disable=SC2006,SC2268 # see below for rationale
timestamp='2022-05-25'
timestamp='2024-01-01'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -47,7 +47,7 @@ me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION]
Output the configuration name of the system \`$me' is run on.
Output the configuration name of the system '$me' is run on.
Options:
-h, --help print this help, then exit
@@ -60,13 +60,13 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright 1992-2022 Free Software Foundation, Inc.
Copyright 1992-2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help="
Try \`$me --help' for more information."
Try '$me --help' for more information."
# Parse command line
while test $# -gt 0 ; do
@@ -102,8 +102,8 @@ GUESS=
# temporary files to be created and, as you can see below, it is a
# headache to deal with in a portable fashion.
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated.
# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still
# use 'HOST_CC' if defined, but it is deprecated.
# Portable tmp directory creation inspired by the Autoconf team.
@@ -155,6 +155,9 @@ Linux|GNU|GNU/*)
set_cc_for_build
cat <<-EOF > "$dummy.c"
#if defined(__ANDROID__)
LIBC=android
#else
#include <features.h>
#if defined(__UCLIBC__)
LIBC=uclibc
@@ -162,6 +165,8 @@ Linux|GNU|GNU/*)
LIBC=dietlibc
#elif defined(__GLIBC__)
LIBC=gnu
#elif defined(__LLVM_LIBC__)
LIBC=llvm
#else
#include <stdarg.h>
/* First heuristic to detect musl libc. */
@@ -169,6 +174,7 @@ Linux|GNU|GNU/*)
LIBC=musl
#endif
#endif
#endif
EOF
cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
eval "$cc_set_libc"
@@ -459,7 +465,7 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
# Japanese Language versions have a version number like '4.1.3-JL'.
SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
GUESS=sparc-sun-sunos$SUN_REL
;;
@@ -904,7 +910,7 @@ EOF
fi
;;
*:FreeBSD:*:*)
UNAME_PROCESSOR=`/usr/bin/uname -p`
UNAME_PROCESSOR=`uname -p`
case $UNAME_PROCESSOR in
amd64)
UNAME_PROCESSOR=x86_64 ;;
@@ -966,11 +972,37 @@ EOF
GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
;;
x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*)
GUESS="$UNAME_MACHINE-pc-managarm-mlibc"
;;
*:[Mm]anagarm:*:*)
GUESS="$UNAME_MACHINE-unknown-managarm-mlibc"
;;
*:Minix:*:*)
GUESS=$UNAME_MACHINE-unknown-minix
;;
aarch64:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
set_cc_for_build
CPU=$UNAME_MACHINE
LIBCABI=$LIBC
if test "$CC_FOR_BUILD" != no_compiler_found; then
ABI=64
sed 's/^ //' << EOF > "$dummy.c"
#ifdef __ARM_EABI__
#ifdef __ARM_PCS_VFP
ABI=eabihf
#else
ABI=eabi
#endif
#endif
EOF
cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
eval "$cc_set_abi"
case $ABI in
eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;;
esac
fi
GUESS=$CPU-unknown-linux-$LIBCABI
;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
@@ -1036,7 +1068,16 @@ EOF
k1om:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
kvx:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
kvx:cos:*:*)
GUESS=$UNAME_MACHINE-unknown-cos
;;
kvx:mbr:*:*)
GUESS=$UNAME_MACHINE-unknown-mbr
;;
loongarch32:Linux:*:* | loongarch64:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
m32r*:Linux:*:*)
@@ -1191,7 +1232,7 @@ EOF
GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# If we were able to find 'uname', then EMX Unix compatibility
# is probably installed.
GUESS=$UNAME_MACHINE-pc-os2-emx
;;
@@ -1332,7 +1373,7 @@ EOF
GUESS=ns32k-sni-sysv
fi
;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
PENTIUM:*:4.0*:*) # Unisys 'ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
GUESS=i586-unisys-sysv4
;;
@@ -1554,6 +1595,9 @@ EOF
*:Unleashed:*:*)
GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
;;
*:Ironclad:*:*)
GUESS=$UNAME_MACHINE-unknown-ironclad
;;
esac
# Do we have a guess based on uname results?

View File

@@ -1,10 +1,10 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright 1992-2022 Free Software Foundation, Inc.
# Copyright 1992-2024 Free Software Foundation, Inc.
# shellcheck disable=SC2006,SC2268 # see below for rationale
timestamp='2022-01-03'
timestamp='2024-01-01'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -76,13 +76,13 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright 1992-2022 Free Software Foundation, Inc.
Copyright 1992-2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help="
Try \`$me --help' for more information."
Try '$me --help' for more information."
# Parse command line
while test $# -gt 0 ; do
@@ -130,7 +130,7 @@ IFS=$saved_IFS
# Separate into logical components for further validation
case $1 in
*-*-*-*-*)
echo Invalid configuration \`"$1"\': more than four components >&2
echo "Invalid configuration '$1': more than four components" >&2
exit 1
;;
*-*-*-*)
@@ -145,7 +145,8 @@ case $1 in
nto-qnx* | linux-* | uclinux-uclibc* \
| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
| storm-chaos* | os2-emx* | rtmk-nova*)
| storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \
| windows-* )
basic_machine=$field1
basic_os=$maybe_os
;;
@@ -943,7 +944,7 @@ $basic_machine
EOF
IFS=$saved_IFS
;;
# We use `pc' rather than `unknown'
# We use 'pc' rather than 'unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
i*86 | x86_64)
@@ -1075,7 +1076,7 @@ case $cpu-$vendor in
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
cpu=i586
;;
pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*)
cpu=i686
;;
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
@@ -1180,7 +1181,7 @@ case $cpu-$vendor in
case $cpu in
1750a | 580 \
| a29k \
| aarch64 | aarch64_be \
| aarch64 | aarch64_be | aarch64c | arm64ec \
| abacus \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
@@ -1199,50 +1200,29 @@ case $cpu-$vendor in
| d10v | d30v | dlx | dsp16xx \
| e2k | elxsi | epiphany \
| f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
| javascript \
| h8300 | h8500 \
| hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i*86 | i860 | i960 | ia16 | ia64 \
| ip2k | iq2000 \
| k1om \
| kvx \
| le32 | le64 \
| lm32 \
| loongarch32 | loongarch64 | loongarchx32 \
| loongarch32 | loongarch64 \
| m32c | m32r | m32rle \
| m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
| m88110 | m88k | maxq | mb | mcore | mep | metag \
| microblaze | microblazeel \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64eb | mips64el \
| mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \
| mips64r5900 | mips64r5900el \
| mips64vr | mips64vrel \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa32r3 | mipsisa32r3el \
| mipsisa32r5 | mipsisa32r5el \
| mipsisa32r6 | mipsisa32r6el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64r3 | mipsisa64r3el \
| mipsisa64r5 | mipsisa64r5el \
| mipsisa64r6 | mipsisa64r6el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mips* \
| mmix \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nanomips* \
| nds32 | nds32le | nds32be \
| nfp \
| nios | nios2 | nios2eb | nios2el \
@@ -1274,6 +1254,7 @@ case $cpu-$vendor in
| ubicom32 \
| v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
| vax \
| vc4 \
| visium \
| w65 \
| wasm32 | wasm64 \
@@ -1285,7 +1266,7 @@ case $cpu-$vendor in
;;
*)
echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
echo "Invalid configuration '$1': machine '$cpu-$vendor' not recognized" 1>&2
exit 1
;;
esac
@@ -1306,11 +1287,12 @@ esac
# Decode manufacturer-specific aliases for certain operating systems.
if test x$basic_os != x
if test x"$basic_os" != x
then
# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just
# set os.
obj=
case $basic_os in
gnu/linux*)
kernel=linux
@@ -1341,6 +1323,10 @@ EOF
kernel=linux
os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
;;
managarm*)
kernel=managarm
os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'`
;;
*)
kernel=
os=$basic_os
@@ -1506,10 +1492,16 @@ case $os in
os=eabi
;;
*)
os=elf
os=
obj=elf
;;
esac
;;
aout* | coff* | elf* | pe*)
# These are machine code file formats, not OSes
obj=$os
os=
;;
*)
# No normalization, but not necessarily accepted, that comes below.
;;
@@ -1528,12 +1520,15 @@ else
# system, and we'll never get to this point.
kernel=
obj=
case $cpu-$vendor in
score-*)
os=elf
os=
obj=elf
;;
spu-*)
os=elf
os=
obj=elf
;;
*-acorn)
os=riscix1.2
@@ -1543,28 +1538,35 @@ case $cpu-$vendor in
os=gnu
;;
arm*-semi)
os=aout
os=
obj=aout
;;
c4x-* | tic4x-*)
os=coff
os=
obj=coff
;;
c8051-*)
os=elf
os=
obj=elf
;;
clipper-intergraph)
os=clix
;;
hexagon-*)
os=elf
os=
obj=elf
;;
tic54x-*)
os=coff
os=
obj=coff
;;
tic55x-*)
os=coff
os=
obj=coff
;;
tic6x-*)
os=coff
os=
obj=coff
;;
# This must come before the *-dec entry.
pdp10-*)
@@ -1586,19 +1588,24 @@ case $cpu-$vendor in
os=sunos3
;;
m68*-cisco)
os=aout
os=
obj=aout
;;
mep-*)
os=elf
os=
obj=elf
;;
mips*-cisco)
os=elf
os=
obj=elf
;;
mips*-*)
os=elf
mips*-*|nanomips*-*)
os=
obj=elf
;;
or32-*)
os=coff
os=
obj=coff
;;
*-tti) # must be before sparc entry or we get the wrong os.
os=sysv3
@@ -1607,7 +1614,8 @@ case $cpu-$vendor in
os=sunos4.1.1
;;
pru-*)
os=elf
os=
obj=elf
;;
*-be)
os=beos
@@ -1688,10 +1696,12 @@ case $cpu-$vendor in
os=uxpv
;;
*-rom68k)
os=coff
os=
obj=coff
;;
*-*bug)
os=coff
os=
obj=coff
;;
*-apple)
os=macos
@@ -1709,10 +1719,11 @@ esac
fi
# Now, validate our (potentially fixed-up) OS.
# Now, validate our (potentially fixed-up) individual pieces (OS, OBJ).
case $os in
# Sometimes we do "kernel-libc", so those need to count as OSes.
musl* | newlib* | relibc* | uclibc*)
llvm* | musl* | newlib* | relibc* | uclibc*)
;;
# Likewise for "kernel-abi"
eabi* | gnueabi*)
@@ -1720,6 +1731,9 @@ case $os in
# VxWorks passes extra cpu info in the 4th filed.
simlinux | simwindows | spe)
;;
# See `case $cpu-$os` validation below
ghcjs)
;;
# Now accept the basic system types.
# The portable systems comes first.
# Each alternative MUST end in a * to match a version number.
@@ -1728,7 +1742,7 @@ case $os in
| hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
| sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \
| hiux* | abug | nacl* | netware* | windows* \
| os9* | macos* | osx* | ios* \
| os9* | macos* | osx* | ios* | tvos* | watchos* \
| mpw* | magic* | mmixware* | mon960* | lnews* \
| amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
| aos* | aros* | cloudabi* | sortix* | twizzler* \
@@ -1737,11 +1751,11 @@ case $os in
| mirbsd* | netbsd* | dicos* | openedition* | ose* \
| bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
| ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
| bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
| ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
| bosx* | nextstep* | cxux* | oabi* \
| ptx* | ecoff* | winnt* | domain* | vsta* \
| udi* | lites* | ieee* | go32* | aux* | hcos* \
| chorusrdb* | cegcc* | glidix* | serenity* \
| cygwin* | msys* | pe* | moss* | proelf* | rtems* \
| cygwin* | msys* | moss* | proelf* | rtems* \
| midipix* | mingw32* | mingw64* | mint* \
| uxpv* | beos* | mpeix* | udk* | moxiebox* \
| interix* | uwin* | mks* | rhapsody* | darwin* \
@@ -1754,49 +1768,116 @@ case $os in
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
| midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
| nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
| fiwix* )
| fiwix* | mlibc* | cos* | mbr* | ironclad* )
;;
# This one is extra strict with allowed versions
sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
# Don't forget version if it is 3.2v4 or newer.
;;
# This refers to builds using the UEFI calling convention
# (which depends on the architecture) and PE file format.
# Note that this is both a different calling convention and
# different file format than that of GNU-EFI
# (x86_64-w64-mingw32).
uefi)
;;
none)
;;
kernel* | msvc* )
# Restricted further below
;;
'')
if test x"$obj" = x
then
echo "Invalid configuration '$1': Blank OS only allowed with explicit machine code file format" 1>&2
fi
;;
*)
echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2
exit 1
;;
esac
case $obj in
aout* | coff* | elf* | pe*)
;;
'')
# empty is fine
;;
*)
echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2
exit 1
;;
esac
# Here we handle the constraint that a (synthetic) cpu and os are
# valid only in combination with each other and nowhere else.
case $cpu-$os in
# The "javascript-unknown-ghcjs" triple is used by GHC; we
# accept it here in order to tolerate that, but reject any
# variations.
javascript-ghcjs)
;;
javascript-* | *-ghcjs)
echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2
exit 1
;;
esac
# As a final step for OS-related things, validate the OS-kernel combination
# (given a valid OS), if there is a kernel.
case $kernel-$os in
linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
| linux-musl* | linux-relibc* | linux-uclibc* )
case $kernel-$os-$obj in
linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \
| linux-mlibc*- | linux-musl*- | linux-newlib*- \
| linux-relibc*- | linux-uclibc*- )
;;
uclinux-uclibc* )
uclinux-uclibc*- )
;;
-dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* )
managarm-mlibc*- | managarm-kernel*- )
;;
windows*-msvc*-)
;;
-dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \
| -uclibc*- )
# These are just libc implementations, not actual OSes, and thus
# require a kernel.
echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2
exit 1
;;
kfreebsd*-gnu* | kopensolaris*-gnu*)
-kernel*- )
echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2
exit 1
;;
vxworks-simlinux | vxworks-simwindows | vxworks-spe)
*-kernel*- )
echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2
exit 1
;;
nto-qnx*)
*-msvc*- )
echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2
exit 1
;;
os2-emx)
kfreebsd*-gnu*- | kopensolaris*-gnu*-)
;;
*-eabi* | *-gnueabi*)
vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-)
;;
-*)
nto-qnx*-)
;;
os2-emx-)
;;
*-eabi*- | *-gnueabi*-)
;;
none--*)
# None (no kernel, i.e. freestanding / bare metal),
# can be paired with an machine code file format
;;
-*-)
# Blank kernel with real OS is always fine.
;;
*-*)
echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
--*)
# Blank kernel and OS with real machine code file format is always fine.
;;
*-*-*)
echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2
exit 1
;;
esac
@@ -1879,7 +1960,7 @@ case $vendor in
;;
esac
echo "$cpu-$vendor-${kernel:+$kernel-}$os"
echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}"
exit
# Local variables:

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2024 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
@@ -395,7 +395,7 @@ int main(void)
printf(
"/*\n"
" Simple DirectMedia Layer\n"
" Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>\n"
" Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>\n"
"\n"
" This software is provided 'as-is', without any express or implied\n"
" warranty. In no event will the authors be held liable for any damages\n"

View File

@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2024 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
@@ -113,7 +113,7 @@ int main(void)
printf(
"/*\n"
" Simple DirectMedia Layer\n"
" Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>\n"
" Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>\n"
"\n"
" This software is provided 'as-is', without any express or implied\n"
" warranty. In no event will the authors be held liable for any damages\n"

View File

@@ -2418,7 +2418,7 @@ libtool_validate_options ()
case $host in
# Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
# see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
*cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
*cygwin* | *mingw* | *windows* | *pw32* | *cegcc* | *solaris2* | *os2*)
# don't eliminate duplications in $postdeps and $predeps
opt_duplicate_compiler_generated_deps=:
;;
@@ -2750,7 +2750,7 @@ EOF
# func_convert_core_file_wine_to_w32 ARG
# Helper function used by file name conversion functions when $build is *nix,
# and $host is mingw, cygwin, or some other w32 environment. Relies on a
# and $host is mingw, windows, cygwin, or some other w32 environment. Relies on a
# correctly configured wine environment available, with the winepath program
# in $build's $PATH.
#
@@ -2782,9 +2782,10 @@ func_convert_core_file_wine_to_w32 ()
# func_convert_core_path_wine_to_w32 ARG
# Helper function used by path conversion functions when $build is *nix, and
# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
# configured wine environment available, with the winepath program in $build's
# $PATH. Assumes ARG has no leading or trailing path separator characters.
# $host is mingw, windows, cygwin, or some other w32 environment. Relies on a
# correctly configured wine environment available, with the winepath program
# in $build's $PATH. Assumes ARG has no leading or trailing path separator
# characters.
#
# ARG is path to be converted from $build format to win32.
# Result is available in $func_convert_core_path_wine_to_w32_result.
@@ -3439,7 +3440,7 @@ func_mode_compile ()
# On Cygwin there's no "real" PIC flag so we must build both object types
case $host_os in
cygwin* | mingw* | pw32* | os2* | cegcc*)
cygwin* | mingw* | windows* | pw32* | os2* | cegcc*)
pic_mode=default
;;
esac
@@ -4316,7 +4317,7 @@ func_mode_install ()
'exit $?'
tstripme=$stripme
case $host_os in
cygwin* | mingw* | pw32* | cegcc*)
cygwin* | mingw* | windows* | pw32* | cegcc*)
case $realname in
*.dll.a)
tstripme=
@@ -4429,7 +4430,7 @@ func_mode_install ()
# Do a test to see if this is really a libtool program.
case $host in
*cygwin* | *mingw*)
*cygwin* | *mingw* | *windows*)
if func_ltwrapper_executable_p "$file"; then
func_ltwrapper_scriptname "$file"
wrapper=$func_ltwrapper_scriptname_result
@@ -4657,7 +4658,7 @@ extern \"C\" {
$RM $export_symbols
eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
case $host in
*cygwin* | *mingw* | *cegcc* )
*cygwin* | *mingw* | *windows* | *cegcc* )
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
;;
@@ -4669,7 +4670,7 @@ extern \"C\" {
eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
eval '$MV "$nlist"T "$nlist"'
case $host in
*cygwin* | *mingw* | *cegcc* )
*cygwin* | *mingw* | *windows* | *cegcc* )
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
;;
@@ -4683,7 +4684,7 @@ extern \"C\" {
func_basename "$dlprefile"
name=$func_basename_result
case $host in
*cygwin* | *mingw* | *cegcc* )
*cygwin* | *mingw* | *windows* | *cegcc* )
# if an import library, we need to obtain dlname
if func_win32_import_lib_p "$dlprefile"; then
func_tr_sh "$dlprefile"
@@ -4858,7 +4859,7 @@ static const void *lt_preloaded_setup() {
# Transform the symbol file into the correct name.
symfileobj=$output_objdir/${my_outputname}S.$objext
case $host in
*cygwin* | *mingw* | *cegcc* )
*cygwin* | *mingw* | *windows* | *cegcc* )
if test -f "$output_objdir/$my_outputname.def"; then
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
@@ -5201,7 +5202,7 @@ func_extract_archives ()
#
# Emit a libtool wrapper script on stdout.
# Don't directly open a file because we may want to
# incorporate the script contents within a cygwin/mingw
# incorporate the script contents within a cygwin/mingw/windows
# wrapper executable. Must ONLY be called from within
# func_mode_link because it depends on a number of variables
# set therein.
@@ -5209,7 +5210,7 @@ func_extract_archives ()
# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
# variable will take. If 'yes', then the emitted script
# will assume that the directory where it is stored is
# the $objdir directory. This is a cygwin/mingw-specific
# the $objdir directory. This is a cygwin/mingw/windows-specific
# behavior.
func_emit_wrapper ()
{
@@ -5333,7 +5334,7 @@ func_exec_program_core ()
"
case $host in
# Backslashes separate directories on plain windows
*-*-mingw | *-*-os2* | *-cegcc*)
*-*-mingw* | *-*-windows* | *-*-os2* | *-cegcc*)
$ECHO "\
if test -n \"\$lt_option_debug\"; then
\$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
@@ -5401,7 +5402,7 @@ func_exec_program ()
file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
done
# Usually 'no', except on cygwin/mingw when embedded into
# Usually 'no', except on cygwin/mingw/windows when embedded into
# the cwrapper.
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
@@ -5558,7 +5559,7 @@ EOF
/* declarations of non-ANSI functions */
#if defined __MINGW32__
# ifdef __STRICT_ANSI__
int _putenv (const char *);
_CRTIMP int __cdecl _putenv (const char *);
# endif
#elif defined __CYGWIN__
# ifdef __STRICT_ANSI__
@@ -5756,7 +5757,7 @@ main (int argc, char *argv[])
{
EOF
case $host in
*mingw* | *cygwin* )
*mingw* | *windows* | *cygwin* )
# make stdout use "unix" line endings
echo " setmode(1,_O_BINARY);"
;;
@@ -5859,7 +5860,7 @@ EOF
EOF
case $host_os in
mingw*)
mingw* | windows*)
cat <<"EOF"
{
char* p;
@@ -5901,7 +5902,7 @@ EOF
EOF
case $host_os in
mingw*)
mingw* | windows*)
cat <<"EOF"
/* execv doesn't actually work on mingw as expected on unix */
newargz = prepare_spawn (newargz);
@@ -6320,7 +6321,7 @@ lt_update_lib_path (const char *name, const char *value)
EOF
case $host_os in
mingw*)
mingw* | windows*)
cat <<"EOF"
/* Prepares an argument vector before calling spawn().
@@ -6495,7 +6496,7 @@ func_mode_link ()
$debug_cmd
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
*-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-cegcc*)
# It is impossible to link a dll without this setting, and
# we shouldn't force the makefile maintainer to figure out
# what system we are compiling for in order to pass an extra
@@ -7003,7 +7004,7 @@ func_mode_link ()
;;
esac
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
*-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-cegcc*)
testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$dir:"*) ;;
@@ -7023,7 +7024,7 @@ func_mode_link ()
-l*)
if test X-lc = "X$arg" || test X-lm = "X$arg"; then
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
*-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
# These systems don't actually have a C or math library (as such)
continue
;;
@@ -7118,7 +7119,7 @@ func_mode_link ()
-no-install)
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
*-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
# The PATH hackery in wrapper scripts is required on Windows
# and Darwin in order for the loader to find any dlls it needs.
func_warning "'-no-install' is ignored for $host"
@@ -7303,13 +7304,26 @@ func_mode_link ()
# -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
# -specs=* GCC specs files
# -stdlib=* select c++ std lib with clang
# -fdiagnostics-color* simply affects output
# -frecord-gcc-switches used to verify flags were respected
# -fsanitize=* Clang/GCC memory and address sanitizer
# -fno-sanitize* Clang/GCC memory and address sanitizer
# -shared-libsan Link with shared sanitizer runtimes (Clang)
# -static-libsan Link with static sanitizer runtimes (Clang)
# -fuse-ld=* Linker select flags for GCC
# -rtlib=* select c runtime lib with clang
# --unwindlib=* select unwinder library with clang
# -f{file|debug|macro|profile}-prefix-map=* needed for lto linking
# -Wa,* Pass flags directly to the assembler
# -Werror, -Werror=* Report (specified) warnings as errors
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
-t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
-O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
-specs=*|-fsanitize=*|-fuse-ld=*|-Wa,*)
-O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*| \
-stdlib=*|-rtlib=*|--unwindlib=*| \
-specs=*|-fsanitize=*|-fno-sanitize*|-shared-libsan|-static-libsan| \
-ffile-prefix-map=*|-fdebug-prefix-map=*|-fmacro-prefix-map=*|-fprofile-prefix-map=*| \
-fdiagnostics-color*|-frecord-gcc-switches| \
-fuse-ld=*|-Wa,*|-Werror|-Werror=*)
func_quote_for_eval "$arg"
arg=$func_quote_for_eval_result
func_append compile_command " $arg"
@@ -8022,7 +8036,7 @@ func_mode_link ()
fi
case $host in
# special handling for platforms with PE-DLLs.
*cygwin* | *mingw* | *cegcc* )
*cygwin* | *mingw* | *windows* | *cegcc* )
# Linker will automatically link against shared library if both
# static and shared are present. Therefore, ensure we extract
# symbols from the import library if a shared library is present
@@ -8166,7 +8180,7 @@ func_mode_link ()
if test -n "$library_names" &&
{ test no = "$use_static_libs" || test -z "$old_library"; }; then
case $host in
*cygwin* | *mingw* | *cegcc* | *os2*)
*cygwin* | *mingw* | *windows* | *cegcc* | *os2*)
# No point in relinking DLLs because paths are not encoded
func_append notinst_deplibs " $lib"
need_relink=no
@@ -8236,7 +8250,7 @@ func_mode_link ()
elif test -n "$soname_spec"; then
# bleh windows
case $host in
*cygwin* | mingw* | *cegcc*) # | *os2* # SDL customization: removed OS/2 versioning support.
*cygwin* | mingw* | *windows* | *cegcc*) # | *os2* # SDL customization: removed OS/2 versioning support.
func_arith $current - $age
major=$func_arith_result
versuffix=-$major
@@ -8845,7 +8859,7 @@ func_mode_link ()
age=$number_minor
revision=$number_revision
;;
freebsd-aout|qnx|sunos)
freebsd-aout|qnx|sco|sunos)
current=$number_major
revision=$number_minor
age=0
@@ -9146,7 +9160,7 @@ func_mode_link ()
if test yes = "$build_libtool_libs"; then
if test -n "$rpath"; then
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
*-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
# these systems don't actually have a c library (as such)!
;;
*-*-rhapsody* | *-*-darwin1.[012])
@@ -9660,7 +9674,7 @@ EOF
orig_export_symbols=
case $host_os in
cygwin* | mingw* | cegcc*)
cygwin* | mingw* | windows* | cegcc*)
if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
# exporting using user supplied symfile
func_dll_def_p "$export_symbols" || {
@@ -10330,7 +10344,7 @@ EOF
esac
fi
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
*-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-cegcc*)
testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$libdir:"*) ;;
@@ -10408,7 +10422,7 @@ EOF
# Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
wrappers_required=false
;;
*cygwin* | *mingw* )
*cygwin* | *mingw* | *windows* )
test yes = "$build_libtool_libs" || wrappers_required=false
;;
*)
@@ -10561,7 +10575,7 @@ EOF
*) exeext= ;;
esac
case $host in
*cygwin* | *mingw* )
*cygwin* | *mingw* | windows* )
func_dirname_and_basename "$output" "" "."
output_name=$func_basename_result
output_path=$func_dirname_result
@@ -10893,7 +10907,7 @@ EOF
# tests/bindir.at for full details.
tdlname=$dlname
case $host,$output,$installed,$module,$dlname in
*cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
*cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *windows*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
# If a -bindir argument was supplied, place the dll there.
if test -n "$bindir"; then
func_relative_path "$install_libdir" "$bindir"

View File

@@ -5,8 +5,8 @@
SDL_ROOT=$(dirname $0)/..
cd $SDL_ROOT
if [ -e ./VERSION ]; then
cat ./VERSION
if [ -e ./VERSION.txt ]; then
cat ./VERSION.txt
exit 0
fi

View File

@@ -4,6 +4,8 @@
set -eu
cd `dirname $0`/..
ref_major=$(sed -ne 's/^#define SDL_MAJOR_VERSION *//p' include/SDL_version.h)
ref_minor=$(sed -ne 's/^#define SDL_MINOR_VERSION *//p' include/SDL_version.h)
ref_micro=$(sed -ne 's/^#define SDL_PATCHLEVEL *//p' include/SDL_version.h)
@@ -139,6 +141,25 @@ else
not_ok "Info-Framework.plist CFBundleVersion $version disagrees with SDL_version.h $ref_version"
fi
version=$(sed -Ene 's/Title SDL (.*)/\1/p' Xcode/SDL/pkg-support/SDL.info)
if [ "$ref_version" = "$version" ]; then
ok "SDL.info Title $version"
else
not_ok "SDL.info Title $version disagrees with SDL_version.h $ref_version"
fi
marketing=$(sed -Ene 's/.*MARKETING_VERSION = (.*);/\1/p' Xcode/SDL/SDL.xcodeproj/project.pbxproj)
ref="$ref_version
$ref_version"
if [ "$ref" = "$marketing" ]; then
ok "project.pbxproj MARKETING_VERSION is consistent"
else
not_ok "project.pbxproj MARKETING_VERSION is inconsistent, expected $ref, got $marketing"
fi
# For simplicity this assumes we'll never break ABI before SDL 3.
dylib_compat=$(sed -Ene 's/.*DYLIB_COMPATIBILITY_VERSION = (.*);$/\1/p' Xcode/SDL/SDL.xcodeproj/project.pbxproj)

View File

@@ -1,7 +1,15 @@
#!/bin/sh
find . -type f -exec grep -Il "Copyright" {} \; \
if [ "$SED" = "" ]; then
if type gsed >/dev/null; then
SED=gsed
else
SED=sed
fi
fi
find . -type f \
| grep -v \.git \
| while read file; do \
LC_ALL=C sed -b -i "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$file"; \
LC_ALL=C $SED -b -i "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$file"; \
done

View File

@@ -30,6 +30,10 @@ echo "Updating version to '$NEWVERSION' ..."
# !!! FIXME: This first one is a kinda scary search/replace that might fail later if another X.Y.Z version is added to the file.
perl -w -pi -e 's/(\<string\>)\d+\.\d+\.\d+/${1}'$NEWVERSION'/;' Xcode/SDL/Info-Framework.plist
perl -w -pi -e 's/(Title SDL )\d+\.\d+\.\d+/${1}'$NEWVERSION'/;' Xcode/SDL/pkg-support/SDL.info
perl -w -pi -e 's/(MARKETING_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$NEWVERSION'/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
DYVER=`expr $MINOR \* 100 + 1`
perl -w -pi -e 's/(DYLIB_CURRENT_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$DYVER'.0.0/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj

View File

@@ -29,7 +29,7 @@ done
rev=`sh showrev.sh 2>/dev/null`
if [ "$rev" != "" ]; then
if [ -n "$dist" ]; then
echo "$rev" > "$outdir/VERSION"
echo "$rev" > "$outdir/VERSION.txt"
fi
echo "/* Generated by updaterev.sh, do not edit */" >"$header.new"
if [ -n "$vendor" ]; then

View File

@@ -10,6 +10,7 @@ my $projectfullname = 'Simple Directmedia Layer';
my $projectshortname = 'SDL';
my $wikisubdir = '';
my $incsubdir = 'include';
my $readmesubdir = undef;
my $apiprefixregex = undef;
my $versionfname = 'include/SDL_version.h';
my $versionmajorregex = '\A\#define\s+SDL_MAJOR_VERSION\s+(\d+)\Z';
@@ -22,10 +23,12 @@ my $wikiurl = 'https://wiki.libsdl.org';
my $bugreporturl = 'https://github.com/libsdl-org/sdlwiki/issues/new';
my $srcpath = undef;
my $wikipath = undef;
my $wikireadmesubdir = 'README';
my $warn_about_missing = 0;
my $copy_direction = 0;
my $optionsfname = undef;
my $wikipreamble = undef;
my $changeformat = undef;
foreach (@ARGV) {
$warn_about_missing = 1, next if $_ eq '--warn-about-missing';
@@ -36,6 +39,9 @@ foreach (@ARGV) {
if (/\A--options=(.*)\Z/) {
$optionsfname = $1;
next;
} elsif (/\A--changeformat=(.*)\Z/) {
$changeformat = $1;
next;
}
$srcpath = $_, next if not defined $srcpath;
$wikipath = $_, next if not defined $wikipath;
@@ -67,6 +73,7 @@ if (defined $optionsfname) {
$projectshortname = $val, next if $key eq 'projectshortname';
$wikisubdir = $val, next if $key eq 'wikisubdir';
$incsubdir = $val, next if $key eq 'incsubdir';
$readmesubdir = $val, next if $key eq 'readmesubdir';
$versionmajorregex = $val, next if $key eq 'versionmajorregex';
$versionminorregex = $val, next if $key eq 'versionminorregex';
$versionpatchregex = $val, next if $key eq 'versionpatchregex';
@@ -131,6 +138,7 @@ sub wordwrap_with_bullet_indent { # don't call this directly.
my $usual_prefix = ' ' x $bulletlen;
foreach (@wrappedlines) {
s/\s*\Z//;
$retval .= "$prefix$_\n";
$prefix = $usual_prefix;
}
@@ -255,10 +263,30 @@ sub wikify_chunk {
$str .= "<syntaxhighlight lang='$codelang'>$code<\/syntaxhighlight>";
}
} elsif ($wikitype eq 'md') {
# convert `code` things first, so they aren't mistaken for other markdown items.
my $codedstr = '';
while ($str =~ s/\A(.*?)(\`.*?\`)//ms) {
my $codeblock = $2;
$codedstr .= wikify_chunk($wikitype, $1, undef, undef);
if (defined $apiprefixregex) {
# Convert obvious API things to wikilinks, even inside `code` blocks,
# BUT ONLY IF the entire code block is the API thing,
# So something like "just call `SDL_Whatever`" will become
# "just call [`SDL_Whatever`](SDL_Whatever)", but
# "just call `SDL_Whatever(7)`" will not. It's just the safest
# way to do this without resorting to wrapping things in html <code> tags.
$codeblock =~ s/\A\`($apiprefixregex[a-zA-Z0-9_]+)\`\Z/[`$1`]($1)/gms;
}
$codedstr .= $codeblock;
}
# Convert obvious API things to wikilinks.
if (defined $apiprefixregex) {
$str =~ s/\b($apiprefixregex[a-zA-Z0-9_]+)/[$1]($1)/gms;
}
$str = $codedstr . $str;
if (defined $code) {
$str .= "```$codelang$code```";
}
@@ -325,6 +353,11 @@ sub dewikify_chunk {
# bullets
$str =~ s/^\* /- /gm;
} elsif ($wikitype eq 'md') {
# Dump obvious wikilinks. The rest can just passthrough.
if (defined $apiprefixregex) {
$str =~ s/\[(\`?$apiprefixregex[a-zA-Z0-9_]+\`?)\]\($apiprefixregex[a-zA-Z0-9_]+\)/$1/gms;
}
}
if (defined $code) {
@@ -355,6 +388,30 @@ sub dewikify_chunk {
# bullets
$str =~ s/^\* /\n\\\(bu /gm;
} elsif ($wikitype eq 'md') {
# Dump obvious wikilinks.
if (defined $apiprefixregex) {
$str =~ s/\[(\`?$apiprefixregex[a-zA-Z0-9_]+\`?)\]\($apiprefixregex[a-zA-Z0-9_]+\)/\n.BR $1\n/gms;
}
# links
$str =~ s/\[(.*?)]\((https?\:\/\/.*?)\)/\n.URL "$2" "$1"\n/g;
# <code></code> is also popular. :/
$str =~ s/\s*\`(.*?)\`\s*/\n.BR $1\n/gms;
# bold+italic
$str =~ s/\s*\*\*\*(.*?)\*\*\*\s*/\n.BI $1\n/gms;
# bold
$str =~ s/\s*\*\*(.*?)\*\*\s*/\n.B $1\n/gms;
# italic
$str =~ s/\s*\*(.*?)\*\s*/\n.I $1\n/gms;
# bullets
$str =~ s/^\- /\n\\\(bu /gm;
} else {
die("Unexpected wikitype when converting to manpages\n"); # !!! FIXME: need to handle Markdown wiki pages.
}
@@ -399,6 +456,23 @@ sub dewikify {
return $retval;
}
sub filecopy {
my $src = shift;
my $dst = shift;
my $endline = shift;
$endline = "\n" if not defined $endline;
open(COPYIN, '<', $src) or die("Failed to open '$src' for reading: $!\n");
open(COPYOUT, '>', $dst) or die("Failed to open '$dst' for writing: $!\n");
while (<COPYIN>) {
chomp;
s/[ \t\r\n]*\Z//;
print COPYOUT "$_$endline";
}
close(COPYOUT);
close(COPYIN);
}
sub usage {
die("USAGE: $0 <source code git clone path> <wiki git clone path> [--copy-to-headers|--copy-to-wiki|--copy-to-manpages] [--warn-about-missing]\n\n");
}
@@ -415,6 +489,7 @@ my @standard_wiki_sections = (
'Function Parameters',
'Return Value',
'Remarks',
'Thread Safety',
'Version',
'Code Examples',
'Related Functions'
@@ -438,9 +513,15 @@ my %headerfuncshasdoxygen = (); # $headerfuncschunk{"SDL_OpenAudio"} -> 1 if t
my $incpath = "$srcpath";
$incpath .= "/$incsubdir" if $incsubdir ne '';
my $wikireadmepath = "$wikipath/$wikireadmesubdir";
my $readmepath = undef;
if (defined $readmesubdir) {
$readmepath = "$srcpath/$readmesubdir";
}
opendir(DH, $incpath) or die("Can't opendir '$incpath': $!\n");
while (readdir(DH)) {
my $dent = $_;
while (my $d = readdir(DH)) {
my $dent = $d;
next if not $dent =~ /$selectheaderregex/; # just selected headers.
open(FH, '<', "$incpath/$dent") or die("Can't open '$incpath/$dent': $!\n");
@@ -588,8 +669,8 @@ my %wikitypes = (); # contains string of wiki page extension, like $wikitypes{"
my %wikifuncs = (); # contains references to hash of strings, each string being the full contents of a section of a wiki page, like $wikifuncs{"SDL_OpenAudio"}{"Remarks"}.
my %wikisectionorder = (); # contains references to array, each array item being a key to a wikipage section in the correct order, like $wikisectionorder{"SDL_OpenAudio"}[2] == 'Remarks'
opendir(DH, $wikipath) or die("Can't opendir '$wikipath': $!\n");
while (readdir(DH)) {
my $dent = $_;
while (my $d = readdir(DH)) {
my $dent = $d;
my $type = '';
if ($dent =~ /\.(md|mediawiki)\Z/) {
$type = $1;
@@ -726,13 +807,14 @@ if ($copy_direction == 1) { # --copy-to-headers
next if not defined $wikifuncs{$fn}; # don't have a page for that function, skip it.
my $wikitype = $wikitypes{$fn};
my $sectionsref = $wikifuncs{$fn};
my $remarks = %$sectionsref{'Remarks'};
my $params = %$sectionsref{'Function Parameters'};
my $returns = %$sectionsref{'Return Value'};
my $version = %$sectionsref{'Version'};
my $related = %$sectionsref{'Related Functions'};
my $deprecated = %$sectionsref{'Deprecated'};
my $brief = %$sectionsref{'[Brief]'};
my $remarks = $sectionsref->{'Remarks'};
my $params = $sectionsref->{'Function Parameters'};
my $returns = $sectionsref->{'Return Value'};
my $threadsafety = $sectionsref->{'Thread Safety'};
my $version = $sectionsref->{'Version'};
my $related = $sectionsref->{'Related Functions'};
my $deprecated = $sectionsref->{'Deprecated'};
my $brief = $sectionsref->{'[Brief]'};
my $addblank = 0;
my $str = '';
@@ -797,6 +879,33 @@ if ($copy_direction == 1) { # --copy-to-headers
$str .= "${whitespace}$_\n";
}
}
} elsif ($wikitype eq 'md') {
my $l;
$l = shift @lines;
die("Unexpected data parsing Markdown table") if (not $l =~ /\A\s*\|\s*\|\s*\|\s*\Z/);
$l = shift @lines;
die("Unexpected data parsing Markdown table") if (not $l =~ /\A\s*\|\s*\-*\s*\|\s*\-*\s*\|\s*\Z/);
while (scalar(@lines) >= 1) {
$l = shift @lines;
if ($l =~ /\A\s*\|\s*(.*?)\s*\|\s*(.*?)\s*\|\s*\Z/) {
my $name = $1;
my $desc = $2;
$name =~ s/\A\*\*(.*?)\*\*/$1/;
$name =~ s/\A\'\'\'(.*?)\'\'\'/$1/;
#print STDERR "FN: $fn NAME: $name DESC: $desc\n";
my $whitespacelen = length($name) + 8;
my $whitespace = ' ' x $whitespacelen;
$desc = wordwrap($desc, -$whitespacelen);
my @desclines = split /\n/, $desc;
my $firstline = shift @desclines;
$str .= "\\param $name $firstline\n";
foreach (@desclines) {
$str .= "${whitespace}$_\n";
}
} else {
last; # we seem to have run out of table.
}
}
} else {
die("write me");
}
@@ -821,6 +930,21 @@ if ($copy_direction == 1) { # --copy-to-headers
}
}
if (defined $threadsafety) {
# !!! FIXME: lots of code duplication in all of these.
$str .= "\n" if $addblank; $addblank = 1;
my $v = dewikify($wikitype, $threadsafety);
my $whitespacelen = length("\\threadsafety") + 1;
my $whitespace = ' ' x $whitespacelen;
$v = wordwrap($v, -$whitespacelen);
my @desclines = split /\n/, $v;
my $firstline = shift @desclines;
$str .= "\\threadsafety $firstline\n";
foreach (@desclines) {
$str .= "${whitespace}$_\n";
}
}
if (defined $version) {
# !!! FIXME: lots of code duplication in all of these.
$str .= "\n" if $addblank; $addblank = 1;
@@ -845,6 +969,7 @@ if ($copy_direction == 1) { # --copy-to-headers
s/\A(\:|\* )//;
s/\(\)\Z//; # Convert "SDL_Func()" to "SDL_Func"
s/\[\[(.*?)\]\]/$1/; # in case some wikilinks remain.
s/\[(.*?)\]\(.*?\)/$1/; # in case some wikilinks remain.
s/\A\/*//;
$str .= "\\sa $_\n";
}
@@ -905,11 +1030,32 @@ if ($copy_direction == 1) { # --copy-to-headers
rename($path, "$incpath/$header") or die("Can't rename '$path' to '$incpath/$header': $!\n");
}
if (defined $readmepath) {
if ( -d $wikireadmepath ) {
mkdir($readmepath); # just in case
opendir(DH, $wikireadmepath) or die("Can't opendir '$wikireadmepath': $!\n");
while (readdir(DH)) {
my $dent = $_;
if ($dent =~ /\A(.*?)\.md\Z/) { # we only bridge Markdown files here.
next if $1 eq 'FrontPage';
filecopy("$wikireadmepath/$dent", "$readmepath/README-$dent", "\r\n");
}
}
closedir(DH);
}
}
} elsif ($copy_direction == -1) { # --copy-to-wiki
if (defined $changeformat) {
$dewikify_mode = $changeformat;
$wordwrap_mode = $changeformat;
}
foreach (keys %headerfuncs) {
my $fn = $_;
next if not $headerfuncshasdoxygen{$fn};
my $wikitype = defined $wikitypes{$fn} ? $wikitypes{$fn} : 'mediawiki'; # default to MediaWiki for new stuff FOR NOW.
my $origwikitype = defined $wikitypes{$fn} ? $wikitypes{$fn} : 'md'; # default to MarkDown for new stuff.
my $wikitype = (defined $changeformat) ? $changeformat : $origwikitype;
die("Unexpected wikitype '$wikitype'\n") if (($wikitype ne 'mediawiki') and ($wikitype ne 'md') and ($wikitype ne 'manpage'));
#print("$fn\n"); next;
@@ -1047,6 +1193,21 @@ if ($copy_direction == 1) { # --copy-to-headers
}
$desc =~ s/[\s\n]+\Z//ms;
$sections{'Version'} = wordwrap(wikify($wikitype, $desc)) . "\n";
} elsif ($l =~ /\A\\threadsafety\s+(.*)\Z/) {
my $desc = $1;
while (@doxygenlines) {
my $subline = $doxygenlines[0];
$subline =~ s/\A\s*//;
last if $subline =~ /\A\\/; # some sort of doxygen command, assume we're past this thing.
shift @doxygenlines; # dump this line from the array; we're using it.
if ($subline eq '') { # empty line, make sure it keeps the newline char.
$desc .= "\n";
} else {
$desc .= " $subline";
}
}
$desc =~ s/[\s\n]+\Z//ms;
$sections{'Thread Safety'} = wordwrap(wikify($wikitype, $desc)) . "\n";
} elsif ($l =~ /\A\\sa\s+(.*)\Z/) {
my $sa = $1;
$sa =~ s/\(\)\Z//; # Convert "SDL_Func()" to "SDL_Func"
@@ -1125,8 +1286,25 @@ if ($copy_direction == 1) { # --copy-to-headers
push @$wikisectionorderref, '[footer]';
}
# If changing format, convert things that otherwise are passed through unmolested.
if (defined $changeformat) {
if (($dewikify_mode eq 'md') and ($origwikitype eq 'mediawiki')) {
$$sectionsref{'[footer]'} =~ s/\[\[(Category[a-zA-Z0-9_]+)\]\]/[$1]($1)/g;
} elsif (($dewikify_mode eq 'mediawiki') and ($origwikitype eq 'md')) {
$$sectionsref{'[footer]'} =~ s/\[(Category[a-zA-Z0-9_]+)\]\(.*?\)/[[$1]]/g;
}
foreach (keys %only_wiki_sections) {
my $sect = $_;
if (defined $$sectionsref{$sect}) {
$$sectionsref{$sect} = wikify($wikitype, dewikify($origwikitype, $$sectionsref{$sect}));
}
}
}
# !!! FIXME: This won't be CategoryAPI if we eventually handle things other than functions.
my $footer = $$sectionsref{'[footer]'};
if ($wikitype eq 'mediawiki') {
$footer =~ s/\[\[CategoryAPI\]\],?\s*//g;
$footer = '[[CategoryAPI]]' . (($footer eq '') ? "\n" : ", $footer");
@@ -1137,10 +1315,11 @@ if ($copy_direction == 1) { # --copy-to-headers
$$sectionsref{'[footer]'} = $footer;
if (defined $wikipreamble) {
my $wikified_preamble = wikify($wikitype, $wikipreamble);
if ($wikitype eq 'mediawiki') {
print FH "====== $wikipreamble ======\n";
print FH "====== $wikified_preamble ======\n";
} elsif ($wikitype eq 'md') {
print FH "###### $wikipreamble\n";
print FH "###### $wikified_preamble\n";
} else { die("Unexpected wikitype '$wikitype'\n"); }
}
@@ -1185,9 +1364,51 @@ if ($copy_direction == 1) { # --copy-to-headers
print FH "\n\n";
close(FH);
if (defined $changeformat and ($origwikitype ne $wikitype)) {
system("cd '$wikipath' ; git mv '$_.${origwikitype}' '$_.${wikitype}'");
unlink("$wikipath/$_.${origwikitype}");
}
rename($path, "$wikipath/$_.${wikitype}") or die("Can't rename '$path' to '$wikipath/$_.${wikitype}': $!\n");
}
if (defined $readmepath) {
if ( -d $readmepath ) {
mkdir($wikireadmepath); # just in case
opendir(DH, $readmepath) or die("Can't opendir '$readmepath': $!\n");
while (my $d = readdir(DH)) {
my $dent = $d;
if ($dent =~ /\AREADME\-(.*?\.md)\Z/) { # we only bridge Markdown files here.
my $wikifname = $1;
next if $wikifname eq 'FrontPage.md';
filecopy("$readmepath/$dent", "$wikireadmepath/$wikifname", "\n");
}
}
closedir(DH);
my @pages = ();
opendir(DH, $wikireadmepath) or die("Can't opendir '$wikireadmepath': $!\n");
while (my $d = readdir(DH)) {
my $dent = $d;
if ($dent =~ /\A(.*?)\.(mediawiki|md)\Z/) {
my $wikiname = $1;
next if $wikiname eq 'FrontPage';
push @pages, $wikiname;
}
}
closedir(DH);
open(FH, '>', "$wikireadmepath/FrontPage.md") or die("Can't open '$wikireadmepath/FrontPage.md': $!\n");
print FH "# All READMEs available here\n\n";
foreach (sort @pages) {
my $wikiname = $_;
print FH "- [$wikiname]($wikiname)\n";
}
close(FH);
}
}
} elsif ($copy_direction == -2) { # --copy-to-manpages
# This only takes from the wiki data, since it has sections we omit from the headers, like code examples.
@@ -1235,14 +1456,15 @@ if ($copy_direction == 1) { # --copy-to-headers
next if not defined $wikifuncs{$fn}; # don't have a page for that function, skip it.
my $wikitype = $wikitypes{$fn};
my $sectionsref = $wikifuncs{$fn};
my $remarks = %$sectionsref{'Remarks'};
my $params = %$sectionsref{'Function Parameters'};
my $returns = %$sectionsref{'Return Value'};
my $version = %$sectionsref{'Version'};
my $related = %$sectionsref{'Related Functions'};
my $examples = %$sectionsref{'Code Examples'};
my $deprecated = %$sectionsref{'Deprecated'};
my $brief = %$sectionsref{'[Brief]'};
my $remarks = $sectionsref->{'Remarks'};
my $params = $sectionsref->{'Function Parameters'};
my $returns = $sectionsref->{'Return Value'};
my $version = $sectionsref->{'Version'};
my $threadsafety = $sectionsref->{'Thread Safety'};
my $related = $sectionsref->{'Related Functions'};
my $examples = $sectionsref->{'Code Examples'};
my $deprecated = $sectionsref->{'Deprecated'};
my $brief = $sectionsref->{'[Brief]'};
my $decl = $headerdecls{$fn};
my $str = '';
@@ -1329,6 +1551,28 @@ if ($copy_direction == 1) { # --copy-to-headers
$str .= ".I $name\n";
$str .= "$desc\n";
}
} elsif ($wikitype eq 'md') {
my $l;
$l = shift @lines;
die("Unexpected data parsing Markdown table") if (not $l =~ /\A\s*\|\s*\|\s*\|\s*\Z/);
$l = shift @lines;
die("Unexpected data parsing Markdown table") if (not $l =~ /\A\s*\|\s*\-*\s*\|\s*\-*\s*\|\s*\Z/);
while (scalar(@lines) >= 1) {
$l = shift @lines;
if ($l =~ /\A\s*\|\s*(.*?)\s*\|\s*(.*?)\s*\|\s*\Z/) {
my $name = $1;
my $desc = $2;
$name =~ s/\A\*\*(.*?)\*\*/$1/;
$name =~ s/\A\'\'\'(.*?)\'\'\'/$1/;
$desc = dewikify($wikitype, $desc);
$str .= ".TP\n";
$str .= ".I $name\n";
$str .= "$desc\n";
} else {
last; # we seem to have run out of table.
}
}
} else {
die("write me");
}
@@ -1346,6 +1590,11 @@ if ($copy_direction == 1) { # --copy-to-headers
$dewikify_manpage_code_indent = 1;
}
if (defined $threadsafety) {
$str .= ".SH THREAD SAFETY\n";
$str .= dewikify($wikitype, $threadsafety) . "\n";
}
if (defined $version) {
$str .= ".SH AVAILABILITY\n";
$str .= dewikify($wikitype, $version) . "\n";
@@ -1361,8 +1610,11 @@ if ($copy_direction == 1) { # --copy-to-headers
s/\A(\:|\* )//;
s/\(\)\Z//; # Convert "SDL_Func()" to "SDL_Func"
s/\[\[(.*?)\]\]/$1/; # in case some wikilinks remain.
s/\[(.*?)\]\(.*?\)/$1/; # in case some wikilinks remain.
s/\A\*\s*\Z//;
s/\A\/*//;
s/\A\.BR\s+//; # dewikify added this, but we want to handle it.
s/\A\.I\s+//; # dewikify added this, but we want to handle it.
s/\A\s+//;
s/\s+\Z//;
next if $_ eq '';

View File

@@ -32,6 +32,8 @@ function(check_cpu_architecture ARCH VARIABLE)
_internal_check_cpu_architecture("defined(__arm__) || defined(_M_ARM)" arm32 ${VARIABLE})
elseif(ARCH STREQUAL "arm64")
_internal_check_cpu_architecture("defined(__aarch64__) || defined(_M_ARM64)" arm64 ${VARIABLE})
elseif(ARCH STREQUAL "loongarch64")
_internal_check_cpu_architecture("defined(__loongarch64)" loongarch64 ${VARIABLE})
else()
message(WARNING "Unknown CPU architectures (${ARCH}).")
set(${VARIABLE} FALSE)

View File

@@ -29,7 +29,7 @@ ENDMACRO()
# Message Output
macro(MESSAGE_WARN _TEXT)
message(STATUS "*** WARNING: ${_TEXT}")
message(WARNING "${_TEXT}")
endmacro()
macro(MESSAGE_ERROR _TEXT)
@@ -64,7 +64,7 @@ macro(MESSAGE_TESTED_OPTION _NAME)
message(STATUS " ${_NAME}${_PAD}(Wanted: ${_REQVALUE}): ${HAVE_${_STRIPPEDNAME}}")
endmacro()
macro(LISTTOSTR _LIST _OUTPUT)
function(LISTTOSTR _LIST _OUTPUT)
if(${ARGC} EQUAL 3)
# prefix for each element
set(_LPREFIX ${ARGV2})
@@ -73,10 +73,12 @@ macro(LISTTOSTR _LIST _OUTPUT)
endif()
# Do not use string(REPLACE ";" " ") here to avoid messing up list
# entries
set(res)
foreach(_ITEM ${${_LIST}})
set(${_OUTPUT} "${${_OUTPUT}} ${_LPREFIX}${_ITEM}")
set(res "${res} ${_LPREFIX}${_ITEM}")
endforeach()
endmacro()
set(${_OUTPUT} "${res}" PARENT_SCOPE)
endfunction()
macro(LISTTOSTRREV _LIST _OUTPUT)
if(${ARGC} EQUAL 3)
@@ -122,3 +124,25 @@ if(CMAKE_VERSION VERSION_LESS 3.13.0)
link_directories(${ARGN})
endmacro()
endif()
# CMP0087: install(CODE) and install(SCRIPT) support generator expressions.
if(POLICY CMP0087)
cmake_policy(SET CMP0087 NEW)
endif()
function(SDL_install_pdb TARGET DIRECTORY)
get_property(type TARGET ${TARGET} PROPERTY TYPE)
if(type MATCHES "^(SHARED_LIBRARY|EXECUTABLE)$")
if(NOT CMAKE_VERSION VERSION_LESS 3.1)
install(FILES $<TARGET_PDB_FILE:${TARGET}> DESTINATION "${DIRECTORY}" OPTIONAL)
endif()
elseif(type STREQUAL "STATIC_LIBRARY")
if(NOT CMAKE_VERSION VERSION_LESS 3.15)
# FIXME: Use $<TARGET_COMPILE_PDB_FILE:${TARGET} once it becomes available (https://gitlab.kitware.com/cmake/cmake/-/issues/25244)
if(CMAKE_GENERATOR MATCHES "^Visual Studio.*")
install(CODE "file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${DIRECTORY}\" TYPE FILE OPTIONAL FILES \"${CMAKE_CURRENT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}/${TARGET}.pdb\")")
else()
install(CODE "file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${DIRECTORY}\" TYPE FILE OPTIONAL FILES \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET}.dir/${TARGET}.pdb\")")
endif()
endif()
endif()
endfunction()

View File

@@ -1,4 +1,5 @@
include(CMakeParseArguments)
include(${SDL2_SOURCE_DIR}/cmake/sdlfind.cmake)
macro(FindLibraryAndSONAME _LIB)
cmake_parse_arguments(FLAS "" "" "LIBDIRS" ${ARGN})
@@ -6,10 +7,18 @@ macro(FindLibraryAndSONAME _LIB)
string(REGEX REPLACE "\\-" "_" _LNAME "${_UPPERLNAME}")
find_library(${_LNAME}_LIB ${_LIB} PATHS ${FLAS_LIBDIRS})
if(${_LNAME}_LIB MATCHES ".*\\${CMAKE_SHARED_LIBRARY_SUFFIX}.*" AND NOT ${_LNAME}_LIB MATCHES ".*\\${CMAKE_STATIC_LIBRARY_SUFFIX}.*")
set(${_LNAME}_SHARED TRUE)
else()
set(${_LNAME}_SHARED FALSE)
endif()
if(${_LNAME}_LIB)
# reduce the library name for shared linking
get_filename_component(_LIB_REALPATH ${${_LNAME}_LIB} REALPATH) # resolves symlinks
get_filename_component(_LIB_DIRECTORY ${_LIB_REALPATH} DIRECTORY)
get_filename_component(_LIB_JUSTNAME ${_LIB_REALPATH} NAME)
if(APPLE)
@@ -18,6 +27,11 @@ macro(FindLibraryAndSONAME _LIB)
string(REGEX REPLACE "(\\.[0-9]*)\\.[0-9\\.]*$" "\\1" _LIB_REGEXD "${_LIB_JUSTNAME}")
endif()
if(NOT EXISTS "${_LIB_DIRECTORY}/${_LIB_REGEXD}")
set(_LIB_REGEXD "${_LIB_JUSTNAME}")
endif()
set(${_LNAME}_LIBDIR "${_LIB_LIBDIR}")
SET(_DEBUG_FindSONAME FALSE)
if(_DEBUG_FindSONAME)
message_warn("DYNLIB OUTPUTVAR: ${_LIB} ... ${_LNAME}_LIB")
@@ -83,26 +97,35 @@ endmacro()
# - HAVE_SDL_LOADSO opt
macro(CheckALSA)
if(SDL_ALSA)
CHECK_INCLUDE_FILE(alsa/asoundlib.h HAVE_ASOUNDLIB_H)
if(HAVE_ASOUNDLIB_H)
CHECK_LIBRARY_EXISTS(asound snd_pcm_recover "" HAVE_LIBASOUND)
endif()
if(HAVE_LIBASOUND)
set(HAVE_ALSA TRUE)
file(GLOB ALSA_SOURCES ${SDL2_SOURCE_DIR}/src/audio/alsa/*.c)
sdlFindALSA()
if(ALSA_FOUND)
file(GLOB ALSA_SOURCES "${SDL2_SOURCE_DIR}/src/audio/alsa/*.c")
list(APPEND SOURCE_FILES ${ALSA_SOURCES})
set(SDL_AUDIO_DRIVER_ALSA 1)
if(SDL_ALSA_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic ALSA loading")
set(HAVE_ALSA TRUE)
set(HAVE_ALSA_SHARED FALSE)
if(SDL_ALSA_SHARED)
if(HAVE_SDL_LOADSO)
FindLibraryAndSONAME("asound")
if(ASOUND_LIB AND ASOUND_SHARED)
target_include_directories(sdl-build-options SYSTEM INTERFACE $<TARGET_PROPERTY:ALSA::ALSA,INTERFACE_INCLUDE_DIRECTORIES>)
set(SDL_AUDIO_DRIVER_ALSA_DYNAMIC "\"${ASOUND_LIB_SONAME}\"")
set(HAVE_ALSA_SHARED TRUE)
else()
message(WARNING "Unable to find asound shared object")
endif()
else()
message(WARNING "You must have SDL_LoadObject() support for dynamic ALSA loading")
endif()
endif()
FindLibraryAndSONAME("asound")
if(SDL_ALSA_SHARED AND ASOUND_LIB AND HAVE_SDL_LOADSO)
set(SDL_AUDIO_DRIVER_ALSA_DYNAMIC "\"${ASOUND_LIB_SONAME}\"")
set(HAVE_ALSA_SHARED TRUE)
else()
list(APPEND EXTRA_LIBS asound)
if(NOT HAVE_ALSA_SHARED)
list(APPEND CMAKE_DEPENDS ALSA::ALSA)
list(APPEND PKGCONFIG_DEPENDS alsa)
endif()
set(HAVE_SDL_AUDIO TRUE)
else()
set(HAVE_ALSA FALSE)
message(WARNING "Unable to found the alsa development library")
endif()
endif()
endmacro()
@@ -143,7 +166,7 @@ endmacro()
# - HAVE_SDL_LOADSO opt
macro(CheckPulseAudio)
if(SDL_PULSEAUDIO)
pkg_check_modules(PKG_PULSEAUDIO libpulse-simple)
pkg_check_modules(PKG_PULSEAUDIO libpulse>=0.9.15)
if(PKG_PULSEAUDIO_FOUND)
set(HAVE_PULSEAUDIO TRUE)
file(GLOB PULSEAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/pulseaudio/*.c)
@@ -153,9 +176,9 @@ macro(CheckPulseAudio)
if(SDL_PULSEAUDIO_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic PulseAudio loading")
endif()
FindLibraryAndSONAME("pulse-simple" LIBDIRS ${PKG_PULSEAUDIO_LIBRARY_DIRS})
if(SDL_PULSEAUDIO_SHARED AND PULSE_SIMPLE_LIB AND HAVE_SDL_LOADSO)
set(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "\"${PULSE_SIMPLE_LIB_SONAME}\"")
FindLibraryAndSONAME("pulse" LIBDIRS ${PKG_PULSEAUDIO_LIBRARY_DIRS})
if(SDL_PULSEAUDIO_SHARED AND PULSE_LIB AND HAVE_SDL_LOADSO)
set(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "\"${PULSE_LIB_SONAME}\"")
set(HAVE_PULSEAUDIO_SHARED TRUE)
else()
list(APPEND EXTRA_LDFLAGS ${PKG_PULSEAUDIO_LDFLAGS})
@@ -357,7 +380,7 @@ macro(CheckLibSampleRate)
set(HAVE_LIBSAMPLERATE TRUE)
set(HAVE_LIBSAMPLERATE_H TRUE)
if(SDL_LIBSAMPLERATE_SHARED)
target_include_directories(sdl-build-options INTERFACE $<TARGET_PROPERTY:SampleRate::samplerate,INTERFACE_INCLUDE_DIRECTORIES>)
target_include_directories(sdl-build-options SYSTEM INTERFACE $<TARGET_PROPERTY:SampleRate::samplerate,INTERFACE_INCLUDE_DIRECTORIES>)
if(NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic libsamplerate loading")
else()
@@ -400,6 +423,7 @@ endmacro()
# - SDL_X11_SHARED opt
# - HAVE_SDL_LOADSO opt
macro(CheckX11)
cmake_push_check_state(RESET)
if(SDL_X11)
foreach(_LIB X11 Xext Xcursor Xi Xfixes Xrandr Xrender Xss)
FindLibraryAndSONAME("${_LIB}")
@@ -422,6 +446,7 @@ macro(CheckX11)
if(X_INCLUDEDIR)
list(APPEND EXTRA_CFLAGS "-I${X_INCLUDEDIR}")
list(APPEND CMAKE_REQUIRED_INCLUDES ${X_INCLUDEDIR})
endif()
find_file(HAVE_XCURSOR_H NAMES "X11/Xcursor/Xcursor.h" HINTS "${X_INCLUDEDIR}")
@@ -446,7 +471,9 @@ macro(CheckX11)
list(APPEND SOURCE_FILES ${X11_SOURCES})
set(SDL_VIDEO_DRIVER_X11 1)
# !!! FIXME: why is this disabled for Apple?
# Note: Disabled on Apple because the dynamic mode backend for X11 doesn't
# work properly on Apple during several issues like inconsistent paths
# among platforms. See #6778 (https://github.com/libsdl-org/SDL/issues/6778)
if(APPLE)
set(SDL_X11_SHARED OFF)
endif()
@@ -597,6 +624,7 @@ macro(CheckX11)
# Prevent Mesa from including X11 headers
list(APPEND EXTRA_CFLAGS "-DMESA_EGL_NO_X11_HEADERS -DEGL_NO_X11")
endif()
cmake_pop_check_state()
endmacro()
macro(WaylandProtocolGen _SCANNER _CODE_MODE _XML _PROTL)
@@ -657,7 +685,7 @@ macro(CheckWayland)
if(WAYLAND_FOUND)
target_link_directories(sdl-build-options INTERFACE "${PKG_WAYLAND_LIBRARY_DIRS}")
target_include_directories(sdl-build-options INTERFACE "${PKG_WAYLAND_INCLUDE_DIRS}")
target_include_directories(sdl-build-options SYSTEM INTERFACE "${PKG_WAYLAND_INCLUDE_DIRS}")
set(HAVE_WAYLAND TRUE)
set(HAVE_SDL_VIDEO TRUE)
@@ -667,7 +695,7 @@ macro(CheckWayland)
# We have to generate some protocol interface code for some unstable Wayland features.
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols")
target_include_directories(sdl-build-options INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols")
target_include_directories(sdl-build-options SYSTEM INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols")
file(GLOB WAYLAND_PROTOCOLS_XML RELATIVE "${SDL2_SOURCE_DIR}/wayland-protocols/" "${SDL2_SOURCE_DIR}/wayland-protocols/*.xml")
foreach(_XML ${WAYLAND_PROTOCOLS_XML})
@@ -703,7 +731,7 @@ macro(CheckWayland)
set(HAVE_WAYLAND_LIBDECOR TRUE)
set(HAVE_LIBDECOR_H 1)
target_link_directories(sdl-build-options INTERFACE "${PKG_LIBDECOR_LIBRARY_DIRS}")
target_include_directories(sdl-build-options INTERFACE "${PKG_LIBDECOR_INCLUDE_DIRS}")
target_include_directories(sdl-build-options SYSTEM INTERFACE "${PKG_LIBDECOR_INCLUDE_DIRS}")
if(SDL_WAYLAND_LIBDECOR_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic libdecor loading")
endif()
@@ -714,6 +742,17 @@ macro(CheckWayland)
else()
list(APPEND EXTRA_LIBS ${PKG_LIBDECOR_LIBRARIES})
endif()
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_FLAGS ${PKG_LIBDECOR_CFLAGS})
list(APPEND CMAKE_REQUIRED_INCLUDES ${PKG_LIBDECOR_INCLUDE_DIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${PKG_LIBDECOR_LINK_LIBRARIES})
check_symbol_exists(libdecor_frame_get_max_content_size "libdecor.h" HAVE_LIBDECOR_FRAME_GET_MAX_CONTENT_SIZE)
check_symbol_exists(libdecor_frame_get_min_content_size "libdecor.h" HAVE_LIBDECOR_FRAME_GET_MIN_CONTENT_SIZE)
if(HAVE_LIBDECOR_FRAME_GET_MAX_CONTENT_SIZE AND HAVE_LIBDECOR_FRAME_GET_MIN_CONTENT_SIZE)
set(SDL_HAVE_LIBDECOR_GET_MIN_MAX 1)
endif()
cmake_pop_check_state()
endif()
endif()
@@ -874,6 +913,22 @@ macro(CheckOpenGLES)
endif()
endmacro()
# Requires:
# - EGL
macro(CheckQNXScreen)
if(QNX AND HAVE_OPENGL_EGL)
check_c_source_compiles("
#include <screen/screen.h>
int main (int argc, char** argv) { return 0; }" HAVE_QNX_SCREEN)
if(HAVE_QNX_SCREEN)
set(SDL_VIDEO_DRIVER_QNX 1)
file(GLOB QNX_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/qnx/*.c)
list(APPEND SOURCE_FILES ${QNX_VIDEO_SOURCES})
list(APPEND EXTRA_LIBS screen EGL)
endif()
endif()
endmacro()
# Requires:
# - nada
# Optional:
@@ -924,6 +979,8 @@ macro(CheckPTHREAD)
elseif(EMSCRIPTEN)
set(PTHREAD_CFLAGS "-D_REENTRANT -pthread")
set(PTHREAD_LDFLAGS "-pthread")
elseif(QNX)
# pthread support is baked in
else()
set(PTHREAD_CFLAGS "-D_REENTRANT")
set(PTHREAD_LDFLAGS "-lpthread")
@@ -946,7 +1003,6 @@ macro(CheckPTHREAD)
list(APPEND SDL_CFLAGS ${PTHREAD_CFLAGS})
check_c_source_compiles("
#define _GNU_SOURCE 1
#include <pthread.h>
int main(int argc, char **argv) {
pthread_mutexattr_t attr;
@@ -957,7 +1013,6 @@ macro(CheckPTHREAD)
set(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1)
else()
check_c_source_compiles("
#define _GNU_SOURCE 1
#include <pthread.h>
int main(int argc, char **argv) {
pthread_mutexattr_t attr;
@@ -988,10 +1043,13 @@ macro(CheckPTHREAD)
check_include_files("pthread_np.h" HAVE_PTHREAD_NP_H)
if (HAVE_PTHREAD_H)
check_c_source_compiles("
#define _GNU_SOURCE 1
#include <pthread.h>
int main(int argc, char **argv) {
pthread_setname_np(pthread_self(), \"\");
#ifdef __APPLE__
pthread_setname_np(\"\");
#else
pthread_setname_np(pthread_self(),\"\");
#endif
return 0;
}" HAVE_PTHREAD_SETNAME_NP)
if (HAVE_PTHREAD_NP_H)
@@ -1265,7 +1323,7 @@ macro(CheckKMSDRM)
pkg_check_modules(PKG_KMSDRM libdrm gbm egl)
if(PKG_KMSDRM_FOUND AND HAVE_OPENGL_EGL)
target_link_directories(sdl-build-options INTERFACE ${PKG_KMSDRM_LIBRARY_DIRS})
target_include_directories(sdl-build-options INTERFACE "${PKG_KMSDRM_INCLUDE_DIRS}")
target_include_directories(sdl-build-options SYSTEM INTERFACE "${PKG_KMSDRM_INCLUDE_DIRS}")
set(HAVE_KMSDRM TRUE)
set(HAVE_SDL_VIDEO TRUE)
@@ -1291,3 +1349,64 @@ macro(CheckKMSDRM)
endif()
endif()
endmacro()
macro(CheckLibUDev)
if(SDL_LIBUDEV)
check_include_file("libudev.h" HAVE_LIBUDEV_HEADER)
if(HAVE_LIBUDEV_HEADER)
set(HAVE_LIBUDEV_H TRUE)
FindLibraryAndSONAME(udev)
if(UDEV_LIB_SONAME)
set(SDL_UDEV_DYNAMIC "\"${UDEV_LIB_SONAME}\"")
set(HAVE_LIBUDEV TRUE)
endif()
endif()
endif()
endmacro()
macro(CheckLibUnwind)
set(found_libunwind FALSE)
set(_libunwind_src "#include <libunwind.h>\nint main() {unw_context_t context; unw_getcontext(&context); return 0;}")
if(NOT found_libunwind)
cmake_push_check_state()
check_c_source_compiles("${_libunwind_src}" LIBC_HAS_WORKING_LIBUNWIND)
cmake_pop_check_state()
if(LIBC_HAS_WORKING_LIBUNWIND)
set(found_libunwind TRUE)
endif()
endif()
if(NOT found_libunwind)
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_LIBRARIES "unwind")
check_c_source_compiles("${_libunwind_src}" LIBUNWIND_HAS_WORKINGLIBUNWIND)
cmake_pop_check_state()
if(LIBUNWIND_HAS_WORKINGLIBUNWIND)
set(found_libunwind TRUE)
list(APPEND EXTRA_TEST_LIBS unwind)
endif()
endif()
if(NOT found_libunwind)
set(LibUnwind_PKG_CONFIG_SPEC libunwind libunwind-generic)
pkg_check_modules(PC_LIBUNWIND IMPORTED_TARGET ${LibUnwind_PKG_CONFIG_SPEC})
if(PC_LIBUNWIND_FOUND)
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_LIBRARIES ${PC_LIBUNWIND_LIBRARIES})
list(APPEND CMAKE_REQUIRED_INCLUDES ${PC_LIBUNWIND_INCLUDE_DIRS})
check_c_source_compiles("${_libunwind_src}" PC_LIBUNWIND_HAS_WORKING_LIBUNWIND)
cmake_pop_check_state()
if(PC_LIBUNWIND_HAS_WORKING_LIBUNWIND)
set(found_libunwind TRUE)
list(APPEND EXTRA_TEST_LIBS ${PC_LIBUNWIND_LIBRARIES})
list(APPEND EXTRA_TEST_INCLUDES ${PC_LIBUNWIND_INCLUDE_DIRS})
endif()
endif()
endif()
if(found_libunwind)
set(HAVE_LIBUNWIND_H TRUE)
endif()
endmacro()

9
cmake/sdlfind.cmake Normal file
View File

@@ -0,0 +1,9 @@
macro(sdlFindALSA)
find_package(ALSA MODULE)
if(ALSA_FOUND AND (NOT TARGET ALSA::ALSA) )
add_Library(ALSA::ALSA UNKNOWN IMPORTED)
set_property(TARGET ALSA::ALSA PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${ALSA_INCLUDE_DIRS})
set_property(TARGET ALSA::ALSA APPEND PROPERTY IMPORTED_LOCATION ${ALSA_LIBRARY})
endif()
endmacro()

59
cmake/sdlplatform.cmake Normal file
View File

@@ -0,0 +1,59 @@
macro(SDL_DetectCMakePlatform)
set(SDL_CMAKE_PLATFORM )
# Get the platform
if(WIN32)
set(SDL_CMAKE_PLATFORM WINDOWS)
elseif(UNIX AND NOT APPLE)
if(CMAKE_SYSTEM_NAME MATCHES ".*Linux")
set(SDL_CMAKE_PLATFORM LINUX)
elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*")
set(SDL_CMAKE_PLATFORM FREEBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*")
set(SDL_CMAKE_PLATFORM NETBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*")
set(SDL_CMAKE_PLATFORM OPENBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*GNU.*")
set(SDL_CMAKE_PLATFORM GNU)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*")
set(SDL_CMAKE_PLATFORM BSDI)
elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*|FreeBSD")
set(SDL_CMAKE_PLATFORM FREEBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "SYSV5.*")
set(SDL_CMAKE_PLATFORM SYSV5)
elseif(CMAKE_SYSTEM_NAME MATCHES "Solaris.*|SunOS.*")
set(SDL_CMAKE_PLATFORM SOLARIS)
elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX.*")
set(SDL_CMAKE_PLATFORM HPUX)
elseif(CMAKE_SYSTEM_NAME MATCHES "AIX.*")
set(SDL_CMAKE_PLATFORM AIX)
elseif(CMAKE_SYSTEM_NAME MATCHES "Minix.*")
set(SDL_CMAKE_PLATFORM MINIX)
elseif(CMAKE_SYSTEM_NAME MATCHES "QNX")
set(SDL_CMAKE_PLATFORM QNX)
endif()
elseif(APPLE)
if(CMAKE_SYSTEM_NAME MATCHES ".*Darwin.*")
set(SDL_CMAKE_PLATFORM DARWIN)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*MacOS.*")
set(SDL_CMAKE_PLATFORM MACOSX)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*tvOS.*")
set(SDL_CMAKE_PLATFORM TVOS)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*iOS.*")
# !!! FIXME: remove the version check when we start requiring >= 3.14.0
if(CMAKE_VERSION VERSION_LESS 3.14)
set(SDL_CMAKE_PLATFORM IOS)
endif()
endif()
elseif(CMAKE_SYSTEM_NAME MATCHES "BeOS.*")
message_error("BeOS support has been removed as of SDL 2.0.2.")
elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku.*")
set(SDL_CMAKE_PLATFORM HAIKU)
elseif(NINTENDO_3DS)
set(SDL_CMAKE_PLATFORM N3DS)
elseif(OS2)
set(SDL_CMAKE_PLATFORM OS2)
endif()
if(SDL_CMAKE_PLATFORM)
set(${SDL_CMAKE_PLATFORM} TRUE)
endif()
endmacro()

View File

@@ -14,7 +14,7 @@ int main(int argc, char *argv[]) {
640, 480,
SDL_WINDOW_SHOWN
);
if (window == NULL) {
if (!window) {
fprintf(stderr, "could not create window: %s\n", SDL_GetError());
return 1;
}

View File

@@ -13,7 +13,7 @@ case "$machine" in
*android* )
EXEPREFIX="lib"
EXESUFFIX=".so"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -shared"
LDFLAGS="$LDFLAGS -shared"
;;
* )
EXEPREFIX=""
@@ -25,20 +25,20 @@ set -e
# Get the canonical path of the folder containing this script
testdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
CFLAGS="$( pkg-config sdl2 --cflags )"
LDFLAGS="$( pkg-config sdl2 --libs )"
STATIC_LDFLAGS="$( pkg-config sdl2 --libs --static )"
SDL_CFLAGS="$( pkg-config sdl2 --cflags )"
SDL_LDFLAGS="$( pkg-config sdl2 --libs )"
SDL_STATIC_LDFLAGS="$( pkg-config sdl2 --libs --static )"
compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_pkgconfig.c.o $CFLAGS $EXTRA_CFLAGS"
link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig${EXESUFFIX} $LDFLAGS $EXTRA_LDFLAGS"
static_link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig_static${EXESUFFIX} $STATIC_LDFLAGS $EXTRA_LDFLAGS"
compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_pkgconfig.c.o $SDL_CFLAGS $CFLAGS"
link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig${EXESUFFIX} $SDL_LDFLAGS $LDFLAGS"
static_link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig_static${EXESUFFIX} $SDL_STATIC_LDFLAGS $LDFLAGS"
echo "-- CC: $CC"
echo "-- CFLAGS: $CFLAGS"
echo "-- EXTRA_CFLAGS: $EXTRA_CFLAGS"
echo "-- LDFLASG: $LDFLAGS"
echo "-- STATIC_LDFLAGS: $STATIC_LDFLAGS"
echo "-- EXTRA_LDFLAGS: $EXTRA_LDFLAGS"
echo "-- CC: $CC"
echo "-- CFLAGS: $CFLAGS"
echo "-- LDFLASG: $LDFLAGS"
echo "-- SDL_CFLAGS: $SDL_CFLAGS"
echo "-- SDL_LDFLAGS: $SDL_LDFLAGS"
echo "-- SDL_STATIC_LDFLAGS: $SDL_STATIC_LDFLAGS"
echo "-- COMPILE: $compile_cmd"
echo "-- LINK: $link_cmd"

View File

@@ -13,7 +13,7 @@ case "$machine" in
*android* )
EXEPREFIX="lib"
EXESUFFIX=".so"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -shared"
LDFLAGS="$LDFLAGS -shared"
;;
* )
EXEPREFIX=""
@@ -25,20 +25,20 @@ set -e
# Get the canonical path of the folder containing this script
testdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
CFLAGS="$( sdl2-config --cflags )"
LDFLAGS="$( sdl2-config --libs )"
STATIC_LDFLAGS="$( sdl2-config --static-libs )"
SDL_CFLAGS="$( sdl2-config --cflags )"
SDL_LDFLAGS="$( sdl2-config --libs )"
SDL_STATIC_LDFLAGS="$( sdl2-config --static-libs )"
compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_sdlconfig.c.o $CFLAGS $EXTRA_CFLAGS"
link_cmd="$CC main_gui_sdlconfig.c.o -o ${EXEPREFIX}main_gui_sdlconfig${EXESUFFIX} $LDFLAGS $EXTRA_LDFLAGS"
static_link_cmd="$CC main_gui_sdlconfig.c.o -o ${EXEPREFIX}main_gui_sdlconfig_static${EXESUFFIX} $STATIC_LDFLAGS $EXTRA_LDFLAGS"
compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_sdlconfig.c.o $CFLAGS $SDL_CFLAGS"
link_cmd="$CC main_gui_sdlconfig.c.o -o ${EXEPREFIX}main_gui_sdlconfig${EXESUFFIX} $SDL_LDFLAGS $LDFLAGS"
static_link_cmd="$CC main_gui_sdlconfig.c.o -o ${EXEPREFIX}main_gui_sdlconfig_static${EXESUFFIX} $SDL_STATIC_LDFLAGS $LDFLAGS"
echo "-- CC: $CC"
echo "-- CFLAGS: $CFLAGS"
echo "-- EXTRA_CFLAGS: $EXTRA_CFLAGS"
echo "-- LDFLAGS: $LDFLAGS"
echo "-- STATIC_LDFLAGS: $STATIC_LDFLAGS"
echo "-- EXTRA_LDFLAGS: $EXTRA_LDFLAGS"
echo "-- CC: $CC"
echo "-- CFLAGS: $CFLAGS"
echo "-- LDFLAGS: $LDFLAGS"
echo "-- SDL_CFLAGS: $SDL_CFLAGS"
echo "-- SDL_LDFLAGS: $SDL_LDFLAGS"
echo "-- SDL_STATIC_LDFLAGS: $SDL_STATIC_LDFLAGS"
echo "-- COMPILE: $compile_cmd"
echo "-- LINK: $link_cmd"

880
configure vendored

File diff suppressed because it is too large Load Diff

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