mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 06:44:27 +00:00
(Cthulhu88) Add netplay hotkey bind
This commit is contained in:
parent
1fc73f11b5
commit
deaf116d38
@ -202,6 +202,8 @@ enum event_command
|
|||||||
CMD_EVENT_NETPLAY_DEINIT,
|
CMD_EVENT_NETPLAY_DEINIT,
|
||||||
/* Switch between netplay gaming and watching. */
|
/* Switch between netplay gaming and watching. */
|
||||||
CMD_EVENT_NETPLAY_GAME_WATCH,
|
CMD_EVENT_NETPLAY_GAME_WATCH,
|
||||||
|
/* Open a netplay chat input menu. */
|
||||||
|
CMD_EVENT_NETPLAY_PLAYER_CHAT,
|
||||||
/* Start hosting netplay. */
|
/* Start hosting netplay. */
|
||||||
CMD_EVENT_NETPLAY_ENABLE_HOST,
|
CMD_EVENT_NETPLAY_ENABLE_HOST,
|
||||||
/* Disconnect from the netplay host. */
|
/* Disconnect from the netplay host. */
|
||||||
|
@ -43,6 +43,7 @@ enum rarch_netplay_ctl_state
|
|||||||
{
|
{
|
||||||
RARCH_NETPLAY_CTL_NONE = 0,
|
RARCH_NETPLAY_CTL_NONE = 0,
|
||||||
RARCH_NETPLAY_CTL_GAME_WATCH,
|
RARCH_NETPLAY_CTL_GAME_WATCH,
|
||||||
|
RARCH_NETPLAY_CTL_PLAYER_CHAT,
|
||||||
RARCH_NETPLAY_CTL_POST_FRAME,
|
RARCH_NETPLAY_CTL_POST_FRAME,
|
||||||
RARCH_NETPLAY_CTL_PRE_FRAME,
|
RARCH_NETPLAY_CTL_PRE_FRAME,
|
||||||
RARCH_NETPLAY_CTL_ENABLE_SERVER,
|
RARCH_NETPLAY_CTL_ENABLE_SERVER,
|
||||||
@ -188,7 +189,6 @@ typedef struct
|
|||||||
{
|
{
|
||||||
netplay_t *data; /* Used while Netplay is running */
|
netplay_t *data; /* Used while Netplay is running */
|
||||||
struct netplay_room host_room; /* ptr alignment */
|
struct netplay_room host_room; /* ptr alignment */
|
||||||
netplay_t *ref;
|
|
||||||
struct netplay_room *room_list;
|
struct netplay_room *room_list;
|
||||||
struct netplay_rooms *rooms_data;
|
struct netplay_rooms *rooms_data;
|
||||||
/* List of discovered hosts */
|
/* List of discovered hosts */
|
||||||
|
@ -893,9 +893,14 @@ static void handshake_password(void *ignore, const char *line)
|
|||||||
struct password_buf_s password_buf;
|
struct password_buf_s password_buf;
|
||||||
char password[8+NETPLAY_PASS_LEN]; /* 8 for salt, 128 for password */
|
char password[8+NETPLAY_PASS_LEN]; /* 8 for salt, 128 for password */
|
||||||
char hash[NETPLAY_PASS_HASH_LEN+1]; /* + NULL terminator */
|
char hash[NETPLAY_PASS_HASH_LEN+1]; /* + NULL terminator */
|
||||||
|
struct netplay_connection *connection;
|
||||||
net_driver_state_t *net_st = &networking_driver_st;
|
net_driver_state_t *net_st = &networking_driver_st;
|
||||||
netplay_t *netplay = net_st->ref;
|
netplay_t *netplay = net_st->data;
|
||||||
struct netplay_connection *connection = &netplay->connections[0];
|
|
||||||
|
if (!netplay)
|
||||||
|
return;
|
||||||
|
|
||||||
|
connection = &netplay->connections[0];
|
||||||
|
|
||||||
snprintf(password, sizeof(password), "%08lX", (unsigned long)connection->salt);
|
snprintf(password, sizeof(password), "%08lX", (unsigned long)connection->salt);
|
||||||
if (!string_is_empty(line))
|
if (!string_is_empty(line))
|
||||||
@ -1071,11 +1076,6 @@ bool netplay_handshake_init(netplay_t *netplay,
|
|||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
menu_input_ctx_line_t line;
|
menu_input_ctx_line_t line;
|
||||||
retroarch_menu_running();
|
retroarch_menu_running();
|
||||||
#endif
|
|
||||||
|
|
||||||
net_st->ref = netplay;
|
|
||||||
|
|
||||||
#ifdef HAVE_MENU
|
|
||||||
memset(&line, 0, sizeof(line));
|
memset(&line, 0, sizeof(line));
|
||||||
line.label = msg_hash_to_str(MSG_NETPLAY_ENTER_PASSWORD);
|
line.label = msg_hash_to_str(MSG_NETPLAY_ENTER_PASSWORD);
|
||||||
line.label_setting = "no_setting";
|
line.label_setting = "no_setting";
|
||||||
@ -4470,7 +4470,7 @@ static void send_chat(void *userdata, const char *line)
|
|||||||
char chat_msg[MAX_CHAT_SIZE];
|
char chat_msg[MAX_CHAT_SIZE];
|
||||||
size_t chat_len;
|
size_t chat_len;
|
||||||
net_driver_state_t *net_st = &networking_driver_st;
|
net_driver_state_t *net_st = &networking_driver_st;
|
||||||
netplay_t *netplay = net_st->ref;
|
netplay_t *netplay = net_st->data;
|
||||||
|
|
||||||
/* We perform the same checks,
|
/* We perform the same checks,
|
||||||
just in case something has changed. */
|
just in case something has changed. */
|
||||||
@ -4512,8 +4512,6 @@ void netplay_input_chat(netplay_t *netplay)
|
|||||||
|
|
||||||
retroarch_menu_running();
|
retroarch_menu_running();
|
||||||
|
|
||||||
net_st->ref = netplay;
|
|
||||||
|
|
||||||
chat_input.label = msg_hash_to_str(MSG_NETPLAY_ENTER_CHAT);
|
chat_input.label = msg_hash_to_str(MSG_NETPLAY_ENTER_CHAT);
|
||||||
chat_input.label_setting = "no_setting";
|
chat_input.label_setting = "no_setting";
|
||||||
chat_input.cb = send_chat;
|
chat_input.cb = send_chat;
|
||||||
@ -7731,6 +7729,9 @@ bool netplay_driver_ctl(enum rarch_netplay_ctl_state state, void *data)
|
|||||||
case RARCH_NETPLAY_CTL_GAME_WATCH:
|
case RARCH_NETPLAY_CTL_GAME_WATCH:
|
||||||
netplay_toggle_play_spectate(netplay);
|
netplay_toggle_play_spectate(netplay);
|
||||||
break;
|
break;
|
||||||
|
case RARCH_NETPLAY_CTL_PLAYER_CHAT:
|
||||||
|
netplay_input_chat(netplay);
|
||||||
|
break;
|
||||||
case RARCH_NETPLAY_CTL_PAUSE:
|
case RARCH_NETPLAY_CTL_PAUSE:
|
||||||
if (netplay->local_paused != true)
|
if (netplay->local_paused != true)
|
||||||
netplay_frontend_paused(netplay, true);
|
netplay_frontend_paused(netplay, true);
|
||||||
|
@ -5295,6 +5295,9 @@ bool command_event(enum event_command cmd, void *data)
|
|||||||
case CMD_EVENT_NETPLAY_GAME_WATCH:
|
case CMD_EVENT_NETPLAY_GAME_WATCH:
|
||||||
netplay_driver_ctl(RARCH_NETPLAY_CTL_GAME_WATCH, NULL);
|
netplay_driver_ctl(RARCH_NETPLAY_CTL_GAME_WATCH, NULL);
|
||||||
break;
|
break;
|
||||||
|
case CMD_EVENT_NETPLAY_PLAYER_CHAT:
|
||||||
|
netplay_driver_ctl(RARCH_NETPLAY_CTL_PLAYER_CHAT, NULL);
|
||||||
|
break;
|
||||||
case CMD_EVENT_NETPLAY_DEINIT:
|
case CMD_EVENT_NETPLAY_DEINIT:
|
||||||
deinit_netplay();
|
deinit_netplay();
|
||||||
break;
|
break;
|
||||||
@ -5531,6 +5534,7 @@ bool command_event(enum event_command cmd, void *data)
|
|||||||
case CMD_EVENT_NETPLAY_DISCONNECT:
|
case CMD_EVENT_NETPLAY_DISCONNECT:
|
||||||
case CMD_EVENT_NETPLAY_ENABLE_HOST:
|
case CMD_EVENT_NETPLAY_ENABLE_HOST:
|
||||||
case CMD_EVENT_NETPLAY_GAME_WATCH:
|
case CMD_EVENT_NETPLAY_GAME_WATCH:
|
||||||
|
case CMD_EVENT_NETPLAY_PLAYER_CHAT:
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
case CMD_EVENT_FULLSCREEN_TOGGLE:
|
case CMD_EVENT_FULLSCREEN_TOGGLE:
|
||||||
@ -15568,6 +15572,9 @@ static enum runloop_state_enum runloop_check_state(
|
|||||||
#ifdef HAVE_NETWORKING
|
#ifdef HAVE_NETWORKING
|
||||||
/* Check Netplay */
|
/* Check Netplay */
|
||||||
HOTKEY_CHECK(RARCH_NETPLAY_GAME_WATCH, CMD_EVENT_NETPLAY_GAME_WATCH, true, NULL);
|
HOTKEY_CHECK(RARCH_NETPLAY_GAME_WATCH, CMD_EVENT_NETPLAY_GAME_WATCH, true, NULL);
|
||||||
|
#if NETPLAY_PROTOCOL_VERSION >= 6
|
||||||
|
HOTKEY_CHECK(RARCH_NETPLAY_PLAYER_CHAT, CMD_EVENT_NETPLAY_PLAYER_CHAT, true, NULL);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Check if we have pressed the pause button */
|
/* Check if we have pressed the pause button */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user