mirror of
https://github.com/libretro/RetroArch
synced 2025-03-20 10:20:51 +00:00
input_swap_override - Get rid of dependency on settings
This commit is contained in:
parent
33f2fe8029
commit
36375cecf8
@ -83,7 +83,6 @@ typedef struct settings
|
||||
#endif
|
||||
|
||||
/* Input */
|
||||
bool input_swap_override;
|
||||
bool input_remap_binds_enable;
|
||||
bool input_autodetect_enable;
|
||||
bool input_overlay_enable;
|
||||
|
@ -36,6 +36,7 @@
|
||||
|
||||
#include "../configuration.h"
|
||||
#include "../runloop_defines.h"
|
||||
#include "../tasks/tasks_internal.h"
|
||||
|
||||
static unsigned char menu_keyboard_key_state[RETROK_LAST] = {0};
|
||||
|
||||
@ -123,10 +124,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->bools.input_swap_override &&
|
||||
bool input_swap_override = input_autoconfigure_get_swap_override();
|
||||
unsigned menu_ok_btn = (!input_swap_override &&
|
||||
settings->bools.input_menu_swap_ok_cancel_buttons) ?
|
||||
RETRO_DEVICE_ID_JOYPAD_B : RETRO_DEVICE_ID_JOYPAD_A;
|
||||
unsigned menu_cancel_btn = (!settings->bools.input_swap_override &&
|
||||
unsigned menu_cancel_btn = (!input_swap_override &&
|
||||
settings->bools.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);
|
||||
|
@ -53,6 +53,12 @@ typedef struct autoconfig_params
|
||||
|
||||
static bool input_autoconfigured[MAX_USERS];
|
||||
static unsigned input_device_name_index[MAX_USERS];
|
||||
static bool input_autoconfigure_swap_override;
|
||||
|
||||
bool input_autoconfigure_get_swap_override(void)
|
||||
{
|
||||
return input_autoconfigure_swap_override;
|
||||
}
|
||||
|
||||
/* Adds an index for devices with the same name,
|
||||
* so they can be identified in the GUI. */
|
||||
@ -162,10 +168,7 @@ static void input_autoconfigure_joypad_add(config_file_t *conf,
|
||||
task_set_title(task, strdup(msg));
|
||||
remote_is_bound = true;
|
||||
if (params->idx == 0)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
configuration_set_bool(settings, settings->bools.input_swap_override, true);
|
||||
}
|
||||
input_autoconfigure_swap_override = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -179,10 +182,7 @@ static void input_autoconfigure_joypad_add(config_file_t *conf,
|
||||
if (params->idx == 0)
|
||||
{
|
||||
if (config_get_bool(conf, "input_swap_override", &tmp))
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
configuration_set_bool(settings, settings->bools.input_swap_override, tmp);
|
||||
}
|
||||
input_autoconfigure_swap_override = tmp;
|
||||
}
|
||||
|
||||
if (!block_osd_spam)
|
||||
@ -404,6 +404,8 @@ void input_autoconfigure_reset(void)
|
||||
input_device_name_index[i] = 0;
|
||||
input_autoconfigured[i] = 0;
|
||||
}
|
||||
|
||||
input_autoconfigure_swap_override = false;
|
||||
}
|
||||
|
||||
bool input_is_autoconfigured(unsigned i)
|
||||
|
@ -235,6 +235,8 @@ bool input_autoconfigure_connect(
|
||||
|
||||
bool input_autoconfigure_disconnect(unsigned i, const char *ident);
|
||||
|
||||
bool input_autoconfigure_get_swap_override(void);
|
||||
|
||||
void task_push_get_powerstate(void);
|
||||
|
||||
enum frontend_powerstate get_last_powerstate(int *percent);
|
||||
|
Loading…
x
Reference in New Issue
Block a user