Commit Graph
18 Commits
Author SHA1 Message Date
Stuart Carnie b990e6496f chore: Fix compiler warnings about importing public headers 2020-07-26 07:45:00 -07:00
Stuart Carnie 82c34fd550 chore: Improve Swift ergonomics 2020-01-26 10:27:47 -07:00
Daniele Cattaneo 8ca6a436eb Fix handling of center value to restore behavior originally introduced in commit fbb49c7. Do not regress wrt commit 367241c by enabling/disabling auto-calibration independently on each axis direction. 2019-12-31 17:34:10 +01:00
Daniele Cattaneo 1591205112 Allow disabling auto-calibration from the device database. 2019-12-15 00:43:11 +01:00
Daniele Cattaneo 5812663036 Minor cleanup and removal of duplicated code. 2019-12-14 23:28:02 +01:00
Daniele Cattaneo ae7ded2f2e Move the rest of the axis calibration logic from OEHIDEvent to OEDeviceHandler 2019-12-14 23:09:36 +01:00
Daniele Cattaneo 367241c7b7 Enable auto-calibration only when the range of inputs seen is larger than the deadzone.
Fixes controllers that exhibit some jitter when the sticks are resting (for example the PS4 controller)
2019-12-14 18:42:35 +01:00
Daniele Cattaneo 38974f7ad7 Expose methods to allow modification of the current state of the auto-calibration system. 2019-12-13 22:45:52 +01:00
Patrick Reynolds fbb49c7a04 Learn only extremes, not the middle
Callers (i.e., OEHIDEvent) now pass an expected middle value to the
scaledValue function, so scaledValue doesn't have to learn the middle.  We
assume the middle is in fact the middle of the IOKit range for the HID
class.

This fixes the drift problem where the character would sometimes walk
slowly if the user had only fully trained the calibration in one direction
on an axis.

The only remaining limitation at this point is: you must run before you
can walk.  If you only ever push the joystick to 25%, the scaler will
assume 25% is the max and will scale it to +1.0 instead of +0.25.  I think
it's rare users will even notice (most games push the analog stick to its
extremes most of the time), and if they do, pushing the stick to its
extreme just once solves the problem.
2019-10-11 02:37:41 -04:00
Daniele Cattaneo f7b4c7dfed Add a way to override the default scaling for axis events 2019-08-30 23:41:02 +02:00
clobber 835ac771f6 Keep track of the Function (Fn) key state and also allow it to be bound.
This can be used for computer system plugins as a way to ignore system media key presses, so that F1-F12 keys may only register if Fn is pressed. The downside is this does not respect OS keyboard preferences if a user has changed the default settings, but seems to be the best we can do without relying on CGEventTap to track events which will require accessibility access. Attempted app-side workarounds by overriding sendEvent: or checking NSApp.currentEvent to block NSSystemDefined type NSEvent's proved to be useless due to syncing.
2018-10-07 17:44:06 -05:00
clobber 2118039958 Remove silly warning. 2016-10-09 17:29:08 -07:00
clobber 431195e021 Annotate binding and device classes. 2015-11-29 14:05:18 -08:00
clobber 379ee66b5a Fix issue with plugging/unplugging controllers while a game is running.
There are two issues in this case:
1. XPC messages are processed in a private queue making OEDeviceManager calls unsafe when retrieving device handlers. We solve this problem by making thread safe operations.
2. Sometimes we may receive binding updates on the emulator process before the process has had the time to recognize a device that is connected. This is solved by using placeholder device objects that we replace with real devices in OEHIDEvent when the device is finally parsed. This is possible because if a device is added to the UI process it will be added to the emulator process eventually.
2015-11-29 02:15:22 -08:00
clobber 3836c5bf82 Add a unique identifier to OEDeviceHandler. This allows multiple processes to uniquely identify a device across processes, later on OEDeviceHandler will be sent over XPC so we can move event handling in the emulator process instead. 2015-11-28 16:28:28 -08:00
clobber 73ea2c9eed Rename OEDeviceHandler name to product. 2014-03-01 23:09:17 -08:00
clobber 843b91d566 Also use device name to get device descriptions. 2014-03-01 17:30:43 -08:00
Remy Demarest a0434761d7 Move OpenEmuSystem and OpenEmuBase frameworks into their own project. 2013-04-07 00:21:09 -07:00