Commit Graph

945 Commits

Author SHA1 Message Date
fae8b15db1 ExpressionParser: Add !pulse function that evaluates to 1.0 for N seconds for each press. 2019-10-11 18:12:18 -05:00
b5b43f8342 ExpressionParser: Add relative input function. 2019-10-11 18:12:18 -05:00
08b291b0f9 ExpressionParser: Fix timer function with negative values. 2019-10-11 18:12:18 -05:00
18b5120441 ExpressionParser: Add !tap function which activates after X (defaults to 2) taps within Y seconds. 2019-10-11 18:12:17 -05:00
f2e499d587 ExpressionParser: Add !hold function that activates after input is held for N seconds. 2019-10-11 18:12:17 -05:00
9e536382c4 ExpressionParser: Add function to smooth inputs. 2019-10-11 18:12:17 -05:00
bbd6b1848f ExpressionParser: Add deadzone function. 2019-10-11 18:12:17 -05:00
6a2096c419 ExpressionParser: Add optional 2nd argument to toggle function which clears state. 2019-10-11 18:12:17 -05:00
fd07ae8cec ExpressionParser: Move FunctionExpression type definitions into another file. 2019-10-11 18:12:16 -05:00
d4f9b8c4ef ExpressionParser: Allow unary functions to be used without parens around the argument. e.g. !Up 2019-10-11 17:31:09 -05:00
2a377e35ed ExpressionParser: Make function names case sensitive. 2019-10-11 17:31:09 -05:00
2b0297489f ExpressionParser: Rename some functions and return a syntax error on trailing tokens. 2019-10-11 17:31:09 -05:00
258832b1e8 ExpressionParser: Change function argument syntax to something more c++-like. 2019-10-11 17:31:09 -05:00
ccac3f1e49 ExpressionParser: Fix negative literals and support unary minus operator. 2019-10-11 17:31:07 -05:00
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
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
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
fa75ab404f ExpressionParser: operator precedence. 2019-10-11 17:14:45 -05:00
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
2c89b60298 ExpressionParser: cleanup. 2019-10-11 17:14:45 -05:00
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
718efce1dc ExpressionParser: Add less-than and greater-than operators. 2019-10-11 17:14:45 -05:00
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
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
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
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
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
f3192ca06d ExpressionParser: Add support for literals. 2019-10-11 17:13:58 -05:00
673f13b7ac WiimoteEmu: Change default tilt angle to 85 degrees. 2019-10-06 09:56:41 -05:00
260cefd60b WiimoteEmu: Expose maximum tilt acceleration. 2019-10-06 09:56:39 -05:00
428ae5a43d Merge pull request #8172 from nokturnusmf/relative-input-hold
Added (held) key for relative input
2019-08-10 00:37:53 +10:00
48ca2c6f2e Merge pull request #8233 from JosJuice/stringutil-string-view
StringUtil: Use std::string_view more
2019-08-09 23:39:01 +10:00
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
a2a1e04fc9 StringUtil: Use std::string_view more 2019-07-23 14:49:12 +02:00
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
ec60027f56 InputCommon: Use nested namespace specifiers where applicable 2019-06-17 16:51:41 -04:00
c62570c527 Added key for relative input 2019-06-10 13:23:16 +01:00
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
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
24f5acf9a5 InputCommon/CMakeLists: Specify headers in target sources 2019-05-31 06:54:25 -04:00
00ecfb3c59 Merge pull request #8138 from lioncash/input-string
ControllerInterface/Device: Minor cleanup
2019-05-30 14:33:53 +02:00
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
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
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
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
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
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
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
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
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