-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Developed by @NewCreature to make enumerating connected joysticks mor…
…e robust. The current implementation assumes each HID device is one controller/joystick. The patch fixes this by interpreting each collection reported by the device as a separate controller/joystick (this is part of the USB HID spec). The names of the various elements are generated from the data reported by the HID device.
- Loading branch information
Showing
1 changed file
with
183 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0828211
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I figured that might happen. Let's add an allegro5.cfg switch that will by default revert to the old button order (hopefully the old order is possible to reconstruct using the new code?).
0828211
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a look too, sorry about that.
0828211
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, didn't know the driver situation for the 360 controller on Mac had been addressed or I would have tested my 360 controller (you previously had to install an unsigned driver and disable an OS security feature just to use the controller).
I tested this out and the controller is being split up into two ALLEGRO_JOYSTICKs by the current code. Digging deeper, the driver reports 3 collections. The first collection has no inputs, the second has 2 inputs, and the third has 24 inputs. The current Allegro code is splitting this up according to my understanding of how HID collections work. Either my understanding is wrong (maybe there is more that needs to happen when looking at a collection), or the 360 driver is using collections incorrectly.
I tried the current Allegro code in one of my projects that allows custom controller binding and was able to bind and use the 360 controller as normal (chose an action and press the button/axis on the controller to bind to action) so the code is working for the most part.
Since my 360 controller is a Guitar Hero X-plorer, I'm not 100% sure what the second collection actually is (the above-mentioned collection that has 2 inputs). All the inputs on my controller are on the second ALLEGRO_JOYSTICK, which is all the inputs in the third collection. It could be that the second collection is something that is supposed to be ignored.
0828211
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added #662 with these changes reinstated so we don't forget about them. I don't have an XBox controller to test with however...
0828211
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably better to leave it rolled back for now. Most people are going to be plugging in single-gamepad devices, which work fine with the old implementation. I'll get back to work on this at some point unless someone beats me to it. I think I can get everything working with just one implementation, but I don't have to have this working for at least a few more months.
It might be a good idea to pull the code that copies the device and element names into the joystick struct and apply it to the old implementation. That would at least provide some improvement without messing up the functionality.
0828211
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds like a good idea. I can do that.