Commit Graph

7156 Commits (89b6209313cc65260f88a28ea99ec0df6dd807fc)

Author SHA1 Message Date
Sam Lantinga 5fc743c4fd Phantom Nintendo Switch Pro Controller initialization problem 2021-01-14 23:49:37 -08:00
Sam Lantinga 92742306a6 Fixed rumble reset failing for Switch Pro controllers in USB mode 2021-01-14 23:49:33 -08:00
Sam Lantinga d0b87fede6 Added HIDAPI rumble debug info 2021-01-14 23:49:27 -08:00
Sam Lantinga e2f46ed8ef Always lock the HIDAPI device when closing, in case rumble is pending 2021-01-14 23:49:20 -08:00
Sam Lantinga 907b8eebc3 Make sure the HIDAPI device is locked when closing it, in case there is rumble pending that didn't complete 2021-01-14 23:49:16 -08:00
Sam Lantinga b3848c5120 Fixed bug 5445 - Incorrect Switch Pro Controller face buttons when SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS disabled
jibb

I'm testing with DualShock 4, DualSense, Switch Pro Controller, and PowerA Switch Controller.

I'm using the standard mapping file from here:
https://raw.github.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt

With SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS turned off (set to "0") I expect the button positions to be the same on all devices, based on Xbox controller button naming (eg SDL_GameControllerGetButton(g, SDL_CONTROLLER_BUTTON_Y) gives me whether the North face button is pressed).

However, the Switch Pro Controller layout is wrong (matching labels rather than positions, so X and Y are swapped and A and B are swapped). And with the PowerA controller the East and West buttons are correct, but the North and South buttons are swapped instead.

Mathias Kaerlev

Also seeing this on 2.0.14. This is most likely a regression, since we weren't seeing this on an earlier SDL version.

I suspect it might be caused by this commit:
a569b21188 (diff-da9344d94c66b8c702a45e7649f412039f08bba83bd82de33f5c80ea9c8c39d5)

It seems like both the HIDAPI driver and SDL_gamecontroller.c will try to swap the buttons if the hint is set to 0, causing the button remap to cancel out.
2021-01-14 15:15:57 -08:00
Sam Lantinga bdc6e4ffc5 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;
2021-01-14 15:03:11 -08:00
Sam Lantinga d54b125a86 Fixed bug 5287 - Support building for UWP with CMake
Jan Niklas Hasse

Actually the SDL2-static target works, if I set SDL_SENSOR to OFF. Awesome!

See this patch: https://github.com/microsoft/vcpkg/blob/master/ports/sdl2/0003-sdl2-fix-uwp-build.patch
2021-01-14 14:53:34 -08:00
Sam Lantinga 351abc585b Fixed bug 5463 - generated Wayland interfaces are included in the library's ABI
Simon McVittie

In versions since 1.15, the `code` mode is a deprecated alias for
`public-code`, which emits symbols with default visibility, overriding
SDL's -fvisibility=hidden option.

Use the `private-code` mode instead. This emits symbols with hidden
visibility, so they do not affect the ABI of libSDL.

See also: https://bugreports.qt.io/browse/QTBUG-73099,
https://lists.freedesktop.org/archives/wayland-devel/2018-February/037097.html
2021-01-14 14:50:15 -08:00
Sam Lantinga 6a342954e8 Fixed bug 5451 - Can't create EGLSurface in Wayland from SDLWindow (no EGLNativeWindow pointer)
sashikknox

In some cases, need create EGLWindow with SDLWindow. In X11 i can get pointer to NativeWindow from **struct SDL_SysWMinfo wmInfo**
```C++
struct SDL_SysWMinfo wmInfo;
SDL_GetWindowWMInfo(ptSDLWindow, &wmInfo)
#if defined(__unix__) && defined(SDL_VIDEO_DRIVER_X11)
nativeWindow=(EGLNativeWindowType)wmInfo.info.x11.window;
nativeDisplay=(EGLNativeDisplayType)wmInfo.info.x11.display;
#endif
```
than i can create EGLSurface
```
eglCreateWindowSurface(nativeDisplay, EGL_CONFIG, nativeWindow, SURFACE_ATTRIBUTES);
```
in Wayland i can do it with same way, just need pointer to **EGLWindow**, we already have pointer to **wl_display** from **SDL_sysWMInfo**, need add to **wl** struct in SDL_SysWMInfo another pointer to **struct wl_egl_window *egl_window;**. And in wayland backend, in function **Wayland_GetWindowWMInfo** return pointer to **egl_window** from **SDL_WindowData**
Now i use patched statically built SDL2 in port of Quake 2 GLES2 for SailfishOS (it use QtWayland):
link to SDL2 commit and changed string for patch:
- 6858a618cd
- b1e29e87b9/SDL2/src/video/wayland/SDL_waylandwindow.c (L463)

link to use in Quake2 port:
1. here i get pointer to EGLNativeWindowType:  6d94fedb1b/Engine/Sources/Compatibility/OpenGLES/EGLWrapper.c (L319)
2. then use it for create EGLSurface: 6d94fedb1b/Engine/Sources/Compatibility/OpenGLES/EGLWrapper.c (L391)
2021-01-14 14:42:53 -08:00
Sam Lantinga b2aaab3d53 Fixed bug 5462 - debug trap update/fix of assembly for Apple devices
David Carlier

updating preprocessor constant and proposing 32 bits variant.
2021-01-14 14:34:24 -08:00
Sam Lantinga 82aafa9aa8 Fixed bug 5461 - Add rewritten WSCONS driver for OpenBSD
wahil1976

This patch adds a written-from-scratch WSCONS driver for OpenBSD. It does not have hardcoded keymaps, and it features mouse support when wsmux is available.

For this to work, it needs access to the /dev/wskbd* devices which are not available to non-root users by default. Access to those can be granted by changing /etc/fbtab to give the logging user the ownership of those devices.
2021-01-14 14:32:11 -08:00
Manuel Alfayate Corchete 1adadc7702 [KMS/DRM] Adjust come return values. Improve comments. 2021-01-14 10:18:40 +01:00
Manuel Alfayate Corchete 57661e42c3 [KMS/DRM] Remove unused header. 2021-01-13 20:17:50 +01:00
Manuel Alfayate Corchete ead3c406a2 [KMS/DRM] Refactor, improve and re-comment async pageflips code. 2021-01-13 20:11:01 +01:00
Sam Lantinga fbd7c718b6 Don't blink the Xbox 360 LED when setting the player slot, it's probably already been set by a driver 2021-01-13 11:02:07 -08:00
Sam Lantinga d757ec7f5c Only select the gamepad interfaces on the Xbox 360 wireless adapter 2021-01-13 11:02:01 -08:00
Sam Lantinga c94283d404 testgamecontroller: log which controller the event came from 2021-01-13 11:01:54 -08:00
Manuel Alfayate Corchete aac74db685 [KMS/DRM] Enable async pageflips. 2021-01-13 15:54:26 +01:00
Manuel Alfayate Corchete 9384e59561 [KMS/DRM] Add warning comentary to avoid future experiments with scaling. 2021-01-12 20:15:37 +01:00
Ryan C. Gordon b99543b682 opengl: More work on making line drawing match software renderer. 2021-01-11 20:40:11 -05:00
Manuel Alfayate Corchete 8442754912 [KMS/DRM] Refactor KMSDR_CreateSurface to group all non-Vulkan stuff in a block. 2021-01-12 00:22:58 +01:00
Manuel Alfayate Corchete 87eb734c4e [KMS/DRM] Don't ask SDL to scale image when in Vulkan mode. 2021-01-11 23:59:40 +01:00
JibbSmart e9887045a2 Gyro and Accel sensor support for Switch Pro Controller.
Note that axes are changed to match the axes we're using with PlayStation controllers, since users will appreciate consistent behaviour across devices.
2021-01-11 15:36:40 +08:00
Manuel Alfayate Corchete 85e8adf78d [KMS/DRM] Unused code cleaning. 2021-01-11 22:28:27 +01:00
Manuel Alfayate Corchete 5105ecf8b1 [KMS/DRM] Move surface size info to window driverdata, for coherency. 2021-01-11 21:02:07 +01:00
Manuel Alfayate Corchete 2067a7db8e [KMS/DRM] Fix fullscreen to windowed transition. Fix aspect ratio correction without using planes. 2021-01-11 20:29:09 +01:00
Sylvain Becker 958e5d5b34 SDL_UpdateNVTexture: fixed pitch/bpp for GLES2 (bug #5430) 2021-01-11 10:01:24 +01:00
Sylvain Becker 68815b6c06 Fixed bug 5465 - Invalid memcpy inside SDL_GestureDelTouch (Thanks dmikushin and Yuki Okumura) 2021-01-10 22:21:12 +01:00
Sylvain Becker b94718e0a7 SDL_UpdateNVTexture: for D3D11, same notation as SDL_UpdateTexture (bug #5430) 2021-01-09 21:22:21 +01:00
Manuel Alfayate Corchete 850d9c8c0d [KMS/DRM] Cleanup remainings from plane/scaling usage. 2021-01-09 02:25:13 +01:00
Ozkan Sezer 8636bc06de acinclude/libtool.m4: Apply macos11 patch from libtool bug #44605
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44605
https://github.com/macports/macports-ports/blob/master/devel/libtool/files/dynamic_lookup-11.patch
( Also see https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44684 )

This also implicitly covers the macos10.10+ support patch from libtool
mainstream which has been in since libtool-v2.4.3, i.e.:
http://git.savannah.gnu.org/gitweb/?p=libtool.git;a=commit;h=e145288b059e14ab7e58fc6a304e82d9dad282a6
2021-01-09 00:11:20 +03:00
Manuel Alfayate Corchete 2aeb317743 [KMS/DRM] Fix vkQuake3 in OpenGL mode. 2021-01-08 22:00:28 +01:00
Sam Lantinga 8746788fea KMSDRM_LEGACY is no longer legacy 2021-01-08 11:08:23 -08:00
Ozkan Sezer 29888bd69a fixed permissions of xcode project file 2021-01-08 21:56:00 +03:00
Ozkan Sezer 8d3963421d regenerated configure 2021-01-08 21:50:02 +03:00
Sam Lantinga 50ea3b77f1 Fixed bug 5080 - SDL_netbsdaudio: Always use the device's preferred frequency
Nia Alarie

The NetBSD kernel's audio resampling code is much simpler and lower quality than libsamplerate.

Presumably, if SDL always performs I/O on the audio device in its native frequency, we can avoid resampling audio in the kernel and let SDL do it with libsamplerate instead.
2021-01-08 10:09:37 -08:00
Sam Lantinga 2f72535c62 Fixed joysticks generating SDL mouse events 2021-01-08 09:54:55 -08:00
Sam Lantinga a5dba7d3ab Fixed Xbox One Series X share button incorrectly triggering on newer firmware 2021-01-08 09:54:52 -08:00
Manuel Alfayate Corchete b24494734b [KMS/DRM] Go back to the LEGACY interface only because using planes breaks compatibility with HW, so no advantage on using ATOMIC. 2021-01-08 18:57:12 +01:00
Manuel Alfayate Corchete 940e1b8dd9 [KMS/DRM] Small readability changes. 2021-01-08 16:33:50 +01:00
Manuel Alfayate Corchete e5bf1850f5 [KMS/DRM] Fix cpmpilation warnings. Thanks to Ozkan Sezer for pointing this out! 2021-01-08 15:39:05 +01:00
Manuel Alfayate Corchete cef1bd0639 [KMS/DRM] Prevent creating another default cursor everytime a window is created. Other fixes and cleanups. 2021-01-08 13:14:42 +01:00
Jordan Christiansen 7032539785 Disabled Bluetooth if BLE is not supported
BluetoothManager is supported for Android API 18+. On older versions, skip
Bluetooth instead of crashing.
2021-01-07 19:33:12 -06:00
Cameron Gutman 0f0946702d Use Clang/GCC builtins for SDL byteswapping functions
__builtin_bswap32/64 were introduced in GCC 4.3. __builtin_bswap16 was
not available on x86 until GCC 4.8 due to a bug.

__builtin_bswap32/64 were introduced in Clang 2.6. __builtin_bswap16
was introduced in Clang 3.2.
2021-01-04 19:51:56 -06:00
Sam Lantinga e778881ada Fixed bug 5449 - SDL_DROPFILE update mouse location of drop in Cocoa
Dominik Reichardt

Exult (http://exult.info) has an editor app that uses GTK+2. Up to now we were using X's drag'n'drop to allow dropping of assets from the editor onto Exult.
There is now an experimental branch that makes use of SDL_DROPFILE. That works under X, dropping in Exult's SDL2 window puts the asset right at the spot you dropped at.
On macOS with native Exult and Quartz GTK+2 this doesn't work, the location of the drop is where the mouse was last tracked before you left the window (usually one of the edges, unless you tabbed out).
All we tried out pointed to the fact that the location update needs to be done by the dropfile event in SDL2, not by our own (which always only worked after the Exult window getting focus).

This patch adds this to SDL_cocoawindow.m and it works perfectly, passing the correct coordinates to our code (SDL_GetMouseState()).
2021-01-07 11:49:28 -08:00
Sam Lantinga c8a64ad90c Fixed building when SDL_LIBUSB_DYNAMIC is defined 2021-01-07 10:23:55 -08:00
Manuel Alfayate Corchete d079130c24 [KMS/DRM] Don't use primary plane for scaling because that's unsupported on most LEGACY-only HW. 2021-01-07 18:44:34 +01:00
Ozkan Sezer e23666f63e update config.guess and config.sub from mainstream. 2021-01-07 17:40:00 +03:00
Manuel Alfayate Corchete e168d1138c [KMS/DRM] Correct drmModeSetCursor() dimensions. 2021-01-07 14:40:24 +01:00