diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 85e2e72553..b6558ba0ae 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -988,6 +988,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT, "连接到游戏主机") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST, "作为游戏主机") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST, + "Stop netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS, "服务器地址") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_LAN_SCAN_SETTINGS, diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index 7783f5ea15..117425d3e9 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -979,6 +979,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT, "Verbinde zu einem Netplay-Host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST, "Starte Hosting") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST, + "Stop netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS, "Server-Adresse") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_LAN_SCAN_SETTINGS, diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index d093f3fddb..791201f8f6 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -898,6 +898,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT, "Connect to Netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST, "Start hosting") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST, + "Stop netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS, "Server Address") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_MODE, diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index ddf9b2e9d4..4517524c9e 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -892,6 +892,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT, "Connexion à l'hôte distant") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST, "Commencer l'hébergement") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST, + "Stop netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS, "Adresse IP") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_MODE, diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index 3c93d165a1..bc1955c3bd 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -864,6 +864,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT, "Connetti alla rete ospite") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST, "Comincia ad ospitare") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST, + "Stop netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS, "Indirizzo Server") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_LAN_SCAN_SETTINGS, diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index 79935229f0..d536fb9020 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -995,6 +995,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT, "ネットプレイサーバーに接続") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST, "ホストする") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST, + "Stop netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS, "サーバーのIPアドレス") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_LAN_SCAN_SETTINGS, diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index fb14b3ba6c..07ad121361 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -979,6 +979,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT, "넷플레이 호스트 연결") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST, "넷플레이 호스트 시작") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST, + "Stop netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS, "서버 주소") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_LAN_SCAN_SETTINGS, diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index 4e7a84af56..9afaeb3138 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -898,6 +898,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT, "Connect to Netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST, "Start hosting") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST, + "Stop netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS, "Server Adres") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_MODE, diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index a3a38522a0..ab4c1480b6 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -977,6 +977,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT, "Conecar ao hospedeiro do netplay") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST, "Iniciar hospedeiro do netplay") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST, + "Stop netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS, "Endereço do Servidor") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_LAN_SCAN_SETTINGS, diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index 5dd001b8fa..8205d9dccc 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -977,6 +977,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT, "Conecar ao hospedeiro do netplay") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST, "Iniciar hospedeiro do netplay") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST, + "Stop netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS, "Endereço do Servidor") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_LAN_SCAN_SETTINGS, diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index 83709e66db..464bea54cb 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -904,6 +904,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT, "Подключение к Netplay-хосту") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST, "Старт хостинг") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST, + "Stop netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS, "Адрес сервера") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_MODE, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 1714a103b8..6e21a58b72 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -991,6 +991,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT, "Connect to netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST, "Start netplay host") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST, + "Stop netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS, "Server Address") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_LAN_SCAN_SETTINGS, diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index 1d433761e9..be8a8728b7 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -991,6 +991,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_CLIENT, "Connect to netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_ENABLE_HOST, "Start netplay host") +MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST, + "Stop netplay host") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_IP_ADDRESS, "Server Address") MSG_HASH(MENU_ENUM_LABEL_VALUE_NETPLAY_LAN_SCAN_SETTINGS, diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index f614f00a3a..cdd1e5702c 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -3515,11 +3515,31 @@ finish: sizeof(struct netplay_room)); menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, file_list); - menu_entries_append_enum(file_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); + if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL)) + { + menu_entries_append_enum(file_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); + } + else if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER_ENABLED, NULL)) + { + menu_entries_append_enum(file_list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST), + msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_DISCONNECT), + MENU_ENUM_LABEL_NETPLAY_DISCONNECT, + MENU_SETTING_ACTION, 0, 0); + } + else + { + menu_entries_append_enum(file_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); + } + menu_entries_append_enum(file_list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_REFRESH_ROOMS), msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS), diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 1774b16116..9e70410a4c 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -42,6 +42,7 @@ #ifdef HAVE_NETWORKING #include +#include "../../network/netplay/netplay.h" #include "../network/netplay/netplay_discovery.h" #endif @@ -3016,11 +3017,32 @@ static int menu_displaylist_parse_netplay_room_list( { #ifdef HAVE_NETWORKING - 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); + + if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL)) + { + 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); + } + else if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER_ENABLED, NULL)) + { + menu_entries_append_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_DISABLE_HOST), + 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_NETPLAY_DISCONNECT), + msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_DISCONNECT), + MENU_ENUM_LABEL_NETPLAY_DISCONNECT, + MENU_SETTING_ACTION, 0, 0); + } + menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_REFRESH_ROOMS), msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS), diff --git a/msg_hash.h b/msg_hash.h index 5426ebc237..b76e08dcca 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -916,6 +916,7 @@ enum msg_hash_enums /* Netplay */ MENU_LABEL(NETPLAY_ENABLE_HOST), + MENU_LABEL(NETPLAY_DISABLE_HOST), MENU_LABEL(NETPLAY_ENABLE_CLIENT), MENU_LABEL(NETPLAY_DISCONNECT), MENU_LABEL(NETPLAY_SETTINGS), diff --git a/network/netplay/netplay.h b/network/netplay/netplay.h index 38b04326ab..3805e6d5b3 100644 --- a/network/netplay/netplay.h +++ b/network/netplay/netplay.h @@ -40,6 +40,7 @@ enum rarch_netplay_ctl_state RARCH_NETPLAY_CTL_ENABLE_CLIENT, RARCH_NETPLAY_CTL_DISABLE, RARCH_NETPLAY_CTL_IS_ENABLED, + RARCH_NETPLAY_CTL_IS_SERVER_ENABLED, RARCH_NETPLAY_CTL_IS_DATA_INITED, RARCH_NETPLAY_CTL_PAUSE, RARCH_NETPLAY_CTL_UNPAUSE, diff --git a/network/netplay/netplay_frontend.c b/network/netplay/netplay_frontend.c index 56543d3a91..ec1a6a1808 100644 --- a/network/netplay/netplay_frontend.c +++ b/network/netplay/netplay_frontend.c @@ -1271,6 +1271,11 @@ bool netplay_driver_ctl(enum rarch_netplay_ctl_state state, void *data) ret = false; goto done; + case RARCH_NETPLAY_CTL_IS_SERVER_ENABLED: + ret = netplay_enabled && !netplay_is_client; + RARCH_LOG("TEST: %d = %d && %d", ret, netplay_enabled, netplay_is_client); + goto done; + default: goto done; } @@ -1287,6 +1292,10 @@ bool netplay_driver_ctl(enum rarch_netplay_ctl_state state, void *data) goto done; case RARCH_NETPLAY_CTL_IS_ENABLED: goto done; + case RARCH_NETPLAY_CTL_IS_SERVER_ENABLED: + ret = netplay_enabled && !netplay_is_client; + RARCH_LOG("TEST: %d = %d && %d", ret, netplay_enabled, netplay_is_client); + goto done; case RARCH_NETPLAY_CTL_POST_FRAME: netplay_post_frame(netplay_data); break;