From 153b5c2a43c109530d5debcfad27e7a845ff2dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 18 Jun 2015 15:13:54 +0700 Subject: [PATCH] (XMB) Restore the contextual menu --- menu/cbs/menu_cbs_deferred_push.c | 7 +++++ menu/cbs/menu_cbs_left.c | 1 + menu/cbs/menu_cbs_ok.c | 52 +++++++++++++++++-------------- menu/cbs/menu_cbs_right.c | 1 + menu/drivers/xmb.c | 2 ++ menu/menu.h | 1 + menu/menu_displaylist.c | 21 +++++-------- menu/menu_hash.h | 1 - 8 files changed, 48 insertions(+), 38 deletions(-) diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index 56a696f91e..dfd00f0423 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -61,6 +61,11 @@ static int deferred_push_rdb_entry_detail(menu_displaylist_info_t *info) return ret; } +static int deferred_push_rpl_entry_actions(menu_displaylist_info_t *info) +{ + return menu_displaylist_push_list(info, DISPLAYLIST_HORIZONTAL_CONTENT_ACTIONS); +} + static int deferred_push_core_list_deferred(menu_displaylist_info_t *info) { return menu_displaylist_push_list(info, DISPLAYLIST_CORES_SUPPORTED); @@ -459,6 +464,8 @@ static int menu_cbs_init_bind_deferred_push_compare_label(menu_file_list_cbs_t * { if (strstr(label, "deferred_rdb_entry_detail")) cbs->action_deferred_push = deferred_push_rdb_entry_detail; + else if (strstr(label, "deferred_rpl_entry_actions")) + cbs->action_deferred_push = deferred_push_rpl_entry_actions; else { switch (label_hash) diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 7a3768f501..5501f33c9f 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -437,6 +437,7 @@ static int menu_cbs_init_bind_left_compare_type(menu_file_list_cbs_t *cbs, case MENU_FILE_CARCHIVE: case MENU_FILE_CORE: case MENU_FILE_RDB: + case MENU_FILE_RPL_ENTRY: case MENU_FILE_RDB_ENTRY: case MENU_FILE_CURSOR: case MENU_FILE_SHADER: diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 3ff448ffb6..c93f2adf8d 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -938,6 +938,31 @@ static int action_ok_rdb_entry(const char *path, return menu_displaylist_push_list(&info, DISPLAYLIST_GENERIC); } +static int action_ok_rpl_entry(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + menu_handle_t *menu = menu_driver_get_ptr(); + char tmp[PATH_MAX_LENGTH] = {0}; + menu_displaylist_info_t info = {0}; + menu_list_t *menu_list = menu_list_get_ptr(); + if (!menu_list) + return -1; + + strlcpy(menu->deferred_path, label, sizeof(menu->deferred_path)); + + strlcpy(tmp, "deferred_rpl_entry_actions|", sizeof(tmp)); + strlcat(tmp, path, sizeof(tmp)); + + info.list = menu_list->menu_stack; + info.type = 0; + info.directory_ptr = idx; + + strlcpy(info.path, label, sizeof(info.path)); + strlcpy(info.label, tmp, sizeof(info.label)); + + return menu_displaylist_push_list(&info, DISPLAYLIST_GENERIC); +} + static int action_ok_cursor_manager_list_deferred(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { @@ -1312,27 +1337,6 @@ static int action_ok_screenshot(const char *path, return generic_action_ok_command(EVENT_CMD_TAKE_SCREENSHOT); } -static int action_ok_file_load_or_resume(const char *path, - const char *label, unsigned type, size_t idx, size_t entry_idx) -{ - menu_handle_t *menu = menu_driver_get_ptr(); - global_t *global = global_get_ptr(); - - if (!menu) - return -1; - - if (!strcmp(menu->deferred_path, global->fullpath)) - return generic_action_ok_command(EVENT_CMD_RESUME); - else - { - strlcpy(global->fullpath, - menu->deferred_path, sizeof(global->fullpath)); - event_command(EVENT_CMD_LOAD_CORE); - rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT); - return -1; - } -} - static int action_ok_shader_apply_changes(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { @@ -1527,9 +1531,6 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, case MENU_LABEL_TAKE_SCREENSHOT: cbs->action_ok = action_ok_screenshot; break; - case MENU_LABEL_FILE_LOAD_OR_RESUME: - cbs->action_ok = action_ok_file_load_or_resume; - break; case MENU_LABEL_QUIT_RETROARCH: cbs->action_ok = action_ok_quit; break; @@ -1739,6 +1740,9 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs, case MENU_FILE_RDB_ENTRY: cbs->action_ok = action_ok_rdb_entry; break; + case MENU_FILE_RPL_ENTRY: + cbs->action_ok = action_ok_rpl_entry; + break; case MENU_FILE_CURSOR: switch (menu_label_hash) { diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index c84724b204..90cbcf5cbf 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -371,6 +371,7 @@ static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs, case MENU_FILE_CARCHIVE: case MENU_FILE_CORE: case MENU_FILE_RDB: + case MENU_FILE_RPL_ENTRY: case MENU_FILE_RDB_ENTRY: case MENU_FILE_CURSOR: case MENU_FILE_SHADER: diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 748f9cb192..7930c324ca 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -985,6 +985,8 @@ static GLuint xmb_icon_get_id(xmb_handle_t *xmb, return xmb->textures.list[XMB_TEXTURE_FOLDER].id; case MENU_FILE_PLAIN: return xmb->textures.list[XMB_TEXTURE_FILE].id; + case MENU_FILE_RPL_ENTRY: + case MENU_FILE_RDB_ENTRY: case MENU_FILE_PLAYLIST_ENTRY: if (xmb->boxart && active && node && node->zoom == 1) return xmb->boxart; diff --git a/menu/menu.h b/menu/menu.h index da068eb509..58699574fc 100644 --- a/menu/menu.h +++ b/menu/menu.h @@ -85,6 +85,7 @@ typedef enum MENU_FILE_DOWNLOAD_CORE_INFO, MENU_FILE_RDB, MENU_FILE_RDB_ENTRY, + MENU_FILE_RPL_ENTRY, MENU_FILE_CURSOR, MENU_FILE_RECORD_CONFIG, MENU_FILE_PLAYLIST_COLLECTION, diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 45a834e69f..84ca2bc5bd 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -657,18 +657,9 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, } } - if (!is_history && core_detected && db_name[0] != '\0') - { - char db_path[PATH_MAX_LENGTH] = {0}; - - fill_pathname_join(db_path, settings->content_database, - db_name, sizeof(db_path)); - path_remove_extension(db_path); - strlcat(db_path, ".rdb", sizeof(db_path)); - + if (!is_history) menu_list_push(info->list, label, - db_path, MENU_FILE_RDB_ENTRY, 0, i); - } + path, MENU_FILE_RPL_ENTRY, 0, i); else menu_list_push(info->list, fill_buf, path_playlist, MENU_FILE_PLAYLIST_ENTRY, 0, i); @@ -1386,7 +1377,7 @@ static int menu_displaylist_parse_horizontal_content_actions(menu_displaylist_in !strcmp(menu->deferred_path, global->fullpath)) { menu_list_push(info->list, menu_hash_to_str(MENU_LABEL_RESUME_CONTENT), - "file_load_or_resume", MENU_SETTING_ACTION_RUN, 0, 0); + "resume_content", MENU_SETTING_ACTION_RUN, 0, 0); menu_list_push(info->list, menu_hash_to_str(MENU_LABEL_SAVE_STATE), "savestate", MENU_SETTING_ACTION_SAVESTATE, 0, 0); menu_list_push(info->list, menu_hash_to_str(MENU_LABEL_LOAD_STATE), @@ -1401,7 +1392,11 @@ static int menu_displaylist_parse_horizontal_content_actions(menu_displaylist_in MENU_SETTING_ACTION_RESET, 0, 0); } else - menu_list_push(info->list, "Run", "file_load_or_resume", MENU_SETTING_ACTION_RUN, 0, 0); + { + // TODO Here, push a list of cores instead of run + // but display Run if the core is detected in the playlist + menu_list_push(info->list, "Run", "", MENU_SETTING_ACTION_RUN, 0, 0); + } return 0; } diff --git a/menu/menu_hash.h b/menu/menu_hash.h index 5c6b230c2d..f426873661 100644 --- a/menu/menu_hash.h +++ b/menu/menu_hash.h @@ -384,7 +384,6 @@ extern "C" { #define MENU_LABEL_VALUE_RESUME 0xce8ac2f6U #define MENU_LABEL_RESTART_CONTENT 0x1ea2e224U #define MENU_LABEL_TAKE_SCREENSHOT 0x6786e867U -#define MENU_LABEL_FILE_LOAD_OR_RESUME 0x952941f4U #define MENU_LABEL_DISK_IMAGE_APPEND 0x5af7d709U #define MENU_LABEL_CONFIGURATIONS 0x3e930a50U #define MENU_LABEL_CHEAT_FILE_SAVE_AS 0x1f58dccaU