Commit graph

77 commits

Author SHA1 Message Date
german77
5798537ce4 input_common: Enable steam controllers and 8 player support 2021-09-10 00:58:12 -05:00
german77
2a2f0bfe9e input_common: Disable sdl raw input mode 2021-08-12 13:17:07 -05:00
german77
48b6d41f1b input_common: Improve SDL joystick and hide toggle option 2021-08-07 23:11:23 -05:00
bunnei
dff438e219
Merge pull request #6654 from german77/custom_threshold
input_common: Make button threshold customizable
2021-07-21 20:31:33 -04:00
bunnei
29fb110049
Merge pull request #6649 from german77/toggle_sdl
input_common: Support SDL toggle buttons
2021-07-20 20:35:20 -04:00
Nicolas Jallamion
6573ff64b4
input/sdl_impl: fix rumble support on DualSense. (#6683)
- value return can be different 0, is not error is normal, error is only -1.
2021-07-20 04:00:07 -04:00
german77
240019feca input_common: Make button threshold customizable 2021-07-15 23:56:57 -05:00
german77
c7478642a6 input_common: Support SDL toggle buttons 2021-07-15 14:31:58 -05:00
bunnei
348ca07e0d
Merge pull request #6318 from german77/dualJoycon
input_common: Add dual joycon support
2021-06-01 00:51:00 -07:00
bunnei
aee3b57c44
Merge pull request #6312 from german77/analogMapping
input_common: Rewrite sdl analog mapping and fix controller disconnection crash
2021-05-24 12:02:37 -07:00
german77
ea4b7226a6 input_common: Add dual joycon support 2021-05-22 18:40:53 -05:00
german77
f20f4587e6 input_common: Implement SDL motion 2021-05-15 08:56:58 -05:00
german77
edd498f6e0 input_common: Fix crash when controller disconnects 2021-05-15 08:27:19 -05:00
german77
85eeae7aad input_common: Rewrite sdl analog mapping 2021-05-14 21:17:08 -05:00
lat9nq
f973274b99 general: Ignore implicit-fallthrough for SDL.h
SDL 2.0.14 introduces an incompatibility with Clang, causing it to
trigger -Wimplicit-fallthrough even though it is marked. Ignore it for
now, with a comment mentioning why this is needed.
2021-04-18 01:31:26 -04:00
bunnei
0a5bc8ec14
Merge pull request #6119 from german77/SDLMapping
InputCommon: Address mapping and naming issues with SDL2
2021-04-15 21:40:35 -07:00
bunnei
a4c6712a4b common: Move settings to common from core.
- Removes a dependency on core and input_common from common.
2021-04-14 16:24:03 -07:00
german77
d9db1d125e InputCommon: Name properly xbox 360 and one controllers, Fix mappings for Nintendo Pro controllers 2021-03-30 21:40:36 -05:00
Morph
1c550ff954
Revert "Port citra-emu/citra#5123: "SDL: Disable hidapi drivers due to compatibility problems with certain controllers"" 2021-02-18 11:16:14 -05:00
bunnei
86212d4bcd
Merge pull request #3603 from FearlessTobi/port-5123
Port citra-emu/citra#5123: "SDL: Disable hidapi drivers due to compatibility problems with certain controllers"
2021-02-15 16:25:53 -08:00
german
481cd86722 Make settings controller image change with controller input 2021-02-06 09:43:41 -06:00
Morph
5942d206c2 sdl_impl: Set the maximum vibration duration to 1 second 2021-01-23 08:06:07 -05:00
bunnei
fb41c82aaa
Merge pull request #5265 from german77/port5509
Port citra-emu/citra#5509 "Look at direction of analog axis travel instead of instantaneous sample"
2020-12-30 22:24:30 -08:00
german
aa4c7687ee Port citra-emu/citra#5509 2020-12-30 22:29:20 -06:00
german
80fece4e08 Allow to invert analog axis with right click 2020-12-26 17:46:14 -06:00
bunnei
7fb7540d69 input_common: Add more missing [[maybe_unused]] from #4927. 2020-11-23 20:50:35 -08:00
Lioncash
5c4774e8ce 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
5b6545b141 Modify rumble amplification 2020-11-19 11:30:52 -06:00
Morph
e7e8a87927 sdl_impl: Pump SDL Events at 1000 Hz 2020-11-15 23:33:21 -05:00
Morph
117bdc71e0 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
30e0d1c973 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
e9e1876e82 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
9b501af8e3 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
2f852f182a 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
Morph
7b3f5845d2 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
046c0c91a3 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
06e65de93c
Merge pull request #4677 from german77/ShakeFromButton
InputCommon: Add random motion input for buttons
2020-10-08 10:18:39 -07:00
german
ab88c2f611 First implementation of controller rumble 2020-09-29 10:38:25 -04:00
german
03b574ae22 Add random motion input to SDL 2020-09-25 17:59:52 -05:00
Vitor Kiguchi
e6f9fe1f60 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
Lioncash
69fa6b4906 sdl_impl: Reduce allocations in GetButtonMappingForDevice()
These maps can be constexpr arrays of std::pair.
2020-08-28 21:24:17 -04:00
Lioncash
f2a680ca89 sdl_impl: Make use of std::move on std::string where applicable
Avoids redundant copies.
2020-08-28 21:14:54 -04:00
Lioncash
e92164e6a0 sdl_impl: Make use of insert_or_assign() where applicable
Avoids churning ParamPackage instances.
2020-08-28 21:13:26 -04:00
Lioncash
f3ac088345 sdl_impl: Prevent type truncation in BuildAnalogParamPackageForButton() default arguments
We need to add the 'f' suffix to make the right hand side a float and
not a double.
2020-08-28 21:08:08 -04:00
Lioncash
2e2dde2f95 sdl_impl: Simplify make_tuple call
The purpose of make_tuple is that you don't need to explicitly type out
the types of the things that comprise said tuple.

Given this just returns default values, we can simplify this a bit.
2020-08-28 21:04:18 -04:00
Lioncash
2680526e6b sdl_impl: Mark FromEvent() as a const member function
This doesn't modify internal member state, so it can be marked as const.
2020-08-28 20:58:49 -04:00
Lioncash
98f5d8a713 input_common/main: Remove unnecessary headers 2020-08-28 19:23:19 -04:00
Morph
de79897f04 input_common: Fix directional deadzone values
The hardware tested value is 0.5 which translates to SHRT_MAX / 2
2020-08-26 02:32:32 -04:00
Morph
efa0b7a056 Address feedback 2020-08-26 02:32:32 -04:00
Morph
f0fac0c7fb Project Mjölnir: Part 1
Co-authored-by: James Rowe <jroweboy@gmail.com>
Co-authored-by: Its-Rei <kupfel@gmail.com>
2020-08-26 02:32:32 -04:00