-
Notifications
You must be signed in to change notification settings - Fork 344
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
HelpComponent: Display different help icons depending on controller #808
base: master
Are you sure you want to change the base?
Conversation
44aa6b8
to
56235c4
Compare
Thanks for sending this over, and apologies for the delay in getting to this. From reading the code, I am comfortable with the change. Two questions, though: Thoughts on that? |
No worries about the delay! Just as the second revision of the patch, the first version wasn't perfect either :) A big thank you for having a look!
For the sake of transparency, I can just mention briefly what I have been testing with: I have a keyboard, an Xbox One controller, and a 15+ year old PSX -> USB converter. So even though I have a few devices to play around with, I have not tested this with a real PlayStation controller. However, based on my Google results, PlayStation controllers seem to identify as "Sony DualShock" or similar, so simply searching (case-insensitive) for "sony" should work. Conclusively, if you have any alternative strategy, please let me know. Otherwise, just hang tight for the new patch set :) |
Got it. Sounds good. I don't have many controllers to test it either, as I only have a PS2 controller around, and then it's the arcade cabinet joysticks. If you'd want to send this over in the forums, maybe some people will be happy to test with other devices :) Let me know when it's ready for review then - I appreciate you taking the time here. Thank you! |
56235c4
to
abdbc54
Compare
Alright, here we go again! I've followed your advice and posted this request for test help to the forums! Let's see then :) From a code standpoint, I think I'm ready to have it reviewed (whenever it suits you). In summary, the changes to the latest patch-set set are:
|
I've tested this a bit and seems to work fine (P3 controller OK, DualShock 4 not ok, but see below). My only observation would be:
Just testing this, I noticed that the NB: you can take a look at some common controller names in the RetroArch joypad configurations. For instance, a Dualshock 4 will identify itself as a Wireless Controller when connected via Bluetooth. I think for now the name based detection is ok, if we're going to add Prod/Vendor IDs to the configuration (as proposed in #797), then we can filter by that also, allowing us to match some other controller models with similar Xbox or PS style (i.e. like HORI PS4 Mini Wired Gamepad or DUALSHOCK®4 USB Wireless Adaptor). |
For controller filtering, I forgot about the GUIDs calculated by SDL - they should work better for matching a certain controller (not just by name). The list included in libSDL for Linux starts here and covers quite a few controllers (and variations). |
Thank you @cmitu for the feedback and testing! I will rework the patch to address the points you have raised. And I will definitely check out that controller list you linked to! Just for my own sake, I will write down the plan then:
I'll let you guys know when I have my next attempt ready :) And thanks again! |
That's optional, was just my observation from testing the help icons. |
abdbc54
to
91aa335
Compare
Got some time over, so I had another attempt at this. Now in the latest change-set, the identification of the controller is made in InputManager at creation time by using the SDL_GameController API. Let's hope it works better/more robust this time! Also, regarding the |
Alright, this looks better and still works. I'm not sure why the other changes in The only thing I'm not sure is shipping Otherwise, looks good. |
Before this commit, all buttons shown in the help component would use the SNES layout, which wouldn't match when having plugged in an Xbox or Sony Playstation controller. If there are different kinds of controllers plugged in, the input mapping shown will be of the last used or inserted. The controller identification is done via the SDL gamecontroller API. The intention here is to help solving RetroPie#442, or at least most of it.
91aa335
to
819ecaf
Compare
I think if we can get away using the SDL provided API, we should. Otherwise, we risk to (poorly) reimplement what SDL has already done.
Done.
Not necessary, just one of those common anti-patterns you see (same is true for C++
Alright, thanks for the info, I wasn't aware of what SDL version that RetroPie bundled with! With that in mind, I have removed the gamecontrollerdb.txt for now. It should be trivial to reintroduce once we start shipping with a newer SDL version.
Nice! I think I have addressed all comments so far, but please let me know though if there are any adjustments to the latest patch set you'd like to make. |
Looks fine, re-tested again with a DS4, a DS3 and another (non Xbox/PS) controller and everything seems to be working fine. |
I've tried to compile this on an older (than current) SDL2 release and it fails with missing |
My testing environment is actually Debian Unstable, so no wonder if I have a very new version :) However, I interpret the 2.0.12 changelog that game controller support/identification appeared then? If so, then it shouldn't be that new (released originally 2020-03-11). Do you agree with that interpretation of the change log? Anyway, it's a bit unfortunate, if now RetroPie ships with libSDL version 2.0.12... how often is libSDL upgraded? I guess it has to be upgraded at some point? The reason I am asking is if it's worth doing the controller identification ourselves, or if we should just wait out a newer SDL version, where it's more or less done for us. Like I said in my earlier comment, I think there are clear benefits simply relying on what SDL provides. |
Yes, you're right, the function appeared earlier than 2.0.22. What was later (2.0.22) is the identifiers for My suggestion would be:
We tried one upgrade and had some regressions and some bugs and unfortunately that has stalled our uprading process. We may bump the version sooner than later.
Yes, I agree - I don't want to change from using |
Before this commit, all buttons shown in the help component would use the SNES layout, which wouldn't match when having plugged in an Xbox or Sony Playstation controller.
If there are different kinds of controllers plugged in, the input mapping shown will be of the last used or inserted.
The intention here is to help solving #442, or at least most of it.