diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index f276aa6088..a64f668c87 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -501,16 +501,17 @@ static int generic_action_ok(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx, unsigned id, unsigned flush_id) { + bool msg_force; char action_path[PATH_MAX_LENGTH]; unsigned flush_type = 0; int ret = 0; const char *menu_path = NULL; const char *flush_char = NULL; global_t *global = global_get_ptr(); - menu_display_t *disp = menu_display_get_ptr(); menu_handle_t *menu = menu_driver_get_ptr(); settings_t *settings = config_get_ptr(); menu_list_t *menu_list = menu_list_get_ptr(); + if (!menu || !menu_list) goto error; @@ -558,10 +559,10 @@ static int generic_action_ok(const char *path, break; case ACTION_OK_LOAD_CONFIG_FILE: - flush_char = NULL; - flush_type = MENU_SETTINGS; - - disp->msg_force = true; + flush_char = NULL; + flush_type = MENU_SETTINGS; + msg_force = true; + menu_display_ctl(MENU_DISPLAY_CTL_SET_MSG_FORCE, &msg_force); if (rarch_replace_config(action_path)) { diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index ec7539c708..19b9844939 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -413,7 +413,6 @@ static void rgui_render(void) uint16_t *fb_data = NULL; rgui_t *rgui = NULL; menu_handle_t *menu = menu_driver_get_ptr(); - menu_display_t *disp = menu_display_get_ptr(); driver_t *driver = driver_get_ptr(); settings_t *settings = config_get_ptr(); uint64_t *frame_count = video_driver_get_frame_count(); @@ -433,8 +432,11 @@ static void rgui_render(void) if (!rgui->force_redraw) { - bool is_idle; - if (menu_entries_needs_refresh() && menu_driver_alive() && !disp->msg_force) + bool is_idle, msg_force; + + menu_display_ctl(MENU_DISPLAY_CTL_MSG_FORCE, &msg_force); + + if (menu_entries_needs_refresh() && menu_driver_alive() && !msg_force) return; rarch_main_ctl(RARCH_MAIN_CTL_IS_IDLE, &is_idle); @@ -605,10 +607,12 @@ static void rgui_render(void) #ifdef GEKKO const char *message_queue; - if (disp->msg_force) + if (msg_force) { + msg_force = false; message_queue = rarch_main_msg_queue_pull(); - disp->msg_force = false; + + menu_display_ctl(MENU_DISPLAY_CTL_SET_MSG_FORCE, &msg_force); } else message_queue = driver->current_msg; diff --git a/menu/drivers/rmenu.c b/menu/drivers/rmenu.c index ae4f13916c..e6a2a4540c 100644 --- a/menu/drivers/rmenu.c +++ b/menu/drivers/rmenu.c @@ -123,13 +123,13 @@ end: static void rmenu_render(void) { + bool msg_force; size_t begin, end, i, j, selection; struct font_params font_parms = {0}; char title[256] = {0}; char title_buf[256] = {0}; char title_msg[64] = {0}; menu_handle_t *menu = menu_driver_get_ptr(); - menu_display_t *disp = menu_display_get_ptr(); menu_list_t *menu_list = menu_list_get_ptr(); uint64_t *frame_count = video_driver_get_frame_count(); size_t entries_end = menu_entries_get_end(); @@ -146,8 +146,10 @@ static void rmenu_render(void) return; } + menu_display_ctl(MENU_DISPLAY_CTL_MSG_FORCE, &msg_force); + if (menu_entries_needs_refresh() && menu_driver_alive() - && !disp->msg_force) + && !msg_force) return; menu_display_fb_unset_dirty(); diff --git a/menu/drivers/rmenu_xui.cpp b/menu/drivers/rmenu_xui.cpp index 98a0088f52..d1a744878c 100644 --- a/menu/drivers/rmenu_xui.cpp +++ b/menu/drivers/rmenu_xui.cpp @@ -530,7 +530,7 @@ static void rmenu_xui_set_list_text(int index, const wchar_t* leftText, static void rmenu_xui_render(void) { - bool display_kb; + bool display_kb, msg_force; unsigned fb_width; size_t end, i, selection; char title[PATH_MAX_LENGTH] = {0}; @@ -538,17 +538,17 @@ static void rmenu_xui_render(void) const char *label = NULL; unsigned menu_type = 0; menu_handle_t *menu = menu_driver_get_ptr(); - menu_display_t *disp = menu_display_get_ptr(); uint64_t frame_count = video_driver_get_frame_count(); - menu_display_ctl(MENU_DISPLAY_CTL_WIDTH, &fb_width); + menu_display_ctl(MENU_DISPLAY_CTL_WIDTH, &fb_width); + menu_display_ctl(MENU_DISPLAY_CTL_MSG_FORCE, &msg_force); if (!menu) return; if ( menu_entries_needs_refresh() && menu_driver_alive() && - !disp->msg_force + !msg_force ) return; diff --git a/menu/menu.c b/menu/menu.c index f80816a6c2..5c2c0d30b3 100644 --- a/menu/menu.c +++ b/menu/menu.c @@ -87,14 +87,13 @@ static void menu_push_to_history_playlist(void) **/ bool menu_load_content(enum rarch_core_type type) { + bool msg_force = true; menu_handle_t *menu = menu_driver_get_ptr(); - menu_display_t *disp = menu_display_get_ptr(); driver_t *driver = driver_get_ptr(); global_t *global = global_get_ptr(); /* redraw menu frame */ - if (disp) - disp->msg_force = true; + menu_display_ctl(MENU_DISPLAY_CTL_SET_MSG_FORCE, &msg_force); menu_iterate(true, MENU_ACTION_NOOP); menu_iterate_render(); @@ -109,9 +108,6 @@ bool menu_load_content(enum rarch_core_type type) snprintf(msg, sizeof(msg), "Failed to load %s.\n", name); menu_display_msg_queue_push(msg, 1, 90, false); - if (disp) - disp->msg_force = true; - return false; } @@ -132,9 +128,9 @@ int menu_common_load_content( const char *core_path, const char *fullpath, bool persist, enum rarch_core_type type) { + bool msg_force = true; settings_t *settings = config_get_ptr(); global_t *global = global_get_ptr(); - menu_display_t *disp = menu_display_get_ptr(); menu_list_t *menu_list = menu_list_get_ptr(); enum event_command cmd = EVENT_CMD_NONE; @@ -171,7 +167,7 @@ int menu_common_load_content( event_command(cmd); menu_list_flush_stack(menu_list, NULL, MENU_SETTINGS); - disp->msg_force = true; + menu_display_ctl(MENU_DISPLAY_CTL_SET_MSG_FORCE, &msg_force); generic_action_ok_displaylist_push("", "", 0, 0, 0, ACTION_OK_DL_CONTENT_SETTINGS); diff --git a/menu/menu_display.c b/menu/menu_display.c index 2373ac7731..a077d2872f 100644 --- a/menu/menu_display.c +++ b/menu/menu_display.c @@ -310,6 +310,22 @@ bool menu_display_ctl(enum menu_display_ctl_state state, void *data) frame_buf->pitch = *ptr; } return true; + case MENU_DISPLAY_CTL_MSG_FORCE: + { + bool *ptr = (bool*)data; + if (!ptr) + return false; + *ptr = disp->msg_force; + } + return true; + case MENU_DISPLAY_CTL_SET_MSG_FORCE: + { + bool *ptr = (bool*)data; + if (!ptr) + return false; + disp->msg_force = *ptr; + } + return true; case MENU_DISPLAY_CTL_FONT_DATA_INIT: { bool *ptr = (bool*)data; diff --git a/menu/menu_display.h b/menu/menu_display.h index c9f45fbd1b..9580570fe7 100644 --- a/menu/menu_display.h +++ b/menu/menu_display.h @@ -51,7 +51,9 @@ enum menu_display_ctl_state MENU_DISPLAY_CTL_FONT_DATA_INIT, MENU_DISPLAY_CTL_SET_FONT_DATA_INIT, MENU_DISPLAY_CTL_FONT_SIZE, - MENU_DISPLAY_CTL_SET_FONT_SIZE + MENU_DISPLAY_CTL_SET_FONT_SIZE, + MENU_DISPLAY_CTL_MSG_FORCE, + MENU_DISPLAY_CTL_SET_MSG_FORCE }; typedef struct menu_display