Start preparing for remap binds

This commit is contained in:
twinaphex 2015-01-05 02:36:10 +01:00
parent 74698f73bf
commit 31d816b6d3
3 changed files with 14 additions and 5 deletions

View File

@ -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;

View File

@ -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];

View File

@ -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;