Commit Graph

956 Commits

Author SHA1 Message Date
Lioncash 24f5acf9a5 InputCommon/CMakeLists: Specify headers in target sources 2019-05-31 06:54:25 -04:00
Léo Lam 00ecfb3c59
Merge pull request #8138 from lioncash/input-string
ControllerInterface/Device: Minor cleanup
2019-05-30 14:33:53 +02:00
Lioncash 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
Lioncash 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
Lioncash 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
Lioncash 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
Vincent Duvert 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
Vincent Duvert 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
Vincent Duvert 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
Vincent Duvert 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
Vincent Duvert 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
weihuoya 0dec8feadb android: thread local env 2019-05-29 20:22:26 +08:00
Léo Lam 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
Léo Lam 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
Artemis Tosini 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
spycrab ec734065db
Merge pull request #8087 from spycrab/cmake_win2019
Support CMake on Windows
2019-05-14 21:07:26 +02:00
Jordan Woyak 374585f128 WiimoteEmu/DolphinQt: Rename "IR" to "Point" and eliminate redundant Forward/Backward mappings. 2019-05-08 20:27:41 -05:00
spycrab 12a26453e9 InputCommon/ControlGroup.h: Add missing include 2019-05-08 21:03:11 +02:00
spycrab 7eaece8814 InputCommon/Device.cpp: Add missing include 2019-05-08 21:02:26 +02:00
spycrab 98d808ab71 InputCommon/DInput.h: Add missing include 2019-05-08 21:01:46 +02:00
Techjar ff972e3673 Reformat repo to clang-format 7.0 rules 2019-05-06 18:48:04 +00:00
Léo Lam ab9ece9bca Replace MathUtil::Clamp with std::clamp 2019-05-04 23:12:17 +02:00
Jordan Woyak 99f537d499 WiimoteEmu/DolphinQt: Better extension display names. 2019-05-01 17:25:48 -05:00
Jordan Woyak 57a23cc4a0 InputCommon: Remove unused "sign" macro. 2019-04-29 18:28:56 -05:00
Jordan Woyak 9f0dc402f4 InputCommon: Make sure setting values are initialized in case they are used before config load. 2019-04-27 07:01:24 -05:00
Jordan Woyak ba1b335118 WiimoteEmu: Improve emulated swing. 2019-04-23 19:02:41 -05:00
Jordan Woyak 4374600367 WiimoteEmu: Implement MotionPlus parameter y0 and other cleanups. 2019-04-23 18:38:00 -05:00
Jordan Woyak 8c1310d1d1 ControllerInterface/DInput: Optimize cursor position updating. 2019-04-20 09:25:11 -05:00
JMC47 80d21b8ffb
Merge pull request #8002 from JMC47/CursorSlowdown
Slow down relative input cursor
2019-04-15 20:43:31 -04:00
JMC47 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
JMC47 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
Jordan Woyak 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
Jordan Woyak c89ddf8cba WiimoteEmu: Allow shake frequency and intensity to be configured. Other minor cleanups. 2019-04-12 16:50:59 -05:00
Jordan Woyak 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
JMC47 75e74315e6
Merge pull request #7689 from jordan-woyak/sdl-improve
ControllerInterface: SDL cleanups/fixes
2019-04-06 14:53:51 -04:00
Jordan Woyak 2b6d718636 InputCommon: Fix Win32 init race. 2019-03-31 07:46:58 -05:00
JMC47 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
Jordan Woyak eadbdd6bc3 ControllerInterface/Win32: Prevent devcies from losing their "id" on a hotplug event. 2019-03-29 09:04:16 -05:00
Michael M d26c1ce24d Add hotplug support to DInput and XInput controller backends 2019-03-29 08:01:40 -05:00
Michael M 92ca6e124e Add ControllerInterface::Win32 to wrap XInput and DInput 2019-03-29 08:01:39 -05:00
Jordan Woyak a015851b02 HW/SI: GCAdapter calibration fix. 2019-03-29 06:15:58 -05:00
spycrab c89139d75d
Merge pull request #7903 from spycrab/imgui_np_chat
Add imgui-based Netplay Chat
2019-03-23 21:11:33 +01:00
spycrab 672b582bec
Merge pull request #7918 from spycrab/iokit_refactor
InputCommon/OSX: Refactor IOKit controller interface
2019-03-22 21:18:27 +01:00
spycrab 80fd01c3c3 InputCommon/OSX: Refactor IOKit controller interface 2019-03-22 14:04:30 +01:00
Tilka 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
spycrab 61350b3d98 Core/Host: Allow frontends to block inputs 2019-03-21 13:16:21 +01:00
Jordan Woyak b53636827b ControllerInterface: Unbreak DirectInput POV Hats having bad values on init. 2019-03-19 16:05:49 -05:00
Jordan Woyak 725d34b2f0 DolphinQt/InputCommon: Fix a few memory leaks. 2019-03-17 18:31:41 -05:00
Jordan Woyak 0bdfa19650 ControllerInterface: SDL: Replace unclear bool parameter with enum class. 2019-03-17 08:53:53 -05:00
Jordan Woyak 4fb68c530b ControllerInterface: SDL cleanup and FF effect fixes. 2019-03-17 08:53:13 -05:00
JMC47 011ecd92e8
Merge pull request #7829 from jordan-woyak/detect-input-improve
ControllerInterface/DolphinQt: Improve input detection.
2019-03-13 19:00:24 -04:00
Tilka a865cc0bf6
Merge pull request #7806 from jordan-woyak/wiimote-emu-swing-improve
WiimoteEmu: Reimplement tilt/swing/camera/orientation data using matrix math.
2019-03-05 23:37:00 +00:00
Jordan Woyak c389d68186 ControllerInterface/DolphinQt: Make mapping "all devices" way less hacky. 2019-03-03 18:39:02 -06:00
Jordan Woyak 48b69ca018 ControllerInterface: Input detection improvements. 2019-03-03 18:36:16 -06:00
Jordan Woyak 4db4840d7c WiimoteEmu: Reimplement tilt/swing/camera/orientation data using matrix math. 2019-03-03 12:43:25 -06:00
Jordan Woyak ecb67cf815 ControllerEmu: Deadzone math fix. 2019-03-01 17:40:10 -06:00
Tilka 131f4931fb
Merge pull request #7792 from jordan-woyak/auto-calibration
DolphinQt/ControllerEmu: Add stick calibration "wizard".
2019-02-13 02:13:27 +00:00
Tilka 8d59d1bb11
Merge pull request #7798 from ShFil119/impr/empty
Use empty instead of size
2019-02-13 01:59:43 +00:00
Filip Gawin 49fe9f5db1 Use empty instead of size 2019-02-13 00:03:49 +01:00
Jordan Woyak 0064f70c8a DolphinQt/ControllerEmu: Replace Input Radius/Shape settings with an input calibration "wizard". 2019-02-10 07:55:47 -06:00
Anthony e9130734af
Merge pull request #7688 from jordan-woyak/evdev-improve
ControllerInterface: evdev: Cleanups and effect processing fixes.
2019-02-03 10:25:23 -08:00
Jordan Woyak 9c1a8891e5 WiimoteEmu: Code cleanups. 2019-02-02 19:40:31 -06:00
Jordan Woyak 0d1fbe7bbc WiimoteEmu: Major renaming and cleanup. 2019-02-02 19:40:31 -06:00
Jordan Woyak 3bc4968c11 ControllerEmu: Round input floats instead of casting to prevent almost-neutral values from being rounded down. 2019-02-02 15:12:07 -06:00
zackhow 4979220cf0 Android: Optimize rumble call
Moved rumble call to IDCache since GetMethodID is expensive
2019-01-26 09:38:35 -05:00
zackhow d0b42286cf Load custom game IR values if they are not set
This is mostly for android so that a user can use the touchscreen to
accurately emulate pointer movements
2019-01-23 17:16:32 -05:00
zackhow 47d6406fd4 Android: Add touch to move pointer in overlay 2019-01-19 23:21:33 -05:00
Jordan Woyak 6cc8775510 ControllerInterface: evdev: Replace unclear bool parameter with enum class. 2019-01-17 12:10:50 -06:00
Jordan Woyak 52aa39991c ControllerInterface: evdev: Cleanup rumble effect processing so effects aren't removed and re-uploaded with every SetState() call. Split the "LeftRight" output into separate "Strong" and "Weak" outputs. Other minor cleanups. 2019-01-17 12:10:50 -06:00
Léo Lam e19ee2ad4f
Merge pull request #7664 from jordan-woyak/kill-button-threshold
ControllerEmu: Killed the button group threshold setting.
2019-01-16 21:33:05 +01:00
Léo Lam a8bc6f9899
Merge pull request #7693 from jordan-woyak/hotplug-callback-fix
ControllerInterface: Hotplug callback fixes.
2019-01-16 21:00:48 +01:00
Léo Lam b2de98cad1
Merge pull request #7680 from jordan-woyak/dinput-axis-range
DirectInput: Use more than 8 bits of precision on axis inputs.
2019-01-16 18:52:11 +01:00
Emmanuel Gil Peyrot fb6fae2b2b Flatten GCAdapter function
Make CheckDeviceAccess() more flat by inverting checks, reducing
indentation and removing dead code.
2019-01-16 14:20:00 +01: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
JMC47 012338288e
Merge pull request #7662 from jordan-woyak/mapping-indicators-make-pretty
ControllerEmu: Make mapping indicators pretty
2019-01-10 19:04:27 -05:00
JosJuice d3e1d2ea00
Merge pull request #7666 from jordan-woyak/input-shutdown-fix
ControllerInterface: Shutdown order and race condition fix.
2019-01-08 14:39:47 +01:00
zackhow 02c649ba20 Android: Change all analoginputs to just inputs
Android doesn't report values for the inputs generated by FullAnalogInput so
there isn't a reason to add them as such. This also avoids a bug(for android)
where if there are three inputs(say 12, 11, and 121), and you generate a FullAnalogInput
with 12/11 then it will create another input with the name 121 which can cause conficts
with the real 121 input. This is probably not an issue on PC since most Axis inputs
are named and not numbered.
2019-01-07 21:52:39 -05:00
Jordan Woyak a7c45fb49e DirectInput: Use more than 8 bits of precision on axis inputs. 2019-01-06 08:14:37 -06:00
JMC47 0ca9accd8b
Merge pull request #7640 from jordan-woyak/input-fixes
ControllerInterface: Output/Rumble fixes
2019-01-05 17:16:35 -05:00
Jordan Woyak a995e2f5ba ControllerInterface: Set DInput FF effect parameters sanely. This fixes a crash with periodic effects and my GCPad adapter (probably a divide by zero behind the scenes). 2019-01-05 13:00:04 -06:00
Jordan Woyak 25d43ffd98 ControllerInterface: Shutdown order and race condition fix. 2019-01-02 08:19:42 -06:00
Jordan Woyak df43fd9472 ControllerEmu: Killed the Buttons group threshold setting. 2018-12-31 08:35:31 -06:00
Jordan Woyak 7efa96eda9 ControllerEmu: code cleanup. 2018-12-30 10:52:45 -06:00
Jordan Woyak 7a00f55cfa ControllerEmu::Cursor: Add input radius/shape settings to IR Cursor mappings to allow use of round inputs in absolute mode. Make relative input option obey the center/width/height settings. Make the mapping indicator pretty and actually show what the relative/center/w/h settings are doing. 2018-12-30 09:10:32 -06:00
Jordan Woyak 247fa8c628 WiimoteEmu: Remove redundant threshold setting from hotkeys button group. 2018-12-29 16:19:28 -06:00
Jordan Woyak c3dc3c106c ControllerEmu: Reorganize stick reshaping code and use it for emu wiimote tilt as well. Also make the tilt mapping indicator pretty. 2018-12-29 16:06:03 -06:00
Jordan Woyak 6a6195f53c ControllerEmu: Implement dead zone setting for triggers. 2018-12-29 13:56:35 -06:00
Jordan Woyak c614f5f534 ControllerEmu: Allow analog stick input radius greater than one. Useful for rounded-square inputs of xbox controllers. 2018-12-27 19:16:37 -06:00
Jordan Woyak da9bcf83ef InputCommon: Simplified StickGate interface and moved class into its own file. Changed default input radius to perform no resizing. Tweaked the indicator colors a bit to improve visibility. Cleaned up some math and code. 2018-12-27 18:31:46 -06:00
Jordan Woyak ceb28a2302 Add ability to reshape analog sticks from square/circle to octagon and make the analog stick mapping indicator pretty. 2018-12-27 18:31:46 -06:00
Jordan Woyak 0f19c4a40f ControllerInterface: DInput: Update force feedback effects in a thread. This should prevent slowdowns experienced by a handful of users. 2018-12-24 19:40:58 -06:00
Jordan Woyak d5df56c677 ControllerInterface: Make CoalesceExpression not set the inactive child's value (rumble) to 0. This caused rumble to not enable when a control expression was both a valid "bareword" and "complex" expression. 2018-12-22 11:17:05 -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
Tillmann Karras 97cc9894e4 Update to Visual Studio's default Windows SDK 2018-10-20 00:53:08 +01:00
Tillmann Karras 79051a28c4 evdev: simplify code
No need to check write access if we call open() right after which checks
that anyway. Also only get the device name once.
2018-10-08 19:51:29 +01:00
Markus Wick 85961f996e
Merge pull request #7400 from zackhow/phone-rumble
Android: Add rumble for phone
2018-09-21 17:05:46 +02:00
Léo Lam e90bd035cb
Merge pull request #7262 from lioncash/force
ControlGroup: Return state data via GetState() by value where applicable
2018-09-16 16:04:21 +02:00
JosJuice a4f950ee86 Fix a string not getting translated 2018-09-08 15:16:39 +02:00
zackhow 126ff8dc5f Android: Add rumble for phone
This currently only supports using the internal vibrate on a phone for rumble.
2018-09-07 08:54:03 -04:00
Techjar 311d0442de InputCommon/XInput2: Increase mouse buttons to 32
Xlib supports many mouse buttons, though there are 9 standard buttons, and they aren't arranged like other mouse APIs. Using only 5 buttons was preventing the use of buttons besides left/right/middle click and the scroll wheel. Here's what all the standard buttons are:
1. left button
2. middle button (pressing the scroll wheel)
3. right button
4. turn scroll wheel up
5. turn scroll wheel down
6. push scroll wheel left
7. push scroll wheel right
8. 4th button (aka browser backward button)
9. 5th button (aka browser forward button)

The remaining button indices are non-standard and device-specific, and technically far more than 32 are supported, but this seems like a reasonable limit to avoid cluttering the list with tons of useless mouse buttons. What mouse has more than 32 buttons anyways?
2018-08-27 08:47:32 -04:00
Lioncash cfe7549091 ControlGroup/Triggers: Return state data by value
Makes it less error-prone to get state data from analog sticks (no need
to pass any locals), and also allows direct assignment, letting the
retrieved data be const.
2018-07-13 13:20:35 -04:00
Lioncash 97ba02df27 ControlGroup/Tilt: Return state data by value
Makes it less error-prone to get state data from tilt controls (no need
to pass any pointers to locals), and also allows direct assignment,
letting the retrieved data be const.
2018-07-13 13:20:35 -04:00
Lioncash 918d448b5b ControlGroup/Slider: Return state data by value
Makes it less error-prone to get state data from sliders (no need
to pass any locals), and also allows direct assignment, letting the
retrieved data be const.
2018-07-13 13:20:35 -04:00
Lioncash 4c30b9e14d ControlGroup/Force: Return state data by value
Ensures that an array of sufficient size is always used and doesn't put
the responsibility on the caller. It also allows for direct assignment.
2018-07-13 13:20:35 -04:00
Lioncash ef1240b0c7 ControlGroup/Cursor: Return state data by value
Makes it less error-prone to get state data from cursors (no need
to pass any pointers to locals), and also allows direct assignment,
letting the retrieved data be const.
2018-07-13 13:20:35 -04:00
Lioncash d05f490caa ControlGroup/AnalogStick: Return state data by value
Makes it less error-prone to get state data from analog sticks (no need
to pass any locals), and also allows direct assignment, letting the
retrieved data be const.
2018-07-13 13:20:31 -04:00
iwubcode bce8041cce Input: Allow per-game configuration to specify directories for input-profiles. If specified, the directories are searched recursively for inis 2018-07-07 13:02:39 -05:00
iwubcode 3b11066e61 Fix lint bugs 2018-07-07 13:02:38 -05:00
iwubcode 83c94feb3d Input: Trim profile names to allow spaces between ','s 2018-07-07 12:55:52 -05:00
iwubcode e10abaed3e InputConfig: Show display message when game specific input profile is loaded; matching how cycling works 2018-07-07 12:55:52 -05:00
iwubcode 14482a72af Input: Allow cycling to occur for each individual controller 2018-07-07 12:55:49 -05:00
iwubcode 485285eadc Input: Add cycling between game specific profiles 2018-07-07 12:39:08 -05:00
iwubcode 3969bf6d1c Input: Add hotkey to cycle the wiimote profile forward or backward
Co-authored-by:  Barath Kannan <barathsotd@gmail.com>
2018-07-07 12:39:08 -05:00
iwubcode 9f9afeb63e Wiimote Emulation: Be able to trigger swings consistently by holding down buttons. This makes certain actions easier (tested with Red Steel) 2018-07-07 00:49:47 -05:00
spycrab c7c93a8e80 ControllerEmu/BooleanSetting: Add exclusive flag 2018-07-02 15:15:23 +02:00
Léo Lam 48b7cfa75c
Merge pull request #7062 from robopilot99/master
Add auto-hide option to Wii IR pointer
2018-06-08 14:04:03 +02:00
JosJuice 1c027bc148 Use UICommon's game list code on Android
Deduplicates code, and gets rid of some problems the old code had
(such as: bad performance when calling native functions, only one
disc showing up for multi-disc games, Wii banners being low-res,
unnecessarily much effort being needed for adding more metadata).
2018-06-06 17:34:07 +02:00
robopilot99 ab02499ce7 Add auto-hide option to Wii IR pointer 2018-06-04 17:58:21 -05:00
Michael M 932ca644aa Add hotplug support to SDL2 controller backend 2018-06-04 17:50:08 +02:00
Michael M 7062967b5b SDLJoystick: store name on creation
Otherwise, Dolphin will crash when the joystick is removed.
2018-06-04 17:49:21 +02:00
Michael M 0eb47e1071 CMake: make SDL a private dep of InputCommon 2018-06-04 17:49:21 +02:00
Connor Roth 3e4725f390 THis fixes issue #08 and #16, the rumble test and slider 2018-04-19 17:48:55 -04:00
Léo Lam ee955e37a9
Merge pull request #6564 from JosJuice/translate-certain-button-names
Translate certain button names but not all
2018-04-14 23:20:39 +02:00
Léo Lam b1bbd8a50e
Merge pull request #6625 from lioncash/evdev-udev
InputCommon/CMakeLists: Include evdev and udev includes on a by-target basis
2018-04-13 20:50:31 +02:00
JosJuice 7ed28297b2 ControllerEmu: Use enum instead of bool for translatability 2018-04-13 13:04:26 +02:00
JosJuice 3f13dbe087 Translate certain button names but not all
Some button names should be translated, for instance Up, Left and such.
At the same time, some other button names shouldn't be translated,
for reasons that might be less obvious. In 0146456af, I removed the
_trans markers for button names that never need to be translated
(such as A and B), but that isn't actually enough to ensure that
DolphinWX won't try to translate them anyway. This commit adds a bool
that explicitly tells the GUI whether a button name should be translated.
Otherwise we'll have problems like the GUI treating the button name "B"
(which isn't supposed to be translated) as matching the translatable
string "B" (being an abbreviation of "bytes"), meaning that the button
"B" will be labeled "o" when running Dolphin in French (after
translations get pulled from Transifex the next time).

By the way, while it turned out that DolphinWX translated all button
names, it also turned out that DolphinQt2 translated *no* button names.
Go figure. This commit makes them consistent with each other.
2018-04-13 13:04:26 +02:00
spycrab 40bb9974f2 Reformat all the things! 2018-04-12 21:28:39 +02:00
Lioncash 73ebc190fa
InputCommon/CMakeLists: Link evdev and udev in privately
These libraries aren't directly used outside of InputCommon
2018-04-10 09:59:55 -04:00
Lioncash d63d0b5069
InputCommon/CMakeLists: Include evdev and udev includes on a by-target basis
Avoids including the evdev/udev includes in the top-level directory
2018-04-10 09:59:51 -04:00
Lioncash e93159e54a
CMakeLists: Link in system framework libraries explicitly on macOS
Makes our libraries explicitly link in which libraries they need.
This makes our dependencies explicit and removes the reliance on the
LIBS variable to contain the libraries that they need.
2018-03-30 16:14:10 -04:00
Lioncash b8a4ab23dd
InputCommon/CMakeLists: Link in ForceFeedback library explicitly on macOS
Makes an implicit dependency explicit. Also makes the macOS libraries link privately
as they aren't used in the exposed interface.
2018-03-29 11:53:50 -04:00
Lioncash 01308330d9
InputCommon/CMakeLists: Migrate off add_dolphin_library
Continues the migration work started in 3a4c3bbe01
2018-03-24 14:13:53 -04:00
Lioncash 50a476c371 Assert: Uppercase assertion macros
Macros should be all upper-cased. This is also kind of a wart that's
been sticking out for quite a while now (we avoid prefixing
underscores).
2018-03-14 22:03:12 -04:00
Anthony 8adce86daa
Merge pull request #6355 from myfreeweb/clang6-warning
Add -Wno-register to calm down clang 6.0.0 (C++17 mode)
2018-02-07 22:25:57 -08:00
Greg V 9b201815f2 Ignore -Wregister to calm down recent clang and GCC (C++17 mode)
The 'register' keyword is used by a header included from Xlib (X11/XKBlib.h).
2018-02-05 14:43:07 +03:00
Léo Lam 6a93223283 evdev: Always unref received udev devices
Whenever udev_monitor_receive_device() returns a non-null pointer,
the device must be unref'd after use with udev_device_unref().

We previously missed some unref calls for non-evdev devices.
2018-02-05 01:01:05 +01:00
Léo Lam 0822bb347d evdev: Don't leak eventfd on shutdown 2018-02-04 22:48:38 +01:00
Léo Lam 9a3705f82d evdev: Fix select() call
It's not guaranteed that the eventfd is smaller than the monitor fd,
because fds are not always monotonically allocated. To select()
correctly in all cases, use the max between the monitor fd and eventfd.
2018-02-04 22:45:28 +01:00
Emmanuel Gil Peyrot f5dc8e7737 Rename constructor parameters to avoid shadowing members 2017-12-19 12:05:06 +01:00
Leo Lam 4733bbd8f3
Merge pull request #6166 from ligfx/invokedeviceschangedcallbacks
ControllerInterface: cleanup callbacks API and logic
2017-12-15 21:05:17 +01:00
Michael M 6b7d5bb80c DeviceQualifier: small cleanup 2017-11-19 12:46:39 -08:00
Michael Maltese c62d83a34b GCPadEmu: only connected if default device connected
This lets Dolphin know if a configured GameCube Controller should actually
be treated as connected or not.

Talked to @JMC47 a bit about this last night. My use-case is that all of
my controllers are the same hardware (Xbox One controllers) so share the
same configuration (modulo device number). Treating them all as always
connected isn't a problem for most games, but in some (Smash Bros.) it
forces me to go find a keyboard/mouse and unconfigure any controllers
that I don't actually have connected. Hotplugging devices (works on macOS,
at least) + this patch remove my need to ever touch the Controller Config
dialog while in a game.

This patch makes the following changes:

- A new `BooleanSetting` in `GCPadEmu` called "Always Connected", which
  defaults to false.
- `ControllerEmu` tracks whether the default device is connected on every
  call to `UpdateReferences()`.
- `GCPadEmu.GetStatus()` now sets err bit to `PAD_ERR_NO_CONTROLLER` if
  the default device isn't connected.
- `SIDevice_GCController` handles `PAD_ERR_NO_CONTROLLER` by imitating the
  behaviour of `SIDevice_Null` (as far as I can tell, this is the only use
  of the error bit from `GCPadStatus`).

I wanted to add an OSD message akin to the ones when Wiimotes get
connected/disconnected, but I haven't yet found where to put the logic.
2017-11-19 16:07:00 +01:00
Michael Maltese 379e28b58c Add GCPadStatus.isConnected boolean 2017-11-19 16:01:08 +01:00
Michael Maltese bb1c794657 Remove unused GCPadStatus.err 2017-11-19 16:01:07 +01:00
Leo Lam 1e24a5f309
Merge pull request #6167 from ligfx/encapsulatedefaultdevice
EmulatedController: encapsulate default device behind getters/setters
2017-11-11 17:11:56 +01:00
Scott Pleb 0bede93daa evdev: Correctly calculate axis range for min values greater than 0.
Axis range was previously calculated as max + abs(min), which relies on the assumption that
min will not exceed 0. For (min, max) values like (0, 255) or (-128, 127), which I assume to
be the most common cases, the range is correctly calculated as 255. However, given (20,
235), the range is erroneously calculated as 255, leading to axis values being normalized
incorrectly.

SDL already handles this case correctly. After changing the range calculation to max - min,
the axis values received from the evdev backend are practically identical to the values
received from the SDL backend.
2017-11-11 02:07:04 -05: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