Commit Graph

3580 Commits

Author SHA1 Message Date
Sam Lantinga
59f28b7f4b Fixed whitespace 2020-12-03 18:17:01 -08:00
Sam Lantinga
f487d63a6b Fixed crash when printing NULL wide character string 2020-12-03 18:16:56 -08:00
Sylvain Becker
754286c61c SDL Renderer: specify the correct flag when recreating the window 2020-12-02 13:45:24 +01:00
Sylvain Becker
035f8f2391 SDL_RecreateWindow: allow clearing VULKAN when recreating the window 2020-12-02 13:37:59 +01:00
Sylvain Becker
93fbab0fac SDL_ReCreateWindow: allow to unload METAL window and switch back to OpenGL.
On older mac, where METAL Renderer METAL fails to create, it allows to switch back to OpenGL SDL_Renderer
by re-creating the window (METAL flags was previously persistent).
2020-12-02 11:04:53 +01:00
Cameron Gutman
9d40a0f317 Fix joystick device add events containing invalid device indexes
This can happen if the application has not yet processed SDL_JOYDEVICEADD when
the same joystick is removed. It may also happen if two joysticks are added
and the second joystick is removed before the first joystick's SDL_JOYDEVICEADD
has been processed by the application.
2020-08-29 16:50:26 -07:00
Sam Lantinga
c78ca2d170 Fixed bug 5371 - Rawinput: Fix truncating cast of string length.
Joel Linn

Fixes an implicit truncation of a string length on 64bit systems.
2020-12-01 13:38:42 -08:00
Sam Lantinga
a3ccf9adca Fixed bug 5373 - [PATCH] Rawinput: Get correlated XInput battery info
Joel Linn

Currently the rawinput driver always reports a device as "wired". This changes that to "unknown" and updates it once the device is correlated with xinput.
2020-12-01 13:36:41 -08:00
Sam Lantinga
e3966e25ca Use the correct internal API for updating the battery level for PS5 controllers 2020-11-30 13:04:30 -08:00
Sam Lantinga
f4ed07de06 We don't know whether the PS5 controller is Bluetooth or not when we open it 2020-11-30 13:02:34 -08:00
Sam Lantinga
1f2f536bd2 Fixed XInput correlation for raw input controllers after hotplug events 2020-11-27 18:57:40 -08:00
Sam Lantinga
1c865c460b Load the raw input device list at init time so it's available when DirectInput is doing device detection 2020-11-27 18:57:36 -08:00
Sam Lantinga
a0c5bfa3bd Moved raw input event processing from the main thread to the joystick thread
This allows fast joystick event delivery regardless of what the main thread is doing.
2020-11-27 13:08:40 -08:00
Sam Lantinga
4fbefbe20d Sort the raw input axes by usage, so X comes before Y, etc. 2020-11-27 11:33:53 -08:00
Sam Lantinga
4ddac485db Backed out minor optimization that prevented correlation_id from being set 2020-11-27 11:33:51 -08:00
Sam Lantinga
8973a25849 Enable dispatching of WM_INPUT_DEVICE_CHANGE events directly, in case the application hasn't created a window with the normal message loop 2020-11-27 10:44:56 -08:00
Sam Lantinga
e8adc64810 Enable dispatching of WM_INPUT events directly, in case the application hasn't created a window with the normal message loop 2020-11-27 10:44:55 -08:00
Sam Lantinga
0252235e82 Recheck devices if another API queries raw input for a new device 2020-11-27 10:44:53 -08:00
Sam Lantinga
a7dede7e36 Re-enable axis correlation for raw input controllers, for twin stick shooters that don't need face buttons 2020-11-27 10:44:51 -08:00
Sam Lantinga
ce77966da8 Fixed RAWINPUT_IsDevicePresent() not returning TRUE for Xbox One controllers 2020-11-27 10:44:49 -08:00
Sam Lantinga
8a449de20d Fixed Xbox 360 wireless controller being picked up by WGI when it's being managed by RAWINPUT 2020-11-27 10:44:47 -08:00
Sam Lantinga
37c9e4afa3 Fixed processing WM_INPUT_DEVICE_CHANGE at startup 2020-11-27 06:03:15 -08:00
Sam Lantinga
248fc75bd2 Correlate just based on buttons, joystick axes are not as precise and could potentially cause incorrect uncorrelation.
It's okay if the triggers aren't precise until someone presses a button on their controller.
2020-11-27 05:53:56 -08:00
Sam Lantinga
e7e615de26 Removed extraneous windows message pumping
Most of the raw input events are dispatched in the main windows message loop. We only dispatch device change messages separately when we need them to be completely up to date.
2020-11-27 05:53:54 -08:00
Sam Lantinga
2931eccd84 Fixed detecting Bluetooth raw input devices, which have device names longer than 128 characters 2020-11-27 05:53:52 -08:00
Sam Lantinga
849ce80376 Renamed SDL_JOYSTICK_RAWINPUT_GAMING_INPUT to SDL_JOYSTICK_RAWINPUT_WGI 2020-11-27 05:53:50 -08:00
Sam Lantinga
219a28dd8a Fixed D-pad uncorrelating raw input controllers (thanks Jimbly!) 2020-11-27 03:45:05 -08:00
Sylvain Becker
2c079a2f6c SDL_FillRects: prevent empty SDL_surface from raising an error message
It's legitimate to have a surface with 0 width or height (null 'pixels' pointer).
But calling SDL_FillRects would wrongly set the error "You must lock the surface".
2020-11-27 09:42:14 +01:00
Ozkan Sezer
3fbff2a45b SDL_rawinputjoystick.c: fix ambiguous 'else' warning
src/joystick/windows/SDL_rawinputjoystick.c: In function 'RAWINPUT_HandleStatePacket':
src/joystick/windows/SDL_rawinputjoystick.c:1343:9: warning: suggest explicit braces to avoid ambiguous 'else'
2020-11-26 10:47:33 +03:00
Sam Lantinga
845b903324 Implemented trigger rumble for raw input controllers 2020-11-25 16:46:42 -08:00
Sam Lantinga
517be80822 Implemented battery status for Bluetooth Xbox One controllers
Also switched the rumble loop count to 0xEB (one hour) to match Windows driver
2020-11-25 16:05:19 -08:00
Sam Lantinga
6a7f29cdbb Fixed compiling on tvOS 2020-11-25 11:31:17 -08:00
Sam Lantinga
9ec2cf5629 Fixed building with Windows.Gaming.Input enabled 2020-11-25 10:31:59 -08:00
Sam Lantinga
3c07dd12f0 Strip an extra '.' off of the HORI manufacturer name 2020-11-25 10:28:48 -08:00
Sam Lantinga
159d1b3df5 Don't set the serial number after the controller is opened
We'll use the USB value instead so it's available as soon as it's opened.
2020-11-25 01:35:45 -08:00
Sam Lantinga
7d92b14f46 Simplified Xbox One controller initialization state, and don't query for the serial number. 2020-11-25 01:18:18 -08:00
Sam Lantinga
9fc4a4c92c Revamped Xbox One HIDAPI init sequence
Added support for querying the controller serial number on newer firmware
2020-11-24 22:25:26 -08:00
Sam Lantinga
46a844786b Added SDL_wcscasecmp() and SDL_wcsncasecmp() 2020-11-24 12:43:01 -08:00
Sam Lantinga
e4b7d9a221 Removed usage of TARGET_OS_OSX for building with older SDKs 2020-11-24 07:56:59 -08:00
Ethan Lee
a7d91ebaa5 winrt: Add EffectiveLocation support for newer Win10 releases 2020-11-09 17:05:21 -05:00
Sam Lantinga
a5cde4cb0c Fixed trying to use @available() on older SDK 2020-11-24 07:29:55 -08:00
Sam Lantinga
97782e6c64 Don't try to call IOS_SupportedHIDDevice() if it's not defined 2020-11-24 07:11:49 -08:00
Sam Lantinga
a063b9fbfb Fixed compiler warning 2020-11-24 07:06:31 -08:00
Sam Lantinga
c63bbb06e9 Including SDL_config_iphoneos.h enables MFI controller code 2020-11-24 06:55:33 -08:00
Sam Lantinga
7a05dbf4b9 Fixed building on FreeBSD
Alex S

Looks like we have a collision with https://hg.libsdl.org/SDL/rev/cd774daff9f6. (Again, the headers in the base system are intended for drivers and should not be used for compiling non-base applications. At least that's the policy for now: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240964#c19.)
2020-11-24 06:42:53 -08:00
Sam Lantinga
feab9d42c1 5363 - Memory leak of joystick->sensors in SDL_JoystickClose
Mathieu Eyraud

Joystick->sensors is never freed.
2020-11-24 06:40:13 -08:00
Sam Lantinga
34bea84a54 Fixed bug 5335 - Patch: enable joystick/haptic/evdev support by default on FreeBSD
Alex S

Ah, that's not quite enough. You need to:
  1. rename src/joystick/bsd/SDL_sysjoystick.c to something;
  2. regenerate configure.
2020-11-23 23:03:55 -08:00
Sam Lantinga
1e943e2ad2 Fixed building with an older SDK and macOS target 2020-11-23 22:59:22 -08:00
Sam Lantinga
4121ab6200 Fixed bug 5354 - DirectFB: Add Vulkan support
Nicolas Caramelli

This patch adds Vulkan support for the DirectFB video driver.
A screenshot with SDL tests running on DirectFB is available on the HiGFXback project:

https://github.com/caramelli/higfxback/wiki/DirectFB#sdl
2020-11-23 21:25:07 -08:00
Sam Lantinga
e44bf8a080 Fixed bug 5359 - Incorrect sensor data from DualShock4
multiply gyro values by sensitivity

When the hardware calibration fails, values read from sensors need to be multiplied by default sensitivity (16 for gyro, 1 for accelerometer).
2020-11-23 21:18:37 -08:00