diff --git a/projects/ROCKNIX/packages/emulators/standalone/dolphin-sa/scripts/start_dolphin_gc.sh b/projects/ROCKNIX/packages/emulators/standalone/dolphin-sa/scripts/start_dolphin_gc.sh index dcaf989b3ba..ea423eeb5b1 100755 --- a/projects/ROCKNIX/packages/emulators/standalone/dolphin-sa/scripts/start_dolphin_gc.sh +++ b/projects/ROCKNIX/packages/emulators/standalone/dolphin-sa/scripts/start_dolphin_gc.sh @@ -406,10 +406,14 @@ SDL_DEVICE="${param_device}" MAPLINE="" if [ -n "${DEVICE}" ] && [ -f "${SDL_DB}" ]; then GUID_KEY="$(echo "${DEVICE}" | cut -c1-4)0000$(echo "${DEVICE}" | cut -c9-)" - MAPLINE="$(awk -F, -v k="${GUID_KEY}" '!/^#/ && NF>1 { - g = substr($1,1,4) "0000" substr($1,9) - if (g == k) { print; exit } - }' "${SDL_DB}")" + MAPLINE="$(awk -F, -v d="${DEVICE}" -v k="${GUID_KEY}" '!/^#/ && NF>1 { + if ($1 == d) { exact = $0; exit } + if (loose == "" && substr($1,5,4) == "0000") { + g = substr($1,1,4) "0000" substr($1,9) + if (g == k) { loose = $0 } + } + } + END { print (exact != "" ? exact : loose) }' "${SDL_DB}")" MAPPED="$(echo "${MAPLINE}" | cut -d, -f2)" [ -n "${MAPPED}" ] && SDL_DEVICE="${MAPPED}" fi diff --git a/projects/ROCKNIX/packages/emulators/standalone/dolphin-sa/scripts/start_dolphin_wii.sh b/projects/ROCKNIX/packages/emulators/standalone/dolphin-sa/scripts/start_dolphin_wii.sh index 91333848530..7430ad0cf31 100755 --- a/projects/ROCKNIX/packages/emulators/standalone/dolphin-sa/scripts/start_dolphin_wii.sh +++ b/projects/ROCKNIX/packages/emulators/standalone/dolphin-sa/scripts/start_dolphin_wii.sh @@ -369,10 +369,14 @@ SDL_DEVICE="${param_device}" MAPLINE="" if [ -n "${DEVICE}" ] && [ -f "${SDL_DB}" ]; then GUID_KEY="$(echo "${DEVICE}" | cut -c1-4)0000$(echo "${DEVICE}" | cut -c9-)" - MAPLINE="$(awk -F, -v k="${GUID_KEY}" '!/^#/ && NF>1 { - g = substr($1,1,4) "0000" substr($1,9) - if (g == k) { print; exit } - }' "${SDL_DB}")" + MAPLINE="$(awk -F, -v d="${DEVICE}" -v k="${GUID_KEY}" '!/^#/ && NF>1 { + if ($1 == d) { exact = $0; exit } + if (loose == "" && substr($1,5,4) == "0000") { + g = substr($1,1,4) "0000" substr($1,9) + if (g == k) { loose = $0 } + } + } + END { print (exact != "" ? exact : loose) }' "${SDL_DB}")" MAPPED="$(echo "${MAPLINE}" | cut -d, -f2)" [ -n "${MAPPED}" ] && SDL_DEVICE="${MAPPED}" fi diff --git a/projects/ROCKNIX/packages/virtual/emulators/sources/Start Dolphin.sh b/projects/ROCKNIX/packages/virtual/emulators/sources/Start Dolphin.sh index 7846c36e786..87b2d1dea5a 100644 --- a/projects/ROCKNIX/packages/virtual/emulators/sources/Start Dolphin.sh +++ b/projects/ROCKNIX/packages/virtual/emulators/sources/Start Dolphin.sh @@ -28,10 +28,15 @@ SDL_DB="${SDL_GAMECONTROLLERCONFIG_FILE:-/storage/.config/gptokeyb/gamecontrolle SDL_DEVICE="${param_device}" if [ -n "${DEVICE}" ] && [ -f "${SDL_DB}" ]; then GUID_KEY="$(echo "${DEVICE}" | cut -c1-4)0000$(echo "${DEVICE}" | cut -c9-)" - MAPPED="$(awk -F, -v k="${GUID_KEY}" '!/^#/ && NF>1 { - g = substr($1,1,4) "0000" substr($1,9) - if (g == k) { print $2; exit } - }' "${SDL_DB}")" + MAPLINE="$(awk -F, -v d="${DEVICE}" -v k="${GUID_KEY}" '!/^#/ && NF>1 { + if ($1 == d) { exact = $0; exit } + if (loose == "" && substr($1,5,4) == "0000") { + g = substr($1,1,4) "0000" substr($1,9) + if (g == k) { loose = $0 } + } + } + END { print (exact != "" ? exact : loose) }' "${SDL_DB}")" + MAPPED="$(echo "${MAPLINE}" | cut -d, -f2)" [ -n "${MAPPED}" ] && SDL_DEVICE="${MAPPED}" fi for CFG in "${CONF_DIR}/Hotkeys.ini" "${CONF_DIR}/GCPadNew.ini" "${CONF_DIR}/WiimoteNew.ini"; do