Commit Graph

860 Commits

Author SHA1 Message Date
cf60a9a7f7 Use separate libusb contexts to avoid thread safety issues
Unfortunately, it appears that using libusb's synchronous transfer API
from several threads causes nasty race conditions in event handling and
can lead to deadlocks, despite the fact that libusb's synchronous API
is documented to be perfectly fine to use from several threads (only
the manual polling functionality is supposed to require special
precautions).

Since usbdk was the only real reason for using a single libusb context
and since usbdk (currently) has so many issues with Dolphin, I think
dropping support for it in order to fix other backends is acceptable.
2019-06-26 17:55:51 +02:00
ec60027f56 InputCommon: Use nested namespace specifiers where applicable 2019-06-17 16:51:41 -04:00
bed2d66bed Merge pull request #8117 from weihuoya/threaded_env
android: get java env from thread local storage
2019-06-08 20:42:15 +10:00
c0c0e412e0 Core/ConfigManager: Use forward declarations where applicable
Avoids dragging in IniFile, EXI device and SI device headers in this header which is
quite widely used throughout the codebase.

This also uncovered a few cases where indirect inclusions were being
relied upon, which this also fixes.
2019-06-07 19:54:39 -04:00
24f5acf9a5 InputCommon/CMakeLists: Specify headers in target sources 2019-05-31 06:54:25 -04:00
00ecfb3c59 Merge pull request #8138 from lioncash/input-string
ControllerInterface/Device: Minor cleanup
2019-05-30 14:33:53 +02:00
0263435050 ControllerInterface/Device: Make DetectInput() a const member function
This doesn't actually modify object instance state, so it can be made
const.
2019-05-29 19:23:54 -04:00
27346fee8a ControllerInterface/Device: Take vector by const reference in DetectInput()
The vector is only ever queryied and it's contents aren't modified, so
there's no reason to take the vector by value. We can take a constant
reference to it to avoid unnecessary allocating.
2019-05-29 19:12:21 -04:00
246e2a77ce ControllerInterface/Device: std::move strings in constructor where applicable
Allows callers to move std::string values into the constructor,
potentially avoiding copies.
2019-05-29 18:46:49 -04:00
1355b43fd2 ControllerInterface/Device: Use std::string_view where applicable
In these cases, the given string is only ever compared against other
string, so std::string can be turned into a std::string_view to allow
non-allocating inputs.
2019-05-29 18:42:24 -04:00
2c3c8bbb90 GCAdapter: Update Android-specific source
Fix the Android version of GCAdapter.cpp so it matches the new definitions in GCAdapter.h.
2019-05-29 18:28:24 +02:00
9e7d4d2abb GCAdapter: Handle dynamic status updates for non-hotplug libusb
Detect when the setup function found no adapter, or found one but could
not connect to it, and report the new status in that case.
2019-05-29 18:28:24 +02:00
2ac1ca133f GCPadWiiUConfigDialog: Update the adapter state dynamically
Update the GC adapter config GUI if the adapter is plugged or unplugged.
2019-05-29 18:28:24 +02:00
b08e2ec959 GCAdapter: Report libusb open errors to the user
If opening the adapter fails, report the libusb error message in the GUI
instead of “No Adapter Detected”.

The error condition is removed when the adapter is unplugged.
2019-05-29 18:28:24 +02:00
0165e5e703 GCAdapter: Close libusb handle if an open error occurs
The handle was previously kept open, which was causing future adapter
plug/unplug events to be ignored.
2019-05-29 18:28:24 +02:00
0dec8feadb android: thread local env 2019-05-29 20:22:26 +08:00
256c9375c9 Move libusb utilities to LibusbUtils
* Simplifies libusb context usage and allows us to set options for
all contexts easily. Notably, this lets us enable usbdk support
in libusb, which is now opt-in in the latest version.

* Moves the libusb config descriptor wrapper class to LibusbUtils too
since that could easily be reused.

* Moves device listing to LibusbUtils too and add a lock around it
as some libusb backends are not thread safe.

* Consequences: only a single context and a single event handling
thread is used now, which is more efficient.
2019-05-27 20:09:55 +02:00
e2c769a9c5 Merge pull request #7992 from artemist/centering
ControllerEmu: Add support for setting the center of a ReshapableInput
2019-05-20 18:29:31 +02:00
49e46c8aff ControllerEmu: Add support for setting the center of a ReshapableInput
This is useful in far out-of-calibration controllers, such as the
Switch Pro controller. This also adds support for configuring the center
in the Mapping widget.
2019-05-18 14:45:16 +00:00
ec734065db Merge pull request #8087 from spycrab/cmake_win2019
Support CMake on Windows
2019-05-14 21:07:26 +02:00
374585f128 WiimoteEmu/DolphinQt: Rename "IR" to "Point" and eliminate redundant Forward/Backward mappings. 2019-05-08 20:27:41 -05:00
12a26453e9 InputCommon/ControlGroup.h: Add missing include 2019-05-08 21:03:11 +02:00
7eaece8814 InputCommon/Device.cpp: Add missing include 2019-05-08 21:02:26 +02:00
98d808ab71 InputCommon/DInput.h: Add missing include 2019-05-08 21:01:46 +02:00
ff972e3673 Reformat repo to clang-format 7.0 rules 2019-05-06 18:48:04 +00:00
ab9ece9bca Replace MathUtil::Clamp with std::clamp 2019-05-04 23:12:17 +02:00
99f537d499 WiimoteEmu/DolphinQt: Better extension display names. 2019-05-01 17:25:48 -05:00
57a23cc4a0 InputCommon: Remove unused "sign" macro. 2019-04-29 18:28:56 -05:00
9f0dc402f4 InputCommon: Make sure setting values are initialized in case they are used before config load. 2019-04-27 07:01:24 -05:00
ba1b335118 WiimoteEmu: Improve emulated swing. 2019-04-23 19:02:41 -05:00
4374600367 WiimoteEmu: Implement MotionPlus parameter y0 and other cleanups. 2019-04-23 18:38:00 -05:00
8c1310d1d1 ControllerInterface/DInput: Optimize cursor position updating. 2019-04-20 09:25:11 -05:00
80d21b8ffb Merge pull request #8002 from JMC47/CursorSlowdown
Slow down relative input cursor
2019-04-15 20:43:31 -04:00
f3aaf5deaa Reduce Relative Input Cursor Speed Dramatically
This makes it about 1/4th the speed which may be a bit slow, but should
work for most controllers.
2019-04-15 17:23:17 -04:00
1cedbd5b82 Merge pull request #7923 from jordan-woyak/full-surface-rename
ControllerInterface: Rename full surface analog inputs.
2019-04-13 17:43:29 -04:00
be897b41a7 ControllerInterface: Rename full surface analog inputs to be more visually dissimilar from their underlying inputs. e.g. "Full Axis X+". 2019-04-13 08:45:19 -05:00
c89ddf8cba WiimoteEmu: Allow shake frequency and intensity to be configured. Other minor cleanups. 2019-04-12 16:50:59 -05:00
5efb717873 InputCommon: Clean up how numeric settings are handled. Add units of measure to UI. Eliminate hidden magic values of the IR cursor. 2019-04-07 09:32:49 -05:00
75e74315e6 Merge pull request #7689 from jordan-woyak/sdl-improve
ControllerInterface: SDL cleanups/fixes
2019-04-06 14:53:51 -04:00
2b6d718636 InputCommon: Fix Win32 init race. 2019-03-31 07:46:58 -05:00
735a705e4d Merge pull request #7776 from jordan-woyak/wm_devicechange
Add hotplug support to DInput and XInput controller backends
2019-03-30 18:41:46 -04:00
eadbdd6bc3 ControllerInterface/Win32: Prevent devcies from losing their "id" on a hotplug event. 2019-03-29 09:04:16 -05:00
d26c1ce24d Add hotplug support to DInput and XInput controller backends 2019-03-29 08:01:40 -05:00
92ca6e124e Add ControllerInterface::Win32 to wrap XInput and DInput 2019-03-29 08:01:39 -05:00
a015851b02 HW/SI: GCAdapter calibration fix. 2019-03-29 06:15:58 -05:00
c89139d75d Merge pull request #7903 from spycrab/imgui_np_chat
Add imgui-based Netplay Chat
2019-03-23 21:11:33 +01:00
672b582bec Merge pull request #7918 from spycrab/iokit_refactor
InputCommon/OSX: Refactor IOKit controller interface
2019-03-22 21:18:27 +01:00
80fd01c3c3 InputCommon/OSX: Refactor IOKit controller interface 2019-03-22 14:04:30 +01:00
0a1aacb5d0 Merge pull request #7906 from jordan-woyak/leak-fix
DolphinQt/InputCommon: Fix a few memory leaks.
2019-03-21 23:26:54 +00:00
61350b3d98 Core/Host: Allow frontends to block inputs 2019-03-21 13:16:21 +01:00