From ed8525b2026495c4b20ee4390360e0018ff961de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 18 Jun 2015 23:21:14 +0700 Subject: [PATCH] (XMB) Start re-implementing the Run entry --- menu/cbs/menu_cbs_ok.c | 18 ++++++++++++++++++ menu/menu_displaylist.c | 23 ++++++++++++++++++----- menu/menu_hash.h | 1 + 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index c93f2adf8d..432071cb8b 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1319,6 +1319,21 @@ static int action_ok_save_new_config(const char *path, return generic_action_ok_command(EVENT_CMD_MENU_SAVE_CONFIG); } +static int action_ok_start_content(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; + + 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_resume_content(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { @@ -1525,6 +1540,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, case MENU_LABEL_RESUME_CONTENT: cbs->action_ok = action_ok_resume_content; break; + case MENU_LABEL_START_CONTENT: + cbs->action_ok = action_ok_start_content; + break; case MENU_LABEL_RESTART_CONTENT: cbs->action_ok = action_ok_restart_content; break; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 84ca2bc5bd..36b0fe318d 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -619,7 +619,6 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, uint32_t core_name_hash; char fill_buf[PATH_MAX_LENGTH] = {0}; char path_copy[PATH_MAX_LENGTH] = {0}; - bool core_detected = false; const char *core_name = NULL; const char *db_name = NULL; const char *path = NULL; @@ -652,7 +651,6 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, char tmp[PATH_MAX_LENGTH] = {0}; snprintf(tmp, sizeof(tmp), " (%s)", core_name); strlcat(fill_buf, tmp, sizeof(fill_buf)); - core_detected = true; } } } @@ -1314,6 +1312,7 @@ static int menu_displaylist_parse_horizontal_list(menu_displaylist_info_t *info) fill_pathname_join(path_playlist, settings->playlist_directory, item->path, sizeof(path_playlist)); + menu->playlist = content_playlist_init(path_playlist, 999); strlcpy(menu->db_playlist_file, path_playlist, sizeof(menu->db_playlist_file)); @@ -1370,6 +1369,7 @@ static int menu_displaylist_parse_horizontal_content_actions(menu_displaylist_in { menu_handle_t *menu = menu_driver_get_ptr(); global_t *global = global_get_ptr(); + settings_t *settings = config_get_ptr(); if (!menu) return -1; @@ -1393,9 +1393,22 @@ static int menu_displaylist_parse_horizontal_content_actions(menu_displaylist_in } else { - // 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); + unsigned idx = 0; // TODO get this value dynamically + const char *core_name = NULL; + const char *core_path = NULL; + + content_playlist_get_index(menu->playlist, idx, + NULL, NULL, &core_path, &core_name, NULL, NULL); + + if (!strcmp(core_name, "DETECT")) + { + menu_list_push(info->list, "TODO: Core selection", "", MENU_SETTING_ACTION_RUN, 0, 0); + } + else + { + strlcpy(settings->libretro, core_path, sizeof(settings->libretro)); + menu_list_push(info->list, "Run", "start_content", MENU_SETTING_ACTION_RUN, 0, 0); + } } return 0; diff --git a/menu/menu_hash.h b/menu/menu_hash.h index f426873661..388c4ee3ea 100644 --- a/menu/menu_hash.h +++ b/menu/menu_hash.h @@ -380,6 +380,7 @@ extern "C" { #define MENU_LABEL_CUSTOM_BIND_DEFAULTS 0xe88f7b13U #define MENU_LABEL_SAVESTATE 0x3a4849b5U #define MENU_LABEL_LOADSTATE 0xa39eb286U +#define MENU_LABEL_START_CONTENT 0xdc53686dU #define MENU_LABEL_RESUME_CONTENT 0xd9f088b0U #define MENU_LABEL_VALUE_RESUME 0xce8ac2f6U #define MENU_LABEL_RESTART_CONTENT 0x1ea2e224U