diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 10c1d9c14c..bdc3c8df3f 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -4266,8 +4266,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) case DISPLAYLIST_CORE_CONTENT: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); #ifdef HAVE_NETWORKING - print_buf_lines(info->list, core_buf, "", - (int)core_len, FILE_TYPE_DOWNLOAD_CORE_CONTENT, true, false); + print_buf_lines(info->list, menu->core_buf, "", + (int)menu->core_len, + FILE_TYPE_DOWNLOAD_CORE_CONTENT, true, false); info->need_push = true; info->need_refresh = true; info->need_clear = true; @@ -4284,9 +4285,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) if (str_list->elems[0].data) strlcpy(new_label, str_list->elems[0].data, sizeof(new_label)); if (str_list->elems[1].data) - strlcpy(core_buf, str_list->elems[1].data, core_len); - print_buf_lines(info->list, core_buf, new_label, - (int)core_len, FILE_TYPE_DOWNLOAD_URL, false, false); + strlcpy(menu->core_buf, str_list->elems[1].data, menu->core_len); + print_buf_lines(info->list, menu->core_buf, new_label, + (int)menu->core_len, FILE_TYPE_DOWNLOAD_URL, false, false); info->need_push = true; info->need_refresh = true; info->need_clear = true; @@ -4306,8 +4307,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) fill_pathname_join(new_label, settings->paths.network_buildbot_assets_url, "cores", sizeof(new_label)); - print_buf_lines(info->list, core_buf, new_label, - (int)core_len, FILE_TYPE_DOWNLOAD_URL, true, false); + print_buf_lines(info->list, menu->core_buf, new_label, + (int)menu->core_len, FILE_TYPE_DOWNLOAD_URL, true, false); info->need_push = true; info->need_refresh = true; info->need_clear = true; @@ -4317,8 +4318,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) case DISPLAYLIST_CORES_UPDATER: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); #ifdef HAVE_NETWORKING - print_buf_lines(info->list, core_buf, "", - (int)core_len, FILE_TYPE_DOWNLOAD_CORE, true, true); + print_buf_lines(info->list, menu->core_buf, "", + (int)menu->core_len, FILE_TYPE_DOWNLOAD_CORE, true, true); info->need_push = true; info->need_refresh = true; info->need_clear = true; @@ -4327,8 +4328,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) case DISPLAYLIST_THUMBNAILS_UPDATER: #ifdef HAVE_NETWORKING menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); - print_buf_lines(info->list, core_buf, "", - (int)core_len, FILE_TYPE_DOWNLOAD_THUMBNAIL_CONTENT, + print_buf_lines(info->list, menu->core_buf, "", + (int)menu->core_len, FILE_TYPE_DOWNLOAD_THUMBNAIL_CONTENT, true, false); info->need_push = true; info->need_refresh = true; @@ -4338,8 +4339,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) case DISPLAYLIST_LAKKA: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); #ifdef HAVE_NETWORKING - print_buf_lines(info->list, core_buf, "", - (int)core_len, FILE_TYPE_DOWNLOAD_LAKKA, + print_buf_lines(info->list, menu->core_buf, "", + (int)menu->core_len, FILE_TYPE_DOWNLOAD_LAKKA, true, false); info->need_push = true; info->need_refresh = true; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 8132428c0d..ed2489c0b1 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -356,9 +356,11 @@ typedef struct { unsigned rpl_entry_selection_ptr; unsigned rdb_entry_start_game_selection_ptr; + size_t core_len; size_t hack_shader_pass; uint64_t state; + char *core_buf; char menu_state_msg[1024]; /* Scratchpad variables. These are used for instance * by the filebrowser when having to store intermediary @@ -601,9 +603,6 @@ const char *menu_driver_find_ident(int index); **/ const char* config_get_menu_driver_options(void); -/* HACK */ -extern unsigned int rdb_entry_start_game_selection_ptr; - const char *menu_driver_ident(void); bool menu_driver_render(bool is_idle, bool is_inited, bool is_dummy); diff --git a/menu/menu_networking.c b/menu/menu_networking.c index 991cd6656f..4d2a2beec9 100644 --- a/menu/menu_networking.c +++ b/menu/menu_networking.c @@ -30,6 +30,7 @@ #include #endif +#include "menu_driver.h" #include "menu_networking.h" #include "menu_cbs.h" #include "menu_entries.h" @@ -40,9 +41,6 @@ #include "../msg_hash.h" #include "../tasks/tasks_internal.h" -char *core_buf = NULL; -size_t core_len = 0; - void print_buf_lines(file_list_t *list, char *buf, const char *label, int buf_size, enum msg_file_type type, bool append, bool extended) @@ -226,28 +224,32 @@ finish: void cb_net_generic(void *task_data, void *user_data, const char *err) { #ifdef HAVE_NETWORKING - bool refresh = false; - http_transfer_data_t *data = (http_transfer_data_t*)task_data; - file_transfer_t *state = (file_transfer_t*)user_data; + bool refresh = false; + http_transfer_data_t *data = (http_transfer_data_t*)task_data; + file_transfer_t *state = (file_transfer_t*)user_data; + menu_handle_t *menu = NULL; - if (core_buf) - free(core_buf); + if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) + goto finish; - core_buf = NULL; - core_len = 0; + if (menu->core_buf) + free(menu->core_buf); + + menu->core_buf = NULL; + menu->core_len = 0; if (!data || err) goto finish; - core_buf = (char*)malloc((data->len+1) * sizeof(char)); + menu->core_buf = (char*)malloc((data->len+1) * sizeof(char)); - if (!core_buf) + if (!menu->core_buf) goto finish; if (!string_is_empty(data->data)) - memcpy(core_buf, data->data, data->len * sizeof(char)); - core_buf[data->len] = '\0'; - core_len = data->len; + memcpy(menu->core_buf, data->data, data->len * sizeof(char)); + menu->core_buf[data->len] = '\0'; + menu->core_len = data->len; finish: refresh = true; diff --git a/menu/menu_networking.h b/menu/menu_networking.h index 176e4e3c34..d88c54563a 100644 --- a/menu/menu_networking.h +++ b/menu/menu_networking.h @@ -29,9 +29,6 @@ RETRO_BEGIN_DECLS -extern char *core_buf; -extern size_t core_len; - void print_buf_lines(file_list_t *list, char *buf, const char *label, int buf_size, enum msg_file_type type, bool append, bool extended);