|
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +# Fix A30 RetroArch input mapping after restore |
| 4 | +# - Set input_menu_toggle_btn to nul so the Guide button path works |
| 5 | +# (old value "9" broke standalone menu button toggle) |
| 6 | +# - Add joypad _btn fallback values for hotkeys |
| 7 | +# (old configs only had keyboard bindings, no btn fallbacks) |
| 8 | + |
| 9 | +TARGET_VERSION="4.1.1" |
| 10 | + |
| 11 | +HELPER_FUNCTIONS="/mnt/SDCARD/spruce/scripts/helperFunctions.sh" |
| 12 | +if [ -f "$HELPER_FUNCTIONS" ]; then |
| 13 | + . "$HELPER_FUNCTIONS" |
| 14 | +else |
| 15 | + echo "Error: helperFunctions.sh not found" |
| 16 | + exit 1 |
| 17 | +fi |
| 18 | + |
| 19 | +RA_A30_CFG="/mnt/SDCARD/RetroArch/platform/retroarch-A30.cfg" |
| 20 | + |
| 21 | +if [ ! -f "$RA_A30_CFG" ]; then |
| 22 | + log_message "No retroarch-A30.cfg found, skipping A30 input fix" |
| 23 | + exit 0 |
| 24 | +fi |
| 25 | + |
| 26 | +log_message "Starting upgrade to version $TARGET_VERSION" |
| 27 | +log_message "Patching A30 RetroArch hotkey config" |
| 28 | + |
| 29 | +# Fix menu toggle btn: must be nul for Guide button autoconfig path |
| 30 | +sed 's|^input_menu_toggle_btn = .*|input_menu_toggle_btn = "nul"|' \ |
| 31 | + "$RA_A30_CFG" > "$RA_A30_CFG.tmp" && mv "$RA_A30_CFG.tmp" "$RA_A30_CFG" |
| 32 | + |
| 33 | +# Add joypad btn fallbacks for hotkeys (only replace nul values) |
| 34 | +for pair in \ |
| 35 | + "input_enable_hotkey_btn:6" \ |
| 36 | + "input_exit_emulator_btn:0" \ |
| 37 | + "input_fps_toggle_btn:2" \ |
| 38 | + "input_load_state_btn:4" \ |
| 39 | + "input_save_state_btn:5" \ |
| 40 | + "input_screenshot_btn:1" |
| 41 | +do |
| 42 | + key="${pair%%:*}" |
| 43 | + val="${pair##*:}" |
| 44 | + sed "s|^${key} = \"nul\"|${key} = \"${val}\"|" \ |
| 45 | + "$RA_A30_CFG" > "$RA_A30_CFG.tmp" && mv "$RA_A30_CFG.tmp" "$RA_A30_CFG" |
| 46 | +done |
| 47 | + |
| 48 | +log_message "Upgrade to version $TARGET_VERSION completed successfully" |
| 49 | +exit 0 |
0 commit comments