Commit Graph

24 Commits

Author SHA1 Message Date
Ryan C. Gordon 5e74299a83 Fix adding of XInput devices (thanks, Mitchell!)
Partially fixes Bugzilla #2126.
2013-10-20 15:40:20 -04:00
Sam Lantinga 7ad441a37c Fixed bug 2069 - Device addition/removal queries all USB devices rather than only HID devices.
Andreas Ertelt
SDL_dxjoystick.c is setting the classguid for device (dis)connect events to USB Devices in general:
    dbh.dbcc_classguid = GUID_DEVINTERFACE_USB_DEVICE;

Wouldn't it make more sense to have it just subscribe to Hid device events? This would mean less meaningless events reaching the application.
2013-10-17 23:40:13 -07:00
Sam Lantinga 12ca3ce3fa Fixed building using MinGW
Our SDL_windows.h needed to be included before anything else so UNICODE is defined.
2013-10-17 23:02:29 -07:00
Sam Lantinga 15682c0c5f Report joystick added/removed events even if we don't have udev.
T. Joseph Carter

As discussed (possibly to death), the Linux joystick driver does not actually report events for added or removed joysticks when you haven't got udev support.

We simply cannot know about removed joysticks without udev.  But we can (and we should) report adding them.  This brings the legacy case in line with pretty much the rest of SDL's joystick drivers.
2013-10-10 20:58:20 -07:00
Sam Lantinga cca094225a Only allocate a joystick instance ID once we know it's a joystick.
This fixes compatibility with code that assumes 0 based joystick instance IDs.
2013-10-06 20:39:23 -07:00
Sam Lantinga 8f46bcfd6d Check for NULL joystick in SDL_JoystickGetGUID() 2013-10-06 13:49:23 -07:00
Sam Lantinga 90a219a375 Fixed bug where a Logitech wireless keyboard with built-in mouse touchpad didn't get recongized as both devices. 2013-10-05 21:15:55 -07:00
Gabriel Jacobo 57e09318dd Uses SDL_UDEV for Linux joystick hotplugging 2013-10-01 08:47:06 -03:00
Sam Lantinga dc9ddf1f61 Fixed bug 2090 - Some joystick inputs are delayed on FreeBSD
kikuchan

Some joysticks with high sampling rate need to be read() more fast,
otherwise it delay user inputs due to internal queue.
Especially, an app that issues SDL_PollEvent() not so frequent
2013-09-06 20:54:14 -07:00
J?rgen P. Tjern? f06eeb013b Fix to buffer overrun in SDL_JoystickGetGUIDString(). 2013-09-05 15:49:57 -07:00
Sam Lantinga f79fc33a39 Christoph Mallon: Remove pointless if (x) before SDL_free(x) 2013-08-29 08:29:21 -07:00
Ryan C. Gordon 257cef3024 Change order we enumerate Windows joysticks.
Make it so XInput devices are listed before DirectInput devices, and that the XInput
 devices are sorted by userid in ascending numeric order (so device 0 comes first).
2013-08-28 22:09:17 -04:00
Ryan C. Gordon ea4350d821 Don't corrupt XInput device state during SDL_SYS_JoystickClose(). 2013-08-28 22:07:54 -04:00
Ryan C. Gordon aa65211486 Make XInput joystick names match the numbers on the device.
(And how the Haptic code already names them.)
2013-08-28 17:17:21 -04:00
Ryan C. Gordon 4b255c63f1 Reworked XInput and DirectInput joystick code.
Now multiple XInput controllers map correctly to device indexes instead of grabbing
the first available userid, and are completely separated out from DirectInput.

Also, the hardcoded limitation on number of DirectInput devices is gone. I don't
expect there to really ever be more than eight joysticks plugged into a machine, but
it was a leftover limitation for a static array we didn't actually use anymore.

Fixes Bugzilla #1984. (etc?)
2013-08-28 16:43:47 -04:00
Ryan C. Gordon c89e04694d Better XInput detection code for DirectInput device enumeration.
This code is way faster than the Wbem code, and less ugly.
2013-08-28 16:35:32 -04:00
Sam Lantinga cd27a1ef05 Fixed compiling on old versions of the DirectX SDK 2013-08-21 12:12:04 -07:00
Sam Lantinga 9faefccd48 SDL
- detect that you tried to open a gamecontroller in xinput mode and failed, then re-get the mapping for the dinput variant you did open (and most likely now just fail the open)

CR: SamL
2013-08-21 10:32:04 -07:00
Sam Lantinga 05d8c2dcd2 Fix SDL xinput code to work at all when xinput has devices at high indexes but no device connected at lower index, for instance 0->disconnected, 1->wireles, 2->wired. Previously the SDL code assumed the indexes were always used up in order which is not true at all and lead to a bunch of failure cases where controllers would go unrecognized.
This entire function is kind of a mess and more complicated than needed, but I don't want to refactor it too heavily tonight.  May look at improving how the indexes are assigned more significanly later.  The way it handles not finding a valid "gamepad" type device is also super broken, it leaves in place the xinput bindings but opens the controller with dinput and ends up with completely wrong mappings, not solving that now, but fixing the bug where we'd very frequently not find a controller due to gaps in assigned player numbers should mostly avoid it.
2013-08-21 10:31:44 -07:00
Gabriel Jacobo 5f8de2b936 Patched to compile on Darwin 2013-08-21 10:27:39 -03:00
Gabriel Jacobo 695344d163 OCD fixes: Adds a space before */ 2013-08-21 09:43:09 -03:00
Gabriel Jacobo 552b04c58a More non C89 compliant comments 2013-08-20 20:34:40 -03:00
Gabriel Jacobo 63fe3a7753 Fixes a few non C89 compliant comments 2013-08-20 19:49:24 -03:00
Gabriel Jacobo dad420670f Fixes #2022, do not resume on Android when surfaceChanged
If the app is in landscape mode and the user presses the power button, a pause
is followed immediately by a surfaceChanged event because the lock screen
is shown in portrait mode. This triggers a "false" resume.
So, we just pause and resume following the onWindowFocusChanged events.

Also, wait for SDL_APP_WILLENTERBACKGROUND and SDL_APP_DIDENTERBACKGROUND before
blocking the event pump.
2013-08-12 11:13:50 -03:00