Commit Graph

1130 Commits

Author SHA1 Message Date
Lioncash 10fea99d80 InputCommon/FunctionExpression: Make MakeFunctionExpression() take a std::string_view
There's nothing within this function that requires a copy of the string
to be made, so we can make use of a non-owning view
2019-11-22 15:36:18 -05:00
Lioncash ddf8abf507 InputCommon/FunctionExpression: Remove unused LOOP_MAX_REPS constant
This isn't used anywhere in the translation unit, so we can remove it.
2019-11-22 15:36:18 -05:00
Lioncash 64bc6f53fd InputCommon/FunctionExpression: Remove cyclical include
This header was including itself, which is likely not intended.
2019-11-22 15:36:18 -05:00
Lioncash cb8fbe872e InputCommon/FunctionExpression: Collapse namespaces
Since we target C++17, we can collapse the namespaces into a single
declaration specifier.
2019-11-22 15:36:14 -05:00
Lioncash 6586ecc7a8 InputCommon/FunctionExpression: include <algorithm>
std::min/std::max are used within this translation unit, so it needs to
be included to prevent potential compilation failures.
2019-11-22 14:41:13 -05:00
Lioncash e8edc49bbe InputCommon: Make use of fmt where applicable
Continues the migration over to fmt
2019-11-22 14:38:26 -05:00
JosJuice c8b8a60033 Android: Let WiimoteEmu know whether we have accelerometer/gyroscope 2019-11-20 20:13:36 +01:00
JosJuice b143df91be Android: Native motion controls 2019-11-20 18:22:20 +01:00
JosJuice fe39e1e6d8
Merge pull request #8440 from rlnilsen/motion-input-tweaks
Motion Input enhancements
2019-11-15 14:08:45 +01:00
Connor McLaughlin 913cb08066
Merge pull request #8456 from jordan-woyak/input-gate-race-fix
InputCommon: Make the "input gate" not racy.
2019-11-11 10:59:49 +10:00
Jordan Woyak 0c57887839 evdev: fix bad integer division. 2019-11-10 10:10:37 -06:00
Jordan Woyak 1180c231a6 InputCommon: Detect when evdev exposes acceleration/gyroscope data. 2019-11-09 13:34:29 -06:00
Jordan Woyak 85ceb37ccd InputCommon: Make the "input gate" not racey. 2019-11-06 16:31:02 -06:00
rlnilsen f7a50545e3 Motion Input: Add "enable" checkbox for motion controlled cursor. 2019-11-03 11:56:01 +01:00
rlnilsen d67a2304b0 Input: Add optional "enable" setting to the ControlGroup class.
The setting is exposed as a check box in the QGroupBox instance that visualises the ControlGroup instance.
The setting is saved under "[control group name]/Enabled", but only when it is "false". The default value is "true".
2019-11-03 11:55:52 +01:00
Mat M fd4bf5f0a2
Merge pull request #8438 from JosJuice/tilt-tooltip-string
Change Wii Remote tilt tooltip string based on translator feedback
2019-10-30 05:39:13 -04:00
Pierre Bourdon 1f3d1a9b7f
Merge pull request #8352 from rlnilsen/motion-controller-support-via-cemuhook-protocol
Support for motion controllers like the DualShock 4
2019-10-28 16:39:10 +01:00
JosJuice f4da08eb13 Change Wii Remote tilt tooltip string based on translator feedback 2019-10-28 11:16:55 +01:00
rlnilsen da1f153b47 Rename all instances of "CemuhookUDPServer"/"UDPServer" to "DualShockUDPClient"/"DSUClient". 2019-10-27 16:05:22 +01:00
rlnilsen 5ff79499a5 UDPServer: Add configuration UI.
Accessed through button "Alternate Input Sources" in the "Controller Settings" dialog.
2019-10-26 02:20:18 +02:00
rlnilsen 4cb3baba5c Add support for motion controllers via the CemuHook controller input protocol.
This is done by:
1) Implementing said protocol in a new controller input class CemuHookUDPServer.
2) Adding functionality in the WiimoteEmu class for pushing that motion input to the emulated Wiimote and MotionPlus.
3) Suitably modifying the UI for configuring an Emulated Wii Remote.
2019-10-26 02:19:53 +02:00
JosJuice c6b4438c62 InputCommon: Change "EOF" to "end of expression" in user facing string
This is hopefully clearer, since we're not dealing with a file.
2019-10-25 23:49:20 +02:00
Jordan Woyak 1fe44238b1 ExpressionParser: Add XOR operator. 2019-10-20 09:51:52 -05:00
JMC47 8bc0a92f2c
Merge pull request #7663 from jordan-woyak/expression-parser-improve
Expression parser improvements
2019-10-17 17:35:30 -04:00
Anthony a21b7b1bdd
Merge pull request #8390 from jordan-woyak/wiimote-emu-tilt-fix
WiimoteEmu: Tilt fixes.
2019-10-16 16:14:42 -07:00
Jordan Woyak b120b08726 ControllerEmu: Clamp results of trigger/slider states to prevent integer overflow later on. 2019-10-15 15:35:07 -05:00
Jordan Woyak 7295458c11 ExpressionParser: Make Lexer ctor explicit and move argument. 2019-10-12 12:28:19 -05:00
Jordan Woyak 72302d9c42 ExpressionParser: Add support for /* */ style comments. 2019-10-12 11:41:02 -05:00
Jordan Woyak b4e2b3cae3 ControllerEmu: Don't clear expression variables on references update. Hotplug would make that problematic. 2019-10-11 19:42:49 -05:00
Jordan Woyak 4d41bd64c8 ExpressionParser: Show error message with expected arguments. 2019-10-11 19:38:18 -05:00
Jordan Woyak b57178d246 ExpressionParser: Remove ! character from function syntax. Remove unused serialization functions. 2019-10-11 18:12:18 -05:00
Jordan Woyak 7912dc57dd ExpressionParser: Remove !while and add optional 2nd argument to !smooth. 2019-10-11 18:12:18 -05:00
Jordan Woyak ca7ce67450 ExpressionParser/DolphinQt: Added parse results to UI. 2019-10-11 18:12:18 -05:00
Jordan Woyak c8b2188e19 DolphinQT: Add syntax highlighting from tokenizer data. 2019-10-11 18:12:18 -05:00
Jordan Woyak 5cb1248612 ExpressionParser: Clean up some redundant using-declarations and wrong comments. 2019-10-11 18:12:18 -05:00
Jordan Woyak fae8b15db1 ExpressionParser: Add !pulse function that evaluates to 1.0 for N seconds for each press. 2019-10-11 18:12:18 -05:00
Jordan Woyak b5b43f8342 ExpressionParser: Add relative input function. 2019-10-11 18:12:18 -05:00
Jordan Woyak 08b291b0f9 ExpressionParser: Fix timer function with negative values. 2019-10-11 18:12:18 -05:00
Jordan Woyak 18b5120441 ExpressionParser: Add !tap function which activates after X (defaults to 2) taps within Y seconds. 2019-10-11 18:12:17 -05:00
Jordan Woyak f2e499d587 ExpressionParser: Add !hold function that activates after input is held for N seconds. 2019-10-11 18:12:17 -05:00
Jordan Woyak 9e536382c4 ExpressionParser: Add function to smooth inputs. 2019-10-11 18:12:17 -05:00
Jordan Woyak bbd6b1848f ExpressionParser: Add deadzone function. 2019-10-11 18:12:17 -05:00
Jordan Woyak 6a2096c419 ExpressionParser: Add optional 2nd argument to toggle function which clears state. 2019-10-11 18:12:17 -05:00
Jordan Woyak fd07ae8cec ExpressionParser: Move FunctionExpression type definitions into another file. 2019-10-11 18:12:16 -05:00
Jordan Woyak d4f9b8c4ef ExpressionParser: Allow unary functions to be used without parens around the argument. e.g. !`Up` 2019-10-11 17:31:09 -05:00
Jordan Woyak 2a377e35ed ExpressionParser: Make function names case sensitive. 2019-10-11 17:31:09 -05:00
Jordan Woyak 2b0297489f ExpressionParser: Rename some functions and return a syntax error on trailing tokens. 2019-10-11 17:31:09 -05:00
Jordan Woyak 258832b1e8 ExpressionParser: Change function argument syntax to something more c++-like. 2019-10-11 17:31:09 -05:00
Jordan Woyak ccac3f1e49 ExpressionParser: Fix negative literals and support unary minus operator. 2019-10-11 17:31:07 -05:00
Jordan Woyak 7cf903a209 ExpressionParser: Suppport N-ary functions. Arguments are read LISP style. N atoms are read after the function name. Added "if" function and made the "while" function more sensible with an arity of 2. Removed the ugly binary conditional operator. 2019-10-11 17:16:05 -05:00
Jordan Woyak 4dd078568b ExpressionParser: Replace the timer literal with a timer function that increases from 0.0 to 1.0 and resets after N seconds. e.g. (!timer 2.0) is a 2 second timer. Fixed parsing of unary expressions so things like (! ! 1.0) work. 2019-10-11 17:14:45 -05:00
Jordan Woyak 785eb14432 ExpressionParser: Clean up string lexing and support numeric literals without tick delimiter: e.g. 0.75 2019-10-11 17:14:45 -05:00
Jordan Woyak fa75ab404f ExpressionParser: operator precedence. 2019-10-11 17:14:45 -05:00
Jordan Woyak 46c0ae7d1f ExpressionParser: Add !while loop unary expression. Limited to 10000 reps to prevent infinite loops. Rhs is re-evaluated until it is < 0.5. Added comma operator, which behaves like it does in c++. Added subration operator. 2019-10-11 17:14:45 -05:00
Jordan Woyak 2c89b60298 ExpressionParser: cleanup. 2019-10-11 17:14:45 -05:00
Jordan Woyak 58efc93ed4 ExpressionParser: Conditional operator. A binary op that evals the rhs if lhs > 0.5 else 0.0. 2019-10-11 17:14:45 -05:00
Jordan Woyak 718efce1dc ExpressionParser: Add less-than and greater-than operators. 2019-10-11 17:14:45 -05:00
Jordan Woyak 35e51ebbaa ExpressionParser: Clear expression variables on UpdateReferences call. I don't know if this is most sensible. 2019-10-11 17:14:45 -05:00
Jordan Woyak e896835f86 ExpressionParser: Renamed ControlFinder to ControlEnvironment. Added support 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-10-11 17:14:32 -05:00
Jordan Woyak 1efcf861ea ExpressionParser: Add mod operator, sin function, and timer "constant" which can be used for auto-fire and oscillators. 2019-10-11 17:13:58 -05:00
Jordan Woyak a8f3e9585f ExpressionParser: Expand ! symbol to allow for named unary functions. Added !toggle function which toggles on/off with each activation of its inner expression. 2019-10-11 17:13:58 -05:00
Jordan Woyak bf63f85d73 ExpressionParser: Add multiplication and division operators. (division by zero evaluates as zero). Don't clamp result of addition operator. Clamping will be done later. 2019-10-11 17:13:58 -05:00
Jordan Woyak f3192ca06d ExpressionParser: Add support for literals. 2019-10-11 17:13:58 -05:00
Jordan Woyak 673f13b7ac WiimoteEmu: Change default tilt angle to 85 degrees. 2019-10-06 09:56:41 -05:00
Jordan Woyak 260cefd60b WiimoteEmu: Expose maximum tilt acceleration. 2019-10-06 09:56:39 -05:00
Connor McLaughlin 428ae5a43d
Merge pull request #8172 from nokturnusmf/relative-input-hold
Added (held) key for relative input
2019-08-10 00:37:53 +10:00
Connor McLaughlin 48ca2c6f2e
Merge pull request #8233 from JosJuice/stringutil-string-view
StringUtil: Use std::string_view more
2019-08-09 23:39:01 +10:00
Lioncash 37d643c7d3 InputCommon/DInputJoystick: Correct force-feedback flag testing
Introduced in a995e2f5ba

We need to be performing a bitwise AND on the flags and not a logical
AND, otherwise we could end up counting device objects that don't
support forced feedback.
2019-08-02 10:26:44 -04:00
JosJuice a2a1e04fc9 StringUtil: Use std::string_view more 2019-07-23 14:49:12 +02:00
Léo Lam cf60a9a7f7 Use separate libusb contexts to avoid thread safety issues
Unfortunately, it appears that using libusb's synchronous transfer API
from several threads causes nasty race conditions in event handling and
can lead to deadlocks, despite the fact that libusb's synchronous API
is documented to be perfectly fine to use from several threads (only
the manual polling functionality is supposed to require special
precautions).

Since usbdk was the only real reason for using a single libusb context
and since usbdk (currently) has so many issues with Dolphin, I think
dropping support for it in order to fix other backends is acceptable.
2019-06-26 17:55:51 +02:00
Lioncash ec60027f56 InputCommon: Use nested namespace specifiers where applicable 2019-06-17 16:51:41 -04:00
Matthew Foulds c62570c527 Added key for relative input 2019-06-10 13:23:16 +01:00
Connor McLaughlin bed2d66bed
Merge pull request #8117 from weihuoya/threaded_env
android: get java env from thread local storage
2019-06-08 20:42:15 +10:00
Lioncash c0c0e412e0 Core/ConfigManager: Use forward declarations where applicable
Avoids dragging in IniFile, EXI device and SI device headers in this header which is
quite widely used throughout the codebase.

This also uncovered a few cases where indirect inclusions were being
relied upon, which this also fixes.
2019-06-07 19:54:39 -04:00
Lioncash 24f5acf9a5 InputCommon/CMakeLists: Specify headers in target sources 2019-05-31 06:54:25 -04:00
Léo Lam 00ecfb3c59
Merge pull request #8138 from lioncash/input-string
ControllerInterface/Device: Minor cleanup
2019-05-30 14:33:53 +02: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
Vincent Duvert 2c3c8bbb90 GCAdapter: Update Android-specific source
Fix the Android version of GCAdapter.cpp so it matches the new definitions in GCAdapter.h.
2019-05-29 18:28:24 +02:00
Vincent Duvert 9e7d4d2abb GCAdapter: Handle dynamic status updates for non-hotplug libusb
Detect when the setup function found no adapter, or found one but could
not connect to it, and report the new status in that case.
2019-05-29 18:28:24 +02:00
Vincent Duvert 2ac1ca133f GCPadWiiUConfigDialog: Update the adapter state dynamically
Update the GC adapter config GUI if the adapter is plugged or unplugged.
2019-05-29 18:28:24 +02:00
Vincent Duvert b08e2ec959 GCAdapter: Report libusb open errors to the user
If opening the adapter fails, report the libusb error message in the GUI
instead of “No Adapter Detected”.

The error condition is removed when the adapter is unplugged.
2019-05-29 18:28:24 +02:00
Vincent Duvert 0165e5e703 GCAdapter: Close libusb handle if an open error occurs
The handle was previously kept open, which was causing future adapter
plug/unplug events to be ignored.
2019-05-29 18:28:24 +02:00
weihuoya 0dec8feadb android: thread local env 2019-05-29 20:22:26 +08:00
Léo Lam 256c9375c9 Move libusb utilities to LibusbUtils
* Simplifies libusb context usage and allows us to set options for
all contexts easily. Notably, this lets us enable usbdk support
in libusb, which is now opt-in in the latest version.

* Moves the libusb config descriptor wrapper class to LibusbUtils too
since that could easily be reused.

* Moves device listing to LibusbUtils too and add a lock around it
as some libusb backends are not thread safe.

* Consequences: only a single context and a single event handling
thread is used now, which is more efficient.
2019-05-27 20:09:55 +02:00
Léo Lam e2c769a9c5
Merge pull request #7992 from artemist/centering
ControllerEmu: Add support for setting the center of a ReshapableInput
2019-05-20 18:29:31 +02:00
Artemis Tosini 49e46c8aff
ControllerEmu: Add support for setting the center of a ReshapableInput
This is useful in far out-of-calibration controllers, such as the
Switch Pro controller. This also adds support for configuring the center
in the Mapping widget.
2019-05-18 14:45:16 +00:00
spycrab ec734065db
Merge pull request #8087 from spycrab/cmake_win2019
Support CMake on Windows
2019-05-14 21:07:26 +02:00
Jordan Woyak 374585f128 WiimoteEmu/DolphinQt: Rename "IR" to "Point" and eliminate redundant Forward/Backward mappings. 2019-05-08 20:27:41 -05:00
spycrab 12a26453e9 InputCommon/ControlGroup.h: Add missing include 2019-05-08 21:03:11 +02:00
spycrab 7eaece8814 InputCommon/Device.cpp: Add missing include 2019-05-08 21:02:26 +02:00
spycrab 98d808ab71 InputCommon/DInput.h: Add missing include 2019-05-08 21:01:46 +02:00
Techjar ff972e3673 Reformat repo to clang-format 7.0 rules 2019-05-06 18:48:04 +00:00
Léo Lam ab9ece9bca Replace MathUtil::Clamp with std::clamp 2019-05-04 23:12:17 +02:00
Jordan Woyak 99f537d499 WiimoteEmu/DolphinQt: Better extension display names. 2019-05-01 17:25:48 -05:00
Jordan Woyak 57a23cc4a0 InputCommon: Remove unused "sign" macro. 2019-04-29 18:28:56 -05:00
Jordan Woyak 9f0dc402f4 InputCommon: Make sure setting values are initialized in case they are used before config load. 2019-04-27 07:01:24 -05:00
Jordan Woyak ba1b335118 WiimoteEmu: Improve emulated swing. 2019-04-23 19:02:41 -05:00
Jordan Woyak 4374600367 WiimoteEmu: Implement MotionPlus parameter y0 and other cleanups. 2019-04-23 18:38:00 -05:00
Jordan Woyak 8c1310d1d1 ControllerInterface/DInput: Optimize cursor position updating. 2019-04-20 09:25:11 -05:00
JMC47 80d21b8ffb
Merge pull request #8002 from JMC47/CursorSlowdown
Slow down relative input cursor
2019-04-15 20:43:31 -04:00
JMC47 f3aaf5deaa Reduce Relative Input Cursor Speed Dramatically
This makes it about 1/4th the speed which may be a bit slow, but should
work for most controllers.
2019-04-15 17:23:17 -04:00
JMC47 1cedbd5b82
Merge pull request #7923 from jordan-woyak/full-surface-rename
ControllerInterface: Rename full surface analog inputs.
2019-04-13 17:43:29 -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 c89ddf8cba WiimoteEmu: Allow shake frequency and intensity to be configured. Other minor cleanups. 2019-04-12 16:50:59 -05:00
Jordan Woyak 5efb717873 InputCommon: Clean up how numeric settings are handled. Add units of measure to UI. Eliminate hidden magic values of the IR cursor. 2019-04-07 09:32:49 -05:00
JMC47 75e74315e6
Merge pull request #7689 from jordan-woyak/sdl-improve
ControllerInterface: SDL cleanups/fixes
2019-04-06 14:53:51 -04:00
Jordan Woyak 2b6d718636 InputCommon: Fix Win32 init race. 2019-03-31 07:46:58 -05:00
JMC47 735a705e4d
Merge pull request #7776 from jordan-woyak/wm_devicechange
Add hotplug support to DInput and XInput controller backends
2019-03-30 18:41:46 -04:00
Jordan Woyak eadbdd6bc3 ControllerInterface/Win32: Prevent devcies from losing their "id" on a hotplug event. 2019-03-29 09:04:16 -05:00
Michael M d26c1ce24d Add hotplug support to DInput and XInput controller backends 2019-03-29 08:01:40 -05:00
Michael M 92ca6e124e Add ControllerInterface::Win32 to wrap XInput and DInput 2019-03-29 08:01:39 -05:00
Jordan Woyak a015851b02 HW/SI: GCAdapter calibration fix. 2019-03-29 06:15:58 -05:00
spycrab c89139d75d
Merge pull request #7903 from spycrab/imgui_np_chat
Add imgui-based Netplay Chat
2019-03-23 21:11:33 +01:00
spycrab 672b582bec
Merge pull request #7918 from spycrab/iokit_refactor
InputCommon/OSX: Refactor IOKit controller interface
2019-03-22 21:18:27 +01:00
spycrab 80fd01c3c3 InputCommon/OSX: Refactor IOKit controller interface 2019-03-22 14:04:30 +01:00
Tilka 0a1aacb5d0
Merge pull request #7906 from jordan-woyak/leak-fix
DolphinQt/InputCommon: Fix a few memory leaks.
2019-03-21 23:26:54 +00:00
spycrab 61350b3d98 Core/Host: Allow frontends to block inputs 2019-03-21 13:16:21 +01:00
Jordan Woyak b53636827b ControllerInterface: Unbreak DirectInput POV Hats having bad values on init. 2019-03-19 16:05:49 -05:00
Jordan Woyak 725d34b2f0 DolphinQt/InputCommon: Fix a few memory leaks. 2019-03-17 18:31:41 -05:00
Jordan Woyak 0bdfa19650 ControllerInterface: SDL: Replace unclear bool parameter with enum class. 2019-03-17 08:53:53 -05:00
Jordan Woyak 4fb68c530b ControllerInterface: SDL cleanup and FF effect fixes. 2019-03-17 08:53:13 -05:00
JMC47 011ecd92e8
Merge pull request #7829 from jordan-woyak/detect-input-improve
ControllerInterface/DolphinQt: Improve input detection.
2019-03-13 19:00:24 -04:00
Tilka a865cc0bf6
Merge pull request #7806 from jordan-woyak/wiimote-emu-swing-improve
WiimoteEmu: Reimplement tilt/swing/camera/orientation data using matrix math.
2019-03-05 23:37:00 +00: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 4db4840d7c WiimoteEmu: Reimplement tilt/swing/camera/orientation data using matrix math. 2019-03-03 12:43:25 -06:00
Jordan Woyak ecb67cf815 ControllerEmu: Deadzone math fix. 2019-03-01 17:40:10 -06:00
Tilka 131f4931fb
Merge pull request #7792 from jordan-woyak/auto-calibration
DolphinQt/ControllerEmu: Add stick calibration "wizard".
2019-02-13 02:13:27 +00:00
Tilka 8d59d1bb11
Merge pull request #7798 from ShFil119/impr/empty
Use empty instead of size
2019-02-13 01:59:43 +00:00
Filip Gawin 49fe9f5db1 Use empty instead of size 2019-02-13 00:03:49 +01:00
Jordan Woyak 0064f70c8a DolphinQt/ControllerEmu: Replace Input Radius/Shape settings with an input calibration "wizard". 2019-02-10 07:55:47 -06:00
Anthony e9130734af
Merge pull request #7688 from jordan-woyak/evdev-improve
ControllerInterface: evdev: Cleanups and effect processing fixes.
2019-02-03 10:25:23 -08:00
Jordan Woyak 9c1a8891e5 WiimoteEmu: Code cleanups. 2019-02-02 19:40:31 -06:00
Jordan Woyak 0d1fbe7bbc WiimoteEmu: Major renaming and cleanup. 2019-02-02 19:40:31 -06:00
Jordan Woyak 3bc4968c11 ControllerEmu: Round input floats instead of casting to prevent almost-neutral values from being rounded down. 2019-02-02 15:12:07 -06:00
zackhow 4979220cf0 Android: Optimize rumble call
Moved rumble call to IDCache since GetMethodID is expensive
2019-01-26 09:38:35 -05:00
zackhow d0b42286cf Load custom game IR values if they are not set
This is mostly for android so that a user can use the touchscreen to
accurately emulate pointer movements
2019-01-23 17:16:32 -05:00
zackhow 47d6406fd4 Android: Add touch to move pointer in overlay 2019-01-19 23:21:33 -05:00
Jordan Woyak 6cc8775510 ControllerInterface: evdev: Replace unclear bool parameter with enum class. 2019-01-17 12:10:50 -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
Léo Lam e19ee2ad4f
Merge pull request #7664 from jordan-woyak/kill-button-threshold
ControllerEmu: Killed the button group threshold setting.
2019-01-16 21:33:05 +01:00
Léo Lam a8bc6f9899
Merge pull request #7693 from jordan-woyak/hotplug-callback-fix
ControllerInterface: Hotplug callback fixes.
2019-01-16 21:00:48 +01:00
Léo Lam b2de98cad1
Merge pull request #7680 from jordan-woyak/dinput-axis-range
DirectInput: Use more than 8 bits of precision on axis inputs.
2019-01-16 18:52:11 +01:00
Emmanuel Gil Peyrot fb6fae2b2b Flatten GCAdapter function
Make CheckDeviceAccess() more flat by inverting checks, reducing
indentation and removing dead code.
2019-01-16 14:20:00 +01:00
Jordan Woyak b425f86121 ControllerInterface: Allow hotplug callbacks to be unregistered and don't reload the entire config from the ini file on hotplug, just update the control references. This should fix a crash on shutdown on Android. 2019-01-10 18:32:16 -06:00
JMC47 012338288e
Merge pull request #7662 from jordan-woyak/mapping-indicators-make-pretty
ControllerEmu: Make mapping indicators pretty
2019-01-10 19:04:27 -05:00
JosJuice d3e1d2ea00
Merge pull request #7666 from jordan-woyak/input-shutdown-fix
ControllerInterface: Shutdown order and race condition fix.
2019-01-08 14:39:47 +01:00
zackhow 02c649ba20 Android: Change all analoginputs to just inputs
Android doesn't report values for the inputs generated by FullAnalogInput so
there isn't a reason to add them as such. This also avoids a bug(for android)
where if there are three inputs(say 12, 11, and 121), and you generate a FullAnalogInput
with 12/11 then it will create another input with the name 121 which can cause conficts
with the real 121 input. This is probably not an issue on PC since most Axis inputs
are named and not numbered.
2019-01-07 21:52:39 -05:00
Jordan Woyak a7c45fb49e DirectInput: Use more than 8 bits of precision on axis inputs. 2019-01-06 08:14:37 -06:00
JMC47 0ca9accd8b
Merge pull request #7640 from jordan-woyak/input-fixes
ControllerInterface: Output/Rumble fixes
2019-01-05 17:16:35 -05:00
Jordan Woyak a995e2f5ba ControllerInterface: Set DInput FF effect parameters sanely. This fixes a crash with periodic effects and my GCPad adapter (probably a divide by zero behind the scenes). 2019-01-05 13:00:04 -06:00
Jordan Woyak 25d43ffd98 ControllerInterface: Shutdown order and race condition fix. 2019-01-02 08:19:42 -06:00
Jordan Woyak df43fd9472 ControllerEmu: Killed the Buttons group threshold setting. 2018-12-31 08:35:31 -06:00
Jordan Woyak 7efa96eda9 ControllerEmu: code cleanup. 2018-12-30 10:52:45 -06:00
Jordan Woyak 7a00f55cfa ControllerEmu::Cursor: Add input radius/shape settings to IR Cursor mappings to allow use of round inputs in absolute mode. Make relative input option obey the center/width/height settings. Make the mapping indicator pretty and actually show what the relative/center/w/h settings are doing. 2018-12-30 09:10:32 -06:00
Jordan Woyak 247fa8c628 WiimoteEmu: Remove redundant threshold setting from hotkeys button group. 2018-12-29 16:19:28 -06:00
Jordan Woyak c3dc3c106c ControllerEmu: Reorganize stick reshaping code and use it for emu wiimote tilt as well. Also make the tilt mapping indicator pretty. 2018-12-29 16:06:03 -06:00
Jordan Woyak 6a6195f53c ControllerEmu: Implement dead zone setting for triggers. 2018-12-29 13:56:35 -06:00
Jordan Woyak c614f5f534 ControllerEmu: Allow analog stick input radius greater than one. Useful for rounded-square inputs of xbox controllers. 2018-12-27 19:16:37 -06:00
Jordan Woyak da9bcf83ef InputCommon: Simplified StickGate interface and moved class into its own file. Changed default input radius to perform no resizing. Tweaked the indicator colors a bit to improve visibility. Cleaned up some math and code. 2018-12-27 18:31:46 -06:00
Jordan Woyak ceb28a2302 Add ability to reshape analog sticks from square/circle to octagon and make the analog stick mapping indicator pretty. 2018-12-27 18:31:46 -06:00
Jordan Woyak 0f19c4a40f ControllerInterface: DInput: Update force feedback effects in a thread. This should prevent slowdowns experienced by a handful of users. 2018-12-24 19:40:58 -06:00
Jordan Woyak d5df56c677 ControllerInterface: Make CoalesceExpression not set the inactive child's value (rumble) to 0. This caused rumble to not enable when a control expression was both a valid "bareword" and "complex" expression. 2018-12-22 11:17:05 -06:00
Stenzek 52828901ef Core: Switch controller interface to render widget on booting
Previously, the Qt frontend would initialize the controller
interface on starting, resulting in the cursor position being
relative to the main window, instead of the render window.
2018-10-29 11:46:06 +10:00
Stenzek a7f334dc2a ControllerInterface: Don't crash on non-X11 QPA 2018-10-29 11:46:06 +10:00
Tillmann Karras 97cc9894e4 Update to Visual Studio's default Windows SDK 2018-10-20 00:53:08 +01:00
Tillmann Karras 79051a28c4 evdev: simplify code
No need to check write access if we call open() right after which checks
that anyway. Also only get the device name once.
2018-10-08 19:51:29 +01:00
Markus Wick 85961f996e
Merge pull request #7400 from zackhow/phone-rumble
Android: Add rumble for phone
2018-09-21 17:05:46 +02:00
Léo Lam e90bd035cb
Merge pull request #7262 from lioncash/force
ControlGroup: Return state data via GetState() by value where applicable
2018-09-16 16:04:21 +02:00
JosJuice a4f950ee86 Fix a string not getting translated 2018-09-08 15:16:39 +02:00
zackhow 126ff8dc5f Android: Add rumble for phone
This currently only supports using the internal vibrate on a phone for rumble.
2018-09-07 08:54:03 -04:00
Techjar 311d0442de InputCommon/XInput2: Increase mouse buttons to 32
Xlib supports many mouse buttons, though there are 9 standard buttons, and they aren't arranged like other mouse APIs. Using only 5 buttons was preventing the use of buttons besides left/right/middle click and the scroll wheel. Here's what all the standard buttons are:
1. left button
2. middle button (pressing the scroll wheel)
3. right button
4. turn scroll wheel up
5. turn scroll wheel down
6. push scroll wheel left
7. push scroll wheel right
8. 4th button (aka browser backward button)
9. 5th button (aka browser forward button)

The remaining button indices are non-standard and device-specific, and technically far more than 32 are supported, but this seems like a reasonable limit to avoid cluttering the list with tons of useless mouse buttons. What mouse has more than 32 buttons anyways?
2018-08-27 08:47:32 -04:00
Lioncash cfe7549091 ControlGroup/Triggers: Return state data by value
Makes it less error-prone to get state data from analog sticks (no need
to pass any locals), and also allows direct assignment, letting the
retrieved data be const.
2018-07-13 13:20:35 -04:00
Lioncash 97ba02df27 ControlGroup/Tilt: Return state data by value
Makes it less error-prone to get state data from tilt controls (no need
to pass any pointers to locals), and also allows direct assignment,
letting the retrieved data be const.
2018-07-13 13:20:35 -04:00
Lioncash 918d448b5b ControlGroup/Slider: Return state data by value
Makes it less error-prone to get state data from sliders (no need
to pass any locals), and also allows direct assignment, letting the
retrieved data be const.
2018-07-13 13:20:35 -04:00
Lioncash 4c30b9e14d ControlGroup/Force: Return state data by value
Ensures that an array of sufficient size is always used and doesn't put
the responsibility on the caller. It also allows for direct assignment.
2018-07-13 13:20:35 -04:00
Lioncash ef1240b0c7 ControlGroup/Cursor: Return state data by value
Makes it less error-prone to get state data from cursors (no need
to pass any pointers to locals), and also allows direct assignment,
letting the retrieved data be const.
2018-07-13 13:20:35 -04:00
Lioncash d05f490caa ControlGroup/AnalogStick: Return state data by value
Makes it less error-prone to get state data from analog sticks (no need
to pass any locals), and also allows direct assignment, letting the
retrieved data be const.
2018-07-13 13:20:31 -04:00
iwubcode bce8041cce Input: Allow per-game configuration to specify directories for input-profiles. If specified, the directories are searched recursively for inis 2018-07-07 13:02:39 -05:00
iwubcode 3b11066e61 Fix lint bugs 2018-07-07 13:02:38 -05:00
iwubcode 83c94feb3d Input: Trim profile names to allow spaces between ','s 2018-07-07 12:55:52 -05:00
iwubcode e10abaed3e InputConfig: Show display message when game specific input profile is loaded; matching how cycling works 2018-07-07 12:55:52 -05:00
iwubcode 14482a72af Input: Allow cycling to occur for each individual controller 2018-07-07 12:55:49 -05:00
iwubcode 485285eadc Input: Add cycling between game specific profiles 2018-07-07 12:39:08 -05:00
iwubcode 3969bf6d1c Input: Add hotkey to cycle the wiimote profile forward or backward
Co-authored-by:  Barath Kannan <barathsotd@gmail.com>
2018-07-07 12:39:08 -05:00
iwubcode 9f9afeb63e Wiimote Emulation: Be able to trigger swings consistently by holding down buttons. This makes certain actions easier (tested with Red Steel) 2018-07-07 00:49:47 -05:00
spycrab c7c93a8e80 ControllerEmu/BooleanSetting: Add exclusive flag 2018-07-02 15:15:23 +02:00
Léo Lam 48b7cfa75c
Merge pull request #7062 from robopilot99/master
Add auto-hide option to Wii IR pointer
2018-06-08 14:04:03 +02:00
JosJuice 1c027bc148 Use UICommon's game list code on Android
Deduplicates code, and gets rid of some problems the old code had
(such as: bad performance when calling native functions, only one
disc showing up for multi-disc games, Wii banners being low-res,
unnecessarily much effort being needed for adding more metadata).
2018-06-06 17:34:07 +02:00
robopilot99 ab02499ce7 Add auto-hide option to Wii IR pointer 2018-06-04 17:58:21 -05:00
Michael M 932ca644aa Add hotplug support to SDL2 controller backend 2018-06-04 17:50:08 +02:00
Michael M 7062967b5b SDLJoystick: store name on creation
Otherwise, Dolphin will crash when the joystick is removed.
2018-06-04 17:49:21 +02:00
Michael M 0eb47e1071 CMake: make SDL a private dep of InputCommon 2018-06-04 17:49:21 +02:00
Connor Roth 3e4725f390 THis fixes issue #08 and #16, the rumble test and slider 2018-04-19 17:48:55 -04:00
Léo Lam ee955e37a9
Merge pull request #6564 from JosJuice/translate-certain-button-names
Translate certain button names but not all
2018-04-14 23:20:39 +02:00
Léo Lam b1bbd8a50e
Merge pull request #6625 from lioncash/evdev-udev
InputCommon/CMakeLists: Include evdev and udev includes on a by-target basis
2018-04-13 20:50:31 +02:00
JosJuice 7ed28297b2 ControllerEmu: Use enum instead of bool for translatability 2018-04-13 13:04:26 +02:00
JosJuice 3f13dbe087 Translate certain button names but not all
Some button names should be translated, for instance Up, Left and such.
At the same time, some other button names shouldn't be translated,
for reasons that might be less obvious. In 0146456af, I removed the
_trans markers for button names that never need to be translated
(such as A and B), but that isn't actually enough to ensure that
DolphinWX won't try to translate them anyway. This commit adds a bool
that explicitly tells the GUI whether a button name should be translated.
Otherwise we'll have problems like the GUI treating the button name "B"
(which isn't supposed to be translated) as matching the translatable
string "B" (being an abbreviation of "bytes"), meaning that the button
"B" will be labeled "o" when running Dolphin in French (after
translations get pulled from Transifex the next time).

By the way, while it turned out that DolphinWX translated all button
names, it also turned out that DolphinQt2 translated *no* button names.
Go figure. This commit makes them consistent with each other.
2018-04-13 13:04:26 +02:00
spycrab 40bb9974f2 Reformat all the things! 2018-04-12 21:28:39 +02:00
Lioncash 73ebc190fa
InputCommon/CMakeLists: Link evdev and udev in privately
These libraries aren't directly used outside of InputCommon
2018-04-10 09:59:55 -04:00
Lioncash d63d0b5069
InputCommon/CMakeLists: Include evdev and udev includes on a by-target basis
Avoids including the evdev/udev includes in the top-level directory
2018-04-10 09:59:51 -04:00
Lioncash e93159e54a
CMakeLists: Link in system framework libraries explicitly on macOS
Makes our libraries explicitly link in which libraries they need.
This makes our dependencies explicit and removes the reliance on the
LIBS variable to contain the libraries that they need.
2018-03-30 16:14:10 -04:00
Lioncash b8a4ab23dd
InputCommon/CMakeLists: Link in ForceFeedback library explicitly on macOS
Makes an implicit dependency explicit. Also makes the macOS libraries link privately
as they aren't used in the exposed interface.
2018-03-29 11:53:50 -04:00
Lioncash 01308330d9
InputCommon/CMakeLists: Migrate off add_dolphin_library
Continues the migration work started in 3a4c3bbe01
2018-03-24 14:13:53 -04:00
Lioncash 50a476c371 Assert: Uppercase assertion macros
Macros should be all upper-cased. This is also kind of a wart that's
been sticking out for quite a while now (we avoid prefixing
underscores).
2018-03-14 22:03:12 -04:00
Anthony 8adce86daa
Merge pull request #6355 from myfreeweb/clang6-warning
Add -Wno-register to calm down clang 6.0.0 (C++17 mode)
2018-02-07 22:25:57 -08:00
Greg V 9b201815f2 Ignore -Wregister to calm down recent clang and GCC (C++17 mode)
The 'register' keyword is used by a header included from Xlib (X11/XKBlib.h).
2018-02-05 14:43:07 +03:00
Léo Lam 6a93223283 evdev: Always unref received udev devices
Whenever udev_monitor_receive_device() returns a non-null pointer,
the device must be unref'd after use with udev_device_unref().

We previously missed some unref calls for non-evdev devices.
2018-02-05 01:01:05 +01:00
Léo Lam 0822bb347d evdev: Don't leak eventfd on shutdown 2018-02-04 22:48:38 +01:00
Léo Lam 9a3705f82d evdev: Fix select() call
It's not guaranteed that the eventfd is smaller than the monitor fd,
because fds are not always monotonically allocated. To select()
correctly in all cases, use the max between the monitor fd and eventfd.
2018-02-04 22:45:28 +01:00
Emmanuel Gil Peyrot f5dc8e7737 Rename constructor parameters to avoid shadowing members 2017-12-19 12:05:06 +01: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 Maltese 379e28b58c Add GCPadStatus.isConnected boolean 2017-11-19 16:01:08 +01:00
Michael Maltese bb1c794657 Remove unused GCPadStatus.err 2017-11-19 16:01:07 +01:00
Leo Lam 1e24a5f309
Merge pull request #6167 from ligfx/encapsulatedefaultdevice
EmulatedController: encapsulate default device behind getters/setters
2017-11-11 17:11:56 +01:00
Scott Pleb 0bede93daa evdev: Correctly calculate axis range for min values greater than 0.
Axis range was previously calculated as max + abs(min), which relies on the assumption that
min will not exceed 0. For (min, max) values like (0, 255) or (-128, 127), which I assume to
be the most common cases, the range is correctly calculated as 255. However, given (20,
235), the range is erroneously calculated as 255, leading to axis values being normalized
incorrectly.

SDL already handles this case correctly. After changing the range calculation to max - min,
the axis values received from the evdev backend are practically identical to the values
received from the SDL backend.
2017-11-11 02:07:04 -05:00
Michael M 8e6677be90 ControllerInterface: don't call InvokeDevicesChangedCallbacks more than once when refreshing 2017-11-10 13:37:42 -08:00
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
Michael M 1b1dd1d749 EmulatedController: encapsulate default device behind getters/setters 2017-11-04 17:08:55 -07: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
Leo Lam 2b4bf8662a Merge pull request #5577 from ligfx/separateexpressionparsingandbinding
ControlReference/ExpressionParser: separate parsing from binding
2017-09-15 19:11:57 +02:00
Michael M 294b1895ef ExpressionParser: std::move() tokens vector to parser 2017-09-14 12:53:36 -07:00
Michael M 31f1c06226 ControlReference: don't reparse expression when references are updated 2017-09-14 12:53:35 -07:00
Michael M c332580b83 ControlReference/ExpressionParser: separate parsing from binding 2017-09-14 12:53:35 -07:00
Michael M ba87a50338 ExpressionParser: add FallbackExpression node type 2017-09-14 12:53:35 -07:00
Michael M 7e74961eb1 ExpressionParser: expose ExpressionNode directly 2017-09-14 12:53:35 -07:00
Michael M 85301e2bae ParseStatus: replace NoDevice with EmptyExpression 2017-09-14 12:53:35 -07:00
Michael M 754efd75c5 ExpressionParser: remove DummyExpression 2017-09-14 12:53:35 -07:00
Michael M f1ff1e3d08 ExpressionParser: clean up ControlExpression 2017-09-14 12:53:35 -07:00
Michael M 3df945f8d0 ExpressionParser: replace bare pointers with unique_ptrs 2017-09-14 12:53:35 -07:00
Michael M bbb7c17235 ExpressionParser: use internal ParseResult struct instead of out-params 2017-09-14 12:53:35 -07:00
Michael M d2821e14fa ParseExpression: return a std::pair 2017-09-14 12:53:34 -07:00
Michael M 22a9a08b24 Add Core::State::Starting 2017-09-13 17:30:18 -07: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
Scott Mansell 3b5cad6682 Merge pull request #5860 from jturcotte/fix-macos-nswitch-axis
Fix axis not working with Switch Pro controller on macOS
2017-08-07 13:44:07 +12:00
Leo Lam d3bb964d79 Merge pull request #5809 from HannesMann/master
Send rumble data to the adapter on a separate thread
2017-08-02 12:36:35 +08:00
Hannes Mann 56239d1ae1 Send rumble data to the adapter on a separate thread 2017-08-02 00:44:46 +02:00