diff --git a/configuration.c b/configuration.c index e2560d1ba1..c32dd39157 100644 --- a/configuration.c +++ b/configuration.c @@ -8937,6 +8937,24 @@ bool config_save_autoconf_profile(const char *device_name, unsigned user) } } + /* The profile's own hotkeys: the port's binds never hold them, and a + * profile saved under a new name would lose them. */ + for (i = RARCH_FIRST_META_KEY; i < RARCH_BIND_LIST_END && valid; i++) + { + const struct retro_keybind *bind = input_autoconf_bind(dev, i); + const struct input_bind_label *lbl = input_autoconf_bind_names(dev, i); + const char *base = input_config_bind_map_get_base(i); + + if (!base) + continue; + save_keybind_joykey(conf, "input", base, bind, false); + save_keybind_axis(conf, "input", base, bind, false); + if (lbl->joykey && *lbl->joykey) + save_keybind_joykey_label(conf, "input", base, lbl); + if (lbl->joyaxis && *lbl->joyaxis) + save_keybind_axis_label(conf, "input", base, lbl); + } + if (valid) { ret = config_file_write(conf, autoconf_file, false); diff --git a/tests-other/test_autoconf.sh b/tests-other/test_autoconf.sh index ca967f586b..2a82de0665 100755 --- a/tests-other/test_autoconf.sh +++ b/tests-other/test_autoconf.sh @@ -333,6 +333,8 @@ input_up_btn = "4" input_down_btn = "5" input_left_btn = "6" input_right_btn = "7" +input_menu_toggle_btn = "10" +input_menu_toggle_btn_label = "PS" CFG run [ "$(grep -c 'Save profile for port 1: saved' "$LOG")" -eq 2 ] \ @@ -341,6 +343,10 @@ run grep -q 'input_b_btn_label = "Cross"' "$AUTOCONF/Test joypad device L.cfg" 2>/dev/null \ && pass "P10 label written to the saved profile" \ || fail "P10 label missing from the saved profile" +grep -q 'input_menu_toggle_btn = "10"' "$AUTOCONF/Test joypad device L.cfg" 2>/dev/null \ + && grep -q 'input_menu_toggle_btn_label = "PS"' "$AUTOCONF/Test joypad device L.cfg" \ + && pass "P10 the profile's hotkey kept in the profile saved under a new name" \ + || fail "P10 the profile's hotkey lost from the saved profile" # Port 1 driven by the second device: port 1's binds, second device's name. setup test_input_autoconf_save_mapped.ratst