Revert "Move menu_displaylist global state to menu_handle_t"

This reverts commit c79966bd620aed2d79e430b4f14b42e50d0a4ef6.
This commit is contained in:
twinaphex 2020-06-06 18:30:08 +02:00
parent c79966bd62
commit 01da7b95e2
2 changed files with 39 additions and 27 deletions

View File

@ -121,6 +121,18 @@
#endif #endif
#endif #endif
/* TODO/FIXME - globals - need to find a way to
* get rid of these */
struct menu_displaylist_state
{
enum msg_hash_enums new_type;
char new_path_entry[4096];
char new_lbl_entry[4096];
char new_entry[4096];
};
static struct menu_displaylist_state menu_displist_st;
static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info) static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info)
{ {
char tmp[PATH_MAX_LENGTH]; char tmp[PATH_MAX_LENGTH];
@ -3811,7 +3823,7 @@ static void wifi_scan_callback(retro_task_t *task,
bool menu_displaylist_process(menu_displaylist_info_t *info) bool menu_displaylist_process(menu_displaylist_info_t *info)
{ {
size_t idx = 0; size_t idx = 0;
menu_handle_t *menu = menu_driver_get_ptr(); struct menu_displaylist_state *p_displist = &menu_displist_st;
#if defined(HAVE_NETWORKING) #if defined(HAVE_NETWORKING)
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
#endif #endif
@ -3883,20 +3895,20 @@ bool menu_displaylist_process(menu_displaylist_info_t *info)
#endif #endif
} }
if (!string_is_empty(menu->new_entry)) if (!string_is_empty(p_displist->new_entry))
{ {
menu_entries_prepend(info->list, menu_entries_prepend(info->list,
menu->new_path_entry, p_displist->new_path_entry,
menu->new_lbl_entry, p_displist->new_lbl_entry,
menu->new_type, p_displist->new_type,
FILE_TYPE_CORE, 0, 0); FILE_TYPE_CORE, 0, 0);
file_list_set_alt_at_offset(info->list, 0, file_list_set_alt_at_offset(info->list, 0,
menu->new_entry); p_displist->new_entry);
menu->new_type = MSG_UNKNOWN; p_displist->new_type = MSG_UNKNOWN;
menu->new_lbl_entry[0] = '\0'; p_displist->new_lbl_entry[0] = '\0';
menu->new_path_entry[0] = '\0'; p_displist->new_path_entry[0] = '\0';
menu->new_entry[0] = '\0'; p_displist->new_entry[0] = '\0';
} }
if (info->need_refresh) if (info->need_refresh)
@ -9349,6 +9361,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if (cores_names_size != 0) if (cores_names_size != 0)
{ {
unsigned j = 0; unsigned j = 0;
struct menu_displaylist_state
*p_displist = &menu_displist_st;
struct string_list *cores_paths = struct string_list *cores_paths =
string_list_new_special(STRING_LIST_SUPPORTED_CORES_PATHS, string_list_new_special(STRING_LIST_SUPPORTED_CORES_PATHS,
(void*)menu->deferred_path, (void*)menu->deferred_path,
@ -9362,15 +9376,15 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if ( !path_is_empty(RARCH_PATH_CORE) && if ( !path_is_empty(RARCH_PATH_CORE) &&
string_is_equal(core_path, path_get(RARCH_PATH_CORE))) string_is_equal(core_path, path_get(RARCH_PATH_CORE)))
{ {
strlcpy(menu->new_path_entry, strlcpy(p_displist->new_path_entry,
core_path, sizeof(menu->new_path_entry)); core_path, sizeof(p_displist->new_path_entry));
snprintf(menu->new_entry, snprintf(p_displist->new_entry,
sizeof(menu->new_entry), "%s (%s)", sizeof(p_displist->new_entry), "%s (%s)",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DETECT_CORE_LIST_OK_CURRENT_CORE), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DETECT_CORE_LIST_OK_CURRENT_CORE),
core_name); core_name);
strlcpy(menu->new_lbl_entry, strlcpy(p_displist->new_lbl_entry,
core_path, sizeof(menu->new_lbl_entry)); core_path, sizeof(p_displist->new_lbl_entry));
menu->new_type = p_displist->new_type =
MENU_ENUM_LABEL_DETECT_CORE_LIST_OK_CURRENT_CORE; MENU_ENUM_LABEL_DETECT_CORE_LIST_OK_CURRENT_CORE;
} }
else if (core_path) else if (core_path)
@ -9447,6 +9461,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if (cores_names_size != 0) if (cores_names_size != 0)
{ {
unsigned j = 0; unsigned j = 0;
struct menu_displaylist_state
*p_displist = &menu_displist_st;
struct string_list *cores_paths = struct string_list *cores_paths =
string_list_new_special(STRING_LIST_SUPPORTED_CORES_PATHS, string_list_new_special(STRING_LIST_SUPPORTED_CORES_PATHS,
(void*)menu->deferred_path, (void*)menu->deferred_path,
@ -9460,14 +9476,14 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if ( !path_is_empty(RARCH_PATH_CORE) && if ( !path_is_empty(RARCH_PATH_CORE) &&
string_is_equal(core_path, path_get(RARCH_PATH_CORE))) string_is_equal(core_path, path_get(RARCH_PATH_CORE)))
{ {
strlcpy(menu->new_path_entry, strlcpy(p_displist->new_path_entry,
core_path, sizeof(menu->new_path_entry)); core_path, sizeof(p_displist->new_path_entry));
snprintf(menu->new_entry, snprintf(p_displist->new_entry,
sizeof(menu->new_entry), "%s (%s)", sizeof(p_displist->new_entry), "%s (%s)",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DETECT_CORE_LIST_OK_CURRENT_CORE), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DETECT_CORE_LIST_OK_CURRENT_CORE),
core_name); core_name);
menu->new_lbl_entry[0] = '\0'; p_displist->new_lbl_entry[0] = '\0';
menu->new_type = p_displist->new_type =
MENU_ENUM_LABEL_FILE_BROWSER_CORE_SELECT_FROM_COLLECTION_CURRENT_CORE; MENU_ENUM_LABEL_FILE_BROWSER_CORE_SELECT_FROM_COLLECTION_CURRENT_CORE;
} }
else if (core_path) else if (core_path)

View File

@ -326,10 +326,6 @@ typedef struct
} scratchpad; } scratchpad;
const menu_ctx_driver_t *driver_ctx; const menu_ctx_driver_t *driver_ctx;
void *userdata; void *userdata;
enum msg_hash_enums new_type;
char new_path_entry[4096];
char new_lbl_entry[4096];
char new_entry[4096];
} menu_handle_t; } menu_handle_t;
typedef struct menu_content_ctx_defer_info typedef struct menu_content_ctx_defer_info