diff --git a/input/input_driver.c b/input/input_driver.c index 54687826cd..0d7d660ada 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -3842,31 +3842,30 @@ static void input_overlay_loaded(retro_task_t *task, { #ifdef HAVE_MENU struct menu_state *menu_st = menu_state_get_ptr(); - bool refresh = false; /* Update menu entries */ if (menu_st->overlay_types != data->overlay_types) { - menu_st->overlay_types = data->overlay_types; - menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); + menu_st->overlay_types = data->overlay_types; + menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; } /* We can't display when the menu is up */ - if ( (data->flags & OVERLAY_LOADER_HIDE_IN_MENU) && - (menu_st->flags & MENU_ST_FLAG_ALIVE)) + if ( (data->flags & OVERLAY_LOADER_HIDE_IN_MENU) + && (menu_st->flags & MENU_ST_FLAG_ALIVE)) goto abort_load; #endif /* If 'hide_when_gamepad_connected' is enabled, * we can't display when a gamepad is connected */ - if ( (data->flags & OVERLAY_LOADER_HIDE_WHEN_GAMEPAD_CONNECTED) && - (input_config_get_device_name(0) != NULL)) + if ( (data->flags & OVERLAY_LOADER_HIDE_WHEN_GAMEPAD_CONNECTED) + && (input_config_get_device_name(0) != NULL)) goto abort_load; } - if ( !(data->flags & OVERLAY_LOADER_ENABLE) || - !video_driver_overlay_interface(&iface) || - !iface) + if ( !(data->flags & OVERLAY_LOADER_ENABLE) + || !video_driver_overlay_interface(&iface) + || !iface) { RARCH_ERR("Overlay interface is not present in video driver," " or not enabled.\n"); diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 03c6ba1434..61472779b8 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -688,12 +688,12 @@ static int manual_content_scan_core_name_left(unsigned type, const char *label, static int cpu_policy_mode_change(unsigned type, const char *label, bool wraparound) { - bool refresh = false; + struct menu_state *menu_st = menu_state_get_ptr(); enum cpu_scaling_mode mode = get_cpu_scaling_mode(NULL); if (mode != CPUSCALING_MANAGED_PERFORMANCE) mode--; set_cpu_scaling_mode(mode, NULL); - menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); + menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; return 0; } diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 4d40611ef9..969dc40b35 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -3299,14 +3299,12 @@ static int generic_action_ok_shader_preset_remove(const char *path, if (menu_shader_manager_remove_auto_preset(preset_type, dir_video_shader, dir_menu_config)) { - bool refresh = false; - + struct menu_state *menu_st = menu_state_get_ptr(); runloop_msg_queue_push( msg_hash_to_str(MSG_SHADER_PRESET_REMOVED_SUCCESSFULLY), 1, 100, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); - - menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); + menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; } else runloop_msg_queue_push( diff --git a/menu/cbs/menu_cbs_start.c b/menu/cbs/menu_cbs_start.c index 5ec03b6934..72c98fafd7 100644 --- a/menu/cbs/menu_cbs_start.c +++ b/menu/cbs/menu_cbs_start.c @@ -407,8 +407,8 @@ static int action_start_cheat_num_passes( { if (cheat_manager_get_size()) { - bool refresh = false; - menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); + struct menu_state *menu_st = menu_state_get_ptr(); + menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; cheat_manager_realloc(0, CHEAT_HANDLER_TYPE_EMU); } diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 1e534e9ca3..a0dc15c30d 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -5702,10 +5702,7 @@ bool menu_displaylist_process(menu_displaylist_info_t *info) } if (info_flags & MD_FLAG_NEED_ENTRIES_REFRESH) - { - bool refresh = false; - menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); - } + menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; if (info_flags & MD_FLAG_NEED_SORT) file_list_sort_on_alt(info_list); diff --git a/menu/menu_driver.c b/menu/menu_driver.c index c1818ac5f5..436f7bbb00 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -1283,12 +1283,11 @@ static void menu_list_flush_stack( menu_list_t *list, size_t idx, const char *needle, unsigned final_type) { - bool refresh = false; const char *label = NULL; unsigned type = 0; file_list_t *menu_list = MENU_LIST_GET(list, (unsigned)idx); - menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); + menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; menu_contentless_cores_flush_runtime(); if (menu_list && menu_list->size) @@ -1300,7 +1299,6 @@ static void menu_list_flush_stack( while (menu_list_flush_stack_type( needle, label, type, final_type) != 0) { - bool refresh = false; size_t new_selection_ptr = menu_st->selection_ptr; bool wont_pop_stack = (MENU_LIST_GET_STACK_SIZE(list, idx) <= 1); if (wont_pop_stack) @@ -1314,7 +1312,7 @@ static void menu_list_flush_stack( menu_userdata, list, idx, &new_selection_ptr); - menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); + menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; menu_st->selection_ptr = new_selection_ptr; menu_list = MENU_LIST_GET(list, (unsigned)idx); @@ -2708,11 +2706,11 @@ int menu_shader_manager_clear_num_passes(struct video_shader *shader) { if (shader) { - bool refresh = false; - shader->passes = 0; - menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); + struct menu_state *menu_st = &menu_driver_state; + shader->passes = 0; + menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; video_shader_resolve_parameters(shader); - shader->flags |= SHDR_FLAG_MODIFIED; + shader->flags |= SHDR_FLAG_MODIFIED; } return 0; @@ -4346,7 +4344,6 @@ void menu_entries_pop_stack(size_t *ptr, size_t idx, bool animate) if (MENU_LIST_GET_STACK_SIZE(menu_list, idx) > 1) { - bool refresh = false; if (animate) { if (menu_driver_ctx->list_cache) @@ -4357,7 +4354,7 @@ void menu_entries_pop_stack(size_t *ptr, size_t idx, bool animate) menu_st->userdata, menu_list, idx, ptr); if (animate) - menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); + menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; } } @@ -4367,22 +4364,13 @@ bool menu_entries_ctl(enum menu_entries_ctl_state state, void *data) switch (state) { - case MENU_ENTRIES_CTL_SET_REFRESH: - { - bool *nonblocking = (bool*)data; - - if (*nonblocking) - menu_st->flags |= MENU_ST_FLAG_ENTRIES_NONBLOCKING_REFRESH; - else - menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; - } - break; case MENU_ENTRIES_CTL_SET_START: { size_t *idx = (size_t*)data; if (idx) menu_st->entries.begin = *idx; } + break; case MENU_ENTRIES_CTL_START_GET: { size_t *idx = (size_t*)data; @@ -6219,6 +6207,7 @@ void menu_driver_toggle( bool pause_libretro = false; bool audio_enable_menu = false; runloop_state_t *runloop_st = runloop_state_get_ptr(); + struct menu_state *menu_st = &menu_driver_state; bool runloop_shutdown_initiated = runloop_st->flags & RUNLOOP_FLAG_SHUTDOWN_INITIATED; #ifdef HAVE_OVERLAY @@ -6285,19 +6274,16 @@ void menu_driver_toggle( if (menu_driver_alive) { - bool refresh = false; - #ifdef WIIU /* Enable burn-in protection menu is running */ IMEnableDim(); #endif - menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); + menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; /* Menu should always run with vsync on and * a video swap interval of 1 */ if (current_video->set_nonblock_state) - { current_video->set_nonblock_state( video_driver_data, false, @@ -6305,7 +6291,6 @@ void menu_driver_toggle( video_adaptive_vsync, 1 ); - } /* Stop all rumbling before entering the menu. */ command_event(CMD_EVENT_RUMBLE_STOP, NULL); @@ -6835,8 +6820,8 @@ end: bool menu_shader_manager_set_preset(struct video_shader *menu_shader, enum rarch_shader_type type, const char *preset_path, bool apply) { - bool refresh = false; bool ret = false; + struct menu_state *menu_st = &menu_driver_state; settings_t *settings = config_get_ptr(); if (apply && !video_shader_apply_shader(settings, type, preset_path, true)) @@ -6862,7 +6847,7 @@ bool menu_shader_manager_set_preset(struct video_shader *menu_shader, ret = true; end: - menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); + menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; command_event(CMD_EVENT_SHADER_PRESET_LOADED, NULL); return ret; @@ -6890,11 +6875,11 @@ clear: bool menu_shader_manager_append_preset(struct video_shader *shader, const char* preset_path, const bool prepend) { - bool refresh = false; bool ret = false; settings_t* settings = config_get_ptr(); const char *dir_video_shader = settings->paths.directory_video_shader; enum rarch_shader_type type = menu_shader_manager_get_type(shader); + struct menu_state *menu_st = &menu_driver_state; if (string_is_empty(preset_path)) { @@ -6909,9 +6894,9 @@ bool menu_shader_manager_append_preset(struct video_shader *shader, /* TODO/FIXME - localize */ RARCH_LOG("[Shaders]: Menu shader set to: \"%s\".\n", preset_path); - ret = true; + ret = true; - menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); + menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; command_event(CMD_EVENT_SHADER_PRESET_LOADED, NULL); return ret; diff --git a/menu/menu_entries.h b/menu/menu_entries.h index 3d6f2f3abd..ff59b25622 100644 --- a/menu/menu_entries.h +++ b/menu/menu_entries.h @@ -38,7 +38,6 @@ RETRO_BEGIN_DECLS enum menu_entries_ctl_state { MENU_ENTRIES_CTL_NONE = 0, - MENU_ENTRIES_CTL_SET_REFRESH, /* Sets the starting index of the menu entry list. */ MENU_ENTRIES_CTL_SET_START, /* Returns the starting index of the menu entry list. */ diff --git a/menu/menu_explore.c b/menu/menu_explore.c index 9379287005..20dd6e1167 100644 --- a/menu/menu_explore.c +++ b/menu/menu_explore.c @@ -1031,20 +1031,17 @@ static void explore_on_edit_views(enum msg_hash_enums msg) static int explore_action_ok_deleteview(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - struct menu_state *menu_st = menu_state_get_ptr(); + struct menu_state *menu_st = menu_state_get_ptr(); menu_list_t *menu_list = menu_st->entries.list; file_list_t *menu_stack = MENU_LIST_GET(menu_list, 0); filestream_delete(explore_get_view_path(menu_st, menu_list, menu_stack)); explore_on_edit_views(MENU_ENUM_LABEL_EXPLORE_VIEW_DELETED); + /* if we're at the top of the menu we can't cancel so just refresh + what becomes selected after MENU_ENVIRON_RESET_HORIZONTAL_LIST. */ if (menu_stack->size == 1) - { - /* if we're at the top of the menu we can't cancel so just refresh - what becomes selected after MENU_ENVIRON_RESET_HORIZONTAL_LIST. */ - bool refresh_nonblocking = false; - menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh_nonblocking); - } + menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; return explore_cancel(path, label, type, idx); } diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 90918e615e..aa66a6c56e 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -8470,9 +8470,9 @@ static void frontend_log_level_change_handler(rarch_setting_t *setting) static void runahead_change_handler(rarch_setting_t *setting) { settings_t *settings = config_get_ptr(); + struct menu_state *menu_st = menu_state_get_ptr(); bool run_ahead_enabled = settings->bools.run_ahead_enabled; bool preempt_enabled = settings->bools.preemptive_frames_enable; - bool refresh = false; #if (defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)) unsigned run_ahead_frames = settings->uints.run_ahead_frames; bool run_ahead_secondary_instance = settings->bools.run_ahead_secondary_instance; @@ -8493,7 +8493,7 @@ static void runahead_change_handler(rarch_setting_t *setting) msg_hash_to_str(MSG_PREEMPT_DISABLED), 1, 100, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); } - menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); + menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; /* fall-through */ case MENU_ENUM_LABEL_RUN_AHEAD_FRAMES: #if (defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)) @@ -8519,17 +8519,15 @@ static void runahead_change_handler(rarch_setting_t *setting) static void preempt_change_handler(rarch_setting_t *setting) { - settings_t *settings = config_get_ptr(); - bool preempt_enabled = settings->bools.preemptive_frames_enable; - bool run_ahead_enabled = settings->bools.run_ahead_enabled; - preempt_t *preempt = runloop_state_get_ptr()->preempt_data; - bool refresh = false; - bool netplay_enabled; - + settings_t *settings = config_get_ptr(); + bool preempt_enabled = settings->bools.preemptive_frames_enable; + bool run_ahead_enabled = settings->bools.run_ahead_enabled; + preempt_t *preempt = runloop_state_get_ptr()->preempt_data; + struct menu_state *menu_st = menu_state_get_ptr(); #ifdef HAVE_NETWORKING - netplay_enabled = netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL); + bool netplay_enabled = netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL); #else - netplay_enabled = false; + bool netplay_enabled = false; #endif if (!setting) @@ -8550,7 +8548,7 @@ static void preempt_change_handler(rarch_setting_t *setting) if ((preempt_enabled != !!preempt) && !netplay_enabled) command_event(CMD_EVENT_PREEMPT_UPDATE, NULL); - menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); + menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; break; case MENU_ENUM_LABEL_PREEMPT_FRAMES: if ( preempt diff --git a/ui/drivers/qt/qt_dialogs.cpp b/ui/drivers/qt/qt_dialogs.cpp index 6ee2499f34..81b9d75116 100644 --- a/ui/drivers/qt/qt_dialogs.cpp +++ b/ui/drivers/qt/qt_dialogs.cpp @@ -2041,10 +2041,6 @@ void ShaderParamsDialog::operateShaderPreset(bool save, const char *path, unsign path_dir_video_shader, path_dir_menu_config)) { -#ifdef HAVE_MENU - bool refresh = false; -#endif - runloop_msg_queue_push( msg_hash_to_str(MSG_SHADER_PRESET_REMOVED_SUCCESSFULLY), 1, 100, true, NULL, @@ -2053,7 +2049,7 @@ void ShaderParamsDialog::operateShaderPreset(bool save, const char *path, unsign ); #ifdef HAVE_MENU - menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); + menu_state_get_ptr()->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; #endif } else