Commit Graph

16 Commits

Author SHA1 Message Date
Sam Lantinga
d797582376 Fixed style 2015-06-14 19:26:20 -07:00
Sam Lantinga
34634082ff Fixed bug 3012 - Android accelerometer joystick axis values overflow when values from Android are larger than gravity
Magnus Bjerke Vik

This causes issues when for instance using the joystick API to make an Android phone rotate an object by rotating the phone. When the absolute value of an axis reported by android is larger than earth gravity, SDL will overflow the Sint16 value used for joystick axes, causing sporadic movements when close to the gravity. Just holding the phone so that e.g. Y points directly upwards will make it unstable, and even more if you just tap the phone gently from below (increasing the acceleration).

More detailed: SDLActivity gets the accelerometer values in onSensorChanged and divides each axis by earth gravity. SDL_SYS_JoystickUpdate takes each of the axis values, multiplies them by 32767.0 (largest Sint16), and the casts them to Sint16. From this you can see that any value from Android that exceeds earth gravity will overflow the joystick axis.

A fix is to clamp the values so that they won't overflow the Sint16.
2015-06-14 19:25:12 -07:00
Sam Lantinga
f29de0d324 Fixed bug 3005 - MOMO steering wheel not detected by SDL
Joe Thompson

This is a regression. The changes to fix #2460 cause the EnumJoysticksCallback() function to return without adding devices (Line 345 in SDL-0a2b6bc7005f\src\joystick\windows\SDL_dinputjoystick.c).
Looking at dinput.h on my system, at least DI8DEVTYPE_DRIVING and DI8DEVTYPE_FLIGHT need to be added to the test.
It might be better to check if (devtype == DI8DEVTYPE_SUPPLEMENTAL) rather than checking if it is NOT EQUAL to a long list of types. Or check if the device is already in the list.
2015-06-11 12:04:57 -07:00
Ryan C. Gordon
e90f87bab0 Another attempt to get this to compile. 2015-05-28 01:08:33 -04:00
Ryan C. Gordon
4add16943e Patched to compile on MingW.
(I think!)
2015-05-28 01:02:03 -04:00
Ryan C. Gordon
58447b24c1 Move tests from SDL_config higher up in Windows joystick/haptic code.
Fixes Bugzilla #2932.
2015-05-28 00:54:52 -04:00
Sam Lantinga
7f17e0ab9e Fixed detecting PS4 wired controller on Windows 2015-05-27 10:29:43 -07:00
Ryan C. Gordon
d1980b93fb Mac: Fix compiler warning when building with a min target >= 10.6. 2015-05-26 12:52:28 -04:00
Ryan C. Gordon
f99d6e1df8 Linux joystick: Look at entire axis namespace for controls (thanks, "spaz16"!).
This apparently has fallout: the PS4 (and maybe PS3?) controllers apparently
report some bogus axes, but it won't change the axes we currently expect, and
thus the game controller config string is still stable.

Fixes Bugzilla #2719.
2015-05-26 12:03:51 -04:00
Sam Lantinga
523064592a Fixed bug 2869 - Controllers connected on launch are reported twice.
Since all device detection/removal happens on the main thread now, post events inline with when the status changes occur.
Also fixed rare cases when joystick API functions could return data about removed joysticks when called with a device index.
2015-05-26 08:52:02 -07:00
Sam Lantinga
2c4a6ea0a2 Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
Sam Lantinga
b0c5e201f8 Added support for Razer Serval Bluetooth mode 2015-05-25 14:52:41 -07:00
Sam Lantinga
6365381422 Added game controller support for the Razer Serval 2015-05-20 16:28:21 -07:00
Sam Lantinga
094c4a160f Added generic xinput fallback for XBox compatible controllers on Linux 2015-05-13 22:37:26 -07:00
Philipp Wiesemann
9979bab20b Android: Deactivated debug log messages on joystick device events. 2015-04-30 21:45:29 +02:00
Ryan C. Gordon
b72938c861 Windows: Always set the system timer resolution to 1ms by default.
An existing hint lets apps that don't need the timer resolution changed avoid
this, to save battery, etc, but this fixes several problems in timing, audio
callbacks not firing fast enough, etc.

Fixes Bugzilla #2944.
2015-04-20 12:22:44 -04:00