diff --git a/scriptmodules/emulators/mupen64plus/mupen64plus.sh b/scriptmodules/emulators/mupen64plus/mupen64plus.sh index 8834f236b7..09224e7056 100755 --- a/scriptmodules/emulators/mupen64plus/mupen64plus.sh +++ b/scriptmodules/emulators/mupen64plus/mupen64plus.sh @@ -99,11 +99,13 @@ function remap() { # read retroarch auto config file and use config # for mupen64plus.cfg local file - local bind + local hotkeys_bind=( "" "" "" ) local hotkeys_rp=( "input_exit_emulator" "input_load_state" "input_save_state" ) local hotkeys_m64p=( "Joy Mapping Stop" "Joy Mapping Load State" "Joy Mapping Save State" ) local i local j + local product_id + local vendor_id iniConfig " = " "" "$config" if ! grep -q "\[CoreEvents\]" "$config"; then @@ -112,23 +114,38 @@ function remap() { fi local atebitdo_hack - for i in {0..2}; do - bind="" - for device_num in "${!devices[@]}"; do - # get name of retroarch auto config file - file=$(grep -lF "\"${devices[$device_num]}\"" "$configdir/all/retroarch-joypads/"*.cfg) - atebitdo_hack=0 - [[ "$file" == *8Bitdo* ]] && getAutoConf "8bitdo_hack" && atebitdo_hack=1 - if [[ -f "$file" ]]; then - if [[ -n "$bind" && "$bind" != *, ]]; then - bind+="," + for device_num in "${!devices[@]}"; do + # get the name of the retroarch auto config file + file=$(grep -lF "\"${devices[$device_num]}\"" "$configdir/all/retroarch-joypads/"*.cfg) + + # if we can't find the profile .cfg by name, try to match it using the vendor/product IDs + # handles the situation when joystick's SDL name is different than the udev name (SDL 2.0.14+) + if [[ ! -f "$file" ]]; then + vendor_id="$(