Commit graph

29 commits

Author SHA1 Message Date
David Khachaturov
25d3fdbe20 Separate swap buttons out into swapAB and swapXY.
For https://github.com/huphuphup
2019-04-12 13:52:45 +01:00
Idan Weizman
c0db76d738 Fix stick casting overflow. 2019-03-13 09:30:24 +02:00
David Khachaturov
95f1b2bbde Began implementation of 3rd party controller support 2019-02-03 16:16:00 +00:00
Jun Wu
390313b3da Fix Rumble feature for bluetooth devices
When rumble_obj.t >= 0, SendRumble should be frequently called to make
Rumbling actually work.
2019-02-02 21:47:21 -08:00
David Khachaturov
c8e98cc86e Adjusted wait timing to allow for rumble (seems to not have re-introduced lag; more testing needed)
More joycon joining bug-fixing (more like fixing my bad coding)
2019-02-02 15:52:23 +00:00
David Khachaturov
235aca5f75 Allow for more than 1 pair of joycons to join up (could be buggy)
Change some colours
2019-02-02 15:19:03 +00:00
David Khachaturov
c8e0f93d54 Adjusted previous commit to prevent USB timeout 2019-02-02 14:01:14 +00:00
Jun Wu
5dd969da05 Read Joycon inputs in a non-blocking way
This makes sure ReceiveRaw() won't block forever, so Poll() has chance
to SendRumble().

Practically, it seems the Joycons frequently send inputs so it's not
necessary, at least for the bluetooth version I got.
2019-02-02 01:36:28 -08:00
Jun Wu
85f77cb91c SendRumble less frequently to reduce input lag
I was using two Joycons as a single controller. One (often right, sometimes
both, sometimes left) of the Joycons seems to have random lags.
This patch reliably removes the lag for me.

Potentially fixes #32.

More context:

I first excluded the possibility that the Bluetooth connection is lagging,
because when I click the "locate" button, both Joycons can rumble
immediately without lag.

Reading the existing issues seems to suggest something was wrong with
threading. When I tried moving both Joycons' "Poll" to a single thread,
by calling both ReceiveRaw() and other.ReceiveRaw() in a single Joycon
Poll thread, and removing "lock { ...}"s), lag still exists.

I then suspected the I/O loop is too busy so the code does not have time
to consume events in time. By adding some debug prints, I was able to
confirm that at the time the code receives an event (after hid_read),
it was already too late. However, it is strange that a) hid_read almost
always returns immediately, b) a single "poll" still takes a few
milliseconds. Finally, I found "SendRumble" is the culprit causing
the majority of the few milliseconds delay. Therefore the patch.

The 5 seconds is not a scientific choice. It works for me. I don't have
a USB controller to test it right now.
2019-02-02 01:31:17 -08:00
David Khachaturov
a451fa94fc Added battery indicator in the form of a background colour (Green->Orange->Red->Dark Red->Black) and in UdpServer info.
Improved stick calculations. Thanks eWaster.
2019-01-24 18:28:49 +00:00
unknown
95a35e39bd prevent gyro drift on some controllers
On some original Nintendo controllers gyro drift occurs (moves
constantly to the right, for example).

Not dividing the neutral point by 2 seems to fix the problem, and
it doesn't seem to effect other controllers negatively (tested
with 8bitDo N30 pro and SF30 Pro).
2019-01-05 22:52:09 +01:00
David Khachaturov
68b6928d86 Fixed gyro in single joycon mode.
Added tooltip on button.
2018-08-23 16:36:55 +03:00
David Khachaturov
37aba95e81 Added ability to toggle for single/double joycon mode.
Reworked UI further.
Final commit for v5.
2018-08-23 15:48:19 +03:00
David Khachaturov
be3c73bc96 Reworked UI.
Improved USB support.
Improved rumble.

(all in all, the program is becoming actually nice to use)
2018-08-22 12:52:41 +03:00
David Khachaturov
64946ed444 Implemented Progressive Scan. (can leave program running and (dis)connect controllers whenever)
Fixed controllers timing out randomly.
2018-08-18 20:52:34 +03:00
David Khachaturov
82fbf36796 Added new configuration manager.
More misc changes.
2018-08-18 14:21:20 +03:00
David Khachaturov
9509e44ae3 Fixed Pro Controller timing out on USB mode due to new rumble implementation.
Fixed Pro Controller sticks. (broken due to single joycon mode)

Finally made program close correctly every time / start correctly every time.
2018-08-14 10:42:00 +03:00
David Khachaturov
c296b5cf2e Added options to turn off HidGuardian and XInput emulation 2018-07-27 09:54:08 +03:00
David Khachaturov
00e51bc4d1 Added single joycon mode. (v5 progress) 2018-07-16 22:03:51 +03:00
David Khachaturov
db90d8357b Version 4 - Added HidGuardian support and implemented a GUI 2018-05-02 18:57:47 +01:00
David Khachaturov
a0bc1eaafc Fixed swapping buttons not working on Joycons 2018-03-20 16:16:47 +00:00
David Khachaturov
31618200fc - Added a few more app settings.
- CemuHook correctly sees type of connection
2018-03-17 08:38:24 +00:00
David Khachaturov
854aa02c2f Added XInput Support using ViGEm.
- Rumble support
 - Ability to rebind keys
 - No longer need to use "Also use for axes/buttons"
 - System-wide compatability (use your joycons with Steam, or something)
 - Requires ViGEm driver (provided in release)
2018-03-15 17:14:54 +00:00
David Khachaturov
cef25dd28f - Fixed v2 breaking USB support 2018-03-06 13:54:43 +00:00
David Khachaturov
e850051957 - Added Joycon Support
- Further gyro changes
- Updated hidapi
2018-03-05 17:55:04 +00:00
David Khachaturov
20f1446751 Further improvements to gyro and proper timestamping (for real this time, I promise!)
Massive thanks to rajkosto!
2018-03-04 21:17:05 +00:00
David Khachaturov
0d5faa7668 Added USB support.
Improved BT connection - no longer have to dis/reconnect controller fully from PC after usage.
2018-03-04 17:38:59 +00:00
David Khachaturov
26714e7a2d Fixed shaky gyro scope.
- Implemented correct timestamps (microseconds instead of system ticks)
 - Cleaned up some code
2018-03-03 16:58:02 +00:00
David Khachaturov
c8bfdb2220 Add project files. 2018-02-27 22:11:58 +00:00