mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-14 16:28:05 +00:00
remap-redux part 2: start inverting the gamepad mapper columns
This commit is contained in:
parent
51edf47ed2
commit
34649d1abf
@ -28,6 +28,8 @@ RETRO_BEGIN_DECLS
|
|||||||
|
|
||||||
#define MAX_INPUT_DEVICES 16
|
#define MAX_INPUT_DEVICES 16
|
||||||
|
|
||||||
|
#define MAX_KEYS 136
|
||||||
|
|
||||||
#define RARCH_FIRST_CUSTOM_BIND 16
|
#define RARCH_FIRST_CUSTOM_BIND 16
|
||||||
#define RARCH_FIRST_LIGHTGUN_BIND RARCH_ANALOG_BIND_LIST_END
|
#define RARCH_FIRST_LIGHTGUN_BIND RARCH_ANALOG_BIND_LIST_END
|
||||||
#define RARCH_FIRST_MISC_CUSTOM_BIND RARCH_LIGHTGUN_BIND_LIST_END
|
#define RARCH_FIRST_MISC_CUSTOM_BIND RARCH_LIGHTGUN_BIND_LIST_END
|
||||||
|
@ -547,72 +547,60 @@ static void menu_action_setting_disp_set_label_input_desc(
|
|||||||
const char *path,
|
const char *path,
|
||||||
char *s2, size_t len2)
|
char *s2, size_t len2)
|
||||||
{
|
{
|
||||||
char descriptor[255];
|
rarch_system_info_t *system = NULL;
|
||||||
|
const char* descriptor = NULL;
|
||||||
const struct retro_keybind *auto_bind = NULL;
|
const struct retro_keybind *auto_bind = NULL;
|
||||||
const struct retro_keybind *keybind = NULL;
|
const struct retro_keybind *keybind = NULL;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
unsigned inp_desc_index_offset =
|
unsigned inp_desc_index_offset =
|
||||||
type - MENU_SETTINGS_INPUT_DESC_BEGIN;
|
type - MENU_SETTINGS_INPUT_DESC_BEGIN;
|
||||||
unsigned inp_desc_user = inp_desc_index_offset /
|
unsigned inp_desc_user = inp_desc_index_offset /
|
||||||
(RARCH_FIRST_CUSTOM_BIND + 4);
|
(RARCH_FIRST_CUSTOM_BIND + 8);
|
||||||
unsigned inp_desc_button_index_offset = inp_desc_index_offset -
|
unsigned inp_desc_button_index_offset = inp_desc_index_offset -
|
||||||
(inp_desc_user * (RARCH_FIRST_CUSTOM_BIND + 4));
|
(inp_desc_user * (RARCH_FIRST_CUSTOM_BIND + 8));
|
||||||
unsigned remap_id = 0;
|
unsigned remap_id = 0;
|
||||||
|
|
||||||
if (!settings)
|
system = runloop_get_system_info();
|
||||||
|
|
||||||
|
if (!system)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
descriptor[0] = '\0';
|
descriptor = system->input_desc_btn[inp_desc_user][inp_desc_button_index_offset];
|
||||||
|
|
||||||
remap_id = settings->uints.input_remap_ids
|
|
||||||
[inp_desc_user][inp_desc_button_index_offset];
|
|
||||||
|
|
||||||
keybind = &input_config_binds[inp_desc_user][remap_id];
|
|
||||||
auto_bind = (const struct retro_keybind*)
|
|
||||||
input_config_get_bind_auto(inp_desc_user, remap_id);
|
|
||||||
|
|
||||||
input_config_get_bind_string(descriptor,
|
|
||||||
keybind, auto_bind, sizeof(descriptor));
|
|
||||||
|
|
||||||
if (inp_desc_button_index_offset < RARCH_FIRST_CUSTOM_BIND)
|
|
||||||
{
|
|
||||||
if(strstr(descriptor, "Auto") && !strstr(descriptor,
|
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE)))
|
|
||||||
strlcpy(s,
|
|
||||||
descriptor,
|
|
||||||
len);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const struct retro_keybind *keyptr = &input_config_binds[inp_desc_user]
|
|
||||||
[remap_id];
|
|
||||||
|
|
||||||
strlcpy(s, msg_hash_to_str(keyptr->enum_idx), len);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (inp_desc_button_index_offset < RARCH_FIRST_CUSTOM_BIND + 8)
|
||||||
|
strlcpy(s, descriptor ? descriptor : "---", len);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char *str = NULL;
|
|
||||||
switch (remap_id)
|
switch (remap_id)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
str = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X);
|
descriptor = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X_PLUS);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
str = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_Y);
|
descriptor = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X_MINUS);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
str = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_X);
|
descriptor = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_Y_PLUS);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
str = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_Y);
|
descriptor = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_Y_MINUS);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
descriptor = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X_PLUS);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
descriptor = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X_MINUS);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
descriptor = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_Y_PLUS);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
descriptor = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_Y_MINUS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string_is_empty(str))
|
if (!string_is_empty(descriptor))
|
||||||
strlcpy(s, str, len);
|
strlcpy(s, descriptor, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
*w = 19;
|
*w = 19;
|
||||||
@ -654,8 +642,14 @@ static void menu_action_setting_disp_set_label_input_desc_kbd(
|
|||||||
if(remap_id == key_descriptors[key_id].key)
|
if(remap_id == key_descriptors[key_id].key)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
snprintf(desc, sizeof(desc), "Keyboard %s", key_descriptors[key_id].desc);
|
|
||||||
strlcpy(s, desc, len);
|
if (key_descriptors[key_id].key != RETROK_FIRST)
|
||||||
|
{
|
||||||
|
snprintf(desc, sizeof(desc), "Keyboard %s", key_descriptors[key_id].desc);
|
||||||
|
strlcpy(s, desc, len);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
strlcpy(s, "---", len);
|
||||||
|
|
||||||
*w = 19;
|
*w = 19;
|
||||||
strlcpy(s2, path, len2);
|
strlcpy(s2, path, len2);
|
||||||
|
@ -32,7 +32,7 @@ static void menu_cbs_init_log(const char *entry_label, const char *bind_label, c
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
struct key_desc key_descriptors[MENU_SETTINGS_INPUT_DESC_KBD_END] =
|
struct key_desc key_descriptors[136] =
|
||||||
{
|
{
|
||||||
{RETROK_FIRST, "Unmapped"},
|
{RETROK_FIRST, "Unmapped"},
|
||||||
{RETROK_BACKSPACE, "Backspace"},
|
{RETROK_BACKSPACE, "Backspace"},
|
||||||
|
@ -3240,33 +3240,44 @@ static int menu_displaylist_parse_options_remappings(
|
|||||||
|
|
||||||
if (system)
|
if (system)
|
||||||
{
|
{
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
unsigned device;
|
||||||
for (p = 0; p < max_users; p++)
|
for (p = 0; p < max_users; p++)
|
||||||
{
|
{
|
||||||
for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND + 4; retro_id++)
|
device = settings->uints.input_libretro_device[p];
|
||||||
|
device &= RETRO_DEVICE_MASK;
|
||||||
|
|
||||||
|
if (device == RETRO_DEVICE_JOYPAD || device == RETRO_DEVICE_ANALOG)
|
||||||
{
|
{
|
||||||
char desc_label[64];
|
for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND + 8; retro_id++)
|
||||||
unsigned user = p + 1;
|
{
|
||||||
unsigned desc_offset = retro_id;
|
char desc_label[64];
|
||||||
const char *description = NULL;
|
unsigned user = p + 1;
|
||||||
|
unsigned desc_offset = retro_id;
|
||||||
|
char descriptor[255];
|
||||||
|
const struct retro_keybind *auto_bind = NULL;
|
||||||
|
const struct retro_keybind *keybind = NULL;
|
||||||
|
|
||||||
desc_label[0] = '\0';
|
keybind = &input_config_binds[p][retro_id];
|
||||||
|
auto_bind = (const struct retro_keybind*)
|
||||||
|
input_config_get_bind_auto(p, retro_id);
|
||||||
|
|
||||||
if (desc_offset >= RARCH_FIRST_CUSTOM_BIND)
|
input_config_get_bind_string(descriptor,
|
||||||
desc_offset = RARCH_FIRST_CUSTOM_BIND
|
keybind, auto_bind, sizeof(descriptor));
|
||||||
+ (desc_offset - RARCH_FIRST_CUSTOM_BIND) * 2;
|
|
||||||
|
|
||||||
description = system->input_desc_btn[p][desc_offset];
|
if(!strstr(descriptor, "Auto"))
|
||||||
|
{
|
||||||
|
const struct retro_keybind *keyptr =
|
||||||
|
&input_config_binds[p][retro_id];
|
||||||
|
|
||||||
if (!description)
|
strlcpy(descriptor, msg_hash_to_str(keyptr->enum_idx), sizeof(descriptor));
|
||||||
continue;
|
}
|
||||||
|
|
||||||
snprintf(desc_label, sizeof(desc_label),
|
menu_entries_append_enum(info->list, descriptor, "",
|
||||||
"%s %u %s : ", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_USER),
|
MSG_UNKNOWN,
|
||||||
user, description);
|
MENU_SETTINGS_INPUT_DESC_BEGIN +
|
||||||
menu_entries_append_enum(info->list, desc_label, "",
|
(p * (RARCH_FIRST_CUSTOM_BIND + 8)) + retro_id, 0, 0);
|
||||||
MSG_UNKNOWN,
|
}
|
||||||
MENU_SETTINGS_INPUT_DESC_BEGIN +
|
|
||||||
(p * (RARCH_FIRST_CUSTOM_BIND + 4)) + retro_id, 0, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3276,9 +3287,9 @@ static int menu_displaylist_parse_options_remappings(
|
|||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
unsigned device;
|
unsigned device;
|
||||||
|
|
||||||
for (int i = 0; i < MAX_USERS; i++)
|
for (p = 0; p < MAX_USERS; p++)
|
||||||
{
|
{
|
||||||
device = settings->uints.input_libretro_device[i];
|
device = settings->uints.input_libretro_device[p];
|
||||||
device &= RETRO_DEVICE_MASK;
|
device &= RETRO_DEVICE_MASK;
|
||||||
|
|
||||||
if (device == RETRO_DEVICE_KEYBOARD)
|
if (device == RETRO_DEVICE_KEYBOARD)
|
||||||
@ -3291,9 +3302,9 @@ static int menu_displaylist_parse_options_remappings(
|
|||||||
const struct retro_keybind *auto_bind = NULL;
|
const struct retro_keybind *auto_bind = NULL;
|
||||||
const struct retro_keybind *keybind = NULL;
|
const struct retro_keybind *keybind = NULL;
|
||||||
|
|
||||||
keybind = &input_config_binds[i][retro_id];
|
keybind = &input_config_binds[p][retro_id];
|
||||||
auto_bind = (const struct retro_keybind*)
|
auto_bind = (const struct retro_keybind*)
|
||||||
input_config_get_bind_auto(i, retro_id);
|
input_config_get_bind_auto(p, retro_id);
|
||||||
|
|
||||||
input_config_get_bind_string(descriptor,
|
input_config_get_bind_string(descriptor,
|
||||||
keybind, auto_bind, sizeof(descriptor));
|
keybind, auto_bind, sizeof(descriptor));
|
||||||
@ -3301,14 +3312,14 @@ static int menu_displaylist_parse_options_remappings(
|
|||||||
if(!strstr(descriptor, "Auto"))
|
if(!strstr(descriptor, "Auto"))
|
||||||
{
|
{
|
||||||
const struct retro_keybind *keyptr =
|
const struct retro_keybind *keyptr =
|
||||||
&input_config_binds[i][retro_id];
|
&input_config_binds[p][retro_id];
|
||||||
|
|
||||||
strlcpy(descriptor, msg_hash_to_str(keyptr->enum_idx), sizeof(descriptor));
|
strlcpy(descriptor, msg_hash_to_str(keyptr->enum_idx), sizeof(descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_entries_append_enum(info->list, descriptor, "",
|
menu_entries_append_enum(info->list, descriptor, "",
|
||||||
MSG_UNKNOWN,
|
MSG_UNKNOWN,
|
||||||
(MENU_SETTINGS_INPUT_DESC_KBD_BEGIN + retro_id) * (i + 1), 0, 0);
|
(MENU_SETTINGS_INPUT_DESC_KBD_BEGIN + retro_id) * (p + 1), 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ enum menu_settings_type
|
|||||||
MENU_SETTINGS_INPUT_DESC_BEGIN,
|
MENU_SETTINGS_INPUT_DESC_BEGIN,
|
||||||
MENU_SETTINGS_INPUT_DESC_END = MENU_SETTINGS_INPUT_DESC_BEGIN + (MAX_USERS * (RARCH_FIRST_CUSTOM_BIND + 4)),
|
MENU_SETTINGS_INPUT_DESC_END = MENU_SETTINGS_INPUT_DESC_BEGIN + (MAX_USERS * (RARCH_FIRST_CUSTOM_BIND + 4)),
|
||||||
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN,
|
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN,
|
||||||
MENU_SETTINGS_INPUT_DESC_KBD_END = (MENU_SETTINGS_INPUT_DESC_KBD_BEGIN + 135) * MAX_USERS,
|
MENU_SETTINGS_INPUT_DESC_KBD_END = (MENU_SETTINGS_INPUT_DESC_KBD_BEGIN + 136) * MAX_USERS,
|
||||||
|
|
||||||
MENU_SETTINGS_SUBSYSTEM_LOAD,
|
MENU_SETTINGS_SUBSYSTEM_LOAD,
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user