mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-07 08:36:02 -10:00
configuration: Save Controller Profile keeps the profile's hotkeys
A profile's hotkeys live with the controller's profile, not the port's binds, so a profile saved under the device's name - a new file when it came from a downloaded profile or a built-in one - lost every hotkey it had, such as a Menu Toggle on the pad. They are written to the saved profile now, with their labels.
This commit is contained in:
1 parent
c3c7db8ee7
commit
de7916ec3f
2 files changed
+24
No files matched your search
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user