File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed
supplementary/emulationstation/configscripts Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -91,10 +91,15 @@ function update_overlays_retroarch() {
91
91
local dir=" $configdir /all/retroarch/overlay"
92
92
# remove if not a git repository for fresh checkout
93
93
[[ ! -d " $dir /.git" ]] && rm -rf " $dir "
94
- gitPullOrClone " $configdir /all/retroarch/overlay " https://github.com/libretro/common-overlays.git
94
+ gitPullOrClone " $dir " https://github.com/libretro/common-overlays.git
95
95
chown -R $user :$user " $dir "
96
96
}
97
97
98
+ function update_joypad_autoconfigs_retroarch() {
99
+ gitPullOrClone " $md_build /autoconfigs" https://github.com/libretro/retroarch-joypad-autoconfig.git
100
+ cp -a " $md_build /autoconfigs/." " $md_inst /autoconfig-presets/"
101
+ }
102
+
98
103
function update_assets_retroarch() {
99
104
local dir=" $configdir /all/retroarch/assets"
100
105
# remove if not a git repository for fresh checkout
@@ -141,6 +146,9 @@ function configure_retroarch() {
141
146
# install minimal assets
142
147
install_minimal_assets_retroarch
143
148
149
+ # install joypad autoconfig presets
150
+ update_joypad_autoconfigs_retroarch
151
+
144
152
local config=" $( mktemp) "
145
153
146
154
cp " $md_inst /retroarch.cfg" " $config "
Original file line number Diff line number Diff line change @@ -239,6 +239,9 @@ function map_retroarch_joystick() {
239
239
local value
240
240
local type
241
241
declare -A hat_map=([1]=" up" [2]=" right" [4]=" down" [8]=" left" )
242
+ iniGet " input_driver"
243
+ local input_driver=" $ini_value "
244
+ local autoconfig_preset=$( grep -rwl " $rootdir /emulators/retroarch/autoconfig-presets/$input_driver " -e " $DEVICE_NAME " | head -1)
242
245
for key in " ${keys[@]} " ; do
243
246
case " $input_type " in
244
247
hat)
@@ -260,8 +263,7 @@ function map_retroarch_joystick() {
260
263
value=" $input_id "
261
264
262
265
# workaround for mismatched controller mappings
263
- iniGet " input_driver"
264
- if [[ " $ini_value " == " udev" ]]; then
266
+ if [[ " $input_driver " == " udev" ]]; then
265
267
case " $DEVICE_NAME " in
266
268
" 8Bitdo FC30" * |" 8Bitdo NES30" * |" 8Bitdo SFC30" * |" 8Bitdo SNES30" * |" 8Bitdo Zero" * )
267
269
if [[ " $_atebitdo_hack " -eq 1 ]]; then
@@ -277,6 +279,16 @@ function map_retroarch_joystick() {
277
279
fi
278
280
key+=" _$type "
279
281
iniSet " $key " " $value "
282
+
283
+ # set button labels from autoconfig preset (if available), when binding matches the preset
284
+ if [[ -f " $autoconfig_preset " ]]; then
285
+ iniGet " $key " " $autoconfig_preset "
286
+ if [[ " $ini_value " == " $value " ]]; then
287
+ key+=" _label"
288
+ iniGet " $key " " $autoconfig_preset "
289
+ [[ -n " $ini_value " ]] && iniSet " $key " " $ini_value "
290
+ fi
291
+ fi
280
292
done
281
293
}
282
294
You can’t perform that action at this time.
0 commit comments