Add fallback in case gamepad is not recognized
lethal-guitar opened this issue ยท 8 comments
To prevent users from getting stuck in the text viewer, add some fallback logic in case SDL doesn't have mappings for the gamepad, or doesn't detect any gamepad at all.
Suggestion:
- If no gamepad detected at all: Show a message like "No controller detected - quitting in 10..." and then count down 10 seconds before automatically closing.
- If gamepad detected, but SDL doesn't find mappings: Show a message "No mappings found for controller. Press any button to quit" and then use the SDL Joystick api to check for any button being pressed
@shantigilbert what do you think? Might be good to have as a safe guard for users with controllers that work in ES/Retroarch but not with SDL due to missing mappings
This is a great idea!
I am not too familiar with much of SDL coding, but does it automatically use gamecontrollerdb.txt if no mapping is found? or is there a way we can use that? this will help fixing the not mapped situation, or is this the same thing?
Yeah, it should automatically use the gamecontrollerdb.txt file as long as the SDL_GAMECONTROLLERCONFIG_FILE environment variable is set (which is the case for EmuELEC). So any controller that has a mapping specified in that file should work out of the box normally.
But it could happen that someone is using a controller that doesn't have an entry in the gamecontrollerdb.txt file, and in that case SDL would not recognize the controller even though we have that file :( I don't know how common this is, but that person I was talking to on Discord had a PS3 controller clone with a GUID that doesn't appear in the controller db file.
Unfortunately is very common for knockoff game-pads, but the solution is rather simple, we could write a WiKi on EmuELEC on how to add their own mapping, EmuELEC includes sdljoymap which helps in creating a mapping, then they just have to copy the result into the db file and it should (in theory) work :)
I will see if I can write a script to simplify this. although I am not sure yet how to properly do it.
That sounds good, then in case the text viewer sees that there's no mapping it could refer people to the Wiki in the error message as well
Script is done, it was easier than I though, but I think it would be great to have the timeout screen so it can be shown before, something like "You are about to add a mapping to the db file, if you opened this by mistake close it now, else wait 10 seconds to start mapping" Because right now it just go straight to the mapping and if you open it by mistake you have to wait for it to finish (which is around 5 seconds per button). In other words it needs fail-safe :P
This one should be closed now, no? or do you still want to add another layer?
Yeah now with your new mapping translation script it doesn't seem necessary anymore ๐๐ป