From ccd5b2f73d5beaa784ad40ea38f2b09dc89dc1f9 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 27 May 2016 19:18:46 +0200 Subject: [PATCH] Add 'Start Remote Gamepad' entry --- menu/cbs/menu_cbs_ok.c | 15 +++++++++++++++ menu/drivers/materialui.c | 3 +++ menu/drivers/xmb.c | 3 +++ menu/intl/menu_hash_us.c | 4 ++++ menu/menu_displaylist.c | 3 +++ menu/menu_hash.h | 3 +++ menu/menu_setting.c | 10 ++++++++++ tasks/task_content.c | 15 +++++++++++++++ tasks/tasks_internal.h | 1 + 9 files changed, 57 insertions(+) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 85398b1ce0..ddb5cf657f 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -2068,6 +2068,18 @@ static int action_ok_start_core(const char *path, return 0; } +static int action_ok_start_net_retropad_core(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + content_ctx_info_t content_info = {0}; + task_push_content_load_default(NULL, NULL, + &content_info, CORE_TYPE_PLAIN, + CONTENT_MODE_LOAD_NOTHING_WITH_NET_RETROPAD_CORE_FROM_MENU, + NULL, NULL); + + return 0; +} + static int action_ok_open_archive_detect_core(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { @@ -2339,6 +2351,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, case MENU_LABEL_START_CORE: BIND_ACTION_OK(cbs, action_ok_start_core); break; + case MENU_LABEL_START_NET_RETROPAD: + BIND_ACTION_OK(cbs, action_ok_start_net_retropad_core); + break; case MENU_LABEL_OPEN_ARCHIVE_DETECT_CORE: BIND_ACTION_OK(cbs, action_ok_open_archive_detect_core); break; diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index fd605cbaef..6ccc385083 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -1408,6 +1408,9 @@ static int mui_list_push(void *data, void *userdata, entry.info_label = menu_hash_to_str(MENU_LABEL_START_CORE); menu_displaylist_ctl(DISPLAYLIST_SETTING, &entry); + entry.info_label = menu_hash_to_str(MENU_LABEL_START_NET_RETROPAD); + menu_displaylist_ctl(DISPLAYLIST_SETTING, &entry); + #ifndef HAVE_DYNAMIC if (frontend_driver_has_fork()) #endif diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 01d8a55c23..d355d48e63 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -3194,6 +3194,9 @@ static int xmb_list_push(void *data, void *userdata, entry.info_label = menu_hash_to_str(MENU_LABEL_START_CORE); menu_displaylist_ctl(DISPLAYLIST_SETTING, &entry); + entry.info_label = menu_hash_to_str(MENU_LABEL_START_NET_RETROPAD); + menu_displaylist_ctl(DISPLAYLIST_SETTING, &entry); + #ifndef HAVE_DYNAMIC if (frontend_driver_has_fork()) #endif diff --git a/menu/intl/menu_hash_us.c b/menu/intl/menu_hash_us.c index 6989ad5f08..96872e2bfd 100644 --- a/menu/intl/menu_hash_us.c +++ b/menu/intl/menu_hash_us.c @@ -620,6 +620,8 @@ static const char *menu_hash_to_str_us_label(uint32_t hash) return "take_screenshot"; case MENU_LABEL_CORE_UPDATER_LIST: return "core_updater_list"; + case MENU_LABEL_START_NET_RETROPAD: + return "menu_start_net_retropad"; case MENU_LABEL_THUMBNAILS_UPDATER_LIST: return "thumbnails_updater_list"; case MENU_LABEL_CORE_UPDATER_BUILDBOT_URL: @@ -754,6 +756,8 @@ const char *menu_hash_to_str_us(uint32_t hash) switch (hash) { + case MENU_LABEL_VALUE_START_NET_RETROPAD: + return "Start Remote RetroPad"; case MENU_LABEL_VALUE_THUMBNAILS_UPDATER_LIST: return "Thumbnails Updater"; case MENU_LABEL_VALUE_MENU_LINEAR_FILTER: diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 298d1f7a8f..4db92cd98c 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -3411,6 +3411,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) menu_displaylist_parse_settings(menu, info, menu_hash_to_str(MENU_LABEL_START_CORE), PARSE_ACTION, false); + menu_displaylist_parse_settings(menu, info, + menu_hash_to_str(MENU_LABEL_START_NET_RETROPAD), PARSE_ACTION, false); + #ifndef HAVE_DYNAMIC if (frontend_driver_has_fork()) #endif diff --git a/menu/menu_hash.h b/menu/menu_hash.h index 9463ed96c2..32d11e8491 100644 --- a/menu/menu_hash.h +++ b/menu/menu_hash.h @@ -20,6 +20,9 @@ extern "C" { #endif +#define MENU_LABEL_START_NET_RETROPAD 0xf2ae670dU +#define MENU_LABEL_VALUE_START_NET_RETROPAD 0xad11a6a0U + #define CB_THUMBNAILS_UPDATER_DOWNLOAD 0xf4ee156bU #define MENU_LABEL_THUMBNAILS_UPDATER_LIST 0xff70176bU diff --git a/menu/menu_setting.c b/menu/menu_setting.c index d8ded80876..eaa31c3d90 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -3563,6 +3563,16 @@ static bool setting_append_list( &subgroup_info, parent_group); +#if defined(HAVE_NETPLAY) && defined(HAVE_NETWORK_GAMEPAD) + CONFIG_ACTION( + list, list_info, + menu_hash_to_str(MENU_LABEL_START_NET_RETROPAD), + menu_hash_to_str(MENU_LABEL_VALUE_START_NET_RETROPAD), + &group_info, + &subgroup_info, + parent_group); +#endif + CONFIG_ACTION( list, list_info, menu_hash_to_str(MENU_LABEL_CONTENT_SETTINGS), diff --git a/tasks/task_content.c b/tasks/task_content.c index b6c6d02c85..2bd7e59617 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -1709,6 +1709,7 @@ bool task_push_content_load_default( switch (mode) { case CONTENT_MODE_LOAD_NOTHING_WITH_CURRENT_CORE_FROM_MENU: + case CONTENT_MODE_LOAD_NOTHING_WITH_NET_RETROPAD_CORE_FROM_MENU: case CONTENT_MODE_LOAD_CONTENT_FROM_PLAYLIST_FROM_MENU: case CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_MENU: case CONTENT_MODE_LOAD_CONTENT_WITH_FFMPEG_CORE_FROM_MENU: @@ -1746,6 +1747,20 @@ bool task_push_content_load_default( #ifdef HAVE_MENU if (!content_load_wrapper(content_info, true)) goto error; +#endif + break; + case CONTENT_MODE_LOAD_NOTHING_WITH_NET_RETROPAD_CORE_FROM_MENU: +#if defined(HAVE_NETWORK) && defined(HAVE_NETWORK_GAMEPAD) + core_path = settings->path.libretro; /* TODO/FIXME */ + runloop_ctl(RUNLOOP_CTL_CLEAR_CONTENT_PATH, NULL); + runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, (void*)core_path); +#ifdef HAVE_DYNAMIC + command_event(CMD_EVENT_LOAD_CORE, NULL); +#endif +#ifdef HAVE_MENU + if (!content_load_wrapper(content_info, true)) + goto error; +#endif #endif break; case CONTENT_MODE_LOAD_CONTENT_WITH_CURRENT_CORE_FROM_MENU: diff --git a/tasks/tasks_internal.h b/tasks/tasks_internal.h index 21314a250e..c16c895948 100644 --- a/tasks/tasks_internal.h +++ b/tasks/tasks_internal.h @@ -32,6 +32,7 @@ enum content_mode_load CONTENT_MODE_LOAD_NOTHING_WITH_DUMMY_CORE, CONTENT_MODE_LOAD_FROM_CLI, CONTENT_MODE_LOAD_NOTHING_WITH_CURRENT_CORE_FROM_MENU, + CONTENT_MODE_LOAD_NOTHING_WITH_NET_RETROPAD_CORE_FROM_MENU, CONTENT_MODE_LOAD_CONTENT_WITH_CURRENT_CORE_FROM_MENU, CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_MENU, CONTENT_MODE_LOAD_CONTENT_WITH_FFMPEG_CORE_FROM_MENU,