mupen64plus: update runtime hotkey configuration #3706
+35
−18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Mupen64plus start-up script adds 3 'hotkey' combinations for the connected joysticks by looking at the RetroArch auto-config profile(s) for the joysticks.
To handle cases when the SDL joystick name (used by Mupen64Plus) is different than the 'udev' name and the auto-config profile is not found just by looking at the filename, an additional search for the profile .cfg files was added - using the 'vendor' and 'product' IDs of the joystick. This takes advantage of the changes in e392c7a for the input configuration, which save 'vendor'/'product' IDs to the RetroArch's auto-config profile.
I re-organized a bit the hotkey bindings loop so it's indexed by the number of joysticks detected. This avoids searching for the auto-config profile 3 times (# of hotkey bindings), which can is more expensive when using
grep
to look up thevendor
/product
IDs. Since 'bind' is a reserved built-in in Bash, I renamed it tohotkeys_bind
, similar to the other arrays used for hotkeys set-up.