From 9772eed73953d0d6051f27ecf92479fbe6f071da Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 30 Aug 2014 16:56:45 +0200 Subject: [PATCH] (Menu) Refactor start screen and info screen --- frontend/menu/backend/menu_common_backend.c | 17 ++++++++++------- frontend/menu/backend/menu_common_backend.h | 2 +- frontend/menu/disp/rgui.c | 4 ++-- frontend/menu/disp/rmenu.c | 4 ++-- frontend/menu/disp/rmenu_xui.cpp | 4 ++-- frontend/menu/menu_common.c | 2 +- frontend/menu/menu_common.h | 2 -- 7 files changed, 18 insertions(+), 17 deletions(-) diff --git a/frontend/menu/backend/menu_common_backend.c b/frontend/menu/backend/menu_common_backend.c index 9db21bca0c..223588b1a3 100644 --- a/frontend/menu/backend/menu_common_backend.c +++ b/frontend/menu/backend/menu_common_backend.c @@ -502,7 +502,7 @@ static void menu_common_entries_init(menu_handle_t *menu, unsigned menu_type) add_entry(menu,"restart_retroarch", 0, setting_data); add_entry(menu,"configurations", MENU_SETTINGS_CONFIG, setting_data); add_entry(menu,"save_new_config", 0, setting_data); - add_entry(menu,"help", MENU_START_SCREEN, setting_data); + add_entry(menu,"help", 0, setting_data); add_entry(menu,"quit_retroarch", 0, setting_data); break; } @@ -1106,8 +1106,8 @@ static int menu_settings_iterate(unsigned action) file_list_get_at_offset(driver.menu->selection_buf, driver.menu->selection_ptr, &path, &label, &driver.menu->info_selection); - file_list_push(driver.menu->menu_stack, "", "", - MENU_INFO_SCREEN, driver.menu->selection_ptr); + file_list_push(driver.menu->menu_stack, "", "info_screen", + 0, driver.menu->selection_ptr); } break; case MENU_ACTION_LEFT: @@ -1208,7 +1208,7 @@ static int menu_settings_iterate(unsigned action) if (driver.menu->push_start_screen) { driver.menu->push_start_screen = false; - file_list_push(driver.menu->menu_stack, "", "", MENU_START_SCREEN, 0); + file_list_push(driver.menu->menu_stack, "", "help", 0, 0); } return 0; @@ -2249,6 +2249,7 @@ static int menu_common_iterate(unsigned action) unsigned menu_type = 0; const char *dir = NULL; const char *label = NULL; + const char *menu_label = NULL; if (!driver.menu) { @@ -2256,14 +2257,16 @@ static int menu_common_iterate(unsigned action) return 0; } - file_list_get_last(driver.menu->menu_stack, &dir, NULL, &menu_type); + file_list_get_last(driver.menu->menu_stack, &dir, &menu_label, &menu_type); if (driver.video_data && driver.menu_ctx && driver.menu_ctx->set_texture) driver.menu_ctx->set_texture(driver.menu); - if (menu_type == MENU_START_SCREEN) + //RARCH_LOG("Menu label: %s\n", menu_label); + + if (!strcmp(menu_label, "help")) return menu_start_screen_iterate(action); - else if (menu_type == MENU_INFO_SCREEN) + else if (!strcmp(menu_label, "info_screen")) return menu_info_screen_iterate(action); else if (menu_common_type_is(menu_type) == MENU_SETTINGS) return menu_settings_iterate(action); diff --git a/frontend/menu/backend/menu_common_backend.h b/frontend/menu/backend/menu_common_backend.h index 8853b9f977..063e399064 100644 --- a/frontend/menu/backend/menu_common_backend.h +++ b/frontend/menu/backend/menu_common_backend.h @@ -30,7 +30,7 @@ typedef enum { // Shader stuff - MENU_SETTINGS_GENERAL_OPTIONS = MENU_START_SCREEN + 1, + MENU_SETTINGS_GENERAL_OPTIONS = MENU_SETTINGS + 1, MENU_SETTINGS_VIDEO_OPTIONS, MENU_SETTINGS_VIDEO_OPTIONS_FIRST, MENU_SETTINGS_VIDEO_RESOLUTION, diff --git a/frontend/menu/disp/rgui.c b/frontend/menu/disp/rgui.c index f5b222ad84..74552df9ad 100644 --- a/frontend/menu/disp/rgui.c +++ b/frontend/menu/disp/rgui.c @@ -355,12 +355,12 @@ static void rgui_render(void) menu_type == MENU_SETTINGS_OPTIONS || menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT || menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT_2 || - menu_type == MENU_START_SCREEN || + !strcmp(label, "help") || menu_type == MENU_SETTINGS) snprintf(title, sizeof(title), "MENU %s", dir); else if (menu_type == MENU_SETTINGS_OPEN_HISTORY) strlcpy(title, "LOAD HISTORY", sizeof(title)); - else if (menu_type == MENU_INFO_SCREEN) + else if (!strcmp(label, "info_screen")) strlcpy(title, "INFO", sizeof(title)); #ifdef HAVE_OVERLAY else if (menu_type == MENU_SETTINGS_OVERLAY_PRESET) diff --git a/frontend/menu/disp/rmenu.c b/frontend/menu/disp/rmenu.c index 889704896c..909dbb17ea 100644 --- a/frontend/menu/disp/rmenu.c +++ b/frontend/menu/disp/rmenu.c @@ -219,12 +219,12 @@ static void rmenu_render(void) (menu_type == MENU_SETTINGS_OPTIONS) || (menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT || menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT_2) || menu_type == MENU_SETTINGS_CUSTOM_BIND || - menu_type == MENU_START_SCREEN || + !strcmp(label, "help") || menu_type == MENU_SETTINGS) snprintf(title, sizeof(title), "MENU %s", dir); else if (menu_type == MENU_SETTINGS_OPEN_HISTORY) strlcpy(title, "LOAD HISTORY", sizeof(title)); - else if (menu_type == MENU_INFO_SCREEN) + else if (!strcmp(label, "info_screen")) strlcpy(title, "INFO", sizeof(title)); #ifdef HAVE_OVERLAY else if (menu_type == MENU_SETTINGS_OVERLAY_PRESET) diff --git a/frontend/menu/disp/rmenu_xui.cpp b/frontend/menu/disp/rmenu_xui.cpp index 1c11a56eb2..1b790a7756 100644 --- a/frontend/menu/disp/rmenu_xui.cpp +++ b/frontend/menu/disp/rmenu_xui.cpp @@ -454,12 +454,12 @@ static void rmenu_xui_render(void) (menu_type == MENU_SETTINGS_OPTIONS) || (menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT || menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT_2) || menu_type == MENU_SETTINGS_CUSTOM_BIND || - menu_type == MENU_START_SCREEN || + !strcmp(label, "help") || menu_type == MENU_SETTINGS) snprintf(title, sizeof(title), "MENU %s", dir); else if (menu_type == MENU_SETTINGS_OPEN_HISTORY) strlcpy(title, "LOAD HISTORY", sizeof(title)); - else if (menu_type == MENU_INFO_SCREEN) + else if (!strcmp(label, "info_screen")) strlcpy(title, "INFO", sizeof(title)); #ifdef HAVE_OVERLAY else if (menu_type == MENU_SETTINGS_OVERLAY_PRESET) diff --git a/frontend/menu/menu_common.c b/frontend/menu/menu_common.c index 8eea62ce32..a7c9c97aa3 100644 --- a/frontend/menu/menu_common.c +++ b/frontend/menu/menu_common.c @@ -696,5 +696,5 @@ void menu_build_scroll_indices(file_list_t *buf) void menu_push_info_screen(void) { - file_list_push(driver.menu->menu_stack, "", "", MENU_START_SCREEN, 0); + file_list_push(driver.menu->menu_stack, "", "help", 0, 0); } diff --git a/frontend/menu/menu_common.h b/frontend/menu/menu_common.h index 6d3af83236..29621ec750 100644 --- a/frontend/menu/menu_common.h +++ b/frontend/menu/menu_common.h @@ -61,8 +61,6 @@ typedef enum MENU_FILE_DEVICE, MENU_FILE_USE_DIRECTORY, MENU_SETTINGS, - MENU_INFO_SCREEN, - MENU_START_SCREEN, } menu_file_type_t; typedef enum