mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-23 03:10:14 +00:00
try to override swap ok/cancel for remote controls
This commit is contained in:
parent
d70d04c473
commit
d236b2db58
@ -283,6 +283,7 @@ typedef struct settings
|
||||
/* Set by autoconfiguration in joypad_autoconfig_dir.
|
||||
* Does not override main binds. */
|
||||
bool autoconfigured[MAX_USERS];
|
||||
bool swap_override;
|
||||
int vid[MAX_USERS];
|
||||
int pid[MAX_USERS];
|
||||
|
||||
|
@ -123,9 +123,11 @@ unsigned menu_event(uint64_t input, uint64_t trigger_input)
|
||||
menu_input_t *menu_input = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
static unsigned ok_old = 0;
|
||||
unsigned menu_ok_btn = settings->input.menu_swap_ok_cancel_buttons ?
|
||||
unsigned menu_ok_btn = (!settings->input.swap_override &&
|
||||
settings->input.menu_swap_ok_cancel_buttons) ?
|
||||
RETRO_DEVICE_ID_JOYPAD_B : RETRO_DEVICE_ID_JOYPAD_A;
|
||||
unsigned menu_cancel_btn = settings->input.menu_swap_ok_cancel_buttons ?
|
||||
unsigned menu_cancel_btn = (!settings->input.swap_override &&
|
||||
settings->input.menu_swap_ok_cancel_buttons) ?
|
||||
RETRO_DEVICE_ID_JOYPAD_A : RETRO_DEVICE_ID_JOYPAD_B;
|
||||
unsigned ok_current = (unsigned)(input & UINT64_C(1) << menu_ok_btn);
|
||||
unsigned ok_trigger = ok_current & ~ok_old;
|
||||
|
@ -133,6 +133,8 @@ static void input_autoconfigure_joypad_add(config_file_t *conf,
|
||||
char display_name[128];
|
||||
char device_type[128];
|
||||
bool block_osd_spam = false;
|
||||
static bool remote_is_bound = false;
|
||||
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
msg[0] = display_name[0] = device_type[0] = '\0';
|
||||
@ -156,14 +158,14 @@ static void input_autoconfigure_joypad_add(config_file_t *conf,
|
||||
|
||||
if (string_is_equal(device_type, "remote"))
|
||||
{
|
||||
static bool remote_is_bound = false;
|
||||
|
||||
snprintf(msg, sizeof(msg), "%s configured.",
|
||||
string_is_empty(display_name) ? params->name : display_name);
|
||||
|
||||
if(!remote_is_bound)
|
||||
task_set_title(task, strdup(msg));
|
||||
remote_is_bound = true;
|
||||
if (params->idx == 0)
|
||||
settings->input.swap_override = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -171,7 +173,8 @@ static void input_autoconfigure_joypad_add(config_file_t *conf,
|
||||
string_is_empty(display_name) ? params->name : display_name,
|
||||
msg_hash_to_str(MSG_DEVICE_CONFIGURED_IN_PORT),
|
||||
params->idx);
|
||||
|
||||
if (params->idx == 0)
|
||||
settings->input.swap_override = false;
|
||||
if (!block_osd_spam)
|
||||
task_set_title(task, strdup(msg));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user