Commit Graph

55 Commits

Author SHA1 Message Date
Jordan Woyak 44a4573303 ControllerInterface: Add InputBackend interface and SDL implementation. 2022-11-01 21:59:08 -05:00
Admiral H. Curtiss 4d27022d0e
Add hotkey for centering mouse in render window. 2022-07-25 00:59:47 +02:00
Jun Bo Bi ceed42a0ee Add SDL as a submodule 2022-07-10 15:38:59 -07:00
Pierre Bourdon e149ad4f0a
treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00
Filoppi c238e49119 ControllerInterface: Remove OSX window handle
also make it more thread safe (avoid rare deadlock)
and fix it trying to add devices before the CI has init
2021-06-07 11:07:05 +03:00
Filoppi 2376aec135 ControllerInterface: Refactor
-Fix Add/Remove/Refresh device safety, devices could be added and removed at the same time, causing missing or duplicated devices (rare but possible)
-Fix other devices population race conditions in ControllerInterface
-Avoid re-creating all devices when dolphin is being shut down
-Avoid re-creating devices when the render window handle has changed (just the relevantr ones now)
-Avoid sending Devices Changed events if devices haven't actually changed
-Made most devices populations will be made async, to increase performance and avoid hanging the host or CPU thread on manual devices refresh
2021-06-07 11:07:05 +03:00
Filoppi f90d851e25 ControllerInterface: mixed comments 2021-06-07 11:07:05 +03:00
iwubcode db4b4e40cb InputCommon / DolphinQt / Core: Add a "RelativeMouse" input which provides the raw delta mouse input
Co-authored-by: Jordan Woyak <jordan.woyak@gmail.com>
2021-03-17 20:58:33 -05:00
Norbert Lange 29eaf09be4 Cleanup X11 and XRANDR Macros
This fixes build with X11 enabled and XRANDR disabled.
2021-02-22 14:30:43 +01:00
Shawn Hoffman 7e1df34735 rename InputCommon/ControllerInterface/Device to CoreDevice 2021-01-27 14:29:48 -08:00
seth 00ec25d520 InputCommon: Fix callback dispatch deadlock
Make sure m_is_populating_devices is true when a WM_INPUT_DEVICE_CHANGE
event is received directly on the ciface thread, so that callbacks do
not occur while removing devices. This breaks a hold-and-wait deadlock
between the ciface thread and the CPU thread when using emulated
Wiimotes.

Co-authored-by: brainleq <brainleq@users.noreply.github.com>
Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com>
2020-12-13 00:30:27 +00:00
Jordan Woyak b92f6480a0 InputCommon: Make "Cursor" inputs aware of the rendered aspect ratio. 2020-01-24 09:20:41 -06:00
rlnilsen da1f153b47 Rename all instances of "CemuhookUDPServer"/"UDPServer" to "DualShockUDPClient"/"DSUClient". 2019-10-27 16:05:22 +01:00
rlnilsen 4cb3baba5c Add support for motion controllers via the CemuHook controller input protocol.
This is done by:
1) Implementing said protocol in a new controller input class CemuHookUDPServer.
2) Adding functionality in the WiimoteEmu class for pushing that motion input to the emulated Wiimote and MotionPlus.
3) Suitably modifying the UI for configuring an Emulated Wii Remote.
2019-10-26 02:19:53 +02:00
Michael M 92ca6e124e Add ControllerInterface::Win32 to wrap XInput and DInput 2019-03-29 08:01:39 -05:00
Jordan Woyak b425f86121 ControllerInterface: Allow hotplug callbacks to be unregistered and don't reload the entire config from the ini file on hotplug, just update the control references. This should fix a crash on shutdown on Android. 2019-01-10 18:32:16 -06:00
Jordan Woyak 25d43ffd98 ControllerInterface: Shutdown order and race condition fix. 2019-01-02 08:19:42 -06:00
Stenzek 52828901ef Core: Switch controller interface to render widget on booting
Previously, the Qt frontend would initialize the controller
interface on starting, resulting in the cursor position being
relative to the main window, instead of the render window.
2018-10-29 11:46:06 +10:00
Stenzek a7f334dc2a ControllerInterface: Don't crash on non-X11 QPA 2018-10-29 11:46:06 +10:00
Michael M 0eb47e1071 CMake: make SDL a private dep of InputCommon 2018-06-04 17:49:21 +02:00
Michael M 8e6677be90 ControllerInterface: don't call InvokeDevicesChangedCallbacks more than once when refreshing 2017-11-10 13:37:42 -08:00
Michael M fd7cbd633e ControllerInterface: add mutex around callbacks vector 2017-11-10 13:37:42 -08:00
Michael M 1ed7532af8 ControllerInterface: HotplugCallbacks -> DevicesChangedCallbacks 2017-11-10 13:37:42 -08:00
Michael M 7355b5f70d ControllerInterface: invoke callbacks in AddDevice/RemoveDevice
Some backends already cause this to happen, so make it consistent across
systems.
2017-11-10 13:37:41 -08:00
Steven Newbury 02681bc352 Add missing "functional" include
Building fails on GCC7 without an explicit
2017-02-20 14:25:55 +00:00
Michael Maltese a509f56116 InputCommon: Extract ControlReference from ControllerInterface
Better separation of concerns. Relegates `ControllerInterface` to
enumerating input controls, and the new `ControlReference` deals with
combining inputs and configuration expression parsing.
2017-02-07 22:59:10 -08:00
Michael Maltese 3e69d066f5 ControllerInterface: replace Reinitialize with RefreshDevices
The SDL backend crashes when you close a joystick after SDL_Quit has
been called. Some backends don't need to be shutdown and
re-initialized everytime, we can just ask to enumerate devices again.
2016-11-30 16:07:55 -08:00
Jasper St. Pierre 928d05ec47 InputCommon: Remove the Xlib backend
The XInput2 backend is more performant, so let's default to it and
remove the old, core-only backend.
2016-09-04 10:44:22 -07:00
Léo Lam 93f5df4195 ControllerInterface: Add RemoveDevice()
This adds RemoveDevice() to ControllerInterface, fixes ExpressionParser
and some other code to support device removals without crashing,
and adds an IsValid() method to Device, to prepare for hotplugging.
2016-07-29 17:18:37 +02:00
Léo Lam 0d783f0869 ControllerInterface: Add a way to register callbacks
This adds RegisterHotplugCallback() to register a callback which will
be invoked by the input backends' hotplug threads when there is a new
device, so that Core (GCKeyboard, GCPad, Wiimote, Hotkey) can reload
the configuration without adding a dependency to Core from InputCommon.
2016-07-29 17:16:22 +02:00
Léo Lam 8678133e87 ControllerInterface: Switch to std::shared_ptr
Small cleanup by using std::shared_ptr and getting rid of
ciface.Devices() which just returned the m_devices (which defeats the
point of making m_devices protected).

Incidentally, this should make the code safer when we have
different threads accessing devices in the future (for hotplug?).

A lot of code use Device references directly so there is
no easy way to remove FindDevice() and make those unique_ptrs.
2016-06-25 21:46:39 +02:00
Léo Lam d3e2ae35ff ControllerInterface: Add synchronisation
Since we may have to add/access devices from different threads, this
adds synchronisation to anything that touches m_devices.
2016-06-25 13:46:53 +02:00
Léo Lam fd29e5c4cc ControllerInterface: Don't pass m_devices to the backends
Previously, the devices vector would be passed to all backends. They
would then manually push_back to it to add new devices. This was fine
but caused issues when trying to add synchronisation.

Instead, backends now call AddDevice() to fill m_devices so that it is
not accessible from the outside.
2016-06-25 13:46:53 +02:00
Pierre Bourdon 3570c7f03a Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
Ryan Houdek 6305f09467 Use cmake to determine if we are enabling the Android Controller Interface 2016-02-05 10:54:17 -06:00
spxtr d9d6cf8eda GC controller input using named pipes
Currently only works on unix, but can be extended to other systems. Can
also be extended to do wiimotes.

Searches the Pipes folder for readable named pipes and creates a dolphin
input device out of them. Send controller inputs to the game by writing
to the file. Commands are described in Pipes.h.
2015-10-24 20:20:03 -07:00
Scott Mansell 2721fdf8a9 Linux: Add an evdev based controller backend, to replace SDL. 2015-07-01 10:13:05 +12:00
Tillmann Karras 30ebb2459e Set copyright year to when a file was created 2015-05-25 13:22:31 +02:00
Tillmann Karras cefcb0ace9 Update license headers to GPLv2+ 2015-05-25 13:22:31 +02:00
skidau c76008b4b9 Removed the controller update lock as it is no longer needed. 2015-03-12 23:41:30 +11:00
Jasper St. Pierre f3b739341e HW: Remove UpdateOutput
All of the rumble interfaces are now immediate mode.
2014-11-28 10:54:04 -08:00
Jasper St. Pierre f2787f620e ControllerInterface: Make UpdateInput / UpdateOutput return void
The return values here have never been checked, so it doesn't make sense
to return a value to begin with.
2014-11-28 10:50:45 -08:00
Jasper St. Pierre b5d4e8d37e ControllerInterface: Remove unused "force" parameter
I'm not sure when this nonsense of forcing locking the mutex when it's
already taken should have ever taken effect, but let's be thankful it
isn't now. That was a badly worded sentence.
2014-11-28 10:50:45 -08:00
Lioncash b7b2074cc2 ControllerInterface: Get rid of SetHwnd(), introduce Reinitialize()
Initialize now just takes the handle directly. Reinitialize is added because it is much more straightforward in comparison to doing the Shutdown-Initialize manually.
2014-10-15 09:29:25 -04:00
Rohit Nirmal fbc64984ca Include CommonTypes.h instead of Common.h. 2014-09-08 15:39:58 -04:00
Rohit Nirmal b0060e5184 Controller Interface: Remove "using namespace" in header file. 2014-09-04 23:02:25 -05:00
Jordan Woyak 9af18d1b96 Remove SDL from Externals. 2014-05-04 19:41:02 -05:00
Jordan Woyak 4321951987 Disable SDL input on Windows. 2014-05-04 19:09:51 -05:00
Tillmann Karras d802d39281 clang-modernize -use-nullptr
and s/\bNULL\b/nullptr/g for *.cpp/h/mm files not compiled on my machine
2014-03-09 21:14:26 +01:00
Tillmann Karras f28116b7da clang-modernize -add-override 2014-03-09 21:12:01 +01:00