diff --git a/menu/menu.c b/menu/menu.c index edfbbefdf2..7b5e6ec517 100644 --- a/menu/menu.c +++ b/menu/menu.c @@ -312,3 +312,19 @@ int menu_iterate(retro_input_t input, return 0; } + +void menu_set_refresh(void) +{ + menu_handle_t *menu = menu_driver_get_ptr(); + if (!menu) + return; + menu->need_refresh = true; +} + +void menu_unset_refresh(void) +{ + menu_handle_t *menu = menu_driver_get_ptr(); + if (!menu) + return; + menu->need_refresh = false; +} diff --git a/menu/menu.h b/menu/menu.h index 577713391e..4b299f1e63 100644 --- a/menu/menu.h +++ b/menu/menu.h @@ -188,6 +188,10 @@ bool menu_load_content(void); void menu_update_system_info(menu_handle_t *menu, bool *load_no_content); +void menu_set_refresh(void); + +void menu_unset_refresh(void); + #ifdef __cplusplus } #endif diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index b906e48eb9..c969fa7962 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -2036,7 +2036,7 @@ int menu_displaylist_push(file_list_t *list, file_list_t *menu_list) ret = menu_displaylist_deferred_push(&info); - menu->need_refresh = false; + menu_unset_refresh(); return ret; } diff --git a/menu/menu_entries_cbs_start.c b/menu/menu_entries_cbs_start.c index 21c90ab88b..7513aea3c0 100644 --- a/menu/menu_entries_cbs_start.c +++ b/menu/menu_entries_cbs_start.c @@ -209,7 +209,7 @@ static int action_start_shader_num_passes(unsigned type, const char *label, return -1; if (shader->passes) shader->passes = 0; - menu->need_refresh = true; + menu_set_refresh(); video_shader_resolve_parameters(NULL, menu->shader); #endif @@ -231,7 +231,7 @@ static int action_start_cheat_num_passes(unsigned type, const char *label, if (cheat->size) { cheat_manager_realloc(cheat, 0); - menu->need_refresh = true; + menu_set_refresh(); } return 0; diff --git a/menu/menu_entries_cbs_toggle.c b/menu/menu_entries_cbs_toggle.c index 76c14ee9c2..534c023332 100644 --- a/menu/menu_entries_cbs_toggle.c +++ b/menu/menu_entries_cbs_toggle.c @@ -347,12 +347,12 @@ static int action_toggle_cheat_num_passes(unsigned type, const char *label, case MENU_ACTION_LEFT: if (cheat->size) new_size = cheat->size - 1; - menu->need_refresh = true; + menu_set_refresh(); break; case MENU_ACTION_RIGHT: new_size = cheat->size + 1; - menu->need_refresh = true; + menu_set_refresh(); break; } @@ -380,13 +380,13 @@ static int action_toggle_shader_num_passes(unsigned type, const char *label, case MENU_ACTION_LEFT: if (shader->passes) shader->passes--; - menu->need_refresh = true; + menu_set_refresh(); break; case MENU_ACTION_RIGHT: if ((shader->passes < GFX_MAX_SHADERS)) shader->passes++; - menu->need_refresh = true; + menu_set_refresh(); break; } diff --git a/menu/menu_list.c b/menu/menu_list.c index 6fa3a1a1de..886d737313 100644 --- a/menu/menu_list.c +++ b/menu/menu_list.c @@ -253,7 +253,7 @@ void menu_list_flush_stack(menu_list_t *list, if (!menu || !list) return; - menu->need_refresh = true; + menu_set_refresh(); file_list_get_last(list->menu_stack, &path, &label, &type); while (type != final_type) @@ -273,7 +273,7 @@ void menu_list_flush_stack_by_needle(menu_list_t *list, if (!menu || !list) return; - menu->need_refresh = true; + menu_set_refresh(); file_list_get_last(list->menu_stack, &path, &label, &type); while (strcmp(needle, label) != 0) @@ -295,7 +295,7 @@ void menu_list_pop_stack(menu_list_t *list) menu_driver_list_cache(false, 0); menu_list_pop(list->menu_stack, &menu->navigation.selection_ptr); - menu->need_refresh = true; + menu_set_refresh(); } void menu_list_pop_stack_by_needle(menu_list_t *list, @@ -309,7 +309,7 @@ void menu_list_pop_stack_by_needle(menu_list_t *list, if (!menu || !list) return; - menu->need_refresh = true; + menu_set_refresh(); file_list_get_last(list->menu_stack, &path, &label, &type); while (strcmp(needle, label) == 0) @@ -392,7 +392,7 @@ int menu_list_push_stack_refresh(menu_list_t *list, menu_list_push(list->menu_stack, path, label, type, directory_ptr); menu_navigation_clear(&menu->navigation, true); - menu->need_refresh = true; + menu_set_refresh(); return 0; } diff --git a/menu/menu_shader.c b/menu/menu_shader.c index fb1f1bb0db..25be09bf8e 100644 --- a/menu/menu_shader.c +++ b/menu/menu_shader.c @@ -167,7 +167,7 @@ void menu_shader_manager_set_preset(struct video_shader *shader, } config_file_free(conf); - menu->need_refresh = true; + menu_set_refresh(); #endif } diff --git a/retroarch.c b/retroarch.c index 3db699342b..9839e9572c 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1273,7 +1273,7 @@ void rarch_main_set_state(unsigned cmd) global->system.frame_time_last = 0; } - menu->need_refresh = true; + menu_set_refresh(); runloop->is_menu = true; } #endif