Commit graph

44 commits

Author SHA1 Message Date
Jordan Woyak
48b76ff90f InputCommon: Improve input detection to produce buton combinations. 2020-09-25 22:51:32 -05:00
Jordan Woyak
d8ad8c3861 InputCommon: Make hotkeys and input detection aware of Ctrl -> L_Ctrl / R_Ctrl hierarchy. 2020-09-25 20:29:18 -05:00
Jordan Woyak
f015c99a51 ControllerInterface: Add platform consistent names for modifier keys. 2020-09-25 20:29:18 -05:00
Jordan Woyak
b3acc7403f InputCommon: Support detecting combinations of inputs. (Hotkeys) 2020-09-25 20:29:18 -05:00
Jordan Woyak
da12f3eebc InputCommon: Constify Device::Input::IsDetectable function. 2020-02-22 10:27:43 -06:00
Jordan Woyak
4176cc77e1 InputCommon/ControllerInterface: Make devices mutex recursive so RemoveDevice can be used within UpdateInput. 2020-02-17 15:58:06 -06:00
Jordan Woyak
f0534cabc6 ControllerInterface: Exposse DSU client battery level as an input. 2020-01-13 16:29:24 -06:00
Lioncash
0263435050 ControllerInterface/Device: Make DetectInput() a const member function
This doesn't actually modify object instance state, so it can be made
const.
2019-05-29 19:23:54 -04:00
Lioncash
27346fee8a ControllerInterface/Device: Take vector by const reference in DetectInput()
The vector is only ever queryied and it's contents aren't modified, so
there's no reason to take the vector by value. We can take a constant
reference to it to avoid unnecessary allocating.
2019-05-29 19:12:21 -04:00
Lioncash
246e2a77ce ControllerInterface/Device: std::move strings in constructor where applicable
Allows callers to move std::string values into the constructor,
potentially avoiding copies.
2019-05-29 18:46:49 -04:00
Lioncash
1355b43fd2 ControllerInterface/Device: Use std::string_view where applicable
In these cases, the given string is only ever compared against other
string, so std::string can be turned into a std::string_view to allow
non-allocating inputs.
2019-05-29 18:42:24 -04:00
Jordan Woyak
be897b41a7 ControllerInterface: Rename full surface analog inputs to be more visually dissimilar from their underlying inputs. e.g. "Full Axis X+". 2019-04-13 08:45:19 -05:00
Jordan Woyak
eadbdd6bc3 ControllerInterface/Win32: Prevent devcies from losing their "id" on a hotplug event. 2019-03-29 09:04:16 -05:00
Jordan Woyak
c389d68186 ControllerInterface/DolphinQt: Make mapping "all devices" way less hacky. 2019-03-03 18:39:02 -06:00
Jordan Woyak
48b69ca018 ControllerInterface: Input detection improvements. 2019-03-03 18:36:16 -06:00
Jordan Woyak
52aa39991c ControllerInterface: evdev: Cleanup rumble effect processing so effects aren't removed and re-uploaded with every SetState() call. Split the "LeftRight" output into separate "Strong" and "Weak" outputs. Other minor cleanups. 2019-01-17 12:10:50 -06:00
spycrab
40bb9974f2 Reformat all the things! 2018-04-12 21:28:39 +02:00
Leo Lam
4733bbd8f3
Merge pull request #6166 from ligfx/invokedeviceschangedcallbacks
ControllerInterface: cleanup callbacks API and logic
2017-12-15 21:05:17 +01:00
Michael M
6b7d5bb80c DeviceQualifier: small cleanup 2017-11-19 12:46:39 -08:00
Michael Maltese
c62d83a34b GCPadEmu: only connected if default device connected
This lets Dolphin know if a configured GameCube Controller should actually
be treated as connected or not.

Talked to @JMC47 a bit about this last night. My use-case is that all of
my controllers are the same hardware (Xbox One controllers) so share the
same configuration (modulo device number). Treating them all as always
connected isn't a problem for most games, but in some (Smash Bros.) it
forces me to go find a keyboard/mouse and unconfigure any controllers
that I don't actually have connected. Hotplugging devices (works on macOS,
at least) + this patch remove my need to ever touch the Controller Config
dialog while in a game.

This patch makes the following changes:

- A new `BooleanSetting` in `GCPadEmu` called "Always Connected", which
  defaults to false.
- `ControllerEmu` tracks whether the default device is connected on every
  call to `UpdateReferences()`.
- `GCPadEmu.GetStatus()` now sets err bit to `PAD_ERR_NO_CONTROLLER` if
  the default device isn't connected.
- `SIDevice_GCController` handles `PAD_ERR_NO_CONTROLLER` by imitating the
  behaviour of `SIDevice_Null` (as far as I can tell, this is the only use
  of the error bit from `GCPadStatus`).

I wanted to add an OSD message akin to the ones when Wiimotes get
connected/disconnected, but I haven't yet found where to put the logic.
2017-11-19 16:07:00 +01: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
Lioncash
5862d1fc41 Device: Provide operator!= counterparts to operator== for DeviceQualifier
Makes comparison logic symmetric
2017-06-03 19:34:35 -04: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
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
Léo Lam
788e19f54d ControllerInterface: Make the ID assigning code common
This makes the device ID assigning code common to all backends, by
moving it to AddDevice() instead of copy-pasting or replicating
the logic in the backends.

Also, to prepare for hotplugging, instead of relying on a name usage
count, the new ID assigning system always starts from ID 0 and tries
to assign the first ID that is not used.
2016-07-14 10:50:53 +02:00
Christian Widmer
be922730b3 ControllerInterface: Include memory to fix building without pch
All affected files use shared_ptr but do not include memory which breaks
building without precompiled headers.
2016-06-26 05:42:29 +02:00
Léo Lam
8678133e87 ControllerInterface: Switch to std::shared_ptr
Small cleanup by using std::shared_ptr and getting rid of
ciface.Devices() which just returned the m_devices (which defeats the
point of making m_devices protected).

Incidentally, this should make the code safer when we have
different threads accessing devices in the future (for hotplug?).

A lot of code use Device references directly so there is
no easy way to remove FindDevice() and make those unique_ptrs.
2016-06-25 21:46:39 +02:00
Léo Lam
d3e2ae35ff ControllerInterface: Add synchronisation
Since we may have to add/access devices from different threads, this
adds synchronisation to anything that touches m_devices.
2016-06-25 13:46:53 +02:00
Pierre Bourdon
3570c7f03a Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
Lioncash
633be0387d General: Remove unimplemented function prototypes 2015-09-05 22:01:07 -04:00
Tillmann Karras
cefcb0ace9 Update license headers to GPLv2+ 2015-05-25 13:22:31 +02:00
Jasper St. Pierre
f3b739341e HW: Remove UpdateOutput
All of the rumble interfaces are now immediate mode.
2014-11-28 10:54:04 -08:00
Jasper St. Pierre
f2787f620e ControllerInterface: Make UpdateInput / UpdateOutput return void
The return values here have never been checked, so it doesn't make sense
to return a value to begin with.
2014-11-28 10:50:45 -08:00
Jasper St. Pierre
61fcfc4bf2 ControllerInterface: Remove unused ClearInputState 2014-11-28 10:50:45 -08:00
Jasper St. Pierre
367a42dcfd ControllerInterface: Implement dummy UpdateInput / UpdateOutputs
Make the implementation here a bit easier.
2014-11-28 10:50:45 -08:00
Rohit Nirmal
fbc64984ca Include CommonTypes.h instead of Common.h. 2014-09-08 15:39:58 -04:00
Rachel Bryk
5adbc83453 Change ControlState typedef to double, and change all related floats/doubles to use it.
Fixes an off by 1 issue related to double->float->double conversion, and eliminates numerous warnings.
2014-09-03 03:08:09 -04:00
Jasper St. Pierre
74f3083381 ControllerInterface: Gate the input based on our new background input setting 2014-07-11 13:38:52 -04:00
Tillmann Karras
d802d39281 clang-modernize -use-nullptr
and s/\bNULL\b/nullptr/g for *.cpp/h/mm files not compiled on my machine
2014-03-09 21:14:26 +01:00
Tillmann Karras
f28116b7da clang-modernize -add-override 2014-03-09 21:12:01 +01:00
Lioncash
2afe215271 Convert all includes to relative paths. 2014-02-18 02:19:10 -05:00
lioncash
d2038049f5 Replace all include guard ifdefs with "#pragma once" 2014-02-10 18:07:16 -05:00
Lioncash
d91a5abba1 Light cleanup to a little bit of InputCommon. Replaces much of the iterators that litter this section of the codebase.
Also clean up a little bit of the comments that describe the interface classes.
2014-01-30 19:51:21 -05:00
Jasper St. Pierre
34692ab826 Remove unnecessary Src/ folders 2013-12-31 14:03:19 -05:00
Renamed from Source/Core/InputCommon/Src/ControllerInterface/Device.h (Browse further)