USB Joystick driver

Discuss development specific to the Pi version of ADFFS
JonAbbott
Posts: 2013
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex

Re: USB Joystick driver

Post by JonAbbott » Sat Sep 15, 2018 7:21 pm

Voltmace Mouse Eliminator details (courtesy of RobC on StarDot):
Mouse movement is proportional so the farther the stick is from the centre, the faster the pointer moves. There are a couple of pots on the bottom that control the sensitivity in the x and y directions. The stick position controls the speed of movement so having the stick dead centre means the pointer doesn't move rather than the pointer being in the centre of the screen.
I'll probably add Voltmace emulation to ADFFS, its only applicable to a few legacy games and will need explicitly turning on only whilst those games are running.

richw
Posts: 84
Joined: Sat Sep 14, 2013 9:05 pm

Re: USB Joystick driver

Post by richw » Tue Sep 18, 2018 12:48 pm

Thanks for the USBDescriptor info - looks the same as my knock-off.

I've been reading and fiddling about, and I've now got the axes to be detected according to their function. So instead of listing axes as 0, 1, 2 etc. it will show X, Y, Z, Rx, Ry and so on. I have not been able to find out how to do the same for their directions.

I am thinking that I could improve the mapping so that it automatically maps up the X and Y axes to the legacy Joystick APIs. We can also define new variations on Joystick_Read that allow additional axes to be reported.

However, on my 360 controller at least, I have a X and Y axes (the sticks) and I have an X and Y hat-switch. So for some/most games, you would want to map the HAT X and Y axis up to the legacy Joystick API (rather than analogue X and Y). I am still mulling this over in my head - not sure:
  • what I can do automatically
  • what the default should be
  • if each stick and/or axis should be specified manually, so it's very granular
And than I can start thinking about how to address items 1, 2 and 3 on your list above. I think they are all do-able, but I want to get the basics right. I'm not convinced that different games will really need different axes mappings: all existing titles must just use X and Y, and it's up to the user which physical control they want for that, isn't it? I agree that the keyboard mapping needs doing for the keyboard-only games: as I understand it, you've done something in ADFFS for now, and I plan on adding 'action to key' mapping in USBJoystick at some point.

I have also put in some code to switch off the XBOX360 controller LEDs, but I don't know if it works, because my clone pad doesn't switch any LEDs on by default! I'll release a newer build at some point soon and you can give it a go on your real controller.

JonAbbott
Posts: 2013
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex

Re: USB Joystick driver

Post by JonAbbott » Tue Sep 18, 2018 6:58 pm

richw wrote:
Tue Sep 18, 2018 12:48 pm
I've been reading and fiddling about, and I've now got the axes to be detected according to their function. So instead of listing axes as 0, 1, 2 etc. it will show X, Y, Z, Rx, Ry and so on. I have not been able to find out how to do the same for their directions.
I'm pretty sure the PID standard defines the direction in one of the ID's.
richw wrote:
Tue Sep 18, 2018 12:48 pm
I am thinking that I could improve the mapping so that it automatically maps up the X and Y axes to the legacy Joystick APIs. We can also define new variations on Joystick_Read that allow additional axes to be reported.
We should probably resurrect the Joystick thread on ROOL and propose any changes.
richw wrote:
Tue Sep 18, 2018 12:48 pm
However, on my 360 controller at least, I have a X and Y axes (the sticks) and I have an X and Y hat-switch. So for some/most games, you would want to map the HAT X and Y axis up to the legacy Joystick API (rather than analogue X and Y).
For the purposes of legacy games, having the HAT alter the analogue X, Y axis returned by Joystick_Read would probably suffice, so you can use either the thumb stick or the HAT. The current Joystick API has no understanding of a HAT, so it would need extending if it were to be presented as a seperate input.
richw wrote:
Tue Sep 18, 2018 12:48 pm
I'm not convinced that different games will really need different axes mappings: all existing titles must just use X and Y, and it's up to the user which physical control they want for that, isn't it? I agree that the keyboard mapping needs doing for the keyboard-only games: as I understand it, you've done something in ADFFS for now, and I plan on adding 'action to key' mapping in USBJoystick at some point.
My thinking here was to have all games accepting a standard set of inputs, so you don't have to configure each game individually. So for example ADFFS knows that game X uses Z X P L RETURN which are mapped to Left, Right, Up, Down, Fire. In the Joystick configuration you're then mapping X Axis, Y Axis and Fire and ADFFS handles translating those to what the game expects. In other words, Up on the Joystick is always Up in a game irrespective of the game using keyboard, Acorn, RTFM, Voltmace.

This will be internally handled by ADFFS, so not something the user needs access to configure. The only configuration the user is doing is in the Joystick Configuration app, which is a global setting.
richw wrote:
Tue Sep 18, 2018 12:48 pm
I have also put in some code to switch off the XBOX360 controller LEDs, but I don't know if it works, because my clone pad doesn't switch any LEDs on by default! I'll release a newer build at some point soon and you can give it a go on your real controller.
You probably want to set the LED to Joystick 1, otherwise you won't know if it's on or off :? eMail it to me if you would like to do some testing before releasing it publicly.

Post Reply