diff --git a/frontend/menu/backend/menu_common_backend.c b/frontend/menu/backend/menu_common_backend.c index cbf1767e77..8ad5455633 100644 --- a/frontend/menu/backend/menu_common_backend.c +++ b/frontend/menu/backend/menu_common_backend.c @@ -1421,17 +1421,7 @@ static int menu_settings_iterate(unsigned action) file_list_get_last(driver.menu->menu_stack, &path, &label, &menu_type); - if (driver.menu->need_refresh && !(menu_type == MENU_FILE_DIRECTORY || - menu_common_type_is(menu_type) == MENU_SETTINGS_SHADER_OPTIONS || - menu_common_type_is(menu_type) == MENU_FILE_DIRECTORY || - menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER || - menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER || - menu_type == MENU_SETTINGS_OVERLAY_PRESET || - menu_type == MENU_CONTENT_HISTORY_PATH || - menu_type == MENU_SETTINGS_CORE || - menu_type == MENU_SETTINGS_CONFIG || - menu_type == MENU_SETTINGS_DISK_APPEND || - menu_type == MENU_SETTINGS_OPEN_HISTORY)) + if (driver.menu->need_refresh && (menu_parse_check(menu_type) == -1)) { driver.menu->need_refresh = false; menu_entries_push(driver.menu, path, label, menu_type); @@ -1724,17 +1714,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) file_list_get_at_offset(driver.menu->selection_buf, driver.menu->selection_ptr, &path, &label, &type); - if ( - menu_common_type_is(type) == MENU_SETTINGS_SHADER_OPTIONS || - menu_common_type_is(type) == MENU_FILE_DIRECTORY || - type == MENU_SETTINGS_OVERLAY_PRESET || - type == MENU_SETTINGS_VIDEO_SOFTFILTER || - type == MENU_SETTINGS_AUDIO_DSP_FILTER || - type == MENU_CONTENT_HISTORY_PATH || - type == MENU_SETTINGS_CORE || - type == MENU_SETTINGS_CONFIG || - type == MENU_SETTINGS_DISK_APPEND || - type == MENU_FILE_DIRECTORY) + if (menu_parse_check(type) == 0) { char cat_path[PATH_MAX]; fill_pathname_join(cat_path, dir, path, sizeof(cat_path)); diff --git a/frontend/menu/menu_entries.c b/frontend/menu/menu_entries.c index 25f2162ca7..d1ddce8958 100644 --- a/frontend/menu/menu_entries.c +++ b/frontend/menu/menu_entries.c @@ -563,6 +563,21 @@ int menu_entries_push(menu_handle_t *menu, return 0; } +int menu_parse_check(unsigned menu_type) +{ + if (!((menu_type == MENU_FILE_DIRECTORY || + menu_common_type_is(menu_type) == MENU_SETTINGS_SHADER_OPTIONS || + menu_common_type_is(menu_type) == MENU_FILE_DIRECTORY || + menu_type == MENU_SETTINGS_OVERLAY_PRESET || + menu_type == MENU_CONTENT_HISTORY_PATH || + menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER || + menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER || + menu_type == MENU_SETTINGS_CORE || + menu_type == MENU_SETTINGS_CONFIG || + menu_type == MENU_SETTINGS_DISK_APPEND))) + return -1; + return 0; +} int menu_parse_and_resolve(void) { @@ -580,16 +595,7 @@ int menu_parse_and_resolve(void) ) return menu_entries_push(driver.menu, dir, label, menu_type); - if (!((menu_type == MENU_FILE_DIRECTORY || - menu_common_type_is(menu_type) == MENU_SETTINGS_SHADER_OPTIONS || - menu_common_type_is(menu_type) == MENU_FILE_DIRECTORY || - menu_type == MENU_SETTINGS_OVERLAY_PRESET || - menu_type == MENU_CONTENT_HISTORY_PATH || - menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER || - menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER || - menu_type == MENU_SETTINGS_CORE || - menu_type == MENU_SETTINGS_CONFIG || - menu_type == MENU_SETTINGS_DISK_APPEND))) + if (menu_parse_check(menu_type) == -1) return - 1; file_list_clear(driver.menu->selection_buf); diff --git a/frontend/menu/menu_entries.h b/frontend/menu/menu_entries.h index 54dfd4981a..6c61d39222 100644 --- a/frontend/menu/menu_entries.h +++ b/frontend/menu/menu_entries.h @@ -22,6 +22,7 @@ int menu_entries_push(menu_handle_t *menu, const char *path, const char *label, unsigned menu_type); void menu_entries_push_info(void); +int menu_parse_check(unsigned menu_type); int menu_parse_and_resolve(void); #endif