Commit Graph

11756 Commits

Author SHA1 Message Date
Sam Lantinga
83f1dfbc7e Free the joystick player index when the joystick is removed 2020-01-13 15:35:54 -08:00
Sam Lantinga
10e1e104f3 Added support for claiming individiual interfaces on USB devices on Android
This is needed for supporting multiple wireless Xbox 360 controllers
2020-01-13 15:35:52 -08:00
David Ludwig
9962d37621 Emscripten: build fix for testoverlay2.c 2020-01-13 11:46:17 -05:00
Sam Lantinga
d7197fd388 Fixed error formatting 2020-01-13 08:12:10 -08:00
Sam Lantinga
fa4b4e4535 Send the full Xbox One controller sequence for Microsoft controllers
This switches Bluetooth controllers back into USB report mode for the latest Xbox One S and Xbox One Elite Series 2 firmware
2020-01-12 17:22:24 -08:00
Sam Lantinga
9465efd616 Fixed NEON detection on arm64 CPUs
This probably breaks RISCOS, but we need a better fix from Cameron Cawley for this
2020-01-11 22:03:06 -08:00
Sam Lantinga
8dce43af34 Worked around an issue where the kernel would lose the force feedback effect 2020-01-11 13:38:50 -08:00
Sam Lantinga
622dec06ca Add the destination format to the error when conversion isn't possible 2020-01-11 04:38:13 -08:00
Sam Lantinga
d34fb48c6f The Xbox One S Bluetooth controller with older firmware uses b16 as the guide button. The same controller with newer firmware uses b12 as the guide button. Map both buttons so both firmware revisions will work with the same mapping. 2020-01-11 04:34:28 -08:00
Sam Lantinga
c58dcb95ef The Amlogic TVB-906X is Android TV 2020-01-11 04:34:23 -08:00
Sam Lantinga
1246c07c48 Only initialize Xbox One controllers once they're ready for initialization (or if they are silent until init)
This fixes the Hyperkin Duke Xbox One controller showing the Xbox startup animation every time an SDL application launches
2020-01-09 14:53:34 -08:00
Sam Lantinga
ddcc71a04c Fixed crash when unplugging a HIDAPI controller 2020-01-09 14:53:30 -08:00
Sam Lantinga
4e4a959b3d Added support for the updated Hyperkin Duke Xbox One controller 2020-01-08 18:55:53 -08:00
Sam Lantinga
315dae6d18 Fixed handling the 8BitDo M30 in Nintendo Switch mode 2020-01-07 16:47:56 -08:00
Sam Lantinga
af5552891d Added support for the 8BitDo M30 GamePad 2020-01-07 18:43:40 -08:00
Cameron Cawley
f223b4a711 riscos: Add CPU feature detection 2020-01-06 20:26:52 +00:00
Sam Lantinga
b667cb328d Added support for the 8Bitdo FC30 Pro 2020-01-06 12:18:51 -08:00
Sam Lantinga
84833fe2f6 Fixed bug 4928 - CMakeLists.txt: put cmake package helpers in proper libdir
Tiago O.

Use LIB_SUFFIX variable to determine the correct path.
2020-01-06 07:06:58 -08:00
"Dmitry V. Levin"
8bb12d0b01 X11_InitKeyboard: do not call XAutoRepeatOn unnecessarily
Use XGetKeyboardControl to initialize the current XKeyboardState, and
skip XAutoRepeatOn invocation if global_auto_repeat is AutoRepeatModeOn.

This fixes SDL2 when the X11 client is untrusted.
2020-01-04 11:05:06 -08:00
"Dmitry V. Levin"
55e26f6586 have_mitshm: use XShmQueryExtension to check for MIT-SHM extension
Do not try to guess MIT_SHM extension availability from the string
returned by XDisplayName, use the appropriate API instead.

This fixes SDL2 inside hasher.
2020-01-04 11:03:04 -08:00
Michael Forney
1e3f00ae92 wayland: support wl_data_device_manager version < 3 2019-12-29 23:10:39 -08:00
Sam Lantinga
1faf6d8040 Added support for the Hyperkin Duke controller 2020-01-01 08:13:40 -08:00
Sam Lantinga
cc2dbe7668 Fixed bug 4357 - iosbuild.sh broken with SDL 2.0.9
Christoph Charles

The new source files for coremotion sensors don't seem to have been included correctly in configure.in. This leads to the build script ios-build.sh to fail at link time, complaining about missing symbols, namely about missing SDL_COREMOTION_SensorDriver.
2019-12-31 10:40:30 -08:00
Sam Lantinga
c4bda820ae Fixed GameCube controller axis and trigger ranges and X and B button being swapped 2019-12-30 17:56:56 -08:00
Sam Lantinga
1feaead3fb Fixed bug 4920 - Wider support for seconds of battery life left on Linux platforms using sys interface
Murad

On my system, SDL_GetPowerInfo() returns -1 seconds of battery life left. I have quickly investigated that in my case SDL uses sys interface to get battery data. It tries to read "time_to_empty_now" file which is not always present. However, it is still possible to calculate remaining lifetime using "energy_now" and "power_now" files. This is what my simple patch (included as attachment) tries to accomplish.
Best wishes.
2019-12-30 13:21:47 -08:00
Sam Lantinga
51b2f1e985 Fixed bug 4918 - SDL failed to build due to error LNK2019: unresolved external symbol memset referenced in function SDL_SetJoystickIDForPlayerIndex with MSVC x64 on Windows
LinGao

We build SDL with Visual studio 2017 compiler on Windows Server 2016, but it failed to build due to error LNK2019: unresolved external symbol memset referenced in function SDL_SetJoystickIDForPlayerIndex with MSVC x64 on Windows on latest default branch. And we found that it can be first reproduced on 6c431d30a6df changeset. Could you please help have a look about this issue? Thanks in advance!

Steps to Reproduce:
1.hg clone https://hg.libsdl.org/SDL D:\SDL\src
2.Open a VS 2017 x64 command prompt as admin and browse to D:\SDL
3.msbuild /p:Configuration=Release /p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17134.0 VisualC\SDL.sln /t:Rebuild

Actual result:
 Creating library D:\SDL\src\VisualC\x64\Release\SDL2.lib and object D:\SDL\src\VisualC\x64\Release\SDL2.exp
SDL_joystick.obj : error LNK2019: unresolved external symbol memset referenced in function SDL_SetJoystickIDForPlayerIndex [D:\SDL\src\VisualC\SDL\SDL.vcxproj]
D:\SDL\src\VisualC\x64\Release\SDL2.dll : fatal error LNK1120: 1 unresolved externals [D:\SDL\src\VisualC\SDL\SDL.vcxproj]
Done Building Project "D:\SDL\src\VisualC\SDL\SDL.vcxproj" (Rebuild target(s)) -- FAILED.
2019-12-30 13:18:57 -08:00
Sam Lantinga
ab17258ae0 Removed unnecessary setlocale() on Mac
240bad3b66
2019-12-30 11:09:03 -08:00
Sam Lantinga
df1101ad7c Added support for the Nintendo GameCube adapter, tested on Steam Link hardware 2019-12-30 09:44:32 -08:00
Ozkan Sezer
b6eac9a8cd SDL_x11events.c (X11_DispatchEvent): remove FIXME and use SDL_strtokr(). 2019-12-27 23:01:10 +03:00
Ozkan Sezer
e9446554d8 Fix build error in SDL_render_metal.m (bug #4916.)
Patch provided by Konrad. Error was introduced by commit 35f99d918ca2 for bug #4914.
2019-12-23 19:55:10 +03:00
Sylvain Becker
1c9a2440ff SDL_ScaleMode: fix compilation GLES renderer 2019-12-23 16:47:00 +01:00
Ryan C. Gordon
04e6c1cdd2 direct3d11: Always set vertex buffers when updating them (thanks, Konrad!).
Fixes Bugzilla #4913.
2019-12-22 20:48:43 -05:00
Sam Lantinga
64a31fbe4e Fixed bug 4910 - Missing joystick-driver type check in haptic
meyraud705

On Linux and MacOS, some haptic system functions access joystick->hw_data without checking the driver type.
2019-12-22 13:56:50 -08:00
Cameron Gutman
b84364a11a Use IOHIDManagerRegisterDeviceRemovalCallback() to monitor for HID removal
The function we currently use, IOHIDDeviceRegisterRemovalCallback(), often
fails on Catalina with a "__CFRunLoopModeFindSourceForMachPort returned NULL"
error message. Once a removal callback is missed, we will eventually crash when
the joystick is closed attempting to use the invalid IOHIDDeviceRef.

https://forums.developer.apple.com/thread/124444
2019-12-20 22:25:49 -08:00
Sam Lantinga
1f18343275 Fixed bug 4911 - Build broken when hidapi enabled
meyraud705

SDL_hidapi.c is added twice to 'SOURCES' which causes "multiple definition error" when linking.
2019-12-22 13:42:20 -08:00
Sam Lantinga
083a8faa77 Fixed bug 4914 - Expose SDL_ScaleMode and add SDL_SetTextureScaleMode/SDL_GetTextureScaleMode
Konrad

This was something rather trivial to add, but asked at least several times before (I did google about it as well).

It should be possible to dynamically change scaling mode of the texture. It is actually trivial task, but until now it was only possible with a hint before creating a texture.

I needed it for my game as well, so I took the liberty of writing it myself.

This patch adds following functions:

SDL_SetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode scaleMode);
SDL_GetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode *scaleMode);

That way you can change texture scaling on the fly.
2019-12-22 13:39:44 -08:00
Zack Middleton
882729d4e7 Fix shutting down HIDAPI device with multiple joysticks
Using Wii U GameCube USB adapter with multiple controllers attached and
restarting SDL input in a game results in extra joysticks with NULL name.

HIDAPI_CleanupDeviceDriver() shut down joysticks by iterating through
device->num_joysticks but each HIDAPI_JoystickDisconnected() decreases
device->num_joysticks and shifts joysticks array down. Resulting in only
half of controllers being shutdown. It worked with only 1 controller
attached though.

Disconnect HIDAPI device joystick 0 until there are none left.
2019-12-22 13:15:11 -08:00
Sam Lantinga
851d18860c Fixed windows build 2019-12-21 22:33:21 -08:00
Sylvain Becker
6188dcaed6 Android: same way as in nativePause(), resume events are sent from SDL thread 2019-12-21 22:40:33 +01:00
Sylvain Becker
9dfac4a2d9 Android: fix call of glFinish without context.
Message in the log, when going to background:
"call to OpenGL ES API with no current context (logged once per thread)"

Because of SDL_WINDOWEVENT_MINIMIZED is sent from the Java Activity thread.
It calls SDL_RendererEventWatch(), _WindowEvent() and glFinish() without context.

Solution is to move sending of SDL_WINDOWEVENT_MINIMIZED to the SDL thread.
2019-12-21 21:18:02 +01:00
Sam Lantinga
fc97c7d073 Added support for the Hori Dragon Quest Slime Controller 2019-12-20 21:40:28 -08:00
Sam Lantinga
f26743acc5 Fixed duplicate controller entries on Mac OS X when using libusb, due to the HID interface number not being available in the Mac OS X HID code. 2019-12-20 21:00:16 -08:00
Sam Lantinga
cb0cbdf5b4 Automatically assign player indexes to game controllers, and allow changing the player index for game controllers and joysticks.
Added the functions SDL_JoystickFromPlayerIndex(), SDL_JoystickSetPlayerIndex(), SDL_GameControllerFromPlayerIndex(), and SDL_GameControllerSetPlayerIndex()
2019-12-20 20:12:03 -08:00
Sylvain Becker
417e062643 Android: fix IllegalStateException in onBackPressed()
Rare exception, not catch-able, which appears when the activity gets in a broken
state.

java.lang.IllegalStateException:
  at android.app.FragmentManagerImpl.checkStateLoss (FragmentManagerImpl.java:1323)
  at android.app.FragmentManagerImpl.popBackStackImmediate (FragmentManagerImpl.java:493)
  at android.app.Activity.onBackPressed (Activity.java:2215)
  at org.libsdl.app.SDLActivity.onBackPressed (SDLActivity.java)
  at android.app.Activity.onKeyUp (Activity.java:2193)
  at android.view.KeyEvent.dispatch (KeyEvent.java:2685)
  at android.app.Activity.dispatchKeyEvent (Activity.java:2423)
  at org.libsdl.app.SDLActivity.dispatchKeyEvent (SDLActivity.java)
2019-12-20 15:58:59 +01:00
Ozkan Sezer
f7c8d6ff6d fix xcode project file permissions 2019-12-20 14:33:37 +03:00
Paul Cercueil
0ac1128be8 kmsdrm: Fix busy-loop within libc's dlopen()
For some obscure reason, the order in which the libdrm/libgbm libraries
are loaded matters.

Without this fix, the first call to check_modesetting() will work and
load then unload all symbols properly, but the second call to this
function will lock up as soon as dlopen() is called on libdrm.

Swapping the order in which the libdrm and libgbm libraries are loaded
is enough to fix (or work around?) this issue.

Fixes #4891:
https://bugzilla.libsdl.org/show_bug.cgi?id=4891

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
2019-12-19 21:47:43 -08:00
Sam Lantinga
6957c0830a Make sure the Xbox 360 driver doesn't try to talk to the wireless controllers 2019-12-19 21:45:44 -08:00
Sam Lantinga
d7d8693a01 Fixed rare infinite rumble in HIDAPI controller driver 2019-12-19 18:03:28 -08:00
Sam Lantinga
7d363ac0c8 Fixed GameCube rumble 2019-12-19 18:00:08 -08:00
Sam Lantinga
c222588851 Added support for the Nintendo GameCube Controller, using the Mayflash GameCube adapter. 2019-12-19 16:14:22 -08:00