Log

Author Commit Date CI Message
Sam Lantinga b6afbe63 2020-04-07T09:38:57 Added SDL_log.h to SDL_internal.h so logging is available everywhere
Sam Lantinga 488b94cb 2020-04-07T09:18:19 Don't interpret raw input messages with no mouse position This happens occasionally on touch devices when raw input is enabled
Sam Lantinga 0721931f 2020-04-06T19:21:56 Avoid sending regular mouse messages for touch input
Sam Lantinga dad73b1f 2020-04-05T10:47:58 Fixed bug 5073 - SDL does not handle URL Schemes in MacOS Jason In iOS, URL Events trigger the DropFile event. I would also expect the same event to be fired on the macOS platform but this is not implemented at all in the AppDelegate.
Sam Lantinga 9525f972 2020-04-05T10:44:51 Fixed bug 5076 - SDL_netbsdaudio: Add support for 32-bit LPCM Nia Alarie The kernel supports this, make SDL expose it so it can be used.
Sam Lantinga e05d92a1 2020-04-05T09:01:33 Fixed bug 5075 - Don't assume a GL library version number on NetBSD. Nia Alarie If you install X as part of NetBSD, the GL library is libGL.so.3, but if you install the GL library later as a package, it's libGL.so.1.
Sam Lantinga d4b561f4 2020-04-05T08:58:47 Fixed bug 5015 - SDL_RenderReadPixels on DirectX 11.1 backend seems to be broken Konrad It appears that I cannot use SDL_RenderReadPixels on a bound framebuffer (SDL_Texture set as render target) as it simply results in gibberish data. However, drawing that framebuffer into the default target (window surface) does render it correctly. Other backends (OpenGL, software, Direct3D) do work fine. It looks to me like D3D11_RenderReadPixels just gets the general backbuffer and not the current render target and its backbuffer. Here is the patch which actually fetches the current render target and its underlying ID3D11Resource which is ID3D11Texture2D.
Sam Lantinga 89fe32dd 2020-04-05T08:46:59 Fixed bug 5072 - Test resources missing when building with SDL_TEST and CMake DominikD There are several tests that need resources in the output directory to work: * `testiconv` depends on `utf8.txt` * `testoverlay2` and `teststreaming` depend on `moose.dat` This patch adds these two files to the `RESOURCE_FILES` variable. One could also copy `shapes\*.bmp` over to the output directory for `testshape` to use but this patch doesn't do that for three reasons: * executable takes path as an argument and doesn't need these files side by side * these are ~45MB and copying them over would cause build directory to swell * there are already files in the output directory that can be used with this test (`sample.bmp` and `button.bmp`)
Sam Lantinga f3e60967 2020-04-02T12:27:29 Fixed setting the "playandrecord" audio hint on Apple TV The Apple TV doesn't have record capability by default, so activating the audio session with AVAudioSessionCategoryPlayAndRecord fails.
Sam Lantinga 378a5cfb 2020-04-01T16:39:05 Updated thread priorities for Apple operating systems
Ryan C. Gordon 377f2d35 2020-04-01T13:43:53 configure: Remove wayland-protocols check from configure and CMake scripts. We ship these with SDL now, don't need the system versions installed.
Sam Lantinga 3154d924 2020-03-30T14:26:21 SDL: plumb previously unused digital trigger bits for PS4 controllers. Victrix fight stick only sets these bits and doesn't send the analog values CR: SamL
Sam Lantinga f4a56d7e 2020-03-30T14:26:15 Enable thread-safety features in libdbus There are multiple SDL APIs that internally sink into dbus calls, e.g. battery status, thread priority. If those calls happen in different threads simultaneously it can result in dbus crashes. To abide by dbus's multithreading guidelines we must call dbus_threads_init_default() to enable dbus's internal locking mechanisms: https://dbus.freedesktop.org/doc/api/html/group__DBusThreads.html#gac7b8a7001befc3eaa8c6b043151008dc Additionally, access to a DBusMessage must be synchronized between threads. SDL was already abiding that guideline as the DBusMessage structs aren't shared. The following email from the dbus mailing list hints that arbitrating access to the DBusConnection on the SDL may also be required: https://lists.freedesktop.org/archives/dbus/2017-September/017306.html
Sam Lantinga 2e667a8b 2020-03-30T14:26:10 Fix incorrectly terminated MakeThreadHighPriority dbus message Currently the message is double terminated, which results in SDL_DBus_CallMethodInternal() incorrectly assuming that the other party is always returning true. I'm not super familiar with dbus, so I'm not sure if this could also be the cause of this bug: https://github.com/ValveSoftware/steam-for-linux/issues/6901
Ryan C. Gordon 55b4f18e 2020-03-29T01:54:00 coreaudio: The default SDL audio device now tracks the system output default. So if you go into System Preferences on a MacBook and toggle between a pair of connected bluetooth headphones and built-in internal speakers, SDL will switch the device it is playing sound through, to match this setting, on the fly. Likewise if the default output device is a USB thing and is unplugged; as the default device changes at the system level, SDL will pick this up and carry on with the new default. This is different from our unplug detection for specific devices, as in those cases we want to send the app a disconnect notification, instead of migrating transparently as we now do for default devices. Note that this should also work for capture devices; if the device changes, SDL will start recording from the new default. Fixes Bugzilla #4851.
David Ludwig 6e7465bd 2020-03-28T15:43:55 Fixed Bug 4883, redux - connect SDL_GetDisplayDPI to UIKit_GetDisplayDPI SDL_GetDisplayDPI was failing on iOS, as UIKit_GetDisplayDPI was not getting assigned to SDL's internal field in SDL_VideoDevice: GetDisplayDPI.
Sam Lantinga abdc5cbf 2020-03-26T19:30:17 Allow background music to play in the "play and record" case on iOS
Ryan C. Gordon 46bb47cf 2020-03-26T22:14:59 thread: Put all important SDL_CreateThread internal data into SDL_Thread. This avoids the need to malloc something extra, use a semaphore, etc, and fixes Emscripten with pthreads support, which might not spin up a web worker until after SDL_CreateThread returns and thus can't wait on a semaphore at this point in any case. Fixes Bugzilla #5064.
Ryan C. Gordon 369e5f33 2020-03-26T20:28:04 dbus: System bus is optional, we only need a session bus (thanks, tamo!). Fixes Bugzilla #4795.
Ryan C. Gordon 07f231ee 2020-03-26T18:47:04 joystick: Make sure recentering events happen before disconnect events. Fixes Bugzilla #5063.
Ryan C. Gordon f2ff953e 2020-03-26T13:42:56 cocoa: Just update the OpenGL context directly if on the main thread.
Fabrice Fontaine 9354aea1 2020-03-25T09:38:45 src/video/kmsdrm/SDL_kmsdrmvideo.c: fix build Build is broken without EGL since version 2.0.12 and https://hg.libsdl.org/SDL/rev/72cc4740dec2: /home/giuliobenetti/autobuild/run/instance-1/output-1/build/sdl2-2.0.12/src/video/kmsdrm/SDL_kmsdrmvideo.c: In function 'KMSDRM_CreateSurfaces': /home/giuliobenetti/autobuild/run/instance-1/output-1/build/sdl2-2.0.12/src/video/kmsdrm/SDL_kmsdrmvideo.c:394:5: error: unknown type name 'EGLContext' EGLContext egl_context; ^ Fixes: - http://autobuild.buildroot.org/results/fafd20a01591032662f9ca025fcea3478239cf3c Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Jay Petacat c760c02c 2020-03-25T01:34:15 Fix some format specifier warnings The warnings were produced by GCC 9.2.x for x86_64-linux-gnu or i386-pc-msdosdjgpp targets. Most of the fixes involve changing the type of a variable rather than the format specifier. For many of the affected test conuter variables, a basic int seems sufficient. Some format specifier warnings still remain for cases where changing type or casting seemed inappropriate. Those warnings will probably require some new format specifier macros (e.g. SDL_PRIu32).
Fabrice Fontaine a4b0204b 2020-03-24T10:05:51 src/video/directfb/SDL_DirectFB_render.c: fix build Build with directfb is broken due to a spurious '}' and a missing 'E' since version 2.0.12 and https://hg.libsdl.org/SDL/rev/4c2dcf490cba: /home/buildroot/autobuild/run/instance-2/output-1/build/sdl2-2.0.12/src/video/directfb/SDL_DirectFB_render.c: In function 'SetBlendMode': /home/buildroot/autobuild/run/instance-2/output-1/build/sdl2-2.0.12/src/video/directfb/SDL_DirectFB_render.c:202:9: error: case label not within a switch statement 202 | case SDL_BLENDMODE_MUL: | ^~~~ /home/buildroot/autobuild/run/instance-2/output-1/build/sdl2-2.0.12/src/video/directfb/SDL_DirectFB_render.c:205:67: error: 'DSBF_DSTCOLOR' undeclared (first use in this function); did you mean 'DSBF_DESTCOLOR'? 205 | SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_DSTCOLOR)); | ^~~~~~~~~~~~~ Fixes: - http://autobuild.buildroot.org/results/83ccefee68c2800c0544e6f40fa8bc8ee6b67b77 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Sam Lantinga 885b3f69 2020-03-23T14:10:25 Don't check the HIDAPI driver for the virtual device created by xow
Sam Lantinga 2c02b741 2020-03-23T12:10:05 Fixed bug 5052 - Interval between SDL_SENSORUPDATE events for gyroscopes is too high Andrei Kortunov Hello. I try to implement an application for Android, which uses a new sensors API from 2.0.9 to control a camera rotation via built-in gyroscope, using the code from the test/testsensor.c as an example. Gyroscope input itself works well, but an interval between SDL_SENSORUPDATE events is about 200ms (the SENSOR_DELAY_NORMAL, I believe), when I need the interval about 20-40ms (the SENSOR_DELAY_GAME or SENSOR_DELAY_FASTEST).
David Ludwig 68c7e80d 2020-03-23T14:54:31 iOS: fixed bug whereby some SDL testing apps weren't launching Test apps in Xcode-iOS/Test/TestiPhoneOS.xcodeproj weren't launching in the most-recent release of Xcode and the iOS Simulator (version 11.3.1). This was caused by their shared Info.plist file not defining a CFBundleShortVersionString (as reported by Xcode, when launching a test app from within Xcode).
Sam Lantinga 1fd548b6 2020-03-23T11:42:44 Fixed building back to Mac OSX using the 10.7 SDK
Jay Petacat e0a27056 2020-03-22T20:09:14 Do not overwrite window surface created by driver If a driver's implementation of CreateWindowFramebuffer sets the window surface, use that rather than overwriting it. A driver may set the window surface if data cannot be passed via the CreateWindowFramebuffer output parameters (e.g. surface palette colors).
Ryan C. Gordon 19a5f4ab 2020-03-22T14:32:47 opengl: Don't enable/disable texturing except when actually rendering. Otherwise our cached state goes out of sync when updating a texture. Since these state changes aren't necessary, they were removed instead of updating the cached state. Fixes Bugzilla #4998.
Sam Lantinga cb8c91d9 2020-03-22T11:01:14 Fixed bug 5051 - Switch Pro Controller hidapi driver does not report battery levels when connected via Bluetooth bluenaxela+sdl I've noticed that the Switch Pro Controller hidapi driver does not report battery levels when connected via Bluetooth, despite having code for setting joystick->epowerlevel. This is caused by the driver always using k_eSwitchInputReportIDs_SimpleControllerState via Bluetooth. Using that mode means that the state reports you get back from the controller do not include battery state. Not using the full controller state over Bluetooth effectively makes this driver's support for setting joystick->epowerlevel entirely pointless, only ever reporting SDL_JOYSTICK_POWER_WIRED. Is there a reason this was set to only use SimpleControllerState via Bluetooth? I've attached a patch I'm using to allow getting battery level for the Switch Pro Controller. A couple notes about this patch: 1) It changes LoadStickCalibration to accept the input_mode that is selected, because that's really what should determine what is used for stick extents, since stick extents differ between the modes. 2) In my patch I only use FullControllerState when the vid/pid matches the official Switch Pro Controller, as a cautionary measure in case some third-party controllers have problems with FullControllerState mode via Bluetooth (I noticed a HORI Wireless Switch Pad I had seemed to not read controller calibration correctly for stick extents. Maybe it's calibration data was uninitialized on account of having never been used with a Switch? I'm unsure, though if that guess is right maybe SDL2 should be detecting an uninitiated calibration state and using some sensible defaults)
Sam Lantinga f55cbdfd 2020-03-20T21:05:07 Allow Valve devices in driver check, we know they're well behaved controllers
Sam Lantinga 6e646b61 2020-03-20T20:53:26 Removed blacklist entries for devices that aren't game controllers, allow Steam Controllers
Sam Lantinga 106ffd57 2020-03-20T20:45:30 Fixed bug 5049 - HORI Wireless Switch Pad does not connect properly via Bluetooth bluenaxela+sdl The HORI Wireless Switch Pad does not properly connect via bluetooth. I did some debugging and found that the code that tries to control the Home LED causes this controller to disconnect.
Sam Lantinga 269f8215 2020-03-20T20:40:14 Fixed build warning when using mingw-64 - the SDL code doesn't have any undefined symbols
Sam Lantinga 891bd829 2020-03-20T20:33:26 Fixed warning building version.rc using mingw-64
Sam Lantinga 1a6f6054 2020-03-20T19:51:54 Regenerated configure with configure.ac changes
Jimb Esser 417713a7 2020-03-20T19:49:19 Probable fix for compile errors on Mac OS and (non-VS) Win32
Sam Lantinga dc36f133 2020-03-20T19:49:15 Backed out changeset c29d04c3fa49
Sam Lantinga 74ba3cb4 2020-03-20T19:48:26 Backed out changeset c5bb2de42684
Sam Lantinga 2db65a7f 2020-03-20T19:47:46 Fixed compile warnings
Sam Lantinga c63bb512 2020-03-20T19:42:59 Only build raw input support on Windows
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()
Cameron Gutman 5ed71f3b 2020-03-20T13:44:50 Only enumerate HID devices on Windows that have gamepad HID usages There are a number of poorly behaved HID devices that time out on attempts to read various strings. Rather than end up on an endless treadmill of blacklisting broken devices, reduce our risk by only querying devices that are gamepads. SDL_hidapijoystick.c already checks these same usages, so we shouldn't exclude any working HID devices (caveat below). This also makes HidP_GetPreparsedData() and HidP_GetCaps() failure skip the device entirely, but that seems desired. If a device can't even return basic top-level collection data properly, we want nothing to do with that broken device. If we do find devices that work with HIDAPI joystick and fail these calls, we can add an exception via VID+PID matching.
Sam Lantinga f7c9502d 2020-03-20T12:13:26 Fixed bug 5044 - CMake messes up hidapi path when project directory contains spaces Eric Jing When the project directory path contains spaces, CMake butchers the include path for the hidapi files. I traced the problem to the cmake/sdlchecks.cmake file at line 1091, which sets flags for the build process. I surrounded the problem flag with double quotes, shown below, and CMake works with spaces in the project directory path.
Ryan C. Gordon 90f9e8f8 2020-03-20T15:13:09 egl: Don't use SDL_LoadFunction to get GL entry points on Emscripten. This results in a dlsym() call, which causes Emscripten to panic if the game wasn't explicitly built dlopen support. eglGetProcAddress works just fine on this platform, so just let that codepath handle it.
Emir Marincic 5b3b55a1 2020-03-20T11:52:18 [NSOpenGLContext update[ is prohibited outside the main thread
David Ludwig 7e5340c5 2020-03-17T17:34:24 Fix for Bug 5034 - Replugging in a controller crashes on macOS in SDL 2.0.12 This is a multi-part fix, and is the 2nd attempt at a fix for Bug 5034. Here are the problems being addressed: 1. On macOS 10.14.x and earlier, trying to call IOHIDDeviceUnscheduleFromRunLoop without a prior, paired call to IOHIDDeviceScheduleWithRunLoop, appears to lead to a crash. A per-device flag has been added to make sure that these calls are paired. 2. DARWIN_JoystickDetect was free'ing its SDL_joystick's hwdata field (via FreeDevice) without setting it to NULL, and DARWIN_JoystickRumble wasn't checking for a NULL hwdata. FreeDevice will now set hwdata to NULL and DARWIN_JoystickRumble will check for a NULL hwdata.
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.
Sylvain Becker e6189f40 2020-03-17T15:47:30 Fix warnining implicit declaration of SDL_DetectPalette (Thanks meyraud705)
Sylvain Becker 838bbf1f 2020-03-17T09:35:42 Fixed bug 5037 - Regression 2.0.12 Alpha value of 0 on palette may become opaque (see also bug 3827)
Flamefire ccc8c5d2 2020-03-17T08:46:34 Fix shared library suffix on OSX
David Ludwig 36d58451 2020-03-17T02:31:47 Backout prior fix for Bug 5034, which needs more research This backs-out the change, https://hg.libsdl.org/SDL/rev/14c961903135
Sam Lantinga 55a2a12d 2020-03-16T22:34:33 Fixed compile warning
Sam Lantinga 9b879a08 2020-03-16T19:15:28 Fixed compiler warning
Jimb Esser c2c5d0b3 2020-03-16T16:52:49 Fix compile error
David Ludwig 197b14de 2020-03-16T19:24:25 Fixed Bug 5034 - Replugging in a controller crashes on macOS in SDL 2.0.12 The Darwin/macOS joystick driver was freeing its joystick's hwdata field without zeroing it out in any live instance of SDL_Joystick.
Jimb Esser 47da53b9 2020-03-16T14:49:20 Fix compiler warnings
David Ludwig 8cd08646 2020-03-16T17:19:18 virtual joysticks: move variable decls to top of function (for C90 compat; Bug 5038)
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 543994b1 2020-03-16T12:25:02 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.
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 40625c4e 2020-03-15T16:01:19 virtual joysticks: MSVC support part 2/2, add file refs to MSVC projects (bug 5028)
David Ludwig b2296506 2020-03-15T15:05:36 virtual joysticks: MSVC support part 1/2, make driver's .c file be uniquely named
David Ludwig 513730c4 2020-03-15T14:40:51 iOS: fixed build error when building test apps via Xcode CoreBluetooth.framework needed to get linked into test apps, all of which are currently using statically-linked SDL.
David Ludwig 9b1ea290 2020-03-15T14:21:05 virtual joysticks: added source files to Xcode projects (Bug 5028)
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 151c8fbf 2020-03-14T17:45:00 Fixed build error Malte Kie?ling I get a build error in SDL_sysjoystick.c:74 for the merged patch, but its nothing to sweat about, just -Werror=declaration-after-statement doing its usual stuff.
Sam Lantinga 1ff483d1 2020-03-13T21:28:09 Added SDL_GetErrorMsg() to get the error message in a thread-safe way
Sam Lantinga 19c34844 2020-03-13T19:19:29 Fixed slow enumeration when Apple Cinema HD display 30" is plugged in
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 879f137a 2020-03-13T19:00:24 Added support for the older Xbox One S Bluetooth controller report format
Sam Lantinga d662a659 2020-03-13T19:00:22 Fixed crash if manufacturer or product string is NULL
Sam Lantinga 255c9c23 2020-03-13T13:28:33 Fixed bug 4921 - Do not swap B/X buttons on GameCube controller unless it's requested The binding for the Mayflash GameCube controller adapter now respects the SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS hint
Sam Lantinga 6318765d 2020-03-13T13:05:43 Handle entirely duplicated joystick product names, as well as vendor and product names that start with the name of the vendor, but with different case (e.g. 8bitdo 8BitDo)
Sam Lantinga de2001ee 2020-03-13T13:05:40 Fixed binding the D-PAD on the 8BitDo M30 controller
Sam Lantinga cb2f78b1 2020-03-13T13:05:38 Updated 8BitDo SF30 Pro mapping with hint support, added Android binding for the 8BitDo M30 Gamepad
Sam Lantinga cb986aff 2020-03-13T13:05:32 Fixed exception at shutdown if the controllers are closed after the HIDDeviceManager is shutdown
Sam Lantinga 80d075a0 2020-03-13T09:43:48 Fixed compiler warnings
Sam Lantinga 5722e884 2020-03-12T19:49:33 Fixed build warnings
Sam Lantinga c44473ba 2020-03-12T19:47:30 Unified code to standardize joystick names
Sam Lantinga db3b3a1d 2020-03-12T19:47:28 Added support for SDL hints in the game controller mapping database
Ethan Lee 133b4755 2020-03-11T14:17:19 Use LIBUSB_CALL for hidapi's read_callback function
Sam Lantinga 1102678b 2020-03-10T18:35:53 Added tag release-2.0.12 for changeset 7715fef44900
Sam Lantinga 983bbf9e 2020-03-10T18:35:31 Backed out changeset 51622f74dc85
Sam Lantinga 9fdc6cf3 2020-03-10T18:34:33 Removed Xbox HIDAPI debug code
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 5c87b8e1 2020-03-10T18:17:41 Added tag release-2.0.12 for changeset 6915d6569091
Sam Lantinga fe979921 2020-03-10T17:35:14 Read the buttons on Nintendo Switch and GameCube controllers as they are labeled, and swap them if the applications wants positional button data instead.
Sam Lantinga 4caa6a06 2020-03-10T16:41:42 Fixed bug 4921 - Do not swap B/X buttons on GameCube controller unless it's requested Ethan Lee Basically replicating the solution of the Switch Controller's button label issue. Physical layout should take priority unless it's explicitly requested by the user or application!
Sam Lantinga 342f62ca 2020-03-10T16:29:28 Fixed bug 5022 - SDL_iconv_string can get stuck in an infinite loop when encountering invalid characters ciremo6483 In `SDL_iconv_string` the `while (inbytesleft > 0)` loop can end up in a state where it never terminates because the library `iconv` function called from `SDL_iconv` doesn't consume any bytes. This happened when a `WCHAR_T` input string was being converted to `UTF-8` but contained invalid characters. It would first It would first skip a few bytes due to `case SDL_ICONV_EILSEQ` but when there were 3 bytes remaining of `inbytesleft` `iconv` just didn't consume anything more (but didn't throw an error either). It just so happens that the Microsoft Classic IntelliMouse `product_string` contains such invalid characters (`"Microsoft? Classic IntelliMouse?"`), meaning the function would get stuck with said mouse plugged in. A fix for this would be to check if `inbytesleft` was unchanged after an iteration and in that case either decrement the counter like when `SDL_ICONV_EILSEQ` is returned or simply break the loop.
Sam Lantinga 1f4965c8 2020-03-08T21:24:06 Fixed warnings building with mingw64
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
Sam Lantinga c8c05a9f 2020-03-08T19:23:21 Fixed bug 4991 - Pixel shader problem when recreating a texture for direct3d renderer cmediaplayer Hi, i already mentioned in the SDL discourse a bug that recreating of a texture occours pixel shader problem on direct3d renderer. There is no problem for direct3d11. You can see the issue by using my app named C Media Player which is available for Windows for free using my web site www.cmediaplayer.com. Just follow the steps: *Open a media file *When playing the file change the scale quality under the video menu. *You will see the problem.
Sam Lantinga 367a3561 2020-03-08T18:56:07 Don't release the backbuffer on error, we didn't acquire it.
Cameron Gutman 4e0fb110 2020-03-07T19:21:21 Clear the old player index slot when moving to a new one
Cameron Gutman 165ccaa8 2020-03-07T17:20:04 Fix incorrect player index when assigning a joystick the same index twice Prior to this fix, we would hit the existing_instance >= 0 case and move the joystick again to a different index than the one requested by the caller. It also breaks the assumption that a SDL_JoystickID is only present in SDL_joystick_players at one location.