Add support for mapping multiple controllers to a single input device
This commit is contained in:
parent
a129764f0d
commit
973f5cda6d
23 changed files with 838 additions and 289 deletions
|
@ -80,10 +80,8 @@ static int action_start_remap_file_load(
|
|||
const char *path, const char *label,
|
||||
unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
#ifdef HAVE_CONFIGFILE
|
||||
input_remapping_deinit();
|
||||
input_remapping_set_defaults();
|
||||
#endif
|
||||
input_remapping_set_defaults(false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -193,20 +191,24 @@ static int action_start_input_desc(
|
|||
rarch_system_info_t *system = runloop_get_system_info();
|
||||
unsigned user_idx;
|
||||
unsigned btn_idx;
|
||||
unsigned mapped_port;
|
||||
|
||||
(void)label;
|
||||
|
||||
if (!settings || !system)
|
||||
return 0;
|
||||
|
||||
user_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN) / (RARCH_FIRST_CUSTOM_BIND + 8);
|
||||
btn_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN) - (RARCH_FIRST_CUSTOM_BIND + 8) * user_idx;
|
||||
user_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN) / (RARCH_FIRST_CUSTOM_BIND + 8);
|
||||
btn_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN) - (RARCH_FIRST_CUSTOM_BIND + 8) * user_idx;
|
||||
mapped_port = settings->uints.input_remap_ports[user_idx];
|
||||
|
||||
if ((user_idx >= MAX_USERS) || (btn_idx >= RARCH_CUSTOM_BIND_LIST_END))
|
||||
if ((user_idx >= MAX_USERS) ||
|
||||
(mapped_port >= MAX_USERS) ||
|
||||
(btn_idx >= RARCH_CUSTOM_BIND_LIST_END))
|
||||
return 0;
|
||||
|
||||
/* Check whether core has defined this input */
|
||||
if (!string_is_empty(system->input_desc_btn[user_idx][btn_idx]))
|
||||
if (!string_is_empty(system->input_desc_btn[mapped_port][btn_idx]))
|
||||
{
|
||||
const struct retro_keybind *keyptr = &input_config_binds[user_idx][btn_idx];
|
||||
settings->uints.input_remap_ids[user_idx][btn_idx] = keyptr->id;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue