include


Log

Author Commit Date CI Message
Ozkan Sezer b6e63625 2020-12-13T15:32:24 fix bug #5395: handle old systems where inotify_init1 is not available
Sam Lantinga ce7c751c 2020-12-12T23:54:40 Document that the joystick deadzone hint defaults off
Sam Lantinga 13a4caf1 2020-12-12T22:08:02 Fixed bug 4286 - Joystick subsystem causes "not responding" when app is in the background Added a hint to control whether a separate thread should be used for joystick events. This is off by default because dispatching messages in other threads appears to cause problems on some versions of Windows.
Ozkan Sezer bca9decb 2020-12-12T23:28:10 fix bug #5394 - define _DARWIN_C_SOURCE only if not already defined
Sam Lantinga 7fa5e95b 2020-12-09T07:23:47 Fixed bug 5213 - Add support to metal in iOS/tvOS simulator Vincent Hamm Xcode11 and ios13 added support for metal simulator. Here is a quick and dirty patch to enable it. Pretty early and only tested on a few samples for now. Required mostly to enable metal support on correct version of ios, generate simulator compatible shaders and enforce buffer alignments on simulator (same as osx).
Ozkan Sezer 250a0557 2020-12-09T12:01:10 fix bug #5384 -- define DLL_EXPORT in DLL builds and adjust begin_code.h
Sam Lantinga a2098a47 2020-12-08T18:56:06 Updated SDL to 2.0.14 in preparation for release candidate
Sam Lantinga 7f1c6e82 2020-12-08T09:13:08 Accepted patch https://github.com/microsoft/vcpkg/blob/master/ports/sdl2/enable-winrt-cmake.patch
Sam Lantinga 7854f43b 2020-12-01T14:43:15 Disable SDL_JOYSTICK_HIDAPI on iOS and tvOS by default It's only needed for Steam Controller support, and introduces a Bluetooth framework dependency which requires additional permissions on the App Store.
Sam Lantinga a0c5bfa3 2020-11-27T13:08:40 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.
Sam Lantinga 845b9033 2020-11-25T16:46:42 Implemented trigger rumble for raw input controllers
Ozkan Sezer e5783e11 2020-11-25T14:51:56 cmake: add missing checks for wcscasecmp, _wcsicmp, wcsncasecmp, _wcsnicmp
Ozkan Sezer 7c18088f 2020-11-25T14:51:56 SDL_config_os2.h: define HAVE__WCSICMP and HAVE__WCSNICMP
Sam Lantinga 46a84478 2020-11-24T12:43:01 Added SDL_wcscasecmp() and SDL_wcsncasecmp()
Sam Lantinga c63bbb06 2020-11-24T06:55:33 Including SDL_config_iphoneos.h enables MFI controller code
Sam Lantinga 1e943e2a 2020-11-23T22:59:22 Fixed building with an older SDK and macOS target
Sam Lantinga 1fc5ca64 2020-11-23T22:24:54 Fixed building with an older SDK and macOS target
Sam Lantinga e9869e07 2020-11-23T21:08:19 Fixed bug 5335 - enable joystick/haptic/evdev support by default on FreeBSD Alex S Evdev headers aren't actually included in the base system (well, it has a private copy), they are available through the devel/evdev-proto port instead. We also have devel/libinotify and devel/libudev-devd shims, I didn't verify whether they work with SDL.
Sam Lantinga 38ab8bf7 2020-11-23T21:03:43 Fixed bug 5362 - Mac OS ARM doesn't build Metal/Vulkan back-end/renderers C.W. Betts As it is, SDL2's built-in config on macOS for Metal excludes Apple Silicon. This is due to thinking that the 64-bit Mac platform would always be x86_64. My patch fixes this by using the catch-all of 64-bit platforms.
Sam Lantinga 62e39b5f 2020-11-23T20:57:14 Fixed building with an older SDK and macOS target
Ozkan Sezer 4c96faee 2020-11-23T20:37:10 remove non-existing tslib support from autofoo and cmake
Sam Lantinga fd894467 2020-11-21T14:13:26 Fixed building on Mac OS X on the command line and with an older macOS SDK
Sam Lantinga 1df593fb 2020-11-21T13:15:33 Fixed bug 5355 - Add GameController Framework support to macOS C.W. Betts This patch adds support to the GameController framework on macOS Big Sur and later, adding support for MFi controllers as well as rumble support for PS4 and Xbox One. There is some code to make sure that the IOKit joystick handler doesn't include two controllers at once. While the GameController framework is present in earlier versions of macOS, there was no public, approved way of checking if a specific IOHIDDevice is a controller that GameController could handle. This was changed in Big Sur.
Sam Lantinga fcb21aa8 2020-11-17T10:30:20 Added API for sensors on game controllers Added support for the PS4 controller gyro and accelerometer on iOS and HIDAPI drivers Also fixed an issue with the accelerometer on iOS having inverted axes
Sam Lantinga d140d887 2020-11-16T17:36:47 Added SDL_JoystickGetSerial() and SDL_GameControllerGetSerial()
Sam Lantinga 71e32f5e 2020-11-16T15:00:15 Added SDL_crc32()
Ozkan Sezer bbbec723 2020-11-14T14:03:40 SDL_config_windows.h: define HAVE_TRUNC[F] for Visual Studio >= 2013
Ozkan Sezer 3e40b87f 2020-11-14T14:03:40 SDL_config_os2.h: undefine HAVE_TRUNC trunc() exists only in OpenWatcom 2.0 fork, and its implementation already is the same as the fallback we have here..
Ryan C. Gordon bee8db3b 2020-11-14T02:16:41 config: Make sure HAVE_TRUNC and HAVE_TRUNCF are defined as appropriate. The configure/cmake scripts were checking for these functions but we didn't have the SDL_config.h.* pieces in place. The other config headers are best guesses.
Sam Lantinga 9f51fad3 2020-11-13T18:01:29 Added support for the touchpad on PS4 and PS5 controllers
Sam Lantinga 0500c044 2020-11-12T07:53:05 Fix SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL also applying to HIGH priorities As the name suggests, the hint should only apply to SDL_THREAD_PRIORITY_TIME_CRITICAL The resulting priorities for my current distro result in these values: | High | Time Critical Hint |--------------|----------------- 0 | P=10 N=-10 | P=5 N=-15 1 | P=10 N=-10 | P=-21 N=0
Ozkan Sezer 52486d01 2020-11-12T15:10:00 SDL_keycode.h (SDL_Keymod): remove comma at end of enumerator list
Sam Lantinga 1822f97e 2020-11-11T19:37:47 Fixed bug 5346 - Add FreeBSD evdev KBIO keyboard input driver wahil1976 This patch adds the KBIO text input driver for FreeBSD, which allows text input to fully work without text spilling out into the console. It also supports accented input, AltGr keys and Alt Lock combinations. Tested with US accent keys layout and various AltGr layouts.
Sam Lantinga 1e2caac5 2020-11-11T18:57:37 Added SDL_JoystickRumbleTriggers() and SDL_GameControllerRumbleTriggers()
Sam Lantinga 07eae7d6 2020-11-11T08:47:18 Fix process randomly getting killed when SDL_THREAD_PRIORITY_HIGH/TIME_CRITICAL is set When we request realtime priority from rtkit, we have a rttime limit. If we exceed that limit, the kernel will send SIGKILL to the process to terminate it. This isn't something that most high priority processes will want, only processes that selectively opt into SCHED_RR/FIFO through SDL_HINT_THREAD_PRIORITY_POLICY should be subject to this level of scrutiny. This change: * Switches non-apple posix OSs to use SCHED_OTHER instead of SCHED_RR for SDL_THREAD_PRIORITY_HIGH/SDL_THREAD_PRIORITY_TIME_CRITICAL. * Fixes using a hardcoded RLIMIT_RTTIME, instead queries it from rtkit * Only sets RLIMIT_RTTIME for MakeRealtime rtkit requests * Adds a note regarding the possible SIGKILL with SDL_HINT_THREAD_PRIORITY_POLICY * Introduces SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL to allow apps to acquire realtime scheduling policies on Linux
Sam Lantinga f656d845 2020-11-09T10:29:10 Fixed typo in the documentation
Sylvain Becker b198febb 2020-11-08T10:22:27 Documentation: fix minor gamecontroller parameter warning
Sam Lantinga 009b62f1 2020-11-07T02:22:15 Be explicit about mapping the new game controller paddle buttons
Sam Lantinga 3a438848 2020-11-06T17:06:41 Document the Xbox One Elite paddle buttons
Sam Lantinga 9a446aa9 2020-11-06T13:55:51 Note that SDL_CONTROLLER_BUTTON_AUX1 is sent for the PS4/PS5 touchpad button on the HIDAPI driver.
Sam Lantinga 3a3aaac2 2020-11-06T11:30:52 Added 4 auxiliary buttons to the game controller API Xbox Elite controllers use AUX1-AUX4 to represent the paddle buttons when using the HIDAPI driver PS4 and PS5 controllers use AUX1 to represent the touchpad button Nintendo Switch Pro controllers use AUX1 to represent the capture button
Sam Lantinga a22beef4 2020-11-05T17:03:28 Moved the PS5 controller driver to a separate file, as the advanced feature protocol is very different from that of the PS4
Sam Lantinga 4d79f966 2020-11-05T15:02:54 Added initial support for the Sony PS5 Controller
Sam Lantinga e555d453 2020-11-05T11:07:54 Added SDL_JoystickHasLED Currently, this is only supported by the PS4 HIDAPI driver.
Ozkan Sezer 79221e85 2020-10-29T20:00:20 SDL_stdinc.h: define _DARWIN_C_SOURCE on macOS for memset_pattern4() hopefully fixes https://bugzilla.libsdl.org/show_bug.cgi?id=5107
Ozkan Sezer fbbc4ab3 2020-10-24T20:12:50 os2: can build with libsamplerate support if wanted to.
Sylvain Becker ffb307e4 2020-10-18T09:52:56 Fixed bug 5304 - add SDL_HasSurfaceRLE() (Thanks Rene Dudfield and Dan Lawrence)
Sam Lantinga b8ed432c 2020-10-16T12:35:30 Added a note about Android 11
Ozkan Sezer 52b319fe 2020-10-16T02:50:10 minor update to os/2 config file and update. binary (dll) output doesn't change.
Ozkan Sezer d2723875 2020-10-14T23:01:06 os2: integrate the port into main tree.
Ozkan Sezer fc795f89 2020-10-13T05:20:00 SDL_cpuinfo.h: add missing const to size parameter of SDL_SIMDRealloc() so that the declaration matches the definition.
Ozkan Sezer 196cda69 2020-10-12T01:02:28 build: fix / update sensors (windows) configuration - SDL_config.h.in: add missing defines SDL_SENSOR_COREMOTION and SDL_SENSOR_WINDOWS (configure did set SDL_SENSOR_WINDOWS but it never went in SDL_config.h or Makefile.) - SDL_config.h.cmake: remove duplicated SDL_SENSOR_XXX cmake defines. - autofoo, cmake: check for sensorsapi.h header before enabling windows sensors.
Ozkan Sezer e58cc5fa 2020-10-09T03:28:30 minor whitespace fix
Ozkan Sezer 3aa418f4 2020-10-09T02:50:15 SDL_video.h (SDL_DisplayEventID): remove comma at end of enumerator list
Sam Lantinga 76980e30 2020-10-08T16:42:20 Added events for dynamically connecting and disconnecting displays, with an iOS implementation
Ryan C. Gordon 77c9d73b 2020-10-05T11:30:33 Removed SDL_AndroidOpenURL, added SDL_OpenURL. Still needs to be wired into Xcode and Visual Studio projects.
Sylvain Becker dd55bfe8 2020-10-01T14:41:09 Android: add helper function to open an URL/URI (see bug 2783)
Sylvain Becker 955f3184 2020-09-25T10:14:42 Fixed bug 5239 - Play audio on Android while backgrounded (Thanks Superfury) Add hint SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO not to pause audio when the app goes to background. (It requires SDL_ANDROID_BLOCK_ON_PAUSE as "Non blocking")
Sylvain Becker ebc12a2f 2020-09-07T18:50:30 SDL_Surface refcount: destination surface keep track of surfaces that are mapped to it and automatically invalidate them when it is freed - refcount is kept so that an external application can still create a reference to SDL_Surface. - lock_data was un-used and is now renamed and used as a list keep track of the blitmap
Sylvain Becker 97fad045 2020-09-02T19:38:03 Fixed bug 5278 - export SDL_AndroidRequestPermission() (Thanks Huki!)
Sylvain Becker 965b466e 2020-08-17T19:50:20 Fixed bug 4297 - Android StrictMode policy. Remove APK expansion support "In the second half of 2021, new apps will be required to publish with the Android App Bundle on Google Play" (see https://developer.android.com/guide/app-bundle) And "Android App Bundles don't support APK expansion (*.obb) files".
Sam Lantinga 86517d3e 2020-08-10T08:42:35 Fixed bug 5242 - KMOD_* flags unnecessarily macros; breaks OGRE Rainer Deyke While most of the KMOD_* flags are enums, the combination flags KMOD_CTRL, KMOD_ALT, KMOD_SHIFT and KMOD_GUI are defined as macros. This breaks third-party code that uses these KMOD_* names for local identifiers, such as OGRE. The correct thing to do is to make them all enums.
Kai Krakow c3ecf18c 2020-07-21T23:38:42 Linux: Add hint for disabling deadzones
Ryan C. Gordon af71510c 2020-07-16T04:43:08 assert: Implement SDL_TriggerBreakpoint for Apple ARM hardware.
Ryan C. Gordon 6aec6da4 2020-06-28T17:45:07 stdinc: Let Clang static analysis see more C runtime functions. For systems without strlcpy and strlcat, just declare them as if they exist; the analyzer possibly still knows the details of these functions and can utilize that in its analysis. Most of this patch was from meyraud705 at gmail and Martin Gerhardy. Thanks! Fixes Bugzilla #5163.
Sylvain Beucler e594a673 2020-06-27T16:25:47 emscripten: Introduce SDL_HINT_EMSCRIPTEN_ASYNCIFY See https://github.com/emscripten-core/emscripten/issues/10746 and https://github.com/emscripten-ports/SDL2/pull/112 Fixes Bugzilla #4997.
Ryan C. Gordon 1947ca70 2020-06-26T20:16:43 video: Changed SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS to default to FALSE. Fixes Bugzilla #5106. (and probably many others, too!)
Sam Lantinga 7c0986fb 2020-06-12T10:30:46 Fixed bug 4938 - Suggestion: rename SDL_PIXELFORMAT_BGR888 to SDL_PIXELFORMAT_XBGR8888 Ellie I just tripped over this: stb_image when requesting 3 channels with 8-bit actually returns them as 3 bytes per pixel with no alignment, so basically 4 pixels are 12 bytes with no padding (0...2, 3...5, 6...8, and 9...11). This I would have naively expected to be called RGB888 or BGR888, since there is no "dead" unused byte as I would expect for something called e.g. RGBX8888. However, SDL2's SDL_PIXELFORMAT_BGR888 uses 4 bytes, same as SDL_PIXELFORMAT_BGRX8888, even though the latter appears to be a longer storage format - which it isn't, internally. It's just swapped, in byte order X, B, G, R (instead of BGRX). So why isn't the macro name also swapped, as "XBGR888" instead of just "BGR888"? I find the formats therefore named inconsistently, and unless there is a reason for this I suggest these changes: 1. deprecate SDL_PIXELFORMAT_BGR888 in favor of a new SDL_PIXELFORMAT_XBGR8888 and 2. deprecate SDL_PIXELFORMAT_RGB888 in favor of a new SDL_PIXELFORMAT_XRGB8888
Ethan Lee 2aa8974f 2020-06-11T12:03:33 Add SDL_SIMDRealloc
Sam Lantinga 06267f50 2020-06-02T16:59:54 Fixed whitespace in SDL_vulkan.h
Sam Lantinga 2303d921 2020-05-29T16:28:56 Fixed bug 5145 - Fix whitespace in SDL_vulkan.h Colin Caine Everywhere else seems to use spaces. See patch diffed from a fresh hg checkout yesterday.
Sam Lantinga abd58418 2020-05-26T13:19:19 Make some changes to SDL_SetThreadPriority to try and have SDL transparently handle more of the work. 1. Comment that SDL_SetThreadPriority will make any necessary system changes when applying priority. 2. Add a hint to override SDL's default behavior for scheduler policy. 3. Modify the pthreads SDL_SetThreadPriority so that instead of just using the current thread scheduler policy it will change it to a policy that should work best for the requested priority. 4. Add hint checks in SDL_SetThreadPriority so that #3 can be overridden if desired. 5. Modify the Linux SDL_SetThreadPriority so that in the case that policy, either by SDL defaults or from the hint, is a realtime policy it uses the realtime rtkit API. 6. Prior to calling rtkit on Linux make the necessary thread state changes that rtkit requires. Currently this is done every time as it isn't expected that SDL_SetThreadPriority will be called repeatedly for a thread.
Sam Lantinga eadc8693 2020-05-11T14:31:04 Fixed bug 5103 - Port fcitx support to both fcitx 4 & 5 wengxt Due to the new major fcitx version is coming close, the existing code need to be ported to use new Fcitx dbus interface. The new dbus interface is supported by both fcitx 4 and 5, and has a good side effect, which is that it will work with flatpak for free. Also the patch remove the dependency on fcitx header. Instead, it just hardcodes a few enum value in the code so need to handle the different header for fcitx4 or 5.
Sam Lantinga 65ad4534 2020-05-04T13:17:43 Improvement for bug 3446 - The haptic API does not allow to select the direction axes meyraud705 I see how the documentation is confusing. I think that the choice of the axis is an implementation detail. The documentation should state the goal of this value, so I propose this wording: "Use this value to play an effect on the steering wheel axis. This provides better compatibility across platforms and devices as SDL will guess the correct axis." Value could even be renamed 'SDL_HAPTIC_STEERING_AXIS'. For Linux, sending an effect on the X axis with a Logitech wheel works. Others brands don't have driver for Linux as far as I know.
Ryan C. Gordon fa23e3d0 2020-05-04T02:27:29 locale: Implemented SDL_GetPreferredLocales(). This was something I proposed a long time ago, Sylvain Becker did additional work on it, then back to me. Fixes Bugzilla #2131.
Ryan C. Gordon 8601996f 2020-05-03T22:13:48 hints: Allow specifying audio device metadata. This is only supported on PulseAudio. You can set a description when opening your audio device that will show up in pauvcontrol, which lets you set per-stream volume levels. Fixes Bugzilla #4801.
Ryan C. Gordon 11fef299 2020-05-03T20:56:18 hints: Fixed a doxygen comment.
Ethan Lee 83cddd2e 2020-04-30T11:57:29 Add SDL_JoystickSetLED. Currently, this is only supported by the PS4 HIDAPI driver.
Sam Lantinga 0f374b06 2020-04-22T15:42:32 Fixed build on older Visual Studio, enable new features on newer Visual Studio
Sam Lantinga 116b8c17 2020-04-19T00:05:54 Note which Windows SDK version is required for Windows Gaming Input support
Sam Lantinga aba27928 2020-04-18T21:41:37 Added a Windows Gaming Input joystick driver This driver supports the Razer Atrox Arcade Stick Some of the quirks of this driver, inherent in Windows Gaming Input: * There will never appear to be controllers connected at startup. You must support hot-plugging in order to see these controllers. * You can't read the state of the guide button * You can't get controller events in the background
Sam Lantinga ed1d8558 2020-04-14T07:41:00 Fixed bug 4299 - A recent change requires Core Bluetooth framework on iOS Caleb Cornett Just ran into this, and from my testing, whatever re-added the dependency is a _major_ regression. Not only is your app forced to link with CoreBluetooth, but iOS has apparently tightened up security and won't even let you _test_ your app unless it specifies the NSBluetoothAlwaysUsageDescription in an Info.plist. It doesn't even pop up an error message, it just straight up crashes. Adding the permission isn't a good solution either, since I'd really, really rather not have my app request users' bluetooth to always be enabled, especially if the only apparent reason is for Steam Controller support.
Sam Lantinga e6c640f3 2020-04-13T08:18:16 Enable the virtual joystick API by default
Sam Lantinga bd7b4f39 2020-04-13T08:05:29 Partial fix for bug 5086 - CMake builds on Windows broken by sensor support (thanks DominikD!)
Ryan C. Gordon d292f6bd 2020-04-10T12:17:14 stdlib: Add SDL_trunc and SDL_truncf
Ryan C. Gordon a7916890 2020-04-10T00:37:35 metal: Added some support interfaces to Apple's Metal API (thanks, Caleb!). Caleb Cornett's comments: "A few weeks ago, Alex added a partial Metal API to SDL2: https://hg.libsdl.org/SDL/rev/22c8e7cd8d38 I noticed it was missing a few features that would help Metal become a first-class citizen in SDL, so I went ahead and wrote them! Here are the new APIs: 1. SDL_WINDOW_METAL flag for SDL_CreateWindow(). This allows the programmer to specify that they intend to create a window for use with SDL_MetalView. The flag is used to ensure correct usage of the API and to prevent accidentally defaulting to OpenGL on iOS. 2. SDL_Metal_GetLayer(). This function takes a SDL_MetalView and returns a pointer to the view's backing CAMetalLayer. This simplifies things considerably, since in the current version of the SDL_Metal API the programmer is required to bridge-cast a SDL_MetalView handle to an NSView or UIView (depending on the platform) and then extract the layer from there. SDL_Metal_GetLayer automatically handles all of that, making the operation simple and cross-platform. 3. SDL_Metal_GetDrawableSize(). This function already exists in the current SDL_Metal API (and is used behind-the-scenes for SDL_Vulkan_GetDrawableSize on Apple platforms) but was not publicly exposed. My patch exposes this function for public use. It works just like you'd expect. Tested on macOS 10.14 and iOS 12.4." Fixes Bugzilla #4796.
Sam Lantinga 3180ba81 2020-04-08T08:34:27 First pass at Windows sensor implementation
Sam Lantinga b6eb09ff 2020-03-20T15:55:02 Updated documentation so people know to set the SDL_HINT_NO_SIGNAL_HANDLERS hint before SDL_Init()
Sam Lantinga 4c22a21e 2020-03-17T14:18:05 Fixed bug 3446 - The haptic API does not allow to select the direction axes meyraud705 Added Linux implementation, otherwise you get "Unsupported direction type" error. Added documentation to explain why one would use SDL_HAPTIC_FIRST_AXIS.
Sam Lantinga 73799917 2020-03-16T13:28:38 Fixed bug 3446 - The haptic API does not allow to select the direction axes Mathieu Laurendeau Consider a device supporting effects on multiple axes. There's currently no way to play effects against a single-axis direction. A device supporting effects against X and Y may not allow to play effects with a two-axis direction coordinate, even if one of the coordinates is null. My current (ugly) work around for this is to add a direction type SDL_HAPTIC_X_FORCE to play effects against a X-axis only direction (patch attached). This issue impacted two GIMX users using the following wheels: - Leo Bodnar SimSteering force feedback wheel - Accuforce direct drive wheel Playing constant/spring/damper effects against a X-axis direction worked well for the first wheel, but not for the second one. A better strategy seems to play the effects against the first axis reported by the DirectInput enumeration. This strategy also works with Logitech wheels (at least the DFGT). It's been more than a year that I have the latest patch (playing effects against the first axis only) in the GIMX software. It's being used by thousands of people, mostly for adapting their FFB wheel to the PS4. I had no report that proves this strategy to be wrong.
Sam Lantinga 4dea340c 2020-03-16T12:23:38 Fixed bug 4477 - Support more than 4 XInput-capable devices on Windows Jimb Esser Add new RawInput controller API, and improved correlation with XInput/WGI Reorder joystick init so drivers can ask the others if they handle a device reliably Do not poll disconnected XInput devices (major perf issue) Fix various cases where incorrect correlation could happen Simple mechanism for propagating unhandled Guide button presses even before guaranteed correlation Correlate by axis motion as well as button presses Fix failing to zero other trigger Fix SDL_HINT_JOYSTICK_HIDAPI not working if set before calling SDL_Init() Add missing device to device names Disable RawInput if we have a mismatch of XInput-capable but not RawInput-capable devices Updated to SDL 2.0.13 code with the following notes: New HID driver: xbox360w - no idea what that is, hopefully urelated SDL_hidapijoystick.c had been refactored to couple data handling logic with device opening logic and device lists caused some problems, yields slightly uglier integration than previously when the 360 HID device driver was just handling the data. SDL_hidapijoystick.c now often pulls the device off of the joystick_hwdata structure for some rumble logic, but it appears that code path is never reached, so probably not a problem. Looks like joystick_hwdata was refactored to not include a mutex in other drivers, maintainers may want to do the same refactor here if that's useful for some reason. Something changed in how devices get names, so getting generic names. Had to fix a (new?) bug where removing an XInput controller caused existing controllers (that moved to a new XInput index) to get identified as 0x045e/0x02fd ("it's probably Bluetooth" in code), rendering the existing HIDAPI_IsDevicePresent and new RAWINPUT_IsDevicePresent unreliable.
David Ludwig cc37ee8a 2020-03-16T00:21:22 virtual joysticks: add autotools-build support (Bug 5028) Autotools support for virtual-joysticks turns it OFF by default. To turn it on, pass the following into configure: --enable-joystick-virtual
David Ludwig d6476155 2020-03-15T13:35:03 virtual joysticks: improved docs for SDL_JoystickSetVirtual* functions
David Ludwig cc908756 2020-03-15T13:25:49 virtual joysticks: removed ball support (Bug 5028)
Sam Lantinga 1ff483d1 2020-03-13T21:28:09 Added SDL_GetErrorMsg() to get the error message in a thread-safe way
Sam Lantinga 2be75c6a 2020-03-13T19:08:45 Fixed bug 5028 - Virtual Joysticks (new joystick backend) David Ludwig I have created a new driver for SDL's Joystick and Game-Controller subsystem: a Virtual driver. This driver allows one to create a software-based joystick, which to SDL applications will look and react like a real joystick, but whose state can be set programmatically. A primary use case for this is to help enable developers to add touch-screen joysticks to their apps. The driver comes with a set of new, public APIs, with functions to attach and detach joysticks, set virtual-joystick state, and to determine if a joystick is a virtual-one. Use of virtual joysticks goes as such: 1. Attach one or more virtual joysticks by calling SDL_JoystickAttachVirtual. If successful, this returns the virtual-device's joystick-index. 2. Open the virtual joysticks (using indicies returned by SDL_JoystickAttachVirtual). 3. Call any of the SDL_JoystickSetVirtual* functions when joystick-state changes. Please note that virtual-joystick state will only get applied on the next call to SDL_JoystickUpdate, or when pumping or polling for SDL events (via SDL_PumpEvents or SDL_PollEvent). Here is a listing of the new, public APIs, at present and subject to change: ------------------------------------------------------------ /** * Attaches a new virtual joystick. * Returns the joystick's device index, or -1 if an error occurred. */ extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type, int naxes, int nballs, int nbuttons, int nhats); /** * Detaches a virtual joystick * Returns 0 on success, or -1 if an error occurred. */ extern DECLSPEC int SDLCALL SDL_JoystickDetachVirtual(int device_index); /** * Indicates whether or not a virtual-joystick is at a given device index. */ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickIsVirtual(int device_index); /** * Set values on an opened, virtual-joystick's controls. * Returns 0 on success, -1 on error. */ extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualAxis(SDL_Joystick * joystick, int axis, Sint16 value); extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualBall(SDL_Joystick * joystick, int ball, Sint16 xrel, Sint16 yrel); extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualButton(SDL_Joystick * joystick, int button, Uint8 value); extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick * joystick, int hat, Uint8 value); ------------------------------------------------------------ Miscellaneous notes on the initial patch, which are also subject to change: 1. no test code is present in SDL, yet. This should, perhaps, change. Initial development was done with an ImGui-based app, which potentially is too thick for use in SDL-official. If tests are to be added, what kind of tests? Automated? Graphical? 2. virtual game controllers can be created by calling SDL_JoystickAttachVirtual with a joystick-type of SDL_JOYSTICK_TYPE_GAME_CONTROLLER, with naxes (num axes) set to SDL_CONTROLLER_AXIS_MAX, and with nbuttons (num buttons) set to SDL_CONTROLLER_BUTTON_MAX. When updating their state, values of type SDL_GameControllerAxis or SDL_GameControllerButton can be casted to an int and used for the control-index (in calls to SDL_JoystickSetVirtual* functions). 3. virtual joysticks' guids are mostly all-zeros with the exception of the last two bytes, the first of which is a 'v', to indicate that the guid is a virtual one, and the second of which is a SDL_JoystickType that has been converted into a Uint8. 4. virtual joysticks are ONLY turned into virtual game-controllers if and when their joystick-type is set to SDL_JOYSTICK_TYPE_GAMECONTROLLER. This is controlled by having SDL's default list of game-controllers have a single entry for a virtual game controller (of guid, "00000000000000000000000000007601", which is subject to the guid-encoding described above). 5. regarding having to call SDL_JoystickUpdate, either directly or indirectly via SDL_PumpEvents or SDL_PollEvents, before new virtual-joystick state becomes active (as specified via SDL_JoystickSetVirtual* function-calls), this was done to match behavior found in SDL's other joystick drivers, almost all of which will only update SDL-state during SDL_JoystickUpdate. 6. the initial patch is based off of SDL 2.0.12 7. the virtual joystick subsystem is disabled by default. It should be possible to enable it by building with SDL_JOYSTICK_VIRTUAL=1 Questions, comments, suggestions, or bug reports very welcome!
Sam Lantinga 983bbf9e 2020-03-10T18:35:31 Backed out changeset 51622f74dc85
Sam Lantinga 93ed3c8b 2020-03-10T18:25:47 Updated SDL to version 2.0.13 for development builds
Sam Lantinga 4fb06a2a 2020-03-10T18:25:47 Updated SDL to version 2.0.13 for development builds
Sam Lantinga 611403dd 2020-03-08T21:02:40 Clarified that the clip rectangle is defined relative to the viewport, and added a clip test to testviewport.c