CurryKitten / CurryKitten-Sim

FPV quad simulator
67 stars 7 forks source link

Rewrite Android joystick handler to have a "blacklist" of devices to ignore #96

Open CurryKitten opened 3 years ago

CurryKitten commented 3 years ago

Recently #95 was fixed as a result of the uinput-fpc showing up as a joystick. Whilst the fix allows users to carry on, and use joysticks if required it's a little bit clunky so as a future goal, I'd like to have a blacklist of joysticks that should be ignored as joysticks.

Really, this should be fixed by either Unity or Rewired, but Unity say "hey Android give it to us as a joystick, so who are we to do anything else" and Rewired says the same, but replace Android with Unity. Whilst neither want responsibility for deciding to override Android when it's saying "here, take this finger print reader... it's a joystick", this is clearly dumb.

The problem we face is that joysticks are assigned automatically to a player when discovered, and only in the event of two joysticks being presented do we give a choice. The touch controller doesn't count as a joystick (it's a custom controller which is different)

What I would intend to do (if in fact feasible) is manually handle joystick connects/disconnects and then decide what were going to do with it based on the name. Right now using the override, the joystick is actually appearing and then we're culling it afterwards.

No rush, as the workaround is fine and works, but I'd like to make it better.