Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: niffiwan on July 23, 2014, 06:02:01 am
-
Just a quick note that as of SVN revision r10933, the number of valid buttons for a joystick has been raised from 32 to 98. See mantis 2651 (http://scp.indiegames.us/mantis/view.php?id=2651) for more details on the type of setup that the limit of 32 can cause a problem with.
Anyway, a side-effect of this change is that the "button numbers" for the joystick hat have changed. If you use a joystick hat then you'll need to remap the hat otherwise it'll stop working. New pilots won't have this issue, their hat will be set to the normal defaults (i.e. controlling the view).
-
I noticed that Mantis comment, and have two questions:
1) Why couldn't the additional buttons have been added without changing the hat indexes?
2) Could you add a feature that will detect when a pilotfile has only 32 button bindings, and change the hat binding on-the-fly before the pilotfile is re-saved with the 98 bindings?
Because this change affects basically everybody who uses a joystick with four buttons. The default binding includes the hat, and suddenly people are going to find that their hat binding which previously worked fine has suddenly stopped working without them changing anything. It not only violates reverse compatibility, it also violates the principle of least astonishment.
-
r10933 doesn't conflict with SDL Everywhere, but it appears that simply bumping up the MAX_BUTTONS would only cause headaches on the pilotfile side of things.
SDL 2.0 splits off the hat input devices from the button array, and naturally so should FSO if more of the SDL features are to be implemented. What this means for the pilotfile side of things is that it'll only have to do one conversion instead of needing to convert to the larger button array before converting to SDL hat mappings.
This means that the whole bit of the controlsconfig code needs something of an overhaul, which is a part of what I'm looking into with my multiple joysticks support branch. And yes, I do need to hurry up. :banghead:
-
In addition to and expanding on what z64555 said:
1) Why couldn't the additional buttons have been added without changing the hat indexes?
There's a number of assumptions made about the hat buttons being at the end of the normal buttons. It may be possible to untangle it all, but I think it'd be finicky, easy to miss something and probably all replaced anyway once SDL everywhere arrives.
2) Could you add a feature that will detect when a pilotfile has only 32 button bindings, and change the hat binding on-the-fly before the pilotfile is re-saved with the 98 bindings?
That would be possible, but z64555 alluded to this would mean extra conversion code in addition to the one that'll probably be needed for SDL everywhere and/or the multiple joysticks revamp post SDL everywhere. I'd rather not carry that baggage forward forever where the benefit period would be short, and the number of people receiving the benefit would be low (i.e. those with 32+ buttons and *not* using virtual joystick software).
Because this change affects basically everybody who uses a joystick with four buttons. The default binding includes the hat, and suddenly people are going to find that their hat binding which previously worked fine has suddenly stopped working without them changing anything. It not only violates reverse compatibility, it also violates the principle of least astonishment.
I was originally of the opinion that it was a trivial expectation to remap the hat, but you raise some good points. Therefore (and I discussed this in more detail with z64555 on IRC today) I'd prefer at this stage to revert r10933, close the mantis ticket and leave increasing the max joystick buttons to be done post SDL everywhere when multiple joystick support is added.
-
I was originally of the opinion that it was a trivial expectation to remap the hat, but you raise some good points. Therefore (and I discussed this in more detail with z64555 on IRC today) I'd prefer at this stage to revert r10933, close the mantis ticket and leave increasing the max joystick buttons to be done post SDL everywhere when multiple joystick support is added.
This sounds like a good plan.
-
Since this is in the current nightly what happens if you remap and then the change is reverted? Will this require remapping again?
-
Umm... it may cause a crash with the respective pilot since it may try to index beyond the size of the controls-config array - I'll put a note on that nightly to not use it.
-
I removed the threads so that nobody accidentally downloads them.