diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index d5033438a55..21dbcf2e2f4 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -7701,7 +7701,14 @@ static void action_ok_netplay_enable_client_hostname_cb(void *userdata, { if (!string_is_empty(line)) { - if (!task_push_netplay_content_reload(line)) + if (netplay_driver_ctl(RARCH_NETPLAY_CTL_USE_CORE_PACKET_INTERFACE, NULL)) + { + netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL); + command_event(CMD_EVENT_NETPLAY_INIT_DIRECT, (void*)line); + menu_input_dialog_end(); + retroarch_menu_running_finished(false); + } + else if (!task_push_netplay_content_reload(line)) { #ifdef HAVE_DYNAMIC command_event(CMD_EVENT_NETPLAY_DEINIT, NULL); diff --git a/network/netplay/netplay_defines.h b/network/netplay/netplay_defines.h index 6c8c78340b8..50c0307c470 100644 --- a/network/netplay/netplay_defines.h +++ b/network/netplay/netplay_defines.h @@ -76,7 +76,7 @@ enum rarch_netplay_ctl_state RARCH_NETPLAY_CTL_KICK_CLIENT, RARCH_NETPLAY_CTL_BAN_CLIENT, RARCH_NETPLAY_CTL_SET_CORE_PACKET_INTERFACE, - RARCH_NETPLAY_CTL_SKIP_NETPLAY_CALLBACKS, + RARCH_NETPLAY_CTL_USE_CORE_PACKET_INTERFACE, RARCH_NETPLAY_CTL_ALLOW_TIMESKIP }; diff --git a/network/netplay/netplay_frontend.c b/network/netplay/netplay_frontend.c index 7ff6522c889..a683041539f 100644 --- a/network/netplay/netplay_frontend.c +++ b/network/netplay/netplay_frontend.c @@ -9242,9 +9242,17 @@ bool netplay_driver_ctl(enum rarch_netplay_ctl_state state, void *data) break; case RARCH_NETPLAY_CTL_PAUSE: - if ( netplay - && (!(netplay->local_paused))) + if (netplay && !netplay->local_paused) netplay_frontend_paused(netplay, true); + + if (netplay && netplay->modus == NETPLAY_MODUS_CORE_PACKET_INTERFACE) + { + /* handle new connections while paused, unpause on connect */ + if (!netplay_sync_pre_frame(netplay)) + netplay_disconnect(netplay); + else if (netplay_have_any_active_connection(netplay)) + command_event(CMD_EVENT_UNPAUSE, NULL); + } break; case RARCH_NETPLAY_CTL_UNPAUSE: @@ -9372,7 +9380,7 @@ bool netplay_driver_ctl(enum rarch_netplay_ctl_state state, void *data) } break; - case RARCH_NETPLAY_CTL_SKIP_NETPLAY_CALLBACKS: + case RARCH_NETPLAY_CTL_USE_CORE_PACKET_INTERFACE: ret = (net_st->core_netpacket_interface != NULL); break; diff --git a/retroarch.c b/retroarch.c index 7e95f870956..27d64e45052 100644 --- a/retroarch.c +++ b/retroarch.c @@ -3958,7 +3958,12 @@ bool command_event(enum event_command cmd, void *data) break; case CMD_EVENT_NETPLAY_ENABLE_HOST: { - if (!task_push_netplay_content_reload(NULL)) + if (netplay_driver_ctl(RARCH_NETPLAY_CTL_USE_CORE_PACKET_INTERFACE, NULL)) + { + netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_SERVER, NULL); + command_event(CMD_EVENT_NETPLAY_INIT, NULL); + } + else if (!task_push_netplay_content_reload(NULL)) { #ifdef HAVE_DYNAMIC command_event(CMD_EVENT_NETPLAY_DEINIT, NULL); diff --git a/runloop.c b/runloop.c index 36e58f0f507..43bed44704c 100644 --- a/runloop.c +++ b/runloop.c @@ -7445,7 +7445,7 @@ bool core_set_netplay_callbacks(void) { runloop_state_t *runloop_st = &runloop_state; - if (netplay_driver_ctl(RARCH_NETPLAY_CTL_SKIP_NETPLAY_CALLBACKS, NULL)) + if (netplay_driver_ctl(RARCH_NETPLAY_CTL_USE_CORE_PACKET_INTERFACE, NULL)) return true; /* Force normal poll type for netplay. */ @@ -8031,7 +8031,7 @@ void runloop_path_set_redirect(settings_t *settings, /* Special save directory for netplay clients. */ if ( netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL) && !netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER, NULL) - && !netplay_driver_ctl(RARCH_NETPLAY_CTL_SKIP_NETPLAY_CALLBACKS, NULL)) + && !netplay_driver_ctl(RARCH_NETPLAY_CTL_USE_CORE_PACKET_INTERFACE, NULL)) { fill_pathname_join(new_savefile_dir, new_savefile_dir, ".netplay", sizeof(new_savefile_dir));