ardaku / stick

Rust library for platform-agnostic asynchronous gamepad, joystick, and flightstick interaction
https://crates.io/crates/stick
Apache License 2.0
76 stars 14 forks source link

add more flydigi compatibility #51

Open zeddidragon opened 2 years ago

zeddidragon commented 2 years ago

This is more hacks for my dumb controller. There's two extra remapping TOMLs for the same controller, but while the first one was for the wired mode, these two are for the controller connected via the wireless dongle and via bluetooth. The assigned buttons as well as which buttons are available changes a lot in these modes, much to my chagrin.

In wireless mode, you lose access to ActionL and ActionR. The various extra buttons also ended up with different assignment which I've remapped to same as before.

In bluetooth mode, button assignment is seemingly random. I ended up assigning to some previous unused flight stick buttons as well as assigning some completely new ones when appropriate. The Z button (ActionD) showed up as 0x01C and, when pressed, would emit an Enter event on my computer. This prompted me to check https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode for inspirations to other keycodes of low values and I added KEY_SLEEP and KEY_ENTER when appropriate. The buttons werre just going to be remapped anyway, but they needed an intermediary to work.

In the existing scheme, the Exit and MenuL button assumed there wouldn't exist a separate back button. In bluetooh mode, Flydigi gives access to its three meta buttons, labeled ))), ⌂, and ↰ , exist along a pair of Select and Start buttons. I dubbed the ))) button Pair, as it's used for pairing and switching modes, and added Home for the ⌂, leaving ↰ as Exit. I probably won't use this configuration much myself, but some owners may not care for the gyro capabilities of the controller which this mode lacks and would thus prefer having access to all buttons instead.

In the original remapping, I assigned Pov to just Up/Down/Left/Right as those seemed the appropriate buttons for controller dpads.

AldaronLau commented 2 years ago

@zeddidragon Thank you for the PR! Quick glance, but this mostly looks good. I think I would rename Pair to Mode because if you're using it you're probably already paired, so that meaning doesn't make as much sense. Pretty weird about the bluetooth mappings.

zeddidragon commented 2 years ago

I would rename Pair to Mode

Sure, no problem. Appended this change to the pull request.

Pretty weird about the bluetooth mappings.

Flydigi Apex 2: Can't live with it, can't live without it. If I could find another controller that had all of these buttons + gyro aim I would've switched already. Even when switching to the modes that lack features, it still has more features than most controllers.