mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
(menu_input_bind_dialog.c) Put port into menu input bind dialog
global state
This commit is contained in:
parent
544df2f03c
commit
814835aa8f
@ -35,7 +35,7 @@
|
||||
|
||||
struct menu_bind_state_port
|
||||
{
|
||||
bool mbuttons[MENU_MAX_MBUTTONS];
|
||||
bool mouse_buttons[MENU_MAX_MBUTTONS];
|
||||
bool buttons[MENU_MAX_BUTTONS];
|
||||
int16_t axes[MENU_MAX_AXES];
|
||||
uint16_t hats[MENU_MAX_HATS];
|
||||
@ -52,21 +52,23 @@ struct menu_bind_axis_state
|
||||
|
||||
struct menu_bind_state
|
||||
{
|
||||
bool skip;
|
||||
|
||||
unsigned begin;
|
||||
unsigned last;
|
||||
unsigned user;
|
||||
unsigned port;
|
||||
|
||||
struct retro_keybind * output;
|
||||
struct retro_keybind buffer;
|
||||
|
||||
rarch_timer_t timer_timeout;
|
||||
rarch_timer_t timer_hold;
|
||||
|
||||
unsigned begin;
|
||||
unsigned last;
|
||||
unsigned user;
|
||||
struct menu_bind_state_port state[MAX_USERS];
|
||||
struct menu_bind_axis_state axis_state[MAX_USERS];
|
||||
bool skip;
|
||||
};
|
||||
|
||||
static unsigned menu_bind_port = 0;
|
||||
static struct menu_bind_state menu_input_binds = {0};
|
||||
|
||||
static bool input_joypad_button_raw(const input_device_driver_t *drv,
|
||||
@ -185,15 +187,16 @@ static int menu_input_key_bind_set_mode_common(
|
||||
}
|
||||
|
||||
static void menu_input_key_bind_poll_bind_get_rested_axes(
|
||||
struct menu_bind_state *state, unsigned port)
|
||||
struct menu_bind_state *state)
|
||||
{
|
||||
unsigned a;
|
||||
const input_device_driver_t *joypad =
|
||||
input_driver_get_joypad_driver();
|
||||
const input_device_driver_t *sec_joypad =
|
||||
input_driver_get_sec_joypad_driver();
|
||||
unsigned port = state->port;
|
||||
|
||||
if (!state || !joypad)
|
||||
if (!joypad)
|
||||
return;
|
||||
|
||||
/* poll only the relevant port */
|
||||
@ -247,26 +250,23 @@ static void menu_input_key_bind_poll_bind_state_internal(
|
||||
|
||||
static void menu_input_key_bind_poll_bind_state(
|
||||
struct menu_bind_state *state,
|
||||
unsigned port,
|
||||
bool timed_out)
|
||||
{
|
||||
unsigned b;
|
||||
rarch_joypad_info_t joypad_info;
|
||||
input_driver_t *input_ptr = input_get_ptr();
|
||||
void *input_data = input_get_data();
|
||||
unsigned port = state->port;
|
||||
const input_device_driver_t *joypad =
|
||||
input_driver_get_joypad_driver();
|
||||
const input_device_driver_t *sec_joypad =
|
||||
input_driver_get_sec_joypad_driver();
|
||||
|
||||
if (!state)
|
||||
return;
|
||||
|
||||
memset(state->state, 0, sizeof(state->state));
|
||||
|
||||
/* poll mouse (on the relevant port) */
|
||||
for (b = 0; b < MENU_MAX_MBUTTONS; b++)
|
||||
state->state[port].mbuttons[b] =
|
||||
state->state[port].mouse_buttons[b] =
|
||||
input_mouse_button_raw(port, b);
|
||||
|
||||
joypad_info.joy_idx = 0;
|
||||
@ -301,13 +301,13 @@ bool menu_input_key_bind_set_mode(
|
||||
if (menu_input_key_bind_set_mode_common(state, setting) == -1)
|
||||
return false;
|
||||
|
||||
index_offset = setting->index_offset;
|
||||
menu_bind_port = settings->uints.input_joypad_map[index_offset];
|
||||
index_offset = setting->index_offset;
|
||||
menu_input_binds.port = settings->uints.input_joypad_map[index_offset];
|
||||
|
||||
menu_input_key_bind_poll_bind_get_rested_axes(
|
||||
&menu_input_binds, menu_bind_port);
|
||||
&menu_input_binds);
|
||||
menu_input_key_bind_poll_bind_state(
|
||||
&menu_input_binds, menu_bind_port, false);
|
||||
&menu_input_binds, false);
|
||||
|
||||
rarch_timer_begin_new_time_us(&menu_input_binds.timer_hold, timeout_end_us);
|
||||
rarch_timer_begin_new_time_us(&menu_input_binds.timer_timeout, timeout_end_us);
|
||||
@ -340,7 +340,7 @@ static bool menu_input_key_bind_poll_find_trigger_pad(
|
||||
|
||||
for (b = 0; b < MENU_MAX_MBUTTONS; b++)
|
||||
{
|
||||
bool iterate = n->mbuttons[b] && !o->mbuttons[b];
|
||||
bool iterate = n->mouse_buttons[b] && !o->mouse_buttons[b];
|
||||
|
||||
if (!iterate)
|
||||
continue;
|
||||
@ -439,7 +439,7 @@ static bool menu_input_key_bind_poll_find_hold_pad(
|
||||
|
||||
for (b = 0; b < MENU_MAX_MBUTTONS; b++)
|
||||
{
|
||||
bool iterate = n->mbuttons[b];
|
||||
bool iterate = n->mouse_buttons[b];
|
||||
|
||||
if (!iterate)
|
||||
continue;
|
||||
@ -625,7 +625,7 @@ bool menu_input_key_bind_iterate(menu_input_ctx_bind_t *bind,
|
||||
if (input_drv)
|
||||
input_drv->keyboard_mapping_blocked = true;
|
||||
|
||||
menu_input_key_bind_poll_bind_state( &binds, menu_bind_port, timed_out );
|
||||
menu_input_key_bind_poll_bind_state(&binds, timed_out);
|
||||
|
||||
#ifdef ANDROID
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user