22 Commits
Author SHA1 Message Date
Evan D. Schoenberg, M.D. 1da0bbb974 Add OEHACOutputReportIDUSBSubcommandReply (same underlying value as OEHACInputReportIDUSBSubcommandReply) and use it to avoid a compilation error from incorrect enum type being used. 2025-07-06 08:11:28 -04:00
Daniele Cattaneo b1acf1454a Fix a data race in the Switch Pro Controller device handler. 2021-04-20 02:56:53 +02:00
Daniele Cattaneo 107bf6352d Refactor calibration methods in OESwitchProControllerHIDDeviceHandler to avoid name clashes with auto-calibration related methods. 2019-12-14 18:44:35 +01:00
Daniele Cattaneo 69a528a911 Fix a rare crash that could happen when quitting OpenEmu while a Switch Pro Controller is connected. 2019-12-13 23:00:38 +01:00
clobber 95a72bac60 Merge pull request #25 from piki/piki/auto-calibrate
Automatically calibrate analog axes
2019-12-09 23:58:10 -06:00
clobber ec66a54171 Fix issue #2326. fix the issues introduced in the previous fix for this issue. Now known controllers should work like before. 2019-12-03 19:44:45 -08:00
Daniele Cattaneo ed02a9a3a2 Fix a very rare crash when disconnecting a Switch Pro Controller. 2019-10-12 18:02:44 +02: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 1b82886d45 Do not lock up the main thread for 10 seconds when the same switch pro controller is connected both via USB and bluetooth at application launch. 2019-09-14 01:07:08 +02:00
Daniele Cattaneo bebee4746d Do not remove the wrong device handler when re-connecting a switch pro controller via bluetooth after removing the USB cable. 2019-09-12 21:26:46 +02:00
Daniele Cattaneo 4fda5a131a Periodically ping Switch Pro Controllers.
Not sure if it is necessary, but it's not like it costs us that much to do this
2019-09-10 18:28:33 +02:00
Daniele Cattaneo 13a8f6a97d Ensure that the same Switch Pro Controller is not simultaneously connected via multiple transports. 2019-09-10 02:07:58 +02:00
Daniele Cattaneo 9208bca298 Fix a bug in the validation code for Switch Pro Controller HID reports. 2019-09-10 01:39:49 +02:00
Daniele Cattaneo 2a55c3600c Use NSRunLoop instead of an auxiliary dispatch queue in the Switch Pro Controller code.
It's a bit risky but as long as we don't do it too much we should be fine. Also, there is no other choice if we have to make synchronous decisions based on the values returned by the controller (and we actually do).
2019-09-10 01:38:02 +02:00
Daniele Cattaneo f348bccb83 Some cleanup of the Switch Pro Controller code 2019-09-09 23:25:12 +02:00
Daniele Cattaneo 2c4bce32d4 Add initial support for the Switch Pro Controller when connected via USB 2019-09-09 17:52:39 +02:00
Daniele Cattaneo 3500b7681b Avoid circular references to OESwitchProControllerHIDDeviceHandler 2019-09-08 16:25:40 +02:00
Daniele Cattaneo e145d677ef Do not randomly disconnect switch pro controllers when closing a game.
Also, fix a comment which erroneously contradicted the code
2019-08-31 16:33:52 +02:00
Daniele Cattaneo ce01c3fd15 Put any connected Switch Pro Controller to sleep when closing OpenEmu 2019-08-31 01:30:40 +02:00
Daniele Cattaneo 35cc502c4b Some cleanup 2019-08-31 00:15:21 +02:00
Daniele Cattaneo 75d11f2436 Slight refactoring of -OE_deviceHandlerClassForIOHIDDevice: (and removal of unused functions) 2019-08-31 00:05:24 +02:00
Daniele Cattaneo 1fb8e2cdff Implement basic support for the Switch Pro Controller 2019-08-30 23:41:02 +02:00