mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-27 13:16:14 +00:00
commit
19121dbee3
2
core.h
2
core.h
@ -155,6 +155,8 @@ bool core_set_default_callbacks(void *data);
|
||||
|
||||
bool core_set_rewind_callbacks(void);
|
||||
|
||||
bool core_set_netplay_callbacks(void);
|
||||
|
||||
bool core_set_poll_type(unsigned *type);
|
||||
|
||||
/* Runs the core for one frame. */
|
||||
|
28
core_impl.c
28
core_impl.c
@ -103,13 +103,7 @@ static bool core_init_libretro_cbs(void *data)
|
||||
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL))
|
||||
return true;
|
||||
|
||||
/* Force normal poll type for netplay. */
|
||||
core_poll_type = POLL_TYPE_NORMAL;
|
||||
|
||||
core.retro_set_video_refresh(video_frame_net);
|
||||
core.retro_set_audio_sample(audio_sample_net);
|
||||
core.retro_set_audio_sample_batch(audio_sample_batch_net);
|
||||
core.retro_set_input_state(input_state_net);
|
||||
core_set_netplay_callbacks();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
@ -182,6 +176,26 @@ bool core_set_rewind_callbacks(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* core_set_netplay_callbacks:
|
||||
*
|
||||
* Set the I/O callbacks to use netplay's interceding callback system. Should
|
||||
* only be called once.
|
||||
**/
|
||||
bool core_set_netplay_callbacks(void)
|
||||
{
|
||||
/* Force normal poll type for netplay. */
|
||||
core_poll_type = POLL_TYPE_NORMAL;
|
||||
|
||||
/* And use netplay's interceding callbacks */
|
||||
core.retro_set_video_refresh(video_frame_net);
|
||||
core.retro_set_audio_sample(audio_sample_net);
|
||||
core.retro_set_audio_sample_batch(audio_sample_batch_net);
|
||||
core.retro_set_input_state(input_state_net);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool core_set_cheat(retro_ctx_cheat_info_t *info)
|
||||
{
|
||||
core.retro_cheat_set(info->index, info->enabled, info->code);
|
||||
|
@ -1600,6 +1600,18 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len)
|
||||
snprintf(s, len,
|
||||
"Shows current core inside menu.");
|
||||
break;
|
||||
case MENU_ENUM_LABEL_NETPLAY_ENABLE_HOST:
|
||||
snprintf(s, len,
|
||||
"Enables Netplay in host (server) mode.");
|
||||
break;
|
||||
case MENU_ENUM_LABEL_NETPLAY_ENABLE_CLIENT:
|
||||
snprintf(s, len,
|
||||
"Enables Netplay in client mode.");
|
||||
break;
|
||||
case MENU_ENUM_LABEL_NETPLAY_DISCONNECT:
|
||||
snprintf(s, len,
|
||||
"Disconnects an active Netplay connection.");
|
||||
break;
|
||||
case MENU_ENUM_LABEL_DYNAMIC_WALLPAPER:
|
||||
snprintf(s, len,
|
||||
"Dynamically load a new wallpaper \n"
|
||||
@ -2470,6 +2482,12 @@ static const char *menu_hash_to_str_us_label_enum(enum msg_hash_enums msg)
|
||||
return "menu_pointer_enable";
|
||||
case MENU_ENUM_LABEL_CORE_ENABLE:
|
||||
return "menu_core_enable";
|
||||
case MENU_ENUM_LABEL_NETPLAY_ENABLE_HOST:
|
||||
return "menu_netplay_enable_host";
|
||||
case MENU_ENUM_LABEL_NETPLAY_ENABLE_CLIENT:
|
||||
return "menu_netplay_enable_client";
|
||||
case MENU_ENUM_LABEL_NETPLAY_DISCONNECT:
|
||||
return "menu_netplay_disconnect";
|
||||
case MENU_ENUM_LABEL_DPI_OVERRIDE_ENABLE:
|
||||
return "dpi_override_enable";
|
||||
case MENU_ENUM_LABEL_DPI_OVERRIDE_VALUE:
|
||||
@ -2858,6 +2876,8 @@ static const char *menu_hash_to_str_us_label_enum(enum msg_hash_enums msg)
|
||||
return "network_information";
|
||||
case MENU_ENUM_LABEL_ONLINE_UPDATER:
|
||||
return "online_updater";
|
||||
case MENU_ENUM_LABEL_NETPLAY:
|
||||
return "netplay";
|
||||
case MENU_ENUM_LABEL_CORE_INFORMATION:
|
||||
return "core_information";
|
||||
case MENU_ENUM_LABEL_CORE_LIST:
|
||||
@ -3797,6 +3817,12 @@ const char *msg_hash_to_str_us(enum msg_hash_enums msg)
|
||||
return "Touch Support";
|
||||
case MENU_ENUM_LABEL_VALUE_CORE_ENABLE:
|
||||
return "Display core name";
|
||||
case MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST:
|
||||
return "Start hosting";
|
||||
case MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT:
|
||||
return "Connect to Netplay host";
|
||||
case MENU_ENUM_LABEL_VALUE_NETPLAY_DISCONNECT:
|
||||
return "Disconnect";
|
||||
case MENU_ENUM_LABEL_VALUE_DPI_OVERRIDE_ENABLE:
|
||||
return "DPI Override Enable";
|
||||
case MENU_ENUM_LABEL_VALUE_DPI_OVERRIDE_VALUE:
|
||||
@ -4129,6 +4155,8 @@ const char *msg_hash_to_str_us(enum msg_hash_enums msg)
|
||||
return "Achievement List";
|
||||
case MENU_ENUM_LABEL_VALUE_ONLINE_UPDATER:
|
||||
return "Online Updater";
|
||||
case MENU_ENUM_LABEL_VALUE_NETPLAY:
|
||||
return "Netplay";
|
||||
case MENU_ENUM_LABEL_VALUE_CORE_INFORMATION:
|
||||
return "Core Information";
|
||||
case MENU_ENUM_LABEL_VALUE_DIRECTORY_NOT_FOUND:
|
||||
|
@ -287,6 +287,11 @@ static int deferred_push_options(menu_displaylist_info_t *info)
|
||||
return deferred_push_dlist(info, DISPLAYLIST_OPTIONS);
|
||||
}
|
||||
|
||||
static int deferred_push_netplay(menu_displaylist_info_t *info)
|
||||
{
|
||||
return deferred_push_dlist(info, DISPLAYLIST_NETPLAY);
|
||||
}
|
||||
|
||||
static int deferred_push_content_settings(menu_displaylist_info_t *info)
|
||||
{
|
||||
return deferred_push_dlist(info, DISPLAYLIST_CONTENT_SETTINGS);
|
||||
@ -905,6 +910,9 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
|
||||
case MENU_ENUM_LABEL_ONLINE_UPDATER:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_options);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_NETPLAY:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_netplay);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_CONTENT_SETTINGS:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_content_settings);
|
||||
break;
|
||||
@ -1156,6 +1164,9 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
|
||||
case MENU_LABEL_ONLINE_UPDATER:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_options);
|
||||
break;
|
||||
case MENU_LABEL_NETPLAY:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_netplay);
|
||||
break;
|
||||
case MENU_LABEL_CONTENT_SETTINGS:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_content_settings);
|
||||
break;
|
||||
|
@ -50,6 +50,10 @@
|
||||
#include "../../lakka.h"
|
||||
#include "../../wifi/wifi_driver.h"
|
||||
|
||||
#ifdef HAVE_NETPLAY
|
||||
#include "../../network/netplay/netplay.h"
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
enum msg_hash_enums enum_idx;
|
||||
@ -3266,6 +3270,126 @@ static int action_ok_video_resolution(const char *path,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_ok_netplay_enable_host(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
#ifdef HAVE_NETPLAY
|
||||
bool netplay_was_on = false;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
global->netplay.enable = true;
|
||||
|
||||
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL))
|
||||
{
|
||||
netplay_was_on = true;
|
||||
|
||||
/* Netplay is already on. Are we in the wrong mode? */
|
||||
if (global->netplay.is_client)
|
||||
{
|
||||
/* Kill it! */
|
||||
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We were already hosting! */
|
||||
return generic_action_ok_command(CMD_EVENT_RESUME);
|
||||
}
|
||||
}
|
||||
|
||||
global->netplay.is_client = false;
|
||||
global->netplay.server[0] = '\0';
|
||||
|
||||
/* If we haven't yet started, this will load on its own */
|
||||
if (!content_is_inited())
|
||||
{
|
||||
runloop_msg_queue_push(
|
||||
"Netplay will start when content is loaded.",
|
||||
1, 480, true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Enable Netplay itself */
|
||||
if (!command_event(CMD_EVENT_NETPLAY_INIT, NULL))
|
||||
return -1;
|
||||
|
||||
/* Then make sure we use Netplay's callbacks */
|
||||
if (!netplay_was_on && !core_set_netplay_callbacks())
|
||||
return -1;
|
||||
|
||||
return generic_action_ok_command(CMD_EVENT_RESUME);
|
||||
|
||||
#else
|
||||
return -1;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static int action_ok_netplay_enable_client(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
#ifdef HAVE_NETPLAY
|
||||
bool netplay_was_on = false;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
global->netplay.enable = true;
|
||||
|
||||
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL))
|
||||
{
|
||||
netplay_was_on = true;
|
||||
|
||||
/* Kill it! */
|
||||
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
|
||||
}
|
||||
|
||||
global->netplay.is_client = true;
|
||||
|
||||
/* We can't do anything without a host specified */
|
||||
if (!global->netplay.server[0])
|
||||
{
|
||||
runloop_msg_queue_push(
|
||||
"Please specify the Netplay server's IP address or hostname.",
|
||||
1, 480, true);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* If we haven't yet started, this will load on its own */
|
||||
if (!content_is_inited())
|
||||
{
|
||||
runloop_msg_queue_push(
|
||||
"Netplay will start when content is loaded.",
|
||||
1, 480, true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Enable Netplay itself */
|
||||
if (!command_event(CMD_EVENT_NETPLAY_INIT, NULL))
|
||||
return -1;
|
||||
|
||||
/* Then make sure we use Netplay's callbacks */
|
||||
if (!netplay_was_on && !core_set_netplay_callbacks())
|
||||
return -1;
|
||||
|
||||
return generic_action_ok_command(CMD_EVENT_RESUME);
|
||||
|
||||
#else
|
||||
return -1;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static int action_ok_netplay_disconnect(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
#ifdef HAVE_NETPLAY
|
||||
netplay_driver_ctl(RARCH_NETPLAY_CTL_DISCONNECT, NULL);
|
||||
return generic_action_ok_command(CMD_EVENT_RESUME);
|
||||
|
||||
#else
|
||||
return -1;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static int is_rdb_entry(enum msg_hash_enums enum_idx)
|
||||
{
|
||||
switch (enum_idx)
|
||||
@ -3501,6 +3625,7 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_CORE_COUNTERS:
|
||||
case MENU_ENUM_LABEL_MANAGEMENT:
|
||||
case MENU_ENUM_LABEL_ONLINE_UPDATER:
|
||||
case MENU_ENUM_LABEL_NETPLAY:
|
||||
case MENU_ENUM_LABEL_LOAD_CONTENT_LIST:
|
||||
case MENU_ENUM_LABEL_ADD_CONTENT_LIST:
|
||||
case MENU_ENUM_LABEL_HELP_LIST:
|
||||
@ -3641,6 +3766,15 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_UPDATE_AUTOCONFIG_PROFILES:
|
||||
BIND_ACTION_OK(cbs, action_ok_update_autoconfig_profiles);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_NETPLAY_ENABLE_HOST:
|
||||
BIND_ACTION_OK(cbs, action_ok_netplay_enable_host);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_NETPLAY_ENABLE_CLIENT:
|
||||
BIND_ACTION_OK(cbs, action_ok_netplay_enable_client);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_NETPLAY_DISCONNECT:
|
||||
BIND_ACTION_OK(cbs, action_ok_netplay_disconnect);
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
@ -86,6 +86,13 @@ static int action_get_online_updater_list(const char *path, const char *label,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_get_netplay_list(const char *path, const char *label,
|
||||
unsigned menu_type, char *s, size_t len)
|
||||
{
|
||||
sanitize_to_string(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY), len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_get_online_thumbnails_updater_list(const char *path, const char *label,
|
||||
unsigned menu_type, char *s, size_t len)
|
||||
{
|
||||
@ -1171,6 +1178,9 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_ONLINE_UPDATER:
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_online_updater_list);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_NETPLAY:
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_netplay_list);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_DEFERRED_THUMBNAILS_UPDATER_LIST:
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_online_thumbnails_updater_list);
|
||||
break;
|
||||
@ -1473,6 +1483,9 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
|
||||
case MENU_LABEL_ONLINE_UPDATER:
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_online_updater_list);
|
||||
break;
|
||||
case MENU_LABEL_NETPLAY:
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_netplay_list);
|
||||
break;
|
||||
case MENU_LABEL_DEFERRED_THUMBNAILS_UPDATER_LIST:
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_online_thumbnails_updater_list);
|
||||
break;
|
||||
|
@ -1651,6 +1651,10 @@ static int mui_list_push(void *data, void *userdata,
|
||||
#endif
|
||||
entry.enum_idx = MENU_ENUM_LABEL_ONLINE_UPDATER;
|
||||
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
||||
#endif
|
||||
#if defined(HAVE_NETPLAY)
|
||||
entry.enum_idx = MENU_ENUM_LABEL_NETPLAY;
|
||||
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
||||
#endif
|
||||
entry.enum_idx = MENU_ENUM_LABEL_INFORMATION_LIST;
|
||||
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
||||
|
@ -3358,6 +3358,10 @@ static int xmb_list_push(void *data, void *userdata,
|
||||
#if defined(HAVE_NETWORKING)
|
||||
entry.enum_idx = MENU_ENUM_LABEL_ONLINE_UPDATER;
|
||||
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
||||
#endif
|
||||
#if defined(HAVE_NETPLAY)
|
||||
entry.enum_idx = MENU_ENUM_LABEL_NETPLAY;
|
||||
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
||||
#endif
|
||||
entry.enum_idx = MENU_ENUM_LABEL_INFORMATION_LIST;
|
||||
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
||||
|
@ -1500,6 +1500,39 @@ static int menu_displaylist_parse_shader_options(menu_displaylist_info_t *info)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int menu_displaylist_parse_netplay(
|
||||
menu_displaylist_info_t *info)
|
||||
{
|
||||
#ifdef HAVE_NETPLAY
|
||||
menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_ENABLE_HOST),
|
||||
MENU_ENUM_LABEL_NETPLAY_ENABLE_HOST,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
|
||||
menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_ENABLE_CLIENT),
|
||||
MENU_ENUM_LABEL_NETPLAY_ENABLE_CLIENT,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
|
||||
menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_DISCONNECT),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_DISCONNECT),
|
||||
MENU_ENUM_LABEL_NETPLAY_DISCONNECT,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
|
||||
#else
|
||||
menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ITEMS),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_NO_ITEMS),
|
||||
MENU_ENUM_LABEL_NO_ITEMS,
|
||||
MENU_SETTING_NO_ITEM, 0, 0);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBRETRODB
|
||||
static int create_string_list_rdb_entry_string(
|
||||
enum msg_hash_enums enum_idx,
|
||||
@ -3971,6 +4004,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
case DISPLAYLIST_DATABASE_ENTRY:
|
||||
case DISPLAYLIST_DATABASE_QUERY:
|
||||
case DISPLAYLIST_OPTIONS_SHADERS:
|
||||
case DISPLAYLIST_NETPLAY:
|
||||
case DISPLAYLIST_CORE_CONTENT:
|
||||
case DISPLAYLIST_CORE_CONTENT_DIRS:
|
||||
case DISPLAYLIST_PLAYLIST_COLLECTION:
|
||||
@ -4241,6 +4275,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_ADD_CONTENT_LIST,
|
||||
PARSE_ACTION, false);
|
||||
#if defined(HAVE_NETPLAY)
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_NETPLAY,
|
||||
PARSE_ACTION, false);
|
||||
#endif
|
||||
#if defined(HAVE_NETWORKING)
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_ONLINE_UPDATER,
|
||||
@ -5344,6 +5383,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
case DISPLAYLIST_OPTIONS_SHADERS:
|
||||
ret = menu_displaylist_parse_shader_options(info);
|
||||
|
||||
info->need_push = true;
|
||||
break;
|
||||
case DISPLAYLIST_NETPLAY:
|
||||
ret = menu_displaylist_parse_netplay(info);
|
||||
|
||||
info->need_push = true;
|
||||
break;
|
||||
case DISPLAYLIST_CORE_CONTENT:
|
||||
|
@ -141,6 +141,7 @@ enum menu_displaylist_ctl_state
|
||||
DISPLAYLIST_OPTIONS_MANAGEMENT,
|
||||
DISPLAYLIST_OPTIONS_DISK,
|
||||
DISPLAYLIST_OPTIONS_SHADERS,
|
||||
DISPLAYLIST_NETPLAY,
|
||||
DISPLAYLIST_ADD_CONTENT_LIST,
|
||||
DISPLAYLIST_SCAN_DIRECTORY_LIST,
|
||||
DISPLAYLIST_ARCHIVE_ACTION,
|
||||
|
@ -2187,6 +2187,17 @@ static bool setting_append_list(
|
||||
parent_group);
|
||||
menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_ADD_CONTENT_LIST);
|
||||
|
||||
#if defined(HAVE_NETPLAY)
|
||||
CONFIG_ACTION(
|
||||
list, list_info,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY),
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group);
|
||||
menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_NETPLAY);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_NETWORKING)
|
||||
CONFIG_ACTION(
|
||||
list, list_info,
|
||||
|
12
msg_hash.h
12
msg_hash.h
@ -959,6 +959,15 @@ enum msg_hash_enums
|
||||
|
||||
|
||||
|
||||
/* Netplay */
|
||||
MENU_ENUM_LABEL_NETPLAY_ENABLE_HOST,
|
||||
MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST,
|
||||
MENU_ENUM_LABEL_NETPLAY_ENABLE_CLIENT,
|
||||
MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT,
|
||||
MENU_ENUM_LABEL_NETPLAY_DISCONNECT,
|
||||
MENU_ENUM_LABEL_VALUE_NETPLAY_DISCONNECT,
|
||||
|
||||
|
||||
|
||||
MENU_ENUM_LABEL_COLLAPSE_SUBGROUPS_ENABLE,
|
||||
MENU_ENUM_LABEL_VALUE_COLLAPSE_SUBGROUPS_ENABLE,
|
||||
@ -1428,6 +1437,8 @@ enum msg_hash_enums
|
||||
MENU_ENUM_LABEL_VALUE_MANAGEMENT,
|
||||
MENU_ENUM_LABEL_ONLINE_UPDATER,
|
||||
MENU_ENUM_LABEL_VALUE_ONLINE_UPDATER,
|
||||
MENU_ENUM_LABEL_NETPLAY,
|
||||
MENU_ENUM_LABEL_VALUE_NETPLAY,
|
||||
MENU_ENUM_LABEL_SETTINGS,
|
||||
MENU_ENUM_LABEL_FRONTEND_COUNTERS,
|
||||
MENU_ENUM_LABEL_VALUE_FRONTEND_COUNTERS,
|
||||
@ -2075,6 +2086,7 @@ enum msg_hash_enums
|
||||
#define MENU_LABEL_LOAD_CONTENT_HISTORY 0xfe1d79e5U
|
||||
#define MENU_LABEL_ADD_CONTENT_LIST 0x046f4668U
|
||||
#define MENU_LABEL_ONLINE_UPDATER 0xcac0025eU
|
||||
#define MENU_LABEL_NETPLAY 0x0b511d22U
|
||||
#define MENU_LABEL_SETTINGS 0x1304dc16U
|
||||
#define MENU_LABEL_HELP 0x7c97d2eeU
|
||||
#define MENU_VALUE_HORIZONTAL_MENU 0x35761704U
|
||||
|
@ -1272,38 +1272,18 @@ void netplay_load_savestate(netplay_t *netplay, retro_ctx_serialize_info_t *seri
|
||||
}
|
||||
|
||||
/**
|
||||
* netplay_reconnect
|
||||
* netplay_disconnect
|
||||
* @netplay : pointer to netplay object
|
||||
*
|
||||
* Reconnect netplay. Only does anything as a client, and only if netplay isn't
|
||||
* currently connected.
|
||||
* Disconnect netplay.
|
||||
*
|
||||
* Returns: true (1) if successful, false (0) if unsuccessful, false (0) if not
|
||||
* client or already connected.
|
||||
* Returns: true (1) if successful. At present, cannot fail.
|
||||
**/
|
||||
bool netplay_reconnect(netplay_t *netplay)
|
||||
bool netplay_disconnect(netplay_t *netplay)
|
||||
{
|
||||
/* FIXME: This function has some things remembered in netplay, some things
|
||||
* brought back from global */
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!netplay || netplay->has_connection || netplay->is_server)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!init_socket(netplay, global->netplay.server, netplay->tcp_port))
|
||||
{
|
||||
RARCH_WARN("Failed to reconnect Netplay.\n");
|
||||
runloop_msg_queue_push("Failed to reconnect Netplay.", 0, 480, false);
|
||||
}
|
||||
|
||||
/* FIXME: Connection info is weirdly conflated into info_cb */
|
||||
if (!netplay_info_cb(netplay, netplay->stall_frames))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!netplay || !netplay->has_connection)
|
||||
return true;
|
||||
hangup(netplay);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1416,8 +1396,8 @@ bool netplay_driver_ctl(enum rarch_netplay_ctl_state state, void *data)
|
||||
case RARCH_NETPLAY_CTL_LOAD_SAVESTATE:
|
||||
netplay_load_savestate((netplay_t*)netplay_data, (retro_ctx_serialize_info_t*)data, true);
|
||||
break;
|
||||
case RARCH_NETPLAY_CTL_RECONNECT:
|
||||
return netplay_reconnect((netplay_t*)netplay_data);
|
||||
case RARCH_NETPLAY_CTL_DISCONNECT:
|
||||
return netplay_disconnect((netplay_t*)netplay_data);
|
||||
default:
|
||||
case RARCH_NETPLAY_CTL_NONE:
|
||||
break;
|
||||
|
@ -39,7 +39,7 @@ enum rarch_netplay_ctl_state
|
||||
RARCH_NETPLAY_CTL_PAUSE,
|
||||
RARCH_NETPLAY_CTL_UNPAUSE,
|
||||
RARCH_NETPLAY_CTL_LOAD_SAVESTATE,
|
||||
RARCH_NETPLAY_CTL_RECONNECT
|
||||
RARCH_NETPLAY_CTL_DISCONNECT
|
||||
};
|
||||
|
||||
enum netplay_cmd
|
||||
@ -196,16 +196,14 @@ void netplay_frontend_paused(netplay_t *netplay, bool paused);
|
||||
void netplay_load_savestate(netplay_t *netplay, retro_ctx_serialize_info_t *serial_info, bool save);
|
||||
|
||||
/**
|
||||
* netplay_reconnect
|
||||
* netplay_disconnect
|
||||
* @netplay : pointer to netplay object
|
||||
*
|
||||
* Reconnect netplay. Only does anything as a client, and only if netplay isn't
|
||||
* currently connected.
|
||||
* Disconnect netplay.
|
||||
*
|
||||
* Returns: true (1) if successful, false (0) if unsuccessful, false (0) if not
|
||||
* client or already connected.
|
||||
* Returns: true (1) if successful. At present, cannot fail.
|
||||
**/
|
||||
bool netplay_reconnect(netplay_t *netplay);
|
||||
bool netplay_disconnect(netplay_t *netplay);
|
||||
|
||||
/**
|
||||
* init_netplay:
|
||||
|
Loading…
Reference in New Issue
Block a user