mist-devel / mist-binaries

Firmware and core binaries for the MIST board
202 stars 48 forks source link

Analogue sticks #76

Closed jotego closed 2 years ago

jotego commented 4 years ago

I am trying to add support for analogue sticks to use in the Forgotten Worlds arcade. I was thinking of moving the character using the d-pad and then rotating him with the analogue stick. But I see that MiST actually links both the d-pad and the analogue stick so I receive inputs for both at the same time. I tried connecting a dual analogue stick game pad but the second stick doesn't seem to be read.

On top of that, Forgotten Worlds is a two player game, so I actually need to do the same for the second character.

I can edit the user_io module provided the firmware already supports this. But does it? And how?

Thank you

gyurco commented 4 years ago

The firmware sends the digital joystick events as analogue ones, too (mapping to min-max values). If I understand you correctly, this is unwanted?

jotego commented 4 years ago

Yes, it is unwanted. Some game pads have a button to produce this effect so if we remove that in the firmware I guess users who like that can still enable it in their gamepads. Is it possible to read the second stick?

harbaum commented 4 years ago

Even digital Joysticks send "analogue like" signals over USB. So the firmware cannot distinguish between them. E.g. where a analogue joystick sends all values from -32768 to 32767 a digital one would only send -32768, 0 or 32767. But the firmware cannot know beforehand if the joystick will use the whole possible signal range or only three values.

gyurco commented 4 years ago

True. And I think it's no problem. You can use joystick_0 or joystick_analog_0 for controller0, and joystick_1 or joystick_analog_1 for controller 1 (or vica-versa, as controller numbers are swapped by default). You can decide if you need digital or analogue values. Probably Jose's problem is that only one of the controllers is recognized on a dual-controller pad. That's something with the USB HID handling, which I don't know much about. The linking of the D-pad and analogue part probably done in the controller itself. Or are they separate controls in Windows for example?

jotego commented 4 years ago

Yes, even if the left analog stick and the d-pad are linked, that's fine if I can use the right analog stick.

gyurco commented 4 years ago

Well, that would need checking the USB part, but I don't have such controller to test with. I suspect the two parts are multiplexed somehow, but I don't know how it's done.