remap-redux part 2: fix nits, hookup left/right callbacks

This commit is contained in:
radius 2018-03-30 11:56:01 -05:00
parent ed334cd1dd
commit 2bfb5ec0df
6 changed files with 17 additions and 28 deletions

View File

@ -33,7 +33,7 @@ else
HAVE_ZLIB := 1
HAVE_7ZIP := 1
HAVE_VITA2D := 1
HAVE_KEYMAPPER := 1
HAVE_KEYMAPPER := 1
HAVE_NETWORKING := 1
HAVE_SOCKET_LEGACY := 1
HAVE_MENU := 1

View File

@ -379,7 +379,6 @@ typedef struct settings
unsigned input_libretro_device[MAX_USERS];
unsigned input_analog_dpad_mode[MAX_USERS];
unsigned input_keymapper_ids[RARCH_CUSTOM_BIND_LIST_END];
unsigned input_keymapper_multi_ids[MAX_USERS][RARCH_CUSTOM_BIND_LIST_END];
unsigned input_remap_ids[MAX_USERS][RARCH_CUSTOM_BIND_LIST_END];

View File

@ -86,7 +86,7 @@ void input_mapper_poll(input_mapper_t *handle)
int i, j;
settings_t *settings = config_get_ptr();
unsigned device = settings->uints.input_libretro_device[handle->port];
bool key_event[RARCH_CUSTOM_BIND_LIST_END];
bool key_event[RARCH_CUSTOM_BIND_LIST_END];
#ifdef HAVE_MENU
bool menu_is_alive = menu_driver_is_alive();
#endif

View File

@ -86,18 +86,6 @@ bool input_remapping_load_file(void *data, const char *path)
key_remap = -1;
if (settings->uints.keymapper_port == i)
{
if (config_get_int(conf, keymapper_ident[j], &key_remap))
{
settings->uints.input_keymapper_ids[j] = key_remap;
#if 0
RARCH_LOG ("%s: %u\n", keymapper_ident[j], settings->uints.input_keymapper_ids[j]);
#endif
}
else
settings->uints.input_keymapper_ids[j] = RETROK_UNKNOWN;
}
if (config_get_int(conf, keymapper_ident[j], &key_remap))
settings->uints.input_keymapper_multi_ids[i][j] = key_remap;
else
@ -206,10 +194,6 @@ bool input_remapping_save_file(const char *path)
else
config_unset(conf,key_ident[j]);
if (settings->uints.keymapper_port == i &&
settings->uints.input_keymapper_ids[j] != RETROK_UNKNOWN)
config_set_int(conf, keymapper_ident[j], settings->uints.input_keymapper_ids[j]);
}
else
{
@ -278,7 +262,7 @@ void input_remapping_set_defaults(bool deinit)
const struct retro_keybind *keybind = &input_config_binds[i][j];
if (keybind)
settings->uints.input_remap_ids[i][j] = keybind->id;
settings->uints.input_keymapper_ids[j] = RETROK_UNKNOWN;
settings->uints.input_keymapper_multi_ids[i][j] = RETROK_UNKNOWN;
}
for (j = 0; j < 4; j++)

View File

@ -112,15 +112,18 @@ static int action_left_input_desc_kbd(unsigned type, const char *label,
bool wraparound)
{
char desc[PATH_MAX_LENGTH];
unsigned key_id;
unsigned key_id, id, offset;
unsigned remap_id;
unsigned offset = type - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN;
settings_t *settings = config_get_ptr();
if (!settings)
return 0;
remap_id = settings->uints.input_keymapper_ids[offset];
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_multi_ids[offset][id];
for (key_id = 0; key_id < MENU_SETTINGS_INPUT_DESC_KBD_END - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN; key_id++)
{
@ -133,7 +136,7 @@ static int action_left_input_desc_kbd(unsigned type, const char *label,
else
key_id = MENU_SETTINGS_INPUT_DESC_KBD_END - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN;
settings->uints.input_keymapper_ids[offset] = key_descriptors[key_id].key;
settings->uints.input_keymapper_multi_ids[offset][id] = key_descriptors[key_id].key;
return 0;
}

View File

@ -105,16 +105,19 @@ int action_right_cheat(unsigned type, const char *label,
int action_right_input_desc_kbd(unsigned type, const char *label,
bool wraparound)
{
unsigned key_id;
unsigned key_id, id, offset;
unsigned remap_id;
char desc[PATH_MAX_LENGTH];
unsigned offset = type - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN;
settings_t *settings = config_get_ptr();
if (!settings)
return 0;
remap_id = settings->uints.input_keymapper_ids[offset];
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_multi_ids[offset][id];
for (key_id = 0; key_id < MENU_SETTINGS_INPUT_DESC_KBD_END - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN; key_id++)
{
@ -127,7 +130,7 @@ int action_right_input_desc_kbd(unsigned type, const char *label,
else
key_id = 0;
settings->uints.input_keymapper_ids[offset] = key_descriptors[key_id].key;
settings->uints.input_keymapper_multi_ids[offset][id] = key_descriptors[key_id].key;
return 0;
}