Commit graph

187 commits

Author SHA1 Message Date
Michael M
fd7cbd633e ControllerInterface: add mutex around callbacks vector 2017-11-10 13:37:42 -08:00
Michael M
1ed7532af8 ControllerInterface: HotplugCallbacks -> DevicesChangedCallbacks 2017-11-10 13:37:42 -08:00
Michael M
7355b5f70d ControllerInterface: invoke callbacks in AddDevice/RemoveDevice
Some backends already cause this to happen, so make it consistent across
systems.
2017-11-10 13:37:41 -08:00
Arthur Carlsson
79a646a67d Prevent multiple HID elements of same usage type on OSX
On OSX, iterate the HID device's elements and only store the last of
each type to accommodate for flaky hardware
2017-09-15 19:19:46 +02:00
Lioncash
696e1b40b5 Common: Move version strings to their own header
Ideally Common.h wouldn't be a header in the Common library, and instead be renamed to something else, like PlatformCompatibility.h or something, but even then, there's still some things in the header that don't really fall under that label

This moves the version strings out to their own version header that doesn't dump a bunch of other unrelated things into scope, like what Common.h was doing.

This also places them into the Common namespace, as opposed to letting them sit in the global namespace.
2017-09-09 19:28:10 -04:00
Nick
ef95bf26cb Implement GamePAd and MultiAxisController detection 2017-08-24 00:31:59 -04:00
Nick
3abde44641 formatting cleanup 2017-08-23 00:19:34 -04:00
Nick
3cddb62aea keyboard fixes v2 2017-08-22 12:26:44 -04:00
Nick
0df4f7db4f Depreciate old OSX Keyboard and Mouse 2017-08-21 01:44:03 -04:00
Leo Lam
918b0375e4 Merge pull request #5742 from ToadKing/fix-bad-controllers
Ignore capabilities reported by an XInput device
2017-08-17 03:42:02 +08:00
Michael Lelli
4fb2d1e361 Ignore capabilities reported by an XInput device 2017-08-09 22:51:01 -05:00
Jocelyn Turcotte
200fb26148 Fix axis not working with Switch Pro controller on macOS
Each axis would appear as multiple elements with 0 min/max.
Filter the list of elements using the correct usage page like
done for buttons.
2017-08-01 01:58:30 +02:00
Léo Lam
17ef4c8046 StringUtil: Make SplitString return by value
Simpler usage.
2017-06-11 16:48:20 +02:00
shuffle2
192fec50b9 Merge pull request #5276 from ligfx/macosheadless
Add headless support on macOS
2017-06-05 20:49:02 -07:00
Léo Lam
d9fd056803 Fix minor formatting issues
These were not caught by the lint script while it was broken.
2017-06-05 02:32:19 +02:00
Lioncash
5862d1fc41 Device: Provide operator!= counterparts to operator== for DeviceQualifier
Makes comparison logic symmetric
2017-06-03 19:34:35 -04:00
Michael Maltese
5298328cb1 Add headless support on macOS 2017-04-15 19:34:42 -07:00
Steven Newbury
02681bc352 Add missing "functional" include
Building fails on GCC7 without an explicit
2017-02-20 14:25:55 +00:00
Michael Maltese
a509f56116 InputCommon: Extract ControlReference from ControllerInterface
Better separation of concerns. Relegates `ControllerInterface` to
enumerating input controls, and the new `ControlReference` deals with
combining inputs and configuration expression parsing.
2017-02-07 22:59:10 -08:00
Michael Maltese
0bc40cacda No longer need to //clang-format off for Windows headers 2017-01-23 16:23:37 -08:00
Michael Maltese
713ec5ffd5 Add includes for building on Windows without PCH 2017-01-23 01:37:41 -08:00
hthh
387164a999 macOS: Add missing includes to fix no-PCH build 2017-01-02 11:45:24 +11:00
Tillmann Karras
57a005ff3e evdev: reduce startup time
GetName() creates a new evdev device which calls tons of ioctls. But the
main culprit is close() which for input devices appears to be a slow
path in the kernel.

This commit reduces PopulateDevices() by 50% on my laptop, but ~730 ms
is still ridiculously slow for something that isn't needed right away.
2016-12-26 01:24:35 +01:00
Tillmann Karras
f575902cf3 evdev: set flag in a thread-safe way 2016-12-05 00:47:26 +00:00
Tillmann Karras
3c090a37d4 evdev: fix shutdown hang
Note: This probably means our approach of populating from udev isn't
safe to be called multiple times.
2016-12-05 00:47:26 +00:00
Anthony
ffe20705dd Merge pull request #4362 from ligfx/osxhotplug
ControllerInterface: enable hotplugging on macOS
2016-12-01 00:29:56 -06:00
Michael Maltese
7ed8fb95c5 ControllerInterface: enable hotplugging on macOS 2016-11-30 22:27:46 -08:00
Michael Maltese
3e69d066f5 ControllerInterface: replace Reinitialize with RefreshDevices
The SDL backend crashes when you close a joystick after SDL_Quit has
been called. Some backends don't need to be shutdown and
re-initialized everytime, we can just ask to enumerate devices again.
2016-11-30 16:07:55 -08:00
Michael Maltese
cebb4d84f2 ControllerInterface: clear devices before shutting down backends
The SDL backend faults if it tries to close a joystick after SDL_Quit
has been called.
2016-11-30 16:07:54 -08:00
Markus Wick
b9e4f67d3a Merge pull request #4405 from xrix4096/mac-unknown-joyaxis
Make analog triggers on PS3 controllers accessible on Mac
2016-10-31 13:01:47 +01:00
Markus Wick
2afa877119 Merge pull request #4376 from leoetlino/warning-fix
Warning fixes
2016-10-31 12:57:03 +01:00
Chris Pritchard
9da9ba616b Use the IOHIDElement cookie as a part of the axis name for unknown axis. Previously the 'usage' value was used to identify the axis by name, but this is not unique. For example on a PS3 controller *all* axis other than the well known ones return a usage of '1' so there are 30 or more axis all named "1". This stops things such as analog triggers being usable.
Using the element cookie uniquely identifies each axis and allows them to be assigned successfully as controls
2016-10-30 10:36:53 +00:00
Sintendo
f163bd1048 Fix various comment typos 2016-10-24 18:27:49 +02:00
Léo Lam
68156a02ed Fix -Wunused-result warnings 2016-10-23 00:43:08 +02:00
Léo Lam
fad17246db InputCommon: Fix formatting issues in Quartz
This wasn't caught by the lint script because it was broken (by me) at
some point :(

If it had been rebased, it wouldn't have passed lint
2016-10-03 18:59:52 +02:00
shuffle2
e38ddfd787 Merge pull request #4111 from EmptyChaos/startup-perf-langs
InputCommon: Fix slow startup on some Windows systems with language packs (Issue 9744)
2016-10-03 04:02:54 -07:00
shuffle2
2747fd3a0d Merge pull request #4102 from ligfx/quartz_input
Add Quartz/CoreGraphics controller interface for default k&m events
2016-10-03 03:13:58 -07:00
Jasper St. Pierre
928d05ec47 InputCommon: Remove the Xlib backend
The XInput2 backend is more performant, so let's default to it and
remove the old, core-only backend.
2016-09-04 10:44:22 -07:00
Jasper St. Pierre
2b640a4f7d XInput2: Only do a round trip when the mouse has moved
This should cut down on round trips and blocking calls dramatically
during gameplay.
2016-09-04 10:44:22 -07:00
EmptyChaos
17e4bd9575 InputCommon: Fix slow startup on some Windows systems
Rewrite GetXInputGUIDS to use SetupAPI instead of WMI Queries. When
using a language pack where the system language and user/program
language differ, Windows starts taking a VERY long time (10+ seconds)
to complete Queries for Win32_PNPEntity objects (it's probably
translating every single string since it transfers every single one
from the WMI server into memory in the program).

Fixes Issue 9744.
2016-08-11 09:30:36 +10:00
Michael Maltese
0f5951e324 And pull KeycodeToName into its own function 2016-08-09 19:59:45 -07:00
Michael Maltese
d1594f9529 use a std::map instead of running through the AOS 2016-08-09 19:54:59 -07:00
Michael Maltese
a5cc054bd1 use std::to_string instead of sstream 2016-08-09 17:45:41 -07:00
Michael Maltese
6097d30288 clang-format and cleaning up Key::GetName 2016-08-09 17:23:30 -07:00
Michael Maltese
3889e4d4b2 style fixes 2016-08-09 15:52:02 -07:00
Michael Maltese
3dc8136e14 Add Quartz/CoreGraphics controller interface for default k&m events 2016-08-08 09:38:22 -07:00
Léo Lam
77fab5940c InputConfigDiag: Don't prevent closing dialog if device not found
There is no reason to prevent the user from closing the config dialog
if the device is not found. It's not very good UX…

Also fixes ExpressionParser to return NO_DEVICE if the device doesn't
exist instead of SUCCESS.
2016-07-30 10:00:55 +02:00
Léo Lam
135641404a evdev: Add hotplugging support
This adds hotplugging support to the evdev input backend. We use
libudev to monitor changes to input devices in a separate thread.
Removed devices are removed from the devices list, and new devices
are added to the list.

The effect is that controllers are usable immediately after plugging
them without having to manually refresh devices (if they were
configured to be used, of course).
2016-07-29 17:18:40 +02:00
Léo Lam
3926db624d ControllerInterface: Don't block on UpdateInput()
Changes UpdateInput() to skip if we can't lock the mutex, instead of
potentially blocking the CPU thread and causing a short but noticeable
frame drop.
2016-07-29 17:18:40 +02:00
Léo Lam
93f5df4195 ControllerInterface: Add RemoveDevice()
This adds RemoveDevice() to ControllerInterface, fixes ExpressionParser
and some other code to support device removals without crashing,
and adds an IsValid() method to Device, to prepare for hotplugging.
2016-07-29 17:18:37 +02:00