mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-18 17:04:34 +00:00
Can set RETRO_DEVICE_ANALOG with input descriptors now too
This commit is contained in:
parent
1e1457c45c
commit
6615f26749
43
dynamic.c
43
dynamic.c
@ -665,18 +665,55 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
|
||||
for (; desc->description; desc++)
|
||||
{
|
||||
unsigned port = desc->port;
|
||||
unsigned id = desc->id;
|
||||
if (desc->port >= MAX_PLAYERS)
|
||||
continue;
|
||||
|
||||
/* Ignore all others for now. */
|
||||
if (desc->device != RETRO_DEVICE_JOYPAD)
|
||||
if (desc->device != RETRO_DEVICE_JOYPAD &&
|
||||
desc->device != RETRO_DEVICE_ANALOG)
|
||||
continue;
|
||||
|
||||
if (desc->id >= RARCH_FIRST_CUSTOM_BIND)
|
||||
continue;
|
||||
|
||||
g_extern.system.input_desc_btn[desc->port][desc->id] =
|
||||
desc->description;
|
||||
if (desc->device == RETRO_DEVICE_ANALOG)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case RETRO_DEVICE_ID_ANALOG_X:
|
||||
switch (desc->index)
|
||||
{
|
||||
case RETRO_DEVICE_INDEX_ANALOG_LEFT:
|
||||
g_extern.system.input_desc_btn[port][RARCH_ANALOG_LEFT_X_PLUS] = desc->description;
|
||||
g_extern.system.input_desc_btn[port][RARCH_ANALOG_LEFT_X_MINUS] = desc->description;
|
||||
break;
|
||||
case RETRO_DEVICE_INDEX_ANALOG_RIGHT:
|
||||
g_extern.system.input_desc_btn[port][RARCH_ANALOG_RIGHT_X_PLUS] = desc->description;
|
||||
g_extern.system.input_desc_btn[port][RARCH_ANALOG_RIGHT_X_MINUS] = desc->description;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RETRO_DEVICE_ID_ANALOG_Y:
|
||||
switch (desc->index)
|
||||
{
|
||||
case RETRO_DEVICE_INDEX_ANALOG_LEFT:
|
||||
g_extern.system.input_desc_btn[port][RARCH_ANALOG_LEFT_Y_PLUS] = desc->description;
|
||||
g_extern.system.input_desc_btn[port][RARCH_ANALOG_LEFT_Y_MINUS] = desc->description;
|
||||
break;
|
||||
case RETRO_DEVICE_INDEX_ANALOG_RIGHT:
|
||||
g_extern.system.input_desc_btn[port][RARCH_ANALOG_RIGHT_Y_PLUS] = desc->description;
|
||||
g_extern.system.input_desc_btn[port][RARCH_ANALOG_RIGHT_Y_MINUS] = desc->description;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_extern.system.input_desc_btn[port][id] = desc->description;
|
||||
}
|
||||
}
|
||||
|
||||
static const char *libretro_btn_desc[] = {
|
||||
|
@ -562,7 +562,7 @@ struct global
|
||||
bool force_nonblock;
|
||||
bool no_content;
|
||||
|
||||
const char *input_desc_btn[MAX_PLAYERS][RARCH_FIRST_CUSTOM_BIND];
|
||||
const char *input_desc_btn[MAX_PLAYERS][RARCH_FIRST_META_KEY];
|
||||
char valid_extensions[PATH_MAX];
|
||||
|
||||
retro_keyboard_event_t key_event;
|
||||
|
@ -4539,8 +4539,9 @@ static bool setting_data_append_list_input_options(
|
||||
|
||||
if (
|
||||
g_settings.input.input_descriptor_label_show
|
||||
&& (i < RARCH_FIRST_CUSTOM_BIND)
|
||||
&& (i < RARCH_FIRST_META_KEY)
|
||||
&& (g_extern.has_set_input_descriptors)
|
||||
&& (i != RARCH_TURBO_ENABLE)
|
||||
)
|
||||
snprintf(label, sizeof(label), "%s %s", buffer[player],
|
||||
g_extern.system.input_desc_btn[player][i] ? g_extern.system.input_desc_btn[player][i] : "N/A");
|
||||
|
Loading…
x
Reference in New Issue
Block a user