Commit graph

583 commits

Author SHA1 Message Date
Chris Pritchard
9da9ba616b Use the IOHIDElement cookie as a part of the axis name for unknown axis. Previously the 'usage' value was used to identify the axis by name, but this is not unique. For example on a PS3 controller *all* axis other than the well known ones return a usage of '1' so there are 30 or more axis all named "1". This stops things such as analog triggers being usable.
Using the element cookie uniquely identifies each axis and allows them to be assigned successfully as controls
2016-10-30 10:36:53 +00:00
Léo Lam
39fd6dcd5b Fix missing includes
Aren't indirect includes great?
2016-10-07 23:46:41 +02:00
Léo Lam
fad17246db InputCommon: Fix formatting issues in Quartz
This wasn't caught by the lint script because it was broken (by me) at
some point :(

If it had been rebased, it wouldn't have passed lint
2016-10-03 18:59:52 +02:00
shuffle2
e38ddfd787 Merge pull request #4111 from EmptyChaos/startup-perf-langs
InputCommon: Fix slow startup on some Windows systems with language packs (Issue 9744)
2016-10-03 04:02:54 -07:00
shuffle2
2db2e88620 Merge pull request #4010 from leoetlino/relative-input
Add relative input for the Wiimote IR
2016-10-03 03:26:04 -07:00
shuffle2
2747fd3a0d Merge pull request #4102 from ligfx/quartz_input
Add Quartz/CoreGraphics controller interface for default k&m events
2016-10-03 03:13:58 -07:00
shuffle2
f71966866b Merge pull request #4230 from ligfx/build_vendored_libusb
Build vendored libusb with CMake if on Apple or not available system-wide
2016-10-02 21:17:01 -07:00
aldelaro5
f0aa9b3751 Reorganise a ton of logs level
Most of this commits changes performance decreasing logs from info to debug and also cleans up innacurate levels.
2016-10-01 15:50:28 -04:00
Michael Maltese
a403e37901 always build an implementation of GCAdapter (either libusb or android) 2016-09-28 13:32:13 -04:00
Léo Lam
149654df5a Add a recenter control for Wiimote IR relative input
This adds a recenter control binding which allows recentering the
cursor when relative input is enabled.

(EnableSettingControl is renamed to avoid confusions.)
2016-09-24 15:57:47 +02:00
Léo Lam
5cf07fdfbf Add relative input for the Wiimote IR
This adds an option to enable relative input for the Wiimote IR
as described in issue 9014.

Enabling it will result in the pointer not going back to the centre
and the inputs will control the direction, not the absolute position.

Also adds a Dead Zone setting which is really needed when relative
input is enabled to prevent the cursor from slowly drifting on
most controllers. (Note: the Deadzone setting has no effect when
relative input is disabled)
2016-09-24 15:57:46 +02:00
Scott Mansell
62d7a698da Merge pull request #4145 from tenthmile/WiiOrientationModifier
Emulated Wiimote Orientation Modifier
2016-09-07 14:20:02 +12: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
Jasper St. Pierre
2b640a4f7d XInput2: Only do a round trip when the mouse has moved
This should cut down on round trips and blocking calls dramatically
during gameplay.
2016-09-04 10:44:22 -07:00
Tim Maile
3266bf052a Toggle and Switches for upward/sideway WiimoteEmu 2016-08-28 12:47:24 +02:00
EmptyChaos
17e4bd9575 InputCommon: Fix slow startup on some Windows systems
Rewrite GetXInputGUIDS to use SetupAPI instead of WMI Queries. When
using a language pack where the system language and user/program
language differ, Windows starts taking a VERY long time (10+ seconds)
to complete Queries for Win32_PNPEntity objects (it's probably
translating every single string since it transfers every single one
from the WMI server into memory in the program).

Fixes Issue 9744.
2016-08-11 09:30:36 +10:00
Michael Maltese
0f5951e324 And pull KeycodeToName into its own function 2016-08-09 19:59:45 -07:00
Michael Maltese
d1594f9529 use a std::map instead of running through the AOS 2016-08-09 19:54:59 -07:00
Michael Maltese
a5cc054bd1 use std::to_string instead of sstream 2016-08-09 17:45:41 -07:00
Michael Maltese
6097d30288 clang-format and cleaning up Key::GetName 2016-08-09 17:23:30 -07:00
Michael Maltese
3889e4d4b2 style fixes 2016-08-09 15:52:02 -07:00
Michael Maltese
3dc8136e14 Add Quartz/CoreGraphics controller interface for default k&m events 2016-08-08 09:38:22 -07:00
Lioncash
041f4f5eea GCAdapter: Return input state by value 2016-08-01 21:27:51 -04:00
Léo Lam
77fab5940c InputConfigDiag: Don't prevent closing dialog if device not found
There is no reason to prevent the user from closing the config dialog
if the device is not found. It's not very good UX…

Also fixes ExpressionParser to return NO_DEVICE if the device doesn't
exist instead of SUCCESS.
2016-07-30 10:00:55 +02:00
Léo Lam
135641404a evdev: Add hotplugging support
This adds hotplugging support to the evdev input backend. We use
libudev to monitor changes to input devices in a separate thread.
Removed devices are removed from the devices list, and new devices
are added to the list.

The effect is that controllers are usable immediately after plugging
them without having to manually refresh devices (if they were
configured to be used, of course).
2016-07-29 17:18:40 +02:00
Léo Lam
3926db624d ControllerInterface: Don't block on UpdateInput()
Changes UpdateInput() to skip if we can't lock the mutex, instead of
potentially blocking the CPU thread and causing a short but noticeable
frame drop.
2016-07-29 17:18:40 +02: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
0e1aeedb5b Fix warnings
This fixes warnings in:
- Source/Core/InputCommon/ControllerEmu.h: avoid shadowing other
  variables (my fault)
- Source/Core/Core/IPC_HLE/WII_IPC_HLE.h: made
  SDIO_EventNotify_CPUThread static as it's not used anywhere else
2016-07-18 23:38:42 +02:00
Léo Lam
788e19f54d ControllerInterface: Make the ID assigning code common
This makes the device ID assigning code common to all backends, by
moving it to AddDevice() instead of copy-pasting or replicating
the logic in the backends.

Also, to prepare for hotplugging, instead of relying on a name usage
count, the new ID assigning system always starts from ID 0 and tries
to assign the first ID that is not used.
2016-07-14 10:50:53 +02:00
Pierre Bourdon
89a03174cc Merge pull request #4001 from leoetlino/split-controller-setting
ControllerEmu: Split the Setting class
2016-07-13 13:59:59 +02:00
Matthew Parlane
3f9a98ddf2 Merge pull request #3979 from JosJuice/use-g_want_determinism
Use g_want_determinism more
2016-07-13 18:56:23 +12:00
Léo Lam
5e829f4527 ControllerEmu: Split the Setting class
The Setting class was used for both numeric values and booleans, and
other parts of the code had hacks to make it work with booleans.

By splitting Setting into NumericSetting and BooleanSetting, it is
clear which settings are numeric, and which are boolean, so there is
no need to guess by checking the default values or anything like that.
Also, booleans are stored as booleans in config files, instead of 1.0.
2016-07-12 11:42:18 +02:00
Scott Mansell
e0839a9478 Strip whitespace from Evdev and OSX controller names. 2016-07-12 14:19:07 +12:00
Léo Lam
6cc4591226 evdev: Clamp axis values to the 0.0-1.0 range
The values are expected to be in the 0.0-1.0 range (as indicated by the
comment), and other parts of Dolphin also expect it to be in that range
since the "full" axis has a -1.0 to 1.0 range.  However, this is not
always the case and fvalue can end up being outside of the range. This
clamps fvalue to always be in the 0.0 and 1.0 range.
2016-07-11 14:00:09 +02:00
JosJuice
ce9622c426 Use g_want_determinism in code added by 8f0cbef
There's no reason this only should apply to netplay.
2016-07-05 20:58:44 +02:00
Mat M
cf50ed82bb Merge pull request #3943 from ShadowsFriend/nopch-fix
ControllerInterface: Include memory to fix building without pch
2016-06-26 02:13:47 -04:00
Lioncash
55916b963d Device: Use std::tie for DeviceQualifier's operator== 2016-06-25 23:45:37 -04:00
Christian Widmer
be922730b3 ControllerInterface: Include memory to fix building without pch
All affected files use shared_ptr but do not include memory which breaks
building without precompiled headers.
2016-06-26 05:42:29 +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
9b075556ea Fix a small formatting issue 2016-06-25 13:46:53 +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
Scott Mansell
2ec3a24e4e analytics: Collect less data about controllers.
The name field can contain personal information, particularly in the
case of bluetooth devices on OSX which get configured with the user's
full name.
2016-06-22 17:02:30 +12:00
Markus Wick
bb6604df76 Merge pull request #3805 from mathieui/gcadapter-unplug-crash
GCAdapter: improve thread safety
2016-05-19 22:58:06 +02:00
mathieui
1bbbe92cd2 GCAdapter: protect some more functions
Reset() and Setup() are not used outside of this namespace
2016-05-19 22:00:49 +02:00
mathieui
54b4efff6b GCAdapter: improve thread safety
make sure Reset() can’t be run concurrently with AddGCAdapter() or
ResetRumble() (which is called on other threads) which can cause
crashes (issue #9462)
2016-05-18 20:44:01 +02:00
mathieui
8f0cbefbe5 Disable part of the adapter features for netplay
In order to avoid desyncs
2016-05-12 23:31:51 +02:00
mimimi085181
fcd5170cff XInput: Apply Rumble/Motor output only on changes (again)
Disclaimer: I can't test if this works on xbox one controllers, i don't have one. But i have conformed that this UpdateMotors() is related to rumble for emulated wiimotes.

This partially reverts commit "XInput: Apply immediately as well" (1958a10b6f) from pr # https://github.com/dolphin-emu/dolphin/pull/1560

Hopefully this fixes the xbox one controller rumble issue:
https://bugs.dolphin-emu.org/issues/9071

And in theory it might reduce the used usb bandwidth, as it was originally intended before pr 1560.

@JMC47: Please do a good amount of testing, to see if this breaks rumble for wiimotes or gamecube controllers emulated with xinput devices.
2016-04-23 13:45:10 +02:00