Commit Graph

11727 Commits

Author SHA1 Message Date
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
Sam Lantinga
67f54bebcb Fixed compiler warning 2019-12-19 15:58:16 -08:00
Sam Lantinga
dbc078fef2 Backed out debug code 2019-12-19 15:21:44 -08:00
Sam Lantinga
dc8d88d236 Added new HIDAPI driver files to the Xcode projects 2019-12-19 15:18:50 -08:00
Sam Lantinga
2041287cc8 Added new HIDAPI driver files to the Visual Studio project 2019-12-19 15:12:36 -08:00
Sam Lantinga
ea2fadebb7 Added missing files from previous commits 2019-12-19 15:02:12 -08:00
Sam Lantinga
73942288a5 Added an untested driver for the Nintendo GameCube adapter, based on code contributed by Ethan Lee 2019-12-19 15:01:35 -08:00
Sam Lantinga
0373aa776f Added support for wireless Xbox 360 controllers using the HIDAPI driver 2019-12-19 15:01:32 -08:00
Sam Lantinga
0efd0db9d3 Refactored HIDAPI controller code to support dongles and hubs that dynamically attach controllers 2019-12-19 15:01:30 -08:00
Sylvain Becker
d94d5dbb68 Fixed bug 4906 - Pressing Back button terminates app after SDL_StartTextInput 2019-12-19 13:54:03 +01:00
Sam Lantinga
7ad5960735 Fixed compiler warning 2019-12-19 04:31:00 -08:00
Sam Lantinga
88807adb49 Added Android support for the Hyperkin X91 and the SteelSeries Stratus Duo 2019-12-17 12:03:57 -08:00
Sam Lantinga
8d032e50f0 Added support for the SteelSeries Stratus Duo 2019-12-16 17:11:23 -08:00
Sam Lantinga
c85f55e413 Update for bug 4883 - Add approximation for display DPI on iOS
Aaron Barany

I realized I made a minor mistake in my patch: I changed the constructor prototype for SDL_DisplayData, but didn't update the declaration in the .h file. The compiler and linker don't complain, but it would probably be best to fix in case a later change runs into a problem from the mismatch. I have attached a patch to fix this.
2019-12-16 10:26:36 -08:00
Sam Lantinga
be7c116d87 Fixed bug 4898 - No rumble because of integer overflow in SDL_JoystickRumble
meyraud705

On a Dualshock 4 controller using hidapi driver, calling SDL_JoystickRumble with a duration too long (SDL_HAPTIC_INFINITY for example) causes the rumble to stop immediately.

This happens because of integer overflow on line 301 of SDL_hidapi_ps4.c
(https://hg.libsdl.org/SDL/file/99ecd178999f/src/joystick/hidapi/SDL_hidapi_ps4.c#l301), which sets expiration time in the past.
2019-12-16 10:20:03 -08:00
Sam Lantinga
96f4fefd49 Fixed binding D-pad on NES30 controller 2019-12-12 19:07:26 -08:00
Sam Lantinga
98273fb246 Added mappings for the Razer Serval on Windows and Mac OSX 2019-12-13 16:12:41 -08:00
Sam Lantinga
d7d926bc9c Added support for the 8Bitdo NES30 GamePad in wired mode 2019-12-13 16:12:39 -08:00
Sam Lantinga
f0a773cd74 Enable the LED on PowerA Xbox One controllers 2019-12-13 16:12:37 -08:00
Sam Lantinga
1993aac6bd Added support for the BDA XB1 Spectra Pro 2019-12-13 16:12:35 -08:00
Sam Lantinga
4811ddc0b9 Identified the BDA XB1 Classic Controller 2019-12-13 16:12:33 -08:00
Sam Lantinga
422fd5cff5 Added general remapping of controller manufacturer 2019-12-13 16:07:25 -08:00
Sam Lantinga
bae75bff7e Added support for the HORI PAD A 2019-12-13 16:07:22 -08:00
Sam Lantinga
3cafdaa1b4 Strip trailing whitespace on controller manufacturer identification 2019-12-12 19:14:37 -08:00
Sam Lantinga
11e1850f08 Fixed Xbox 360 Controller support using libusb on Linux 2019-12-12 14:26:34 -08:00
Sam Lantinga
1bbf6753a2 Fixed comment typo 2019-12-12 14:25:02 -08:00
Sylvain Becker
d3c5c1dbc2 Android: use SDL_arraysize() 2019-12-12 20:33:11 +01:00
Sylvain Becker
2ee35e7012 Android: use 'RegisterNatives' to export the native methods
"The advantages of RegisterNatives are that you get up-front checking
that the symbols exist, plus you can have smaller and faster shared
libraries by not exporting anything but JNI_OnLoad"

https://developer.android.com/training/articles/perf-jni#native-libraries
2019-12-12 18:38:36 +01:00
Sam Lantinga
9c9afbca1f Added names for official Microsoft controllers, since they don't have descriptive product names 2019-12-11 19:24:40 -08:00
Sam Lantinga
1354cb0c56 Added custom names for some controllers 2019-12-11 17:47:01 -08:00