mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 08:30:16 +00:00
Expand menu_entries_get_last_stack so we can grab enum_idx
This commit is contained in:
parent
03b93b224c
commit
3b3e822d78
@ -125,6 +125,7 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
const char *info_label = NULL;
|
||||
const char *info_path = NULL;
|
||||
menu_handle_t *menu = NULL;
|
||||
enum menu_hash_enums enum_idx = MENU_ENUM_LABEL_UNKNOWN;
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
||||
@ -133,7 +134,7 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return menu_cbs_exit();
|
||||
|
||||
menu_entries_get_last_stack(&menu_path, &menu_label, NULL, NULL);
|
||||
menu_entries_get_last_stack(&menu_path, &menu_label, NULL, &enum_idx, NULL);
|
||||
|
||||
if (path && menu_path)
|
||||
fill_pathname_join(action_path, menu_path, path, sizeof(action_path));
|
||||
@ -482,6 +483,7 @@ static int file_load_with_detect_core_wrapper(size_t idx, size_t entry_idx,
|
||||
char new_core_path[PATH_MAX_LENGTH] = {0};
|
||||
char menu_path_new[PATH_MAX_LENGTH] = {0};
|
||||
int ret = 0;
|
||||
enum menu_hash_enums enum_idx = MENU_ENUM_LABEL_UNKNOWN;
|
||||
const char *menu_path = NULL;
|
||||
const char *menu_label = NULL;
|
||||
menu_handle_t *menu = NULL;
|
||||
@ -490,7 +492,7 @@ static int file_load_with_detect_core_wrapper(size_t idx, size_t entry_idx,
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return menu_cbs_exit();
|
||||
|
||||
menu_entries_get_last_stack(&menu_path, &menu_label, NULL, NULL);
|
||||
menu_entries_get_last_stack(&menu_path, &menu_label, NULL, &enum_idx, NULL);
|
||||
|
||||
if (!string_is_empty(menu_path))
|
||||
strlcpy(menu_path_new, menu_path, sizeof(menu_path_new));
|
||||
@ -848,6 +850,7 @@ static int generic_action_ok(const char *path,
|
||||
char action_path[PATH_MAX_LENGTH] = {0};
|
||||
unsigned flush_type = 0;
|
||||
int ret = 0;
|
||||
enum menu_hash_enums enum_idx = MENU_ENUM_LABEL_UNKNOWN;
|
||||
const char *menu_path = NULL;
|
||||
const char *menu_label = NULL;
|
||||
const char *flush_char = NULL;
|
||||
@ -856,8 +859,7 @@ static int generic_action_ok(const char *path,
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
goto error;
|
||||
|
||||
menu_entries_get_last_stack(&menu_path, &menu_label,
|
||||
NULL, NULL);
|
||||
menu_entries_get_last_stack(&menu_path, &menu_label, NULL, &enum_idx, NULL);
|
||||
|
||||
if (!string_is_empty(path))
|
||||
fill_pathname_join(action_path, menu_path, path, sizeof(action_path));
|
||||
|
@ -44,6 +44,7 @@ int action_scan_file(const char *path,
|
||||
const char *label, unsigned type, size_t idx)
|
||||
{
|
||||
char fullpath[PATH_MAX_LENGTH] = {0};
|
||||
enum menu_hash_enums enum_idx = MENU_ENUM_LABEL_UNKNOWN;
|
||||
const char *menu_label = NULL;
|
||||
const char *menu_path = NULL;
|
||||
menu_handle_t *menu = NULL;
|
||||
@ -51,7 +52,7 @@ int action_scan_file(const char *path,
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return menu_cbs_exit();
|
||||
|
||||
menu_entries_get_last_stack(&menu_path, &menu_label, NULL, NULL);
|
||||
menu_entries_get_last_stack(&menu_path, &menu_label, NULL, &enum_idx, NULL);
|
||||
|
||||
fill_pathname_join(fullpath, menu_path, path, sizeof(fullpath));
|
||||
|
||||
@ -64,6 +65,7 @@ int action_scan_directory(const char *path,
|
||||
const char *label, unsigned type, size_t idx)
|
||||
{
|
||||
char fullpath[PATH_MAX_LENGTH] = {0};
|
||||
enum menu_hash_enums enum_idx = MENU_ENUM_LABEL_UNKNOWN;
|
||||
const char *menu_label = NULL;
|
||||
const char *menu_path = NULL;
|
||||
menu_handle_t *menu = NULL;
|
||||
@ -71,7 +73,7 @@ int action_scan_directory(const char *path,
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return menu_cbs_exit();
|
||||
|
||||
menu_entries_get_last_stack(&menu_path, &menu_label, NULL, NULL);
|
||||
menu_entries_get_last_stack(&menu_path, &menu_label, NULL, &enum_idx, NULL);
|
||||
|
||||
strlcpy(fullpath, menu_path, sizeof(fullpath));
|
||||
|
||||
|
@ -269,15 +269,16 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action)
|
||||
size_t selection;
|
||||
menu_entry_t entry;
|
||||
enum action_iterate_type iterate_type;
|
||||
const char *label = NULL;
|
||||
int ret = 0;
|
||||
uint32_t label_hash = 0;
|
||||
uint32_t hash = 0;
|
||||
menu_handle_t *menu = (menu_handle_t*)data;
|
||||
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
|
||||
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
||||
const char *label = NULL;
|
||||
int ret = 0;
|
||||
uint32_t label_hash = 0;
|
||||
uint32_t hash = 0;
|
||||
enum menu_hash_enums enum_idx = MENU_ENUM_LABEL_UNKNOWN;
|
||||
menu_handle_t *menu = (menu_handle_t*)data;
|
||||
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
|
||||
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
||||
|
||||
menu_entries_get_last_stack(NULL, &label, NULL, NULL);
|
||||
menu_entries_get_last_stack(NULL, &label, NULL, &enum_idx, NULL);
|
||||
|
||||
if (!menu)
|
||||
return 0;
|
||||
|
@ -40,21 +40,22 @@ void menu_cbs_init(void *data,
|
||||
unsigned type, size_t idx)
|
||||
{
|
||||
menu_ctx_bind_t bind_info;
|
||||
char elem0[PATH_MAX_LENGTH] = {0};
|
||||
char elem1[PATH_MAX_LENGTH] = {0};
|
||||
const char *repr_label = NULL;
|
||||
struct string_list *str_list = NULL;
|
||||
const char *menu_label = NULL;
|
||||
uint32_t label_hash = 0;
|
||||
uint32_t menu_label_hash = 0;
|
||||
file_list_t *list = (file_list_t*)data;
|
||||
char elem0[PATH_MAX_LENGTH] = {0};
|
||||
char elem1[PATH_MAX_LENGTH] = {0};
|
||||
const char *repr_label = NULL;
|
||||
struct string_list *str_list = NULL;
|
||||
const char *menu_label = NULL;
|
||||
uint32_t label_hash = 0;
|
||||
uint32_t menu_label_hash = 0;
|
||||
enum menu_hash_enums enum_idx = MENU_ENUM_LABEL_UNKNOWN;
|
||||
file_list_t *list = (file_list_t*)data;
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
elem0[0] = '\0';
|
||||
elem1[0] = '\0';
|
||||
|
||||
menu_entries_get_last_stack(NULL, &menu_label, NULL, NULL);
|
||||
menu_entries_get_last_stack(NULL, &menu_label, NULL, &enum_idx, NULL);
|
||||
|
||||
if (label)
|
||||
str_list = string_split(label, "|");
|
||||
|
@ -3324,9 +3324,10 @@ static int menu_displaylist_parse_generic(
|
||||
{
|
||||
case MENU_LABEL_CORE_LIST:
|
||||
{
|
||||
const char *dir = NULL;
|
||||
enum menu_hash_enums enum_idx = MENU_ENUM_LABEL_UNKNOWN;
|
||||
const char *dir = NULL;
|
||||
|
||||
menu_entries_get_last_stack(&dir, NULL, NULL, NULL);
|
||||
menu_entries_get_last_stack(&dir, NULL, NULL, &enum_idx, NULL);
|
||||
|
||||
list_size = file_list_get_size(info->list);
|
||||
|
||||
@ -3563,16 +3564,17 @@ static bool menu_displaylist_push_internal(
|
||||
|
||||
static bool menu_displaylist_push(menu_displaylist_ctx_entry_t *entry)
|
||||
{
|
||||
menu_file_list_cbs_t *cbs = NULL;
|
||||
const char *path = NULL;
|
||||
const char *label = NULL;
|
||||
unsigned type = 0;
|
||||
menu_displaylist_info_t info = {0};
|
||||
menu_file_list_cbs_t *cbs = NULL;
|
||||
const char *path = NULL;
|
||||
const char *label = NULL;
|
||||
unsigned type = 0;
|
||||
enum menu_hash_enums enum_idx = MENU_ENUM_LABEL_UNKNOWN;
|
||||
menu_displaylist_info_t info = {0};
|
||||
|
||||
if (!entry)
|
||||
return false;
|
||||
|
||||
menu_entries_get_last_stack(&path, &label, &type, NULL);
|
||||
menu_entries_get_last_stack(&path, &label, &type, &enum_idx, NULL);
|
||||
|
||||
info.list = entry->list;
|
||||
info.menu_list = entry->stack;
|
||||
|
@ -385,13 +385,14 @@ size_t menu_entries_get_end(void)
|
||||
/* Get an entry from the top of the menu stack */
|
||||
void menu_entries_get(size_t i, menu_entry_t *entry)
|
||||
{
|
||||
const char *label = NULL;
|
||||
const char *path = NULL;
|
||||
const char *entry_label = NULL;
|
||||
menu_file_list_cbs_t *cbs = NULL;
|
||||
const char *label = NULL;
|
||||
const char *path = NULL;
|
||||
const char *entry_label = NULL;
|
||||
menu_file_list_cbs_t *cbs = NULL;
|
||||
enum menu_hash_enums enum_idx = MENU_ENUM_LABEL_UNKNOWN;
|
||||
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
||||
|
||||
menu_entries_get_last_stack(NULL, &label, NULL, NULL);
|
||||
menu_entries_get_last_stack(NULL, &label, NULL, &enum_idx, NULL);
|
||||
|
||||
entry->path[0] = entry->value[0] = string_is_empty(entry->label);
|
||||
|
||||
@ -416,15 +417,16 @@ void menu_entries_get(size_t i, menu_entry_t *entry)
|
||||
/* Sets title to what the name of the current menu should be. */
|
||||
int menu_entries_get_title(char *s, size_t len)
|
||||
{
|
||||
unsigned menu_type = 0;
|
||||
const char *path = NULL;
|
||||
const char *label = NULL;
|
||||
unsigned menu_type = 0;
|
||||
const char *path = NULL;
|
||||
const char *label = NULL;
|
||||
enum menu_hash_enums enum_idx = MENU_ENUM_LABEL_UNKNOWN;
|
||||
menu_file_list_cbs_t *cbs = menu_entries_get_last_stack_actiondata();
|
||||
|
||||
if (!cbs)
|
||||
return -1;
|
||||
|
||||
menu_entries_get_last_stack(&path, &label, &menu_type, NULL);
|
||||
menu_entries_get_last_stack(&path, &label, &menu_type, &enum_idx, NULL);
|
||||
|
||||
if (cbs && cbs->action_get_title)
|
||||
return cbs->action_get_title(path, label, menu_type, s, len);
|
||||
@ -622,13 +624,19 @@ menu_file_list_cbs_t *menu_entries_get_last_stack_actiondata(void)
|
||||
}
|
||||
|
||||
void menu_entries_get_last_stack(const char **path, const char **label,
|
||||
unsigned *file_type, size_t *entry_idx)
|
||||
unsigned *file_type, enum menu_hash_enums *enum_idx, size_t *entry_idx)
|
||||
{
|
||||
menu_file_list_cbs_t *cbs = NULL;
|
||||
menu_list_t *menu_list = NULL;
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_LIST_GET, &menu_list);
|
||||
if (menu_list)
|
||||
menu_entries_get_last(menu_list->menu_stack[0],
|
||||
path, label, file_type, entry_idx);
|
||||
if (!menu_list)
|
||||
return;
|
||||
|
||||
menu_entries_get_last(menu_list->menu_stack[0],
|
||||
path, label, file_type, entry_idx);
|
||||
cbs = menu_entries_get_last_stack_actiondata();
|
||||
if (cbs)
|
||||
*enum_idx = cbs->enum_idx;
|
||||
}
|
||||
|
||||
void menu_entries_flush_stack(const char *needle, unsigned final_type)
|
||||
|
@ -143,7 +143,7 @@ void menu_entries_add(file_list_t *list, const char *path, const char *label,
|
||||
unsigned type, size_t directory_ptr, size_t entry_idx);
|
||||
|
||||
void menu_entries_get_last_stack(const char **path, const char **label,
|
||||
unsigned *file_type, size_t *entry_idx);
|
||||
unsigned *file_type, enum menu_hash_enums *enum_idx, size_t *entry_idx);
|
||||
|
||||
menu_file_list_cbs_t *menu_entries_get_last_stack_actiondata(void);
|
||||
|
||||
|
@ -290,8 +290,9 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
|
||||
|
||||
if (cbs && cbs->action_get_value && use_representation)
|
||||
{
|
||||
const char *label = NULL;
|
||||
menu_entries_get_last_stack(NULL, &label, NULL, NULL);
|
||||
enum menu_hash_enums enum_idx = MENU_ENUM_LABEL_UNKNOWN;
|
||||
const char *label = NULL;
|
||||
menu_entries_get_last_stack(NULL, &label, NULL, &enum_idx, NULL);
|
||||
|
||||
cbs->action_get_value(list,
|
||||
&entry->spacing, entry->type, i, label,
|
||||
|
Loading…
Reference in New Issue
Block a user