src/joystick/darwin/SDL_iokitjoystick.c


Log

Author Commit Date CI Message
Pierre Wendling d0bbfdbf 2022-12-01T16:07:03 Clang-Tidy fixes (#6725) (cherry picked from commit 3c501b963dd8f0605a6ce7978882df39ba76f9cd)
Sam Lantinga 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)
Sylvain Becker 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)
Sam Lantinga eb046958 2022-09-16T08:19:45 Fixed build warning
Sam Lantinga 277b033e 2022-08-22T19:28:21 Refactor joystick GUID creation
Sam Lantinga 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
Pierre Wendling 6c536afd 2022-06-27T15:43:17 Fix C89 declaration for macOS modules. Since Clang 14, `-Wdeclaration-after-statement` is enforced on every standard.
Sam Lantinga e551384a 2022-04-26T14:54:14 Added functions to get the platform dependent name for a joystick or game controller
Sam Lantinga 120c76c8 2022-01-03T09:40:00 Updated copyright for 2022
Cameron Gutman 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.
Cameron Gutman 1ccfbf96 2021-11-11T11:13:08 joystick: Convert HasLED() into a generic GetCapabilities() function
Sam Lantinga 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
Sam Lantinga bdc6e4ff 2021-01-14T15:03:11 Fixed bug 5195 - Replugging in "mixed" controller types crashes on macOS RustyM This is related to Bug 5034, but crashes under a somewhat different condition. In the latest tip (changeset 13914) or with the SDL 2.0.12 source + David?s 5034 patch, unplugging and then replugging in certain controller types on macOS will crash. A mix of new controllers like Switch Pro, PS4 and Xbox One all work without issue. But if a controller without a rumble function, like many SNES retro USB gamepads, is mixed with a PS4 or Switch Pro controller it will crash. File: joystick/darwin/SDL_sysjoystick.c Function: static recDevice *FreeDevice(recDevice *removeDevice) On line 159: while (device->pNext != removeDevice) { Causes: Thread 1: EXC_BAD_ACCESS (code=1, address=0x188) This can be reproduced in testgamecontroller" by starting the test program with both a ?retro? controller plugged in and a ?modern rumble? controller (Switch Pro/PS4). This may crash on launch, but it depends on which controller ends up as device 0. If it doesn?t crash, unplug the ?modern rumble? controller and plug it back in. Some of the "retro" controllers I?ve seen this crash with: - iBuffalo SNES Controller - 8Bitdo SN30 Gamepad (in MacOS mode) - Retrolink NES Controller - HuiJia SNES Controller Adaptor The issue appears macOS specific. Seen on 10.12.6 and 10.14.6. Not seen on Windows 10. The while loop in FreeDevice() assumes that every device is not NULL. recDevice *device = gpDeviceList; while (device->pNext != removeDevice) { device = device->pNext; } device->pNext = pDeviceNext; So maybe we should check for NULL here? Or instead prevent adding NULL devices to the list in the first place? Checking device for NULL before entering the loop appears to work. recDevice *device = gpDeviceList; if (!device) { while (device->pNext != removeDevice) { device = device->pNext; } } device->pNext = pDeviceNext;
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Sam Lantinga 6a7f29cd 2020-11-25T11:31:17 Fixed compiling on tvOS
Sam Lantinga e4b7d9a2 2020-11-24T07:56:59 Removed usage of TARGET_OS_OSX for building with older SDKs
Sam Lantinga 97782e6c 2020-11-24T07:11:49 Don't try to call IOS_SupportedHIDDevice() if it's not defined
Sam Lantinga fd894467 2020-11-21T14:13:26 Fixed building on Mac OS X on the command line and with an older macOS SDK