Commit Graph

7435 Commits

Author SHA1 Message Date
Daniel Gibson
501fe46597 sdl2-config.cmake.in: Make SDL2::SDL2 work with MinGW, fixes #3665
It didn't work at all because shared libs defined in CMake with
add_library() need something like IMPORTED_IMPLIB (pointing to a .dll.a
or .lib for th DLLs) set to link on Windows.
But even with that it didn't work because the order of the libs is very
important: it must be -lmingw32 -lSDL2main -lSDL -mwindows - but
with normal add_library(SDL2::SDL2 SHARED IMPORTED) libs, SDL2 itself
is always linked first.
So I use an "INTERFACE" library (usually used for header-only libs), which
doesn't implicitly/automatically link anything so I can specify the whole
order of the linked libs.
(SDL2::SDL2-static is completely untested)
2021-07-08 14:55:33 -07:00
Daniel Gibson
fac6e9f1e2 sdl2-config.cmake.in: Use more CMake variables and less autotools ones
this makes it easier to create a portable sdl2-config.cmake that doesn't
hardcode its path (by replacing the hardcoded prefix with something
like "${CMAKE_CURRENT_LIST_DIR}/../../..")
2021-07-08 14:55:33 -07:00
Daniel Gibson
c342696172 Enhanced SDL2Config.cmake to also work on non-Windows
tested Linux; I assume most other Unices are similar; I don't have a Mac
2021-07-08 14:55:33 -07:00
Daniel Gibson
3ea11f9acb Make SDL2Config.cmake export SDL2_LIBRARIES etc (on Windows)
still WIP and other platforms than windows still TODO and open
questions etc

see https://github.com/libsdl-org/SDL/issues/4004
2021-07-08 14:55:33 -07:00
Vladislav Dmitrievich Turbanov
f9bf1aeba8
Latest Unifont with OFL is now bundled. (#4268)
* * Latest Unifont with OFL is now bundled.

* * Added a Unifont license file.

Co-authored-by: Vladislav Dmitrievich Turbanov <vladislav@turbanov.ru>
2021-07-08 14:51:16 -07:00
Hanseul Jun
557d0f827f Commenting a false alarm in WIN_GLES_SetupWindow.
When hint SDL_HINT_OPENGL_ES_DRIVER is set to "1" (e.g. for ANGLE support), assertion due to !_this->gl_config.driver_loaded can be causes while EGL is available.
2021-07-08 14:49:40 -07:00
Sam Lantinga
d135c0762f Added SDL_GameControllerSendEffect() and SDL_JoystickSendEffect() to allow applications to send custom effects to the PS4 and PS5 controllers
See testgamecontroller.c for an example of a custom PS5 trigger effect
2021-07-08 13:22:41 -07:00
Ozkan Sezer
073cbc40cb SDL_platform.h: define TARGET_OS_SIMULATOR as 0 if not already defined.
c.f.: https://github.com/libsdl-org/SDL/issues/4475
2021-07-08 21:20:02 +03:00
Ozkan Sezer
be41cf2dfe CMake: don't blacklist TARGET_OS_SIMULATOR for Metal configuration
7fa5e95b62 enabled it.
2021-07-08 21:20:02 +03:00
Ozkan Sezer
97d4fe9433 removed extra whitespace. 2021-07-08 20:55:10 +03:00
Ozkan Sezer
3da6d2cdde WIN_SetErrorFromHRESULT: kill CR/LF that FormatMessage sticks at the end
Fixes: https://github.com/libsdl-org/SDL_mixer/issues/320
2021-07-08 20:33:50 +03:00
Dean Herbert
8fb95034e8 Avoid warping the cursor to the center of the window when not in relative_warp_mode
When relative mode is enabled and not using warp mode, the cursor is
being clipped to the window. Therefore there is no reason to restore the
cursor position to the center.

Avoiding the warp to center simplifies mouse position event flow, as we
are no longer potentially receiving mouse events for the automated
movement of the cursor and can be (mostly) assured that an incoming
event from the windowing system is that of external means.
2021-07-08 09:27:09 -07:00
Dean Herbert
4359a47b3e Simplify ClipCursor behaviour when RelativeMouseMode is enabled
The implementation of clip logic for relative mode seemed to
unnecessarily limit the usable area to the middle of the window, in a
2x2 pixel region. This has the adverse side effect of moving the
operating system cursor to that location, even if it is in a valid
location in the window.

While in most scenarios this is handled correctly (by storing the
original position of the cursor in the window and restoring when leaving
relative mode), there are edge cases where this clip operation can cause
WM_MOUSEMOVE to fire at a point in time where it counts as a relative
delta from SDL's perspective.
2021-07-08 09:27:09 -07:00
Dean Herbert
3720e254c4 Trim some stray whitespace 2021-07-08 09:27:09 -07:00
Sam Lantinga
170924278d Fixed https://github.com/libsdl-org/SDL/issues/4475
-Wundef errors from clang-11.1 when targeting macOS

Targeting i386 against 10.8 SDK:

In file included from src/SDL_assert.c:21:
In file included from src/./SDL_internal.h:52:
In file included from include/SDL_config.h:33:
include/SDL_platform.h:73:5: error: 'TARGET_OS_TV' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
    ^
1 error generated.

src/joystick/iphoneos/SDL_mfijoystick.m:38:5: error: 'TARGET_OS_IOS' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
    ^
src/joystick/iphoneos/SDL_mfijoystick.m:460:5: error: 'TARGET_OS_TV' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
    ^
2 errors generated.

src/filesystem/cocoa/SDL_sysfilesystem.m:83:6: error: 'TARGET_OS_TV' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
     ^
1 error generated.

Targeting x86_64 against 10.12 SDK:

src/video/SDL_video.c:1492:25: error: 'TARGET_OS_MACCATALYST' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
                        ^
1 error generated.
2021-07-08 09:24:54 -07:00
Austin Shafer
16e3bfe807 SetDisplayMode: Call XRRSetScreenSize before setting CRTC config
X11_SetDisplayMode currently calls X11_XRRSetCrtcConfig alone. This results
in the monitor's viewport getting changed, but the underlying screen dimensions
stay the same.

The spec indicates that RRSetCrtcConfig only changes the crtc mode and has no effect
on the screen dimensions, only mentioning that the new crtc must fit entirely within the
screen size. For the size to change, RRSetScreenSize also needs to be called.

This affects Metro Exodus on Linux, when changing the resolution in the in-game settings
Metro gets stuck in a loop waiting for the size of its vulkan surface to change. Because
XRRSetScreenSize is not called the screen size is never changed, the vulkan surface dimensions
do not change, and Metro hangs forever watching for a surface size update that will
never come.

This change disables the CRTC, calls XRRSetScreenSize, and then updates the
CRTC configuration. This fixes changing the resolution from the Metro settings.

Tested with:
Metro Exodus, Portal 2
2021-07-08 08:41:29 -07:00
Ozkan Sezer
118480e563 fix permissions 2021-07-08 17:56:14 +03:00
Sam Lantinga
4a20dd3e54 Removed unnecessary comment, the mic button is in byte 16 on all firmware versions 2021-07-08 07:38:18 -07:00
Sam Lantinga
46f19c311d Implemented mouse relative mode for iOS 14.1 and newer 2021-07-08 07:23:29 -07:00
Croydon
3433f3c4cc CMake: Small improvement for MinGW
This is currently a small patch we have in our Conan package for SDL 4dc894cc2c/recipes/sdl2/all/conanfile.py (L184)

Introduced in 9fb93a6044
2021-07-07 16:55:17 -07:00
Ozkan Sezer
6f0865fe42 updated os2 makefile. 2021-07-07 23:51:32 +03:00
Sam Lantinga
599001d4c7 Revert "Removed reference to ant project."
This reverts commit 0cad302346.

The ant directory still exists in source control
2021-07-07 13:30:48 -07:00
Sam Lantinga
75a9f8e2b2 Added SDL_hidapi_luna.c to the Xcode project 2021-07-07 13:06:15 -07:00
Sam Lantinga
430bbcb87f Added HIDAPI support for the Amazon Luna Controller connected over USB in DirectInput mode 2021-07-07 09:49:33 -07:00
Sam Lantinga
863f566941 Fixed reading thumbstick axes and mic button on the Amazon Luna Controller firmware version 305164320 2021-07-07 08:55:16 -07:00
Dimitriy Ryazantcev
17ed8d8085 Added HIDAPI backend for Amazon Luna Controller Model T28B69 connected via Bluetooth LE (VID:0171, PID:0419).
To enter Bluetooth pairing mode hold B and Action (button with circle) buttons for 3 seconds.

It works via usual HIDAPI if special filter driver is not installed:
https://www.amazon.com/gp/help/customer/display.html?nodeId=GZCT4CTFHXLHEB9T

With that driver installed it mimics Xbox One controller and works via XInput under Windows.

Under DInput this controller is not usable at all.
2021-07-07 08:31:12 -07:00
Sam Lantinga
00d67620da Added the SteelSeries manufacturer to the Nimbus+ entry on macOS 2021-07-06 11:32:11 -07:00
Sam Lantinga
0f00f6dd86 Ignore checkkeysthreads 2021-07-06 10:01:31 -07:00
Sam Lantinga
24e836b0db Added controller mapping for the Nimbus+ controller on macOS when MFi support is not available 2021-07-06 10:00:09 -07:00
Ozkan Sezer
6b21a6ccc6 Update config.guess and config.sub from mainstream. 2021-07-05 20:02:02 +03:00
Ivan Epifanov
0994a75879 Don't hardcode message length 2021-07-01 15:14:49 -07:00
Ivan Epifanov
3b6e999244 Vita: remove unused variable and allow Razor perf analysis 2021-07-01 15:14:49 -07:00
Ivan Epifanov
656eb7df35 Vite: return system installed memory 2021-07-01 15:14:49 -07:00
Ivan Epifanov
89015b9c35 Vita: default window size for tests 2021-07-01 15:14:49 -07:00
Ivan Epifanov
b55ee12f69 Vita: fix clip rectangle 2021-07-01 15:14:49 -07:00
Ivan Epifanov
e41d3e617e VIta: fix render clearing 2021-07-01 15:14:49 -07:00
Ivan Epifanov
6b12280510 Vita: proper syntax 2021-07-01 15:14:49 -07:00
Ivan Epifanov
32deb6f70c Vita: fix point size 2021-07-01 15:14:49 -07:00
Ivan Epifanov
9d4527193d Vita: append messagebox title 2021-07-01 15:14:49 -07:00
Ivan Epifanov
6460151c84 Vita: add missing stub 2021-07-01 15:14:49 -07:00
Dimitriy Ryazantcev
39302c9214 Add Steam Virtual Gamepad and Xbox 360 Wired Controller defines instead of magic values
See  https://partner.steamgames.com/doc/features/steam_controller/steam_input_gamepad_emulation_bestpractices for details on what is Steam Virtual Gamepad.
2021-06-30 08:48:13 -07:00
Sam Lantinga
0c4ac33a09 Added support for the Razer Wolverine Tournament Edition controller 2021-06-28 14:31:27 -07:00
Ozkan Sezer
2143534a1c configure.ac: manually check immintrin.h with AC_COMPILE_IFELSE().
AC_CHECK_HEADER() emits warnings when configuring for non-x86, because
the preprocessor check is OK but the compile check is not:

configure: WARNING: immintrin.h: present but cannot be compiled
configure: WARNING: immintrin.h:     check for missing prerequisite headers?
configure: WARNING: immintrin.h: see the Autoconf documentation
configure: WARNING: immintrin.h:     section "Present But Cannot Be Compiled"
configure: WARNING: immintrin.h: proceeding with the compiler's result
2021-06-28 02:00:24 +03:00
Joshua Ashton
ca383599b5 Fix Anne Pro II keyboard showing up as a joystick
Having used this for a couple years, I can definitely confirm that it is not a joystick.
2021-06-26 21:23:26 -07:00
Joshua Ashton
c90bd3bf79 Add missing PS5 DualSense GUIDs
Fixes my DualSense controller not being recognised as a SDL GameController which breaks Steam Input filtering causing SDL to fight for input.
2021-06-26 21:21:46 -07:00
Ozkan Sezer
bfdea60572 avoid -Wundef warning from SDL_config_windows.h 2021-06-26 05:56:10 +03:00
Sam Lantinga
205b951b46 SDL_DINPUT_JoystickPresent() needs to do the full device enumeration
It is called from WGI before the normal joystick detection has been run, so it needs to actually enumerate currently connected devices.

We can skip the logic checking for other drivers also supporting this device, because that logic is duplicated from the call site.
2021-06-25 14:20:08 -07:00
Sam Lantinga
ae6d9e343b Correcting the name of the Amazon Luna Controller 2021-06-25 11:09:46 -07:00
Sam Lantinga
5042ab6f24 Added Linux and macOS mappings for the DirectInput mode of the Amazon Luna Controller 2021-06-24 18:09:06 -07:00
Sam Lantinga
5b051459ed Fixed warnings on Windows 2021-06-24 18:09:04 -07:00