summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp
AgeCommit message (Collapse)Author
2021-11-20ControllerInterface: fix UpdateReferences() deadlockFiloppi
Removed useless locks to DeviceContainer::m_devices_mutex, as they were all already protected by m_devices_population_mutex. We have no interest in blocking other threads that were potentially reading devices at the same time so this seems fine. This simplifies the code, and I've adjusted a few comments which mentioned possible deadlock that should now be totally gone. The deadlock could have happen if a thread directly called EmulatedController::UpdateReferences(), while another another thread also reached EmulatedController::UpdateReferences() within a call to ControllerInterface::UpdateDevices(), as the mentioned function locked both the DeviceContainer::m_devices_mutex and s_get_state_mutex at the same time. The deadlock was frequent on game emulation startup on Android, due to the UpdateReferences() call in InputConfig::LoadConfig() and the UI thread triggering calls to ControllerInterface::UpdateDevices(). It could also have happened on Desktop if a user pressed "Refresh Devices" manually in the UI while the input config was loading. Also brought some UpdateReferences() comments and thread safety fixes from https://github.com/dolphin-emu/dolphin/pull/9489
2021-07-05treewide: convert GPLv2+ license info to SPDX tagsPierre Bourdon
SPDX standardizes how source code conveys its copyright and licensing information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX tags are adopted in many large projects, including things like the Linux kernel.
2021-05-24Expose Control Expression variables to mappings UIFiloppi
-add a way to reset their value (from the mappings UI) -fix "memory leak" where they would never be cleaned, one would be created every time you wrote a character after a "$" -fix ability to create variables with an empty string by just writing "$" (+added error for it) -Add $ operator to the UI operators list, to expose this functionality even more
2021-02-27InputCommon: reduce number of image loads and texture cache invalidations by ↵iwubcode
only running dynamic input textures once for all controllers
2020-10-03InputCommon: Introducing the "Dynamic Input Texture". Configuration links ↵iwubcode
an emulated input action to an image based on what host key is defined for that emulated input. Specific regions are called out in configuration that mark where to replace an input button with a host key image.
2020-02-08InputCommon: Allow Wii remote extension to be set with an input expression.Jordan Woyak
2020-02-08InputCommon: Allow controller settings specified with input expresions.Jordan Woyak
2019-10-11ControllerEmu: Don't clear expression variables on references update. ↵Jordan Woyak
Hotplug would make that problematic.
2019-10-11ExpressionParser: Clear expression variables on UpdateReferences call. I ↵Jordan Woyak
don't know if this is most sensible.
2019-10-11ExpressionParser: Renamed ControlFinder to ControlEnvironment. Added support ↵Jordan Woyak
for variables and assignment operator. ControlExpression objects now reference a matching input and output so the two can me mixed in any expression. (you can set rumble directly from inputs)
2019-05-01WiimoteEmu/DolphinQt: Better extension display names.Jordan Woyak
2019-02-02WiimoteEmu: Major renaming and cleanup.Jordan Woyak
2017-11-19GCPadEmu: only connected if default device connectedMichael Maltese
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-04EmulatedController: encapsulate default device behind getters/settersMichael M
2017-04-04ControllerEmu: Replace includes with forward declarationsLioncash
Replaces includes with forward declarations where applicable, and moves includes to where they're actually needed.
2017-02-25ControlGroup: Convert group type enum into an enum classLioncash
Gets some constants out of the ControllerEmu namespace, and modifies ControlGroup so that it uses the enum type itself to represent the underlying type, rather than a u32 value.
2017-02-11ControllerEmu: Add const to UpdateReferences() first reference parameterLioncash
None of these parameters are modified.
2017-02-09ControllerEmu: Separate ControlGroup from ControllerEmuLioncash
ControllerEmu, the class, is essentially acting like a namespace for ControlGroup. This makes it impossible to forward declare any of the internals. It also globs a bunch of classes together which is kind of a pain to manage. This splits ControlGroup and the classes it contains into their own source files and situates them all within a namespace, which gets them out of global scope. Since this allows forward declarations for the once-internal classes, it now requires significantly less files to be rebuilt if anything is changed in the ControllerEmu portion of code. It does not split out the settings classes yet, however, as it would be preferable to make a settings base class that all settings derive from, but this would be a functional change -- this commit only intends to move around existing code. Extracting the settings class will be done in another commit.
2017-02-08ControllerEmu: Fix incorrect default radius being set in AnalogStickLioncash
The three parameter AnalogStick constructor takes an internal name, a display name, and a default radius argument. The delegated constructor is the one that calls the ControlGroup constructor, setting the group type, so passing the group type here is a logic bug. The only reason this appeared to work despite this bug is because GROUP_TYPE_STICK has a value of 1, and the default radius value used for attachment sticks is 1.0.
2017-02-07InputCommon: Extract ControlReference from ControllerInterfaceMichael Maltese
Better separation of concerns. Relegates `ControllerInterface` to enumerating input controls, and the new `ControlReference` deals with combining inputs and configuration expression parsing.
2017-02-07ControllerEmu: Move into its own directoryLioncash
ControllerEmu is a massive class with a lot of nested public classes. The only reason these are nested is because the outer class acts as a namespace. There's no reason to keep these classes nested just for that. Keeping these classes nested makes it impossible to forward declare them, which leads to quite a few includes in other headers, making compilation take longer. This moves the source files to their own directory so classes can be separated as necessary to their own source files, and be namespaced under the ControllerEmu namespace.