Create menu_entries_get_menu_stack_ptr

This commit is contained in:
twinaphex 2015-10-17 17:44:57 +02:00
parent 71a5e8eab5
commit d1fa131a35
3 changed files with 41 additions and 18 deletions

View File

@ -184,6 +184,22 @@ int menu_entries_get_core_title(char *s, size_t len)
return 0; return 0;
} }
file_list_t *menu_entries_get_menu_stack_ptr(void)
{
menu_list_t *menu_list = menu_list_get_ptr();
if (!menu_list)
return NULL;
return menu_list->menu_stack;
}
file_list_t *menu_entries_get_selection_buf_ptr(void)
{
menu_list_t *menu_list = menu_list_get_ptr();
if (!menu_list)
return NULL;
return menu_list->selection_buf;
}
bool menu_entries_needs_refresh(void) bool menu_entries_needs_refresh(void)
{ {
menu_entries_t *entries = menu_entries_get_ptr(); menu_entries_t *entries = menu_entries_get_ptr();

View File

@ -52,6 +52,10 @@ void menu_entries_set_refresh(bool nonblocking);
void menu_entries_unset_refresh(bool nonblocking); void menu_entries_unset_refresh(bool nonblocking);
file_list_t *menu_entries_get_selection_buf_ptr(void);
file_list_t *menu_entries_get_menu_stack_ptr(void);
void menu_entries_push(file_list_t *list, const char *path, const char *label, void menu_entries_push(file_list_t *list, const char *path, const char *label,
unsigned type, size_t directory_ptr, size_t entry_idx); unsigned type, size_t directory_ptr, size_t entry_idx);

View File

@ -175,12 +175,12 @@ static void menu_input_key_end_line(void)
static void menu_input_search_callback(void *userdata, const char *str) static void menu_input_search_callback(void *userdata, const char *str)
{ {
size_t idx = 0; size_t idx = 0;
menu_list_t *menu_list = menu_list_get_ptr(); file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
if (!menu_list) if (!selection_buf)
return; return;
if (str && *str && file_list_search(menu_list->selection_buf, str, &idx)) if (str && *str && file_list_search(selection_buf, str, &idx))
{ {
bool scroll = true; bool scroll = true;
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx);
@ -593,14 +593,16 @@ static int menu_input_key_bind_set_mode_common(rarch_setting_t *setting,
unsigned index_offset, bind_type; unsigned index_offset, bind_type;
menu_displaylist_info_t info = {0}; menu_displaylist_info_t info = {0};
struct retro_keybind *keybind = NULL; struct retro_keybind *keybind = NULL;
file_list_t *menu_stack = NULL;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
menu_input_t *menu_input = menu_input_get_ptr(); menu_input_t *menu_input = menu_input_get_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
if (!setting) if (!setting)
return -1; return -1;
index_offset = menu_setting_get_index_offset(setting); index_offset = menu_setting_get_index_offset(setting);
menu_stack = menu_entries_get_menu_stack_ptr();
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection); menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
@ -621,7 +623,7 @@ static int menu_input_key_bind_set_mode_common(rarch_setting_t *setting,
menu_input->binds.target = keybind; menu_input->binds.target = keybind;
menu_input->binds.user = index_offset; menu_input->binds.user = index_offset;
info.list = menu_list->menu_stack; info.list = menu_stack;
info.type = MENU_SETTINGS_CUSTOM_BIND_KEYBOARD; info.type = MENU_SETTINGS_CUSTOM_BIND_KEYBOARD;
info.directory_ptr = selection; info.directory_ptr = selection;
strlcpy(info.label, strlcpy(info.label,
@ -635,7 +637,7 @@ static int menu_input_key_bind_set_mode_common(rarch_setting_t *setting,
menu_input->binds.begin = MENU_SETTINGS_BIND_BEGIN; menu_input->binds.begin = MENU_SETTINGS_BIND_BEGIN;
menu_input->binds.last = MENU_SETTINGS_BIND_LAST; menu_input->binds.last = MENU_SETTINGS_BIND_LAST;
info.list = menu_list->menu_stack; info.list = menu_stack;
info.type = MENU_SETTINGS_CUSTOM_BIND_KEYBOARD; info.type = MENU_SETTINGS_CUSTOM_BIND_KEYBOARD;
info.directory_ptr = selection; info.directory_ptr = selection;
strlcpy(info.label, strlcpy(info.label,
@ -645,6 +647,7 @@ static int menu_input_key_bind_set_mode_common(rarch_setting_t *setting,
menu_displaylist_push_list(&info, DISPLAYLIST_INFO); menu_displaylist_push_list(&info, DISPLAYLIST_INFO);
break; break;
} }
return 0; return 0;
} }
@ -1179,14 +1182,14 @@ void menu_input_post_iterate(int *ret, unsigned action)
menu_file_list_cbs_t *cbs = NULL; menu_file_list_cbs_t *cbs = NULL;
menu_entry_t entry = {{0}}; menu_entry_t entry = {{0}};
menu_input_t *menu_input = menu_input_get_ptr(); menu_input_t *menu_input = menu_input_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection)) if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
return; return;
cbs = menu_list_get_actiondata_at_offset if (selection_buf)
(menu_list->selection_buf, selection); cbs = menu_list_get_actiondata_at_offset(selection_buf, selection);
menu_entry_get(&entry, selection, NULL, false); menu_entry_get(&entry, selection, NULL, false);