mirror of
https://github.com/libretro/RetroArch
synced 2025-01-27 21:35:25 +00:00
Create menu_input_dialog_start
This commit is contained in:
parent
ed3f002f1b
commit
b9320514cb
@ -1475,7 +1475,7 @@ static int action_ok_cheat(const char *path,
|
||||
line.idx = idx;
|
||||
line.cb = menu_input_st_cheat_cb;
|
||||
|
||||
if (!menu_input_ctl(MENU_INPUT_CTL_START_LINE, &line))
|
||||
if (!menu_input_dialog_start(&line))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
@ -1526,7 +1526,7 @@ static int action_ok_shader_preset_save_as(const char *path,
|
||||
line.idx = idx;
|
||||
line.cb = menu_input_st_string_cb_save_preset;
|
||||
|
||||
if (!menu_input_ctl(MENU_INPUT_CTL_START_LINE, &line))
|
||||
if (!menu_input_dialog_start(&line))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
@ -1647,7 +1647,7 @@ static int action_ok_cheat_file_save_as(const char *path,
|
||||
line.idx = idx;
|
||||
line.cb = menu_input_st_string_cb_cheat_file_save_as;
|
||||
|
||||
if (!menu_input_ctl(MENU_INPUT_CTL_START_LINE, &line))
|
||||
if (!menu_input_dialog_start(&line))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -628,10 +628,11 @@ bool menu_input_mouse_check_vector_inside_hitbox(menu_input_ctx_hitbox_t *hitbox
|
||||
return inside_hitbox;
|
||||
}
|
||||
|
||||
static const char **menu_input_keyboard_buffer;
|
||||
|
||||
bool menu_input_ctl(enum menu_input_ctl_state state, void *data)
|
||||
{
|
||||
static char menu_input_keyboard_label_setting[256];
|
||||
static const char **menu_input_keyboard_buffer;
|
||||
static const char *menu_input_keyboard_label = NULL;
|
||||
static bool pointer_dragging = false;
|
||||
menu_input_t *menu_input = menu_input_get_ptr();
|
||||
@ -761,29 +762,6 @@ bool menu_input_ctl(enum menu_input_ctl_state state, void *data)
|
||||
return false;
|
||||
return menu_input_key_bind_iterate(bind->s, bind->len);
|
||||
}
|
||||
case MENU_INPUT_CTL_START_LINE:
|
||||
{
|
||||
bool keyboard_display = true;
|
||||
menu_handle_t *menu = NULL;
|
||||
menu_input_ctx_line_t *line = (menu_input_ctx_line_t*)data;
|
||||
if (!menu_input || !line)
|
||||
return false;
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return false;
|
||||
|
||||
menu_input_ctl(MENU_INPUT_CTL_SET_KEYBOARD_DISPLAY,
|
||||
&keyboard_display);
|
||||
menu_input_ctl(MENU_INPUT_CTL_SET_KEYBOARD_LABEL,
|
||||
&line->label);
|
||||
menu_input_ctl(MENU_INPUT_CTL_SET_KEYBOARD_LABEL_SETTING,
|
||||
&line->label_setting);
|
||||
|
||||
menu_input->keyboard.type = line->type;
|
||||
menu_input->keyboard.idx = line->idx;
|
||||
menu_input_keyboard_buffer =
|
||||
input_keyboard_start_line(menu, line->cb);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
case MENU_INPUT_CTL_NONE:
|
||||
break;
|
||||
@ -792,6 +770,31 @@ bool menu_input_ctl(enum menu_input_ctl_state state, void *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool menu_input_dialog_start(menu_input_ctx_line_t *line)
|
||||
{
|
||||
bool keyboard_display = true;
|
||||
menu_handle_t *menu = NULL;
|
||||
menu_input_t *menu_input = menu_input_get_ptr();
|
||||
if (!menu_input || !line)
|
||||
return false;
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return false;
|
||||
|
||||
menu_input_ctl(MENU_INPUT_CTL_SET_KEYBOARD_DISPLAY,
|
||||
&keyboard_display);
|
||||
menu_input_ctl(MENU_INPUT_CTL_SET_KEYBOARD_LABEL,
|
||||
&line->label);
|
||||
menu_input_ctl(MENU_INPUT_CTL_SET_KEYBOARD_LABEL_SETTING,
|
||||
&line->label_setting);
|
||||
|
||||
menu_input->keyboard.type = line->type;
|
||||
menu_input->keyboard.idx = line->idx;
|
||||
menu_input_keyboard_buffer =
|
||||
input_keyboard_start_line(menu, line->cb);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int menu_input_pointer(unsigned *action)
|
||||
{
|
||||
const struct retro_keybind *binds[MAX_USERS] = {NULL};
|
||||
|
@ -91,8 +91,7 @@ enum menu_input_ctl_state
|
||||
MENU_INPUT_CTL_BIND_SINGLE,
|
||||
MENU_INPUT_CTL_BIND_ALL,
|
||||
MENU_INPUT_CTL_BIND_ITERATE,
|
||||
MENU_INPUT_CTL_BIND_SET_MIN_MAX,
|
||||
MENU_INPUT_CTL_START_LINE
|
||||
MENU_INPUT_CTL_BIND_SET_MIN_MAX
|
||||
};
|
||||
|
||||
typedef struct menu_input_ctx_hitbox
|
||||
@ -118,6 +117,10 @@ typedef struct menu_input_ctx_line
|
||||
input_keyboard_line_complete_t cb;
|
||||
} menu_input_ctx_line_t;
|
||||
|
||||
bool menu_input_dialog_start(menu_input_ctx_line_t *line);
|
||||
|
||||
void menu_input_dialog_end(void);
|
||||
|
||||
typedef struct menu_input_ctx_bind_limits
|
||||
{
|
||||
unsigned min;
|
||||
@ -139,7 +142,6 @@ int16_t menu_input_mouse_state(enum menu_input_mouse_state state);
|
||||
|
||||
bool menu_input_mouse_check_vector_inside_hitbox(menu_input_ctx_hitbox_t *hitbox);
|
||||
|
||||
void menu_input_dialog_end(void);
|
||||
|
||||
bool menu_input_ctl(enum menu_input_ctl_state state, void *data);
|
||||
|
||||
|
@ -1824,7 +1824,7 @@ static int setting_generic_action_ok_linefeed(void *data, bool wraparound)
|
||||
line.idx = 0;
|
||||
line.cb = cb;
|
||||
|
||||
if (!menu_input_ctl(MENU_INPUT_CTL_START_LINE, &line))
|
||||
if (!menu_input_dialog_start(&line))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user