diff --git a/driver.h b/driver.h index b84832a1e8..b49a76710a 100644 --- a/driver.h +++ b/driver.h @@ -143,11 +143,7 @@ struct retro_keybind const char *desc; enum retro_key key; - /* PC only uses lower 16-bits. - * Full 64-bit can be used for port-specific purposes, - * like simplifying multiple binds, etc. */ uint64_t joykey; - /* Default key binding value - for resetting bind to default */ uint64_t def_joykey; diff --git a/general.h b/general.h index 97b7d1f0ac..d824361133 100644 --- a/general.h +++ b/general.h @@ -360,13 +360,15 @@ struct settings char driver[32]; char joypad_driver[32]; char keyboard_layout[64]; + struct retro_keybind binds[MAX_USERS][RARCH_BIND_LIST_END]; + struct retro_keybind remap_binds[MAX_USERS][RARCH_BIND_LIST_END]; + struct retro_keybind autoconf_binds[MAX_USERS][RARCH_BIND_LIST_END]; unsigned max_users; /* Set by autoconfiguration in joypad_autoconfig_dir. * Does not override main binds. */ - struct retro_keybind autoconf_binds[MAX_USERS][RARCH_BIND_LIST_END]; bool autoconfigured[MAX_USERS]; unsigned libretro_device[MAX_USERS]; diff --git a/settings.c b/settings.c index 197de791e7..3cd6590eb4 100644 --- a/settings.c +++ b/settings.c @@ -449,10 +449,17 @@ static void config_set_defaults(void) rarch_assert(sizeof(g_settings.input.binds[0]) >= sizeof(retro_keybinds_1)); rarch_assert(sizeof(g_settings.input.binds[1]) >= sizeof(retro_keybinds_rest)); + memcpy(g_settings.input.binds[0], retro_keybinds_1, sizeof(retro_keybinds_1)); + memcpy(g_settings.input.remap_binds[0], retro_keybinds_1, sizeof(retro_keybinds_1)); + for (i = 1; i < MAX_USERS; i++) + { memcpy(g_settings.input.binds[i], retro_keybinds_rest, sizeof(retro_keybinds_rest)); + memcpy(g_settings.input.remap_binds[i], retro_keybinds_rest, + sizeof(retro_keybinds_rest)); + } for (i = 0; i < MAX_USERS; i++) { @@ -468,8 +475,12 @@ static void config_set_defaults(void) /* Verify that binds are in proper order. */ for (i = 0; i < MAX_USERS; i++) for (j = 0; j < RARCH_BIND_LIST_END; j++) + { if (g_settings.input.binds[i][j].valid) rarch_assert(j == g_settings.input.binds[i][j].id); + if (g_settings.input.remap_binds[i][j].valid) + rarch_assert(j == g_settings.input.remap_binds[i][j].id); + } g_settings.input.axis_threshold = axis_threshold; g_settings.input.netplay_client_swap_input = netplay_client_swap_input;