Commit Graph

35 Commits

Author SHA1 Message Date
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 7accd9825f InputCommon: Remove racy UpdateInput call in DetectInput. 2020-02-24 16:25:06 -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
Lioncash e8edc49bbe InputCommon: Make use of fmt where applicable
Continues the migration over to fmt
2019-11-22 14:38:26 -05:00
Lioncash ec60027f56 InputCommon: Use nested namespace specifiers where applicable 2019-06-17 16:51:41 -04: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 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
spycrab 7eaece8814 InputCommon/Device.cpp: Add missing include 2019-05-08 21:02:26 +02: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
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
Mat M cf50ed82bb Merge pull request #3943 from ShadowsFriend/nopch-fix
ControllerInterface: Include memory to fix building without pch
2016-06-26 02:13:47 -04:00
Lioncash 55916b963d Device: Use std::tie for DeviceQualifier's operator== 2016-06-25 23:45:37 -04: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
Pierre Bourdon 3570c7f03a Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
Tillmann Karras cefcb0ace9 Update license headers to GPLv2+ 2015-05-25 13:22:31 +02:00
Jasper St. Pierre 61fcfc4bf2 ControllerInterface: Remove unused ClearInputState 2014-11-28 10:50:45 -08:00
Jasper St. Pierre 44307c9508 Host: Add a new "UIHasFocus" hook to determine if the UI has focus
We can't use RendererHasFocus for this purpose because of some issues
with exclusive fullscreen, and the new RendererHasFocus implementation
didn't work for non-Render to Main Window cases, since the renderer
window wasn't managed by wx.
2014-07-16 10:27:21 -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
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