Commit graph

503 commits

Author SHA1 Message Date
bunnei
2382020d8d input_common: Add more missing [[maybe_unused]] from #4927. 2020-11-23 20:50:35 -08:00
Lioncash
c8aec32f12 input_common: Treat warnings as errors
Migrates over warnings as errors for input common to match how the
common library treats warnings as errors.
2020-11-22 04:50:03 -05:00
german77
3edd74463f Modify rumble amplification 2020-11-19 11:30:52 -06:00
bunnei
afa4ced6e4 Merge pull request #4866 from Morph1984/mjolnir-p3-prod
Project Mjölnir: Part 3 - Controller Profiles and Vibration Rework
2020-11-17 20:02:27 -08:00
Morph
f5ee5e7f3c sdl_impl: Pump SDL Events at 1000 Hz 2020-11-15 23:33:21 -05:00
Morph
24cfdbc7fe sdl_impl: Revert to the "old" method of mapping sticks
Not all controllers have a SDL_GameController binding. This caused controllers not present in the SDL GameController database to have buttons mapped instead of axes.

Furthermore, it was not possible to invert the axes when it could be useful such as emulating a horizontal single joycon or other potential cases. This allows us to invert the axes by reversing the order of mapping (vertical, then horizontal).
2020-11-15 23:33:21 -05:00
Morph
bd42b2093c controllers/npad: Remove the old vibration filter
Previously we used a vibration filter that filters out amplitudes close to each other. It turns out there are cases where this results into vibrations that are too inaccurate. Remove this and move the 100Hz vibration filter (Only allowing a maximum of 100 vibrations per second) from sdl_impl to npad when enable_accurate_vibrations is set to false.
2020-11-15 23:33:21 -05:00
Morph
ad3905fe27 input_common: Add VibrationDevice and VibrationDeviceFactory
A vibration device is an input device that returns an unsigned byte as status.
It represents whether the vibration device supports vibration or not.
If the status returns 1, it supports vibration. Otherwise, it does not support vibration.
2020-11-15 23:33:20 -05:00
Morph
cce389221b configure_input: Add per-player vibration
Allows for enabling and modifying vibration and vibration strength per player.
Also adds a toggle for enabling/disabling accurate vibrations.

Co-authored-by: Its-Rei <kupfel@gmail.com>
2020-11-15 23:33:20 -05:00
Morph
ed9df522ec controllers/npad: Add heuristics to reduce rumble state changes
Sending too many state changes in a short period of time can cause massive performance issues.
As a result, we have to use several heuristics to reduce the number of state changes to minimize/eliminate this performance impact while maintaining the quality of these vibrations as much as possible.
2020-11-15 23:33:20 -05:00
Morph
b29a52982a configure_input_player: Change "Defaults" button behavior
RestoreDefaults() now restores the selected devices' mappings using UpdateMappingWithDefaults().
This allows us to move the keyboard mapping from RestoreDefaults() to UpdateMappingWithDefaults().
2020-11-15 23:33:20 -05:00
Morph
5eb160d4c6 udp/client: Reduce testing period to 5 seconds 2020-11-15 23:33:19 -05:00
Morph
ad9a909bc7 configure_input_player: Implement input exclusivity and persistence
With this, the "Input Devices" combobox should accurately reflect the input device being used and disallows inputs from other input devices unless the input device is set to "Any".
2020-11-15 23:33:19 -05:00
Lioncash
eccf766a39 motion_input: Mark constructor as explicit 2020-11-15 14:20:41 -05:00
Lioncash
93312282aa motion_input: Mark member functions as [[nodiscard]] where applicable 2020-11-15 14:18:09 -05:00
german
fbab229893 fix minor clang error 2020-11-10 10:38:15 -06:00
german
b1f65683bc Allow to dial any angle with digital joystick 2020-11-08 09:15:33 -06:00
german
2aafcc5f4b Add hotplug, rumble and fix 3rd party adapters for the GC adapter 2020-10-28 21:12:34 -05:00
Morph
62e0851476 sdl_impl: Fix controller reconnection issues
It turns out that after a controller is disconnected, there is a chance that events from the previous controller are sent/processed after it has been disconnected.
This causes the previously disconnected controller to reappear as connected due to GetSDLJoystickBySDLID() emplacing this controller back to the map.

Fix this by only returning an SDLJoystick if and only if it exists in the map.
2020-10-21 09:41:30 -04:00
LC
bd5383ad7e Merge pull request #4809 from Morph1984/mjolnir-p3
configure_input_player: Fix modifier buttons
2020-10-20 15:00:06 -04:00
bunnei
d49a2e305e Merge pull request #4627 from Morph1984/fix-dinput-controller-disconnect
sdl_impl: Erase the SDLJoystick entry after removing a controller
2020-10-20 11:40:06 -07:00
Morph
6fa2144d90 configure_input_player: Fix modifier buttons
Fix them for real this time, now they finally work.
2020-10-20 14:23:25 -04:00
Lioncash
c3c19060dd udp/client: Make use of designated initializers in TestCommunication()
Same behavior, but makes the callback list nicer to look at.
2020-10-16 06:23:51 -04:00
Lioncash
3232d03657 udp/client: Take std::function by const reference with TestCommunication()
Avoids redundant copies.
2020-10-16 06:22:29 -04:00
Morph
7f475ec996 sdl_impl: Erase the SDLJoystick entry after removing a controller
Previously, disconnecting a controller still leaves a null SDLJoystick entry within the vector of SDLJoysticks mapped by GUID.
When a DirectInput device of the same GUID is reconnected, it adds that device to a new port causing non-detectable input.
Furthermore, opening the "Configure" menu would cause yuzu to crash since it first tries to resolve the name of a null SDLJoystick entry that was not removed.
Resolve this by properly erasing the SDLJoystick entry from the vector.
2020-10-16 00:04:59 -04:00
Lioncash
d44d662529 input_common/CMakeLists: Make some warnings errors
Makes the input_common code warnings consistent with the rest of the
codebase.
2020-10-15 19:37:51 -04:00
bunnei
7eaad002f5 Merge pull request #4757 from german77/BetterMotion
InputCommon: Add compatibility with only accelerometer and auto calibrate for drift
2020-10-09 23:37:08 -07:00
bunnei
86a98a3137 Merge pull request #4677 from german77/ShakeFromButton
InputCommon: Add random motion input for buttons
2020-10-08 10:18:39 -07:00
bunnei
b3767ab3be Merge pull request #4727 from FrogTheFrog/patch-1
Reduce the "shake" requirements when configuring UDP.
2020-10-06 15:29:28 -07:00
german
ec0a0a94b4 Address comments 2020-10-04 18:15:53 -05:00
german
0d4c60c3ef Add compatibility with only accelerometer and auto calibrate for drift 2020-10-03 22:22:01 -05:00
Lukas Senionis
e237086658 Reduce the "shake" requirements when configuring UDP. 2020-09-30 10:30:33 +03:00
german
782aab6cf2 First implementation of controller rumble 2020-09-29 10:38:25 -04:00
german
ef4f095aae Add random motion input to keyboard 2020-09-25 17:59:52 -05:00
german
db47701464 Add random motion input to SDL 2020-09-25 17:59:52 -05:00
german
9f70da1a9b Add automap feature for GC adapter 2020-09-18 16:51:16 -05:00
bunnei
9a2553c952 Merge pull request #4594 from german77/MotionHID
hid/configuration: Implement motion controls to HID
2020-09-17 12:39:01 -07:00
ReinUsesLisp
67dd8466b3 gc_adapter: Disable MSVC nonstandard extension warning on libusb.h
Pragma disable zero-sized array nonstandard extension warning on MSVC.
2020-09-14 19:38:08 -03:00
Lioncash
14d5340a9d gc_adapter: Make DeviceConnected() a const member function
This doesn't modify instance state, so it can be made const.
2020-09-07 02:49:13 -04:00
german
b26bc3864a Minor cleanup 2020-09-05 09:42:21 -04:00
german
82eb4be33b Add cemu hook changes related to PR #4609 2020-09-04 21:48:13 -05:00
german
17b48f8d42 Remove RealMotionDevice 2020-09-04 21:48:13 -05:00
german
876e6fc255 Include HID and configuration changes related to motion 2020-09-04 21:48:03 -05:00
bunnei
9c6972fda5 Merge pull request #4583 from lioncash/trunc
gc_poller: Resolve compilation warnings on MSVC
2020-09-03 20:23:33 -04:00
Morph
f3417b01e1 input_common/motion_input: Make use of Common::PI constant
Also amend the copyright notice to yuzu's instead of Dolphin's, which was mistakenly copy-pasted from another file.
2020-09-02 11:58:15 -04:00
bunnei
60e59d1d0c Merge pull request #4570 from german77/motionInput
input_common: Add a basic class for motion devices
2020-09-02 11:09:18 -04:00
bunnei
99ae6cfc68 Merge pull request #4382 from FearlessTobi/port-udp-config
yuzu: Add motion and touch configuration from Citra
2020-09-01 13:56:37 -04:00
Vitor Kiguchi
52df885a42 sdl_joystick: disable the use of the hidapi drivers due to many problems caused by them.
The main problem is the loss of compatibility with some controllers, but there are also
unwanted changes to the behaviour of PS4 controllers (hardcoded lightbar color).
2020-08-30 05:06:49 +02:00
FearlessTobi
ee199ead59 Address second batch of reviews 2020-08-30 00:43:25 +02:00
FearlessTobi
01dbe3a624 Address review comments and fix code compilation 2020-08-29 20:56:51 +02:00