Commit Graph

1249 Commits

Author SHA1 Message Date
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
JosJuice
9b3816c993 InputCommon: Fix ControlGroup::SaveConfig with DefaultValue::Disabled
I also changed LoadConfig, but that change doesn't affect correctness,
it's only so it looks neat by matching SaveConfig.

This bug was added in 18a4afb053, the
commit that introduced DefaultValue::Disabled. The bug can't actually be
triggered in master, but it can be triggered in the Android input
overhaul PR.
2023-02-26 17:45:09 +01:00
Pokechu22
f1f3fd5d9d InputCommon: Fix memory leak in ExpressionParser
We allocate in MakeSuppressor via `return unique_ptr(std::make_unique<...>(...).release(), InvokingDeleter{}`, so it wasn't properly getting freed.
2023-02-17 18:29:36 -08: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
Pokechu22
49a84cbc4c Resolve various "no previous declaration" warnings 2023-02-09 16:23:01 -08:00
Markus Wick
17d7b75a9b
Merge pull request #11544 from jmallach/spng
Allow building against system libspng
2023-02-09 14:47:58 +01:00
Jordi Mallach
4d164fcb77 Allow building against system libspng 2023-02-06 13:30:46 +01:00
Scott Mansell
0da69055d9 Split out everying remaining from Swap 2023-01-31 19:41:24 +13: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
Admiral H. Curtiss
c9558ecb4c
CoreTiming: Refactor to class. 2022-11-27 03:47:12 +01: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
Jordan Woyak
5ed0543430 GCAdapter: Process pad state in read thread and other general cleanups. 2022-10-22 00:38:59 -05:00
Jordan Woyak
f5b9049421 Input: Add "abs" input expression function. 2022-10-11 19:28:21 -05: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
JosJuice
b296248b49 DolphinQt: Use input override system for TAS input windows
This lets the TAS input code use a higher-level interface for
overriding inputs instead of having to fiddle with raw bits.
WiiTASInputWindow in particular was messy with how much
controller code it had to re-implement.
2022-10-03 22:04:09 +02:00
JosJuice
cb16d20f2d ControllerEmu: Add new "input override" system 2022-10-03 22:00:21 +02:00
Admiral H. Curtiss
26fd4ea361
WiimoteEmu: Update IR camera status from DesiredWiimoteState. 2022-10-02 23:14:35 +02:00
Admiral H. Curtiss
02a967f786
InputCommon: Add equality operators to RawValue. 2022-09-24 01:44:21 +02:00
Admiral H. Curtiss
24a1fe32f1
InputCommon: Make RawValue constructors constexpr. 2022-09-24 01:38:09 +02:00
Minty-Meeo
73dfcc15a5 Use std::llround in MapFloat
I don't see why not.
2022-09-22 11:30:32 -05: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
a9edf129e3
Merge pull request #10889 from shuffle2/spng
replace libpng with libspng
2022-07-26 12:53:04 +02: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
Shawn Hoffman
acb10f0006 replace libpng with libspng 2022-07-25 18:32:16 -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