mirror of
https://github.com/libretro/RetroArch
synced 2025-01-29 00:32:49 +00:00
remap-redux part 2: cleanup keymapper code
This commit is contained in:
parent
db5f3d7a75
commit
51edf47ed2
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -14,4 +14,5 @@
|
||||
"*.in": "c",
|
||||
"*.rh": "c"
|
||||
},
|
||||
"C_Cpp.dimInactiveRegions": false,
|
||||
}
|
@ -103,13 +103,14 @@ void input_mapper_poll(input_mapper_t *handle)
|
||||
|
||||
memset(handle->keys, 0, sizeof(handle->keys));
|
||||
i = 0;
|
||||
for (i = 0; i < 8; i++)
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
{
|
||||
for (j = 0; j < RARCH_CUSTOM_BIND_LIST_END; j++)
|
||||
{
|
||||
if (j < RETROK_LAST)
|
||||
{
|
||||
if (input_state(i, RETRO_DEVICE_JOYPAD, 0, j) && settings->uints.input_keymapper_ids[i][j] != RETROK_UNKNOWN)
|
||||
if (input_state(i, RETRO_DEVICE_JOYPAD, 0, j) &&
|
||||
settings->uints.input_keymapper_ids[i][j] != RETROK_UNKNOWN)
|
||||
{
|
||||
MAPPER_SET_KEY (handle,
|
||||
settings->uints.input_keymapper_ids[i][j]);
|
||||
|
@ -194,11 +194,16 @@ bool input_remapping_save_file(const char *path)
|
||||
else
|
||||
config_unset(conf,key_ident[j]);
|
||||
|
||||
if (settings->uints.input_keymapper_ids[i][j] != RETROK_UNKNOWN)
|
||||
config_set_int(conf, keymapper_ident[j],
|
||||
settings->uints.input_keymapper_ids[i][j]);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(settings->uints.input_remap_ids[i][j] != j - RARCH_FIRST_CUSTOM_BIND)
|
||||
config_set_int(conf, key_ident[j], settings->uints.input_remap_ids[i][j]);
|
||||
config_set_int(conf, key_ident[j],
|
||||
settings->uints.input_remap_ids[i][j]);
|
||||
else
|
||||
config_unset(conf,key_ident[j]);
|
||||
}
|
||||
|
@ -640,15 +640,16 @@ static void menu_action_setting_disp_set_label_input_desc_kbd(
|
||||
if (!settings)
|
||||
return;
|
||||
|
||||
offset = type / ((MENU_SETTINGS_INPUT_DESC_KBD_END - (MENU_SETTINGS_INPUT_DESC_KBD_END - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN))) - 1;
|
||||
offset = type / ((MENU_SETTINGS_INPUT_DESC_KBD_END -
|
||||
(MENU_SETTINGS_INPUT_DESC_KBD_END -
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN))) - 1;
|
||||
|
||||
id = (type / (offset + 1)) - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN;
|
||||
remap_id =
|
||||
settings->uints.input_keymapper_ids[offset][id];
|
||||
|
||||
RARCH_LOG("o: %d, type: %d, remap_id: %d\n", offset, type, remap_id);
|
||||
|
||||
for (key_id = 0; key_id < MENU_SETTINGS_INPUT_DESC_KBD_END - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN; key_id++)
|
||||
for (key_id = 0; key_id < MENU_SETTINGS_INPUT_DESC_KBD_END -
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN; key_id++)
|
||||
{
|
||||
if(remap_id == key_descriptors[key_id].key)
|
||||
break;
|
||||
|
@ -119,13 +119,17 @@ static int action_left_input_desc_kbd(unsigned type, const char *label,
|
||||
if (!settings)
|
||||
return 0;
|
||||
|
||||
offset = type / ((MENU_SETTINGS_INPUT_DESC_KBD_END - (MENU_SETTINGS_INPUT_DESC_KBD_END - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN))) - 1;
|
||||
offset = type / ((MENU_SETTINGS_INPUT_DESC_KBD_END -
|
||||
(MENU_SETTINGS_INPUT_DESC_KBD_END -
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN))) - 1;
|
||||
|
||||
id = (type / (offset + 1)) - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN;
|
||||
|
||||
remap_id =
|
||||
settings->uints.input_keymapper_ids[offset][id];
|
||||
|
||||
for (key_id = 0; key_id < MENU_SETTINGS_INPUT_DESC_KBD_END - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN; key_id++)
|
||||
for (key_id = 0; key_id < MENU_SETTINGS_INPUT_DESC_KBD_END -
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN; key_id++)
|
||||
{
|
||||
if(remap_id == key_descriptors[key_id].key)
|
||||
break;
|
||||
|
@ -113,13 +113,17 @@ int action_right_input_desc_kbd(unsigned type, const char *label,
|
||||
if (!settings)
|
||||
return 0;
|
||||
|
||||
offset = type / ((MENU_SETTINGS_INPUT_DESC_KBD_END - (MENU_SETTINGS_INPUT_DESC_KBD_END - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN))) - 1;
|
||||
offset = type / ((MENU_SETTINGS_INPUT_DESC_KBD_END -
|
||||
(MENU_SETTINGS_INPUT_DESC_KBD_END -
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN))) - 1;
|
||||
|
||||
id = (type / (offset + 1)) - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN;
|
||||
|
||||
remap_id =
|
||||
settings->uints.input_keymapper_ids[offset][id];
|
||||
|
||||
for (key_id = 0; key_id < MENU_SETTINGS_INPUT_DESC_KBD_END - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN; key_id++)
|
||||
for (key_id = 0; key_id < MENU_SETTINGS_INPUT_DESC_KBD_END -
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN; key_id++)
|
||||
{
|
||||
if(remap_id == key_descriptors[key_id].key)
|
||||
break;
|
||||
|
@ -439,7 +439,10 @@ static int action_bind_sublabel_remap_sublabel(
|
||||
if (!settings)
|
||||
return 0;
|
||||
|
||||
offset = type / ((MENU_SETTINGS_INPUT_DESC_KBD_END - (MENU_SETTINGS_INPUT_DESC_KBD_END - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN))) - 1;
|
||||
offset = type / ((MENU_SETTINGS_INPUT_DESC_KBD_END -
|
||||
(MENU_SETTINGS_INPUT_DESC_KBD_END -
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN))) - 1;
|
||||
|
||||
snprintf(s, len, "User #%d: %s", offset + 1,
|
||||
input_config_get_device_display_name(offset) ?
|
||||
input_config_get_device_display_name(offset) :
|
||||
|
@ -3276,7 +3276,7 @@ static int menu_displaylist_parse_options_remappings(
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned device;
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
for (int i = 0; i < MAX_USERS; i++)
|
||||
{
|
||||
device = settings->uints.input_libretro_device[i];
|
||||
device &= RETRO_DEVICE_MASK;
|
||||
|
Loading…
x
Reference in New Issue
Block a user