Skip to content

Commit b7d4386

Browse files
authored
emulationstation: fixes for the SDL2 gamecontrollerdb (#4045)
Based on the feedback from @protocultor: - add the correct Hat mapping value ('h' and not 'hat') - don't add automatically direction signs for axis mappings since they're only necessary in certain configurations. However the info from the ES file is not enough to determine those configurations, though they seem to be an exception rather than the norm. One case where the signs are needed seems to be when the D-Pad is mapped using axis, so that was left implemented.
1 parent ea8db8e commit b7d4386

File tree

1 file changed

+11
-6
lines changed
  • scriptmodules/supplementary/emulationstation/configscripts

1 file changed

+11
-6
lines changed

scriptmodules/supplementary/emulationstation/configscripts/sdl2.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,19 @@ function map_sdl2_joystick() {
8787

8888
case "$input_type" in
8989
axis)
90-
if [[ "$input_value" == "-1" ]]; then
91-
echo "$sdl2_mapped_input:-a${input_id}" >> "$input_temp_map"
92-
else
93-
echo "$sdl2_mapped_input:+a${input_id}" >> "$input_temp_map"
94-
fi
90+
# add the direction for D-Pads only
91+
if [[ "$sdl2_mapped_input" == "dp"* ]]; then
92+
if [[ "$input_value" == "-1" ]]; then
93+
echo "$sdl2_mapped_input:-a${input_id}" >> "$input_temp_map"
94+
else
95+
echo "$sdl2_mapped_input:+a${input_id}" >> "$input_temp_map"
96+
fi
97+
else
98+
echo "$sdl2_mapped_input:a${input_id}" >> "$input_temp_map"
99+
fi
95100
;;
96101
hat)
97-
echo "$sdl2_mapped_input:hat${input_id}.${input_value}" >> "$input_temp_map"
102+
echo "$sdl2_mapped_input:h${input_id}.${input_value}" >> "$input_temp_map"
98103
;;
99104
button)
100105
echo "$sdl2_mapped_input:b${input_id}" >> "$input_temp_map"

0 commit comments

Comments
 (0)