Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement al_get_joystick_name() on MacOS. #1448

Merged
merged 1 commit into from
Aug 6, 2023
Merged

Implement al_get_joystick_name() on MacOS. #1448

merged 1 commit into from
Aug 6, 2023

Conversation

NewCreature
Copy link
Contributor

This commit implements retrieving the name of joystick devices on MacOS. This was implemented in a previous commit (0828211) and was apparently accidentally reverted in a subsequent commit (e18a22b).

I plan to go back over the original commit to see if any other changes from that commit need to be re-implemented.

@pedro-w
Copy link
Contributor

pedro-w commented Jun 16, 2023 via email

@NewCreature
Copy link
Contributor Author

Yeah, I had forgotten about that original PR and that a modified version of it was still hanging out here. That was 7 years ago. The project I was needing to fix the code for got put on hold. Now I'm trying to add joystick support to one of my current projects and thought I would just fix al_get_joystick_name() real quick since I noticed it wasn't implemented.

Joystick code in general is a mess since all the manufactures can't seem to follow the HID spec correctly. I didn't realize how bad it was since I wasn't trying to do autodetection back then. I fired up ex_joystick_events on the Steam Deck to see what it would report. Sure enough it was giving me the same messed up configuration I was getting under MacOS.

Apparently, the standard way to handle joysticks is to just assume people are using XBox 360 or compatible controllers and handling the axis/button configuration based on that assumption.

Should I go back to 0828211 to see if I can make that work? I still have the device that wasn't working properly back then and have added quite a few others that I can test with.

@SiegeLord
Copy link
Member

Thanks.

Apparently, the standard way to handle joysticks is to just assume people are using XBox 360 or compatible controllers and handling the axis/button configuration based on that assumption.

Should I go back to 0828211 to see if I can make that work? I still have the device that wasn't working properly back then and have added quite a few others that I can test with.

I'd love to have a system that detects XBox-like controllers and works across OSs. As it is now, I don't think this happens, e.g. my Logitech F310 splits its left thumbstick into two sticks.

@SiegeLord SiegeLord merged commit e62be5f into liballeg:master Aug 6, 2023
@NewCreature
Copy link
Contributor Author

NewCreature commented Aug 9, 2023

Unfortunately, the only way to get something that resembles detection is to keep a database of joysticks and have a remapping system.

I ended up implementing a remapping system into my own framework that sits on top of Allegro. The one thing that Allegro lacks is a way to get the joystick device identifier (vendor/product). If it had that, I would be able to support more joysticks with my remapping system. It looks like some work on this is already being done: #1426.

Currently, I'm just assuming controllers are XBox and allowing the user to remap if it is incorrect.

@MarkOates
Copy link
Contributor

Thanks for the merge @SiegeLord.

@NewCreature What types of name values can we expect from the al_get_joystick_name() here?

Currently, I'm just assuming controllers are XBox and allowing the user to remap if it is incorrect.

Thanks for this assumption, it happens to work for me.

Also, thank you for mentioning #1426, if you wish to work on it and move it forward that would be great 🙏. I'll help if I have bandwidth.

@NewCreature
Copy link
Contributor Author

al_get_joystick_name() currently gets the name as reported by the HID device itself. This is what I consider the expected behavior. For instance, my 8BitDo controller correctly reports itself as an 8BitDo controller even when set to XInput mode (at least under MacOS). The controls themselves are mapped like an XBox controller would be.

As for #1426, I would be happy to help with it if needed. What work is left to be done there?

@SiegeLord
Copy link
Member

Unfortunately, the only way to get something that resembles detection is to keep a database of joysticks and have a remapping system.

That's not what I meant. What I mean is, I am certain that XBox-like controllers all look the same to each OS, and Allegro should provide the same mapping across OS's. This is not the case right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants