Commit graph

425 commits

Author SHA1 Message Date
Minty-Meeo
f29019180f Pragma diagnostic ignore [-Wregister] is no longer needed 2023-04-12 03:59:57 -05:00
Pierre Bourdon
3783bedc25
Merge pull request #11635 from Dentomologist/wiimote_fix_disconnection_deadlock
ControllerInterface: Fix deadlock when Wii Remote disconnects
2023-03-14 02:41:36 +01:00
Dentomologist
d6a8e6caaf ControllerInterface: Fix deadlock when Wii Remote disconnects
In UpdateInput, lock m_devices_population_mutex before m_devices_mutex
to be consistent with other ControllerInterface functions. Normally the
former lock isn't needed in UpdateInput, but when a Wii Remote
disconnects it calls RemoveDevice which results in the mutexes being
locked in the wrong order.
2023-03-08 17:22:27 -08:00
JosJuice
c2779aef06 Android: Add the advanced input mapping dialog
It's missing a lot of features from the PC version for now, like
buttons for inserting functions and the ability to see what the
expression evaluates to. I mostly just wanted to get something in
place so you can set up rumble.

Co-authored-by: Charles Lombardo <clombardo169@gmail.com>
2023-03-07 17:39:30 +01:00
JosJuice
2b1dd52750 Android: Add input device selection 2023-03-03 22:28:24 +01:00
JosJuice
8e33458f48 ControllerInterface/Android: Implement rumble 2023-03-03 22:28:23 +01:00
JosJuice
065481d989 ControllerInterface/Android: Automatically suspend sensors
This is a battery-saving measure. Whether a sensor should be suspended
is determined in the same way as whether key events and motion events
should be handled by the OS rather than consumed by Dolphin.
2023-03-03 22:28:23 +01:00
JosJuice
36acb17700 ControllerInterface/Android: Implement sensor input for InputDevices
This functionality was added in Android 12 to let apps get motion data
for gamepads.
2023-03-03 22:28:23 +01:00
JosJuice
5e51b56d72 ControllerInterface/Android: Implement sensor input 2023-03-03 22:28:23 +01:00
JosJuice
104ea09892 ControllerInterface/Android: Implement hotplug 2023-03-03 22:28:23 +01:00
JosJuice
d6af294a23 ControllerInterface/Android: Return whether input was handled
When Android presents an input event to an app, it wants the app to
return true or false depending on whether the app handled the event or
not. If the event wasn't handled by the app, it will be passed on to
the system, which may decide to take an action depending on what kind
of input event it is. For instance, if a B button press is passed on to
the system, it will be turned into a Back press. But if an R1 press is
passed on to the system, nothing in particular happens.

It's important that we get this return value right in Dolphin. For
instance, the user generally wouldn't want a B button press to open
the EmulationActivity menu, so B button presses usually shouldn't be
passed on to the system - but volume button presses usually should be
passed on to the system, since it would be hard to adjust the volume
otherwise. What ButtonManager did was to pass on input events that are
for a button which the user has not mapped, which I think makes sense.
But exactly how to implement that is more complicated in the new input
backend than in ButtonManager, because now we have a separation between
the input backend and the code that keeps track of the user's mappings.

What I'm going with in this commit is to treat an input as mapped if
it has been polled recently. In part I chose this because it seemed
like a simple way of implementing it that wouldn't cause too many
layering violations, but it also has two useful side effects:

1. If a controller is not being polled (e.g. GameCube controllers in
   Wii games that don't use them), its mappings will not be considered.
2. Once sensor input is implemented in the Android input backend,
   we will be able to use this "polled recently" tracking to power down
   the sensors at times when the game is using a Wii Remote reporting
   mode that doesn't include motion data. (Assuming that the sensor
   inputs only are mapped to Wii Remote motion controls, that is.)
2023-03-03 22:28:23 +01:00
JosJuice
ca508e4503 ControllerInterface/Android: Handle input events
Android doesn't let us poll inputs whenever we want. Instead, we
listen to input events (activities will have to forward them to the
input backend), and store the received values in atomic variables
in the Input classes. This is similar in concept to how ButtonManager
worked, but without its homegrown second input mapping system.
2023-03-03 22:28:23 +01:00
JosJuice
792cb62195 ControllerInterface/Android: Implement device population 2023-03-03 22:28:23 +01:00
JosJuice
0150f521f7 ControllerInterface/Android: Rip out ButtonManager
ButtonManager is very different from how a normal input backend works,
and is making it hard for us to improve controller support on Android.
The following commits will add a new input backend in its place.
2023-03-03 22:28:23 +01:00
Pokechu22
74a14c7d1f ControllerInterface: Fix uninitialized variables in DualShockUDPClient
Strangely, this case did not trigger a C26495 warning in Visual Studio's analyzer; instead, I spotted this when using Valgrind.
2023-02-15 19:23:47 -08:00
Pokechu22
7fafb00561 InputCommon/XInput2: Fix shadowing warning 2023-02-09 16:23:02 -08:00
Lioncash
e5b91f00b0 Common: Replace StringBeginsWith/StringEndsWith with std equivalents
Obsoletes these functions in favor of the standard member functions
added in C++20.
2023-01-24 14:58:20 -05:00
Admiral H. Curtiss
d949aa60bb
Merge pull request #11397 from TellowKrinkle/QuartzMousePos
InputCommon:QuartzKB&M: Fix mouse y coordinates
2023-01-02 23:04:12 +01:00
TellowKrinkle
8659de4d71 InputCommon:QuartzKB&M: Fix mouse y coordinates
Cocoa uses a different coordinate system from Carbon (Carbon's origin is the top left while Cocoa's is the bottom left)
2022-12-31 23:42:11 -06:00
TheConfuZzledDude
288fa635f9 InputCommon/XInput2: Changed axis value reading to be more correct 2022-12-26 17:27:48 +00:00
TheConfuZzledDude
27d596b89c InputCommon/Xinput: Cleaned up a bit 2022-12-23 22:35:09 +00:00
TheConfuZzledDude
c3018fdc3b InputCommon/XInput2: Added an axis output for the scroll wheel 2022-12-23 22:10:28 +00:00
TellowKrinkle
72eadc6520 InputCommon:SDL: Add SDL 2.26 left and right motion inputs 2022-11-24 15:12:07 -06:00
Jordan Woyak
168a49c87f ControllerInterface: DSU InputBackend implementation. 2022-11-01 21:59:09 -05:00
Jordan Woyak
2e5cd5d519 ControllerInterface: evdev InputBackend implementation. 2022-11-01 21:59:08 -05:00
Jordan Woyak
44a4573303 ControllerInterface: Add InputBackend interface and SDL implementation. 2022-11-01 21:59:08 -05:00
JMC47
bc4d08047d
Merge pull request #10979 from tellowkrinkle/QuartzWindowSpeed
InputCommon:QuartzKB&M: Use KVO to watch window position
2022-10-22 04:55:12 -04:00
JosJuice
51ee05cb35 Android: Use input override system for touch controls
This is the first step of getting rid of the controller indirection
on Android. (Needing a way for touch controls to provide input
to the emulator core is the reason why the controller indirection
exists to begin with as far as I understand it.)
2022-10-03 22:04:09 +02:00
Admiral H. Curtiss
26fd4ea361
WiimoteEmu: Update IR camera status from DesiredWiimoteState. 2022-10-02 23:14:35 +02:00
Admiral H. Curtiss
710210365a
Merge pull request #11038 from AdmiralCurtiss/steam-overlay-crash-fix-wgi
WGInput: Work around crash with Steam overlay.
2022-09-08 19:03:31 +02:00
Admiral H. Curtiss
b8ca1b2907
InputCommon: Fix deadlock in EmulatedController::UpdateReferences(). 2022-09-07 22:37:24 +02:00
Admiral H. Curtiss
67c97a0bf2
WGInput: Work around crash with Steam overlay. 2022-09-07 21:06:26 +02:00
Shawn Hoffman
cd407abe34 WGInput: implement error handling 2022-08-27 02:11:27 -07:00
Shawn Hoffman
6bc8ab7001 WGInput: use c++/winrt 2022-08-26 23:20:34 -07:00
Shawn Hoffman
76d2e47444 ciface/win32: use CM_Register_Notification instead of wnd msgs 2022-08-26 21:59:56 -07:00
TellowKrinkle
588c4bd635 InputCommon:QuarzKB&M: Use view position instead of window position 2022-08-18 16:29:43 -05:00
TellowKrinkle
798b241832 InputCommon:QuarzKB&M: Use KVO to watch window position
CGWindowListCreateDescriptionFromArray would block for up to ~1ms, which isn't a great thing to do on the main emulation thread
2022-08-18 16:29:43 -05:00
TellowKrinkle
b96bc4267e InputCommon: Enable ARC for obj-c++ 2022-08-12 02:09:53 -05:00
Admiral H. Curtiss
9d15a1c5a1
Merge pull request #10858 from AdmiralCurtiss/mouse-center-hotkey
Add hotkey for centering mouse in render window.
2022-07-26 12:52:33 +02:00
Shawn Hoffman
f92541fbd9 StripSpaces: only strip spaces
StripWhitespace maintains old behavior
2022-07-25 18:40:12 -07:00
Admiral H. Curtiss
d14bd10cd7
Quartz: Handle mouse centering hotkey.
Co-authored-by: Dentomologist <dentomologist@gmail.com>
2022-07-25 01:26:57 +02:00
Admiral H. Curtiss
e0870166ef
XInput2: Handle mouse centering hotkey. 2022-07-25 01:26:56 +02:00
Admiral H. Curtiss
d57d04bb04
DInput: Handle mouse centering hotkey. 2022-07-25 01:26:56 +02:00
Admiral H. Curtiss
4d27022d0e
Add hotkey for centering mouse in render window. 2022-07-25 00:59:47 +02:00
Admiral H. Curtiss
89067e66f9
InputCommon: Get rid of static strings. 2022-07-15 19:53:10 +02:00
Admiral H. Curtiss
e79c7d4985
InputCommon: Don't force-link against SDL2.lib on Windows. 2022-07-13 01:37:05 +02:00
Shawn Hoffman
54b4ad8f55 ci/sdl: pump messages for SDL_hidapi so device detection works 2022-07-10 15:39:06 -07:00
Shawn Hoffman
ddf83462ac sdl: enable SDL_HINT_JOYSTICK_THREAD
fixes window message pumping
2022-07-10 15:39:06 -07:00
Shawn Hoffman
655fb94e61 ci/win32: give the wndclass a unique name
other things (like SDL) may try to use "Message"
2022-07-10 15:39:06 -07:00
Shawn Hoffman
dd20c7cf78 ci/sdl: re-add the x360 controller block 2022-07-10 15:39:06 -07:00