|
d0bbfdbf
|
2022-12-01T16:07:03
|
|
Clang-Tidy fixes (#6725)
(cherry picked from commit 3c501b963dd8f0605a6ce7978882df39ba76f9cd)
|
|
b8d85c69
|
2022-11-30T12:51:59
|
|
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 5750bcb174300011b91d1de20edb288fcca70f8c)
|
|
2d24baaa
|
2022-11-29T09:26:29
|
|
Fixed building on Windows with SDL_VIDEO=OFF
Fixes https://github.com/libsdl-org/SDL/issues/6562
|
|
fb0ce375
|
2022-11-27T17:38:43
|
|
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 6a2200823c66e53bd3cda4a25f0206b834392652 to reduce conflicts merging between SDL2 and SDL3)
|
|
8b20b568
|
2022-11-21T07:41:35
|
|
Don't report battery level for disconnected batteries
Fixes https://github.com/libsdl-org/SDL/issues/6536
|
|
ec58a817
|
2022-10-05T19:26:09
|
|
Fixes made in response to running a static code analyzer under MS Windows.
Most of these are probably harmless, but the changes to SDL_immdevice.c and SDL_pixels.c appear to have fixed genuine bugs.
SDL_audiocvt.c: By separating the calculation of the divisor, I got rid of the suspicion that dividing a double by an integer led to loss of precision.
SDL_immdevice.c: Added a missing test, one that could have otherwise led to dereferencing a null pointer.
SDL_events.c, SDL_gamecontroller.c, SDL_joystick.c, SDL_malloc.c, SDL_video.c: Made it clear the return values weren't used.
SDL_hidapi_shield.c: The size is zero, so nothing bad would have happened, but the SDL_memset() was still being given an address outside of the array's range.
SDL_dinputjoystick.c: Initialize local data, just in case IDirectInputDevice8_GetProperty() isn't guaranteed to write to it.
SDL_render_sw.c: drawstate.viewport could be null (as seen on line 691).
SDL.c: SDL_MostSignificantBitIndex32() could return -1, though I don't know if you want to cope with that (what I did) or SDL_assert() that it can't happen.
SDL_hints.c: Replaced boolean tests on pointer values with comparisons to NULL.
SDL_pixels.c: Looks like the switch is genuinely missing a break!
SDL_rect_impl.h: The MacOS static checker pointed out issues with the X comparisons that were handled by assertions; I added assertions for the Y comparisons.
SDL_yuv.c, SDL_windowskeyboard.c, SDL_windowswindow.c: Checked error-result returns.
|
|
b7e65a81
|
2022-11-11T08:57:07
|
|
Fixed incorrect WGI controller state when the application loses focus
Recenter the controller elements when WGI stops reporting valid state
Fixes https://github.com/libsdl-org/SDL/issues/5261
|
|
3d35c085
|
2022-10-02T17:30:03
|
|
fix a few 'unused but set variable' and 'unused function' warnings
|
|
0bc852ce
|
2022-10-17T17:43:06
|
|
Revert "Disable the RAWINPUT joystick driver by default"
Disabling RAWINPUT on Windows 10 causes these issues:
* All Xbox controllers are named "XInput Controller".
* Trigger rumble no longer works.
* "XInput Controllers" are now also listed as separate haptic devices
|
|
47ba997f
|
2022-10-17T07:39:52
|
|
Disable the RAWINPUT joystick driver by default
It's only needed to support more than 4 Xbox controllers, and adds significant complexity to the joystick processing, and we regularly get bugs from people who aren't using an SDL window who need to turn on SDL_HINT_JOYSTICK_THREAD.
|
|
5025f240
|
2022-10-17T07:32:44
|
|
Don't use RAWINPUT joystick driver on Windows XP
Fixes https://github.com/libsdl-org/SDL/issues/6400
|
|
3607f831
|
2022-10-03T11:00:50
|
|
Find out if a controller is wireless using WGI (thanks @DJm00n!)
Confirmed using an Xbox Series X controller over USB and Bluetooth
Fixes https://github.com/libsdl-org/SDL/issues/6322
|
|
a3900a75
|
2022-09-08T13:59:25
|
|
Lock joysticks when removing a controller on the WGI thread
|
|
0ad8d9d2
|
2022-09-07T15:31:24
|
|
SDL_IsXInputDevice() shouldn't return true if XInput isn't enabled
|
|
e5f161bd
|
2022-08-30T19:12:22
|
|
Restored accidentally removed code to guess XInput device
|
|
973a677a
|
2022-08-31T02:32:28
|
|
SDL_xinputjoystick.c: commented out GuessXInputDevice()
Not used since commit 277b033e78235d6ffad7525a1fb9acfef3a43433.
|
|
42d09a8f
|
2022-08-30T13:54:32
|
|
wgi: refcount the delegate objects
|
|
ca915b18
|
2022-08-30T13:54:58
|
|
WGI_JoystickUpdate: bounds-check array sizes
|
|
92d3fc48
|
2022-08-30T12:58:38
|
|
Fixed deadlock when shutting down the Windows joystick system
|
|
675d90c7
|
2022-08-30T12:09:07
|
|
Revert "wgi: refcount the delegate objects"
This reverts commit ff233fe3060e51706937a7b366438403bce774a4.
This doesn't compile cleanly with Visual Studio and I don't want to introduce any subtle issues because we're passing the wrong types of pointers to WGI functions.
|
|
40bd4fee
|
2022-08-30T11:42:13
|
|
Revamped joystick locking
This makes the joystick locking more robust by holding the lock while updating joysticks.
The lock should be held when calling any SDL joystick function on a different thread than the one calling SDL_PumpEvents() and SDL_JoystickUpdate().
It is now possible to hold the lock while reinitializing the joystick subsystem, however any open joysticks will become invalid and potentially cause crashes if used afterwards.
Fixes https://github.com/libsdl-org/SDL/issues/6063
|
|
ff233fe3
|
2022-08-28T22:20:58
|
|
wgi: refcount the delegate objects
assert if calls become unbalanced.
|
|
b7c1fbf9
|
2022-08-28T17:38:02
|
|
WGI: Fix a couple of reference leaks
|
|
277b033e
|
2022-08-22T19:28:21
|
|
Refactor joystick GUID creation
|
|
c1e08739
|
2022-08-22T16:46:55
|
|
Added the CRC of the joystick name to the GUID
This will make it possible to have mappings for different controllers
that have the same VID/PID. This happens frequently with some generic
controller boards that have been reused in many products.
Fixes https://github.com/libsdl-org/SDL/issues/6004
|
|
cfbeb438
|
2022-08-12T21:05:37
|
|
fix a bug if XINPUTGETBATTERYINFORMATION is nullptr
|
|
5aa438e8
|
2022-08-08T14:52:19
|
|
WGI: fix interop with applications that have their own WGI code
QI for Added/Removed events need to handle IAgileObject
|
|
12aa4d56
|
2022-08-01T11:11:25
|
|
Added header needed for SDL_Delay()
|
|
aeb27514
|
2022-08-01T10:38:31
|
|
Poll DirectInput devices to get their initial state
Fixes https://github.com/libsdl-org/SDL/issues/3816
|
|
f317d619
|
2022-07-01T13:59:14
|
|
Xbox GDKX support (#5869)
* Xbox GDK support (14 squashed commits)
* Added basic keyboard testing
* Update readme
* Code review fixes
* Fixed issue where controller add/removal wasn't working (since the device notification events don't work on Xbox, have to use the joystick thread to poll XInput)
|
|
6a2e6c82
|
2022-06-28T21:03:16
|
|
Add SDL_HINT_DIRECTINPUT_ENABLED (on by default)
|
|
16f55fbd
|
2022-06-15T20:44:43
|
|
Separate the controller protocol from the controller style
This allows us to handle controllers that use the Xbox protocol but look like Nintendo Switch or Playstation controllers, like the Qanba Dragon Arcade Stick in PC mode
|
|
714502d3
|
2022-06-13T22:15:56
|
|
minor windows warning fixes.
|
|
d2c4d74d
|
2022-05-27T15:49:35
|
|
Fixed build with MinGW-64 windows.devices.power.h
The MinGW-64 header defines the parameters as ABI::Windows::Foundation::IReference<INT32 > **, but the Windows header defines the parameters as __FIReference_1_int**
|
|
bd22ca76
|
2022-05-27T15:40:50
|
|
Revert "Workaround for compiling with MinGW-w64"
This reverts commit efdf43aa9b4f4d623ffba01f503d9793d5021330.
The broken mingw headers aren't in an official release yet, so reporting this upstream.
|
|
efdf43aa
|
2022-05-27T15:34:45
|
|
Workaround for compiling with MinGW-w64
Fixes bug https://github.com/libsdl-org/SDL/issues/5589
|
|
b28d304b
|
2022-05-24T17:24:03
|
|
Only include controller_type.h in SDL_joystick.c
It has a huge array of controllers and we only want it instantiated once
|
|
0cca71a8
|
2022-05-18T22:12:05
|
|
Use SDLCALL for callbacks in public APIs
|
|
3f813cf1
|
2022-05-04T10:05:56
|
|
SDL_rawinputjoystick.c: fixed -Werror=declaration-after-statement
|
|
bb0b6dd4
|
2022-05-02T20:12:13
|
|
Fixed using WGI without XInput
|
|
e551384a
|
2022-04-26T14:54:14
|
|
Added functions to get the platform dependent name for a joystick or game controller
|
|
c39df2fb
|
2021-12-22T18:27:10
|
|
joystick: get HID top-level collection preparsed data directly from RawInput API.
|
|
0b2a55ea
|
2022-02-02T14:58:33
|
|
Fix typo
|
|
0964c84d
|
2022-02-02T11:21:32
|
|
Always use SDL_PrivateJoystickBatteryLevel to update battery level
But do not use it for initialisation.
|
|
04bf7c94
|
2022-04-22T09:36:39
|
|
Fixed build
|
|
d9b5805b
|
2022-04-22T09:12:48
|
|
Return a correlation error when trigger rumble is attempted without correlation
|
|
145824f6
|
2022-04-21T01:38:53
|
|
WGI: Only call RoUninitialize() if RoInitialize() succeeded
|
|
00b2e10a
|
2022-04-20T20:58:29
|
|
WGI: Keep a reference to the MTA to avoid crashing on COM teardown
Fixes #5552
Fixes #5270
|
|
312c899f
|
2022-04-02T03:32:10
|
|
attempt to fix uwp build
|
|
8ebef12d
|
2022-04-01T14:58:33
|
|
Use RoInitialize/RoUninitialize for Windows.Gaming.Input
Thanks @walbourn!
Fixes https://github.com/libsdl-org/SDL/issues/5270
|
|
006aafab
|
2022-03-22T20:23:09
|
|
Fixed freeing a constant string (thanks @gnrlwart)
|
|
1868c5b5
|
2022-03-17T18:25:50
|
|
Start rumbling once a raw input controller has been correlated
Fixes https://github.com/libsdl-org/SDL/issues/5351
|
|
b22ce2b5
|
2022-03-17T17:10:40
|
|
Workaround for bug in Microsoft WGI support
Fixes https://github.com/libsdl-org/SDL/issues/5270
|
|
677dc101
|
2022-03-09T19:43:29
|
|
rawinput: Fix double detection of gamepads on some 3rd party X360 wireless receivers
The name that the Raw Input joystick driver pulls from the HID stack comes
from USB string descriptors contained on the device. For official wireless
receivers, this always contains "Xbox 360 Wireless Receiver for Windows"
which matches the friendly name that WGI provides.
3rd party Xbox 360 wireless receivers may have different strings in their
USB string descriptors (one uses "XBOX 360 For Windows" instead). This
fails to match WGI's name and causes Raw Input and WGI to both report the
same gamepad.
Since wireless Xbox 360 controllers seem to have a consistent VID/PID
regardless of the adapter enumerating them, we can also match on that to
catch these.
The duplicate case reported to me was:
Controller (XBOX 360 For Windows) - 030000005e040000a102000000007200
Xbox 360 Wireless Receiver for Windows - 030000005e0400000000000000007701
|
|
9299a3e7
|
2022-02-21T16:24:45
|
|
Workaround for crash in CoUninitialize()
|
|
f97a29f6
|
2022-02-11T22:10:33
|
|
Use the real device VID/PID when seeing the Steam virtual controller
|
|
43f0271b
|
2022-01-24T08:56:33
|
|
Revert "fix compiler warnings in SDL_windows_gaming_input.c"
This reverts commit ca36cdb185f2f26241598068927821896f36b904.
The older Windows SDK's headers are wrong, and this change would crash if
you hotplug a device.
|
|
d7110b44
|
2022-01-08T12:07:16
|
|
fix compiler warnings in SDL_windows_gaming_input.c
|
|
67cb548b
|
2022-01-20T19:31:54
|
|
Fixed build error with C90 compilers
|
|
a23b3c76
|
2022-01-20T17:21:28
|
|
Add support for correlating trigger input
|
|
d73bd0d2
|
2022-01-03T21:39:30
|
|
dinput: Don't crash in SDL_DINPUT_JoystickPresent if DInput init failed
The WGI driver will call this regardless of whether our init succeeded.
|
|
120c76c8
|
2022-01-03T09:40:00
|
|
Updated copyright for 2022
|
|
dd2f9111
|
2021-11-27T20:18:29
|
|
Fixed warnings with Windows SDK 10.0.19041
Fixes https://github.com/libsdl-org/SDL/issues/4998
Also breaks https://github.com/libsdl-org/SDL/issues/4998 for older SDKs, but we're going to ignore them, they're just incorrect.
|
|
c2904c8c
|
2021-11-27T11:16:15
|
|
Fixed compile warnings and errors
Fixes https://github.com/libsdl-org/SDL/issues/4998
|
|
09b7ca27
|
2021-11-27T10:53:20
|
|
Get the current WGI controller list at startup
On Win32 this list is empty and we always get controller added events. On UWP, this list is populated and we don't get controlle added events for currently connected controllers.
|
|
12895eca
|
2021-11-27T10:52:58
|
|
Fixed WGI initialization on Win32
|
|
110e4e13
|
2021-11-27T10:24:32
|
|
Use WGI instead of XInput for Windows 10 UWP apps
Fixes https://github.com/libsdl-org/SDL/issues/5017
|
|
02021ae7
|
2021-11-27T13:17:04
|
|
Return capabitlities from RawInput joystick
|
|
67b5de5b
|
2021-11-26T10:18:08
|
|
Fixed build warnings
|
|
2ca2ad76
|
2021-11-26T10:13:45
|
|
Fixed build warnings
|
|
f8900583
|
2021-11-23T17:04:40
|
|
removed windows winmm joystick driver
|
|
6fb50bd0
|
2021-11-22T11:16:23
|
|
Don't use "exp" as a name so that it's doesn´t show up with searching for the function
|
|
881a6749
|
2021-11-18T19:58:04
|
|
rawinput: Only access SDL_RAWINPUT_mutex if initialized
We can also ditch the lock in RAWINPUT_JoystickQuit() now that the joystick
subsystem quits drivers in reverse order. There's no chance of a racing call
to RAWINPUT_WindowProc() anymore.
|
|
3eb9bfac
|
2021-11-14T22:22:50
|
|
win32 rawinput & wgi joystick: avoid -Werror=declaration-after-statement
|
|
c2dd50a9
|
2021-11-12T08:28:02
|
|
Fixed whitespace
|
|
50971577
|
2021-11-11T22:35:41
|
|
dinput: Fix memory leak when SDL_DINPUT_JoystickPresent() returns true
|
|
afccabb8
|
2021-11-11T12:12:05
|
|
joystick: Add capability flags for rumble and trigger rumble
When API limitations force us to guess, we favor a false positive (reporting
support when it doesn't exist) compared to a false negative.
|
|
1ccfbf96
|
2021-11-11T11:13:08
|
|
joystick: Convert HasLED() into a generic GetCapabilities() function
|
|
f6dc47ca
|
2021-11-07T16:00:47
|
|
WGI/DInput: Fix SDL_IsXInputDevice() checks when RawInput is enabled
Enabling the RawInput backend causes SDL_XINPUT_Enabled() to return false.
That causes WGI and DInput backends to take ownership of XInput-compatible
controllers, because they think there's no XInput-specific backend enabled.
In WGI's case, it will actually race with RawInput to open the device. By
properly excluding XInput devices from WGI, we can ensure that the sets of
devices managed by WGI and RawInput don't intersect. This makes the race
harmless, since they'll never both go after the same device.
|
|
b3e909dc
|
2021-11-07T13:51:34
|
|
WGI: Fix SDL_IsXInputDevice() for Xbox One controllers
The Xbox One driver stack doesn't propagate the VID/PID down to the
HID devices that end up in the GetRawInputDeviceList() output. This
means we end up matching against the wrong VID/PID and can't properly
exclude Xbox One controllers from WGI.
Fortunately, it is possible to walk back up the device tree to find
the parent with the matching VID/PID.
|
|
6312aaea
|
2021-11-06T21:52:22
|
|
WGI: Add workaround for delayed callbacks after WGI_JoystickQuit()
|
|
2371b247
|
2021-10-31T18:27:51
|
|
windows: improve feature detection consistency between CMake and non-CMake builds
|
|
27a48b14
|
2021-09-07T15:50:21
|
|
Check the pathname first, as that's a faster check for XInput devices
|
|
9b4884d5
|
2021-08-03T09:23:54
|
|
Warn if you're building a partially functional RAWINPUT driver without device notifications
|
|
834a84fa
|
2021-08-03T05:02:32
|
|
winrt: Don't use LoadLibraryA on WinRT.
This removes the CM_Register_Notification code on WinRT. Note
that this API _is_ available to UWP apps as of Windows 10.0.17763
(version 1809, released October 2018), according to:
https://docs.microsoft.com/en-us/uwp/win32-and-com/win32-apis#apis-from-api-ms-win-devices-config-l1-1-1dll
So it might be worth readding with some sort of preprocessor check
for minimum targeted version, or whatever is appropriate for WinRT
development.
|
|
02223501
|
2021-08-02T16:40:58
|
|
Fixed crash if WGI didn't give us the name for a controller
|
|
9d457aa4
|
2021-07-29T14:24:40
|
|
Don't uninitialize COM because of what appears to be a bug in Microsoft WGI reference counting.
This fixes https://github.com/libsdl-org/SDL/issues/4488
|
|
d4ac6b5e
|
2021-07-24T15:58:33
|
|
Detect buffer overflow when getting DirectInput device state
This fixes bug https://github.com/libsdl-org/SDL/issues/4528
|
|
adb75d64
|
2021-07-23T23:45:18
|
|
Fixed hotplug detection not working on UWP or when SDL isn't pumping Windows events
This fixes bugs:
https://github.com/libsdl-org/SDL/issues/4321
https://github.com/libsdl-org/SDL/issues/4147
Thanks to DJm00n for the suggestion!
|
|
24059a19
|
2021-07-09T18:11:42
|
|
The RAWINPUT driver is no longer tied to HIDAPI in any way
|
|
d135c076
|
2021-07-08T13:22:41
|
|
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
|
|
39302c92
|
2021-06-02T14:28:33
|
|
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.
|
|
205b951b
|
2021-06-25T14:20:08
|
|
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.
|
|
f5122377
|
2021-06-10T14:06:32
|
|
Move SDL_IsXInputDevice check above actual joystick allocation
|
|
766d81ec
|
2021-06-10T14:01:04
|
|
Rewrite SDL_DINPUT_JoystickPresent method to avoid costly IDirectInput8_CreateDevice calls
|
|
a6da2fbf
|
2021-05-25T12:33:23
|
|
Rename haptic methods to avoid confusion with joystick:
`SDL_DINPUT_MaybeAddDevice`->`SDL_DINPUT_HapticMaybeAddDevice`
`SDL_DINPUT_MaybeRemoveDevice`->`SDL_DINPUT_HapticMaybeRemoveDevice`
`SDL_XINPUT_MaybeAddDevice`->`SDL_XINPUT_HapticMaybeAddDevice`
`SDL_XINPUT_MaybeRemoveDevice`->`SDL_XINPUT_HapticMaybeRemoveDevice`
|
|
73dc68a7
|
2021-05-19T17:52:08
|
|
Simplify and cleanup DirectInput joystick backend code:
- Do not call IDirectInputDevice8_QueryInterface(device, &IID_IDirectInputDevice8,...) on DIRECTINPUTDEVICE8 device
- Get joystick VendorID and ProductID via IDirectInputDevice8_GetProperty(.., DIPROP_VIDPID, ..) call instead of messing with DIDEVICEINSTANCE.guidProduct
- Normalize HID device interface path to upper case for stable operation of XInput check
- Remove useless RawInput calls in SDL_IsXInputDevice() - just check for "IG_" string in HID device interface path that we already have
There shouldn't be any observable behavior changes.
|
|
f2f759dc
|
2021-02-26T15:34:34
|
|
Remove not used DirectInput ignored_devices list
|
|
adc2d362
|
2021-02-26T15:33:41
|
|
Remove outdated and not used WIN_IsXInputDevice code
|
|
f498c281
|
2021-06-02T14:10:50
|
|
fixed build with SDL_JOYSTICK_RAWINPUT enabled after commit b81969d46f4b
See: https://github.com/libsdl-org/SDL/pull/4388#issuecomment-852713792
|