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 dd42128207..60005b3f2d 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 72148b8abd..88a379268e 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 885750c358..95ec1e6000 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -3340,6 +3340,66 @@ static int action_ok_push_scan_file(const char *path, } #ifdef HAVE_NETWORKING +struct netplay_host_list *lan_hosts; +int lan_room_count; +void netplay_refresh_rooms_menu(file_list_t *list) +{ + char s[PATH_MAX_LENGTH]; + int i = 0; + int j = 0; + + if (netplay_room_count != 0) + { + RARCH_LOG ("Found %d rooms...\n", netplay_room_count); + + for (i = 0; i < netplay_room_count; i++) + { + /* Uncomment this to debug mismatched room parameters*/ +#if 0 + RARCH_LOG("Room Data: %d\n" + "Nickname: %s\n" + "Address: %s\n" + "Port: %d\n" + "Core: %s\n" + "Core Version: %s\n" + "Game: %s\n" + "Game CRC: %08x\n" + "Timestamp: %d\n", room_data->elems[j + 6].data, + netplay_room_list[i].nickname, + netplay_room_list[i].address, + netplay_room_list[i].port, + netplay_room_list[i].corename, + netplay_room_list[i].coreversion, + netplay_room_list[i].gamename, + netplay_room_list[i].gamecrc, + netplay_room_list[i].timestamp); +#endif + j+=8; + if (netplay_room_list[i].lan) + { + snprintf(s, sizeof(s), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME_LAN), + netplay_room_list[i].nickname); + } + else + { + snprintf(s, sizeof(s), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME), + netplay_room_list[i].nickname); + } + + menu_entries_append_enum(list, + s, + msg_hash_to_str(MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM), + MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM, + MENU_ROOM, 0, 0); + } + + netplay_rooms_free(); + } +} + + static void netplay_refresh_rooms_cb(void *task_data, void *user_data, const char *err) { char buf[PATH_MAX_LENGTH]; @@ -3383,13 +3443,9 @@ finish: int i = 0; int j = 0; int k = 0; - int lan_room_count = 0; - struct netplay_host_list *lan_hosts = NULL; file_list_t *file_list = menu_entries_get_selection_buf_ptr(0); -#if 1 netplay_discovery_driver_ctl(RARCH_NETPLAY_DISCOVERY_CTL_LAN_GET_RESPONSES, &lan_hosts); -#endif if (lan_hosts) lan_room_count = (int)lan_hosts->size; @@ -3408,80 +3464,39 @@ 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), MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS, MENU_SETTING_ACTION, 0, 0); - if (netplay_room_count != 0) - { - RARCH_LOG ("Found %d rooms...\n", netplay_room_count); - - for (i = 0; i < netplay_room_count; i++) - { - memcpy(&netplay_room_list[i], netplay_room_get(i), sizeof(netplay_room_list[i])); - - /*strlcpy(netplay_room_list[i].nickname, - room_data->elems[j + 0].data, - sizeof(netplay_room_list[i].nickname)); - strlcpy(netplay_room_list[i].address, - room_data->elems[j + 1].data, - sizeof(netplay_room_list[i].address)); - strlcpy(netplay_room_list[i].corename, - room_data->elems[j + 3].data, - sizeof(netplay_room_list[i].corename)); - strlcpy(netplay_room_list[i].coreversion, - room_data->elems[j + 4].data, - sizeof(netplay_room_list[i].coreversion)); - strlcpy(netplay_room_list[i].gamename, - room_data->elems[j + 5].data, - sizeof(netplay_room_list[i].gamename)); - - netplay_room_list[i].port = atoi(room_data->elems[j + 2].data); - netplay_room_list[i].gamecrc = atoi(room_data->elems[j + 6].data); - netplay_room_list[i].timestamp = atoi(room_data->elems[j + 7].data);*/ - - /* Uncomment this to debug mismatched room parameters*/ -#if 0 - RARCH_LOG("Room Data: %d\n" - "Nickname: %s\n" - "Address: %s\n" - "Port: %d\n" - "Core: %s\n" - "Core Version: %s\n" - "Game: %s\n" - "Game CRC: %08x\n" - "Timestamp: %d\n", room_data->elems[j + 6].data, - netplay_room_list[i].nickname, - netplay_room_list[i].address, - netplay_room_list[i].port, - netplay_room_list[i].corename, - netplay_room_list[i].coreversion, - netplay_room_list[i].gamename, - netplay_room_list[i].gamecrc, - netplay_room_list[i].timestamp); -#endif - j+=8; - - snprintf(s, sizeof(s), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME), - netplay_room_list[i].nickname); - - menu_entries_append_enum(file_list, - s, - msg_hash_to_str(MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM), - MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM, - MENU_ROOM, 0, 0); - } - - netplay_rooms_free(); - } + for (i = 0; i < netplay_room_count; i++) + memcpy(&netplay_room_list[i], netplay_room_get(i), sizeof(netplay_room_list[i])); if (lan_room_count != 0) { @@ -3512,20 +3527,15 @@ finish: netplay_room_list[i].port = 55435; netplay_room_list[i].gamecrc = host->content_crc; netplay_room_list[i].timestamp = 0; + netplay_room_list[i].lan = true; snprintf(s, sizeof(s), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME_LAN), netplay_room_list[i].nickname); - - menu_entries_append_enum(file_list, - s, - msg_hash_to_str(MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM), - MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM, - MENU_ROOM, 0, 0); - k++; } netplay_room_count += lan_room_count; } + netplay_refresh_rooms_menu(file_list); } } diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index d9dd6dc135..f83829836d 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 @@ -3126,36 +3127,40 @@ 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), MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS, MENU_SETTING_ACTION, 0, 0); - - if (netplay_room_count > 0) - { - unsigned i; - for (i = 0; i < (unsigned)netplay_room_count; i++) - { - char s[PATH_MAX_LENGTH]; - s[0] = '\0'; + netplay_refresh_rooms_menu(info->list); - snprintf(s, sizeof(s), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_ROOM_NICKNAME), netplay_room_list[i].nickname); - menu_entries_append_enum(info->list, - s, - msg_hash_to_str(MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM), - MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM, - MENU_ROOM, 0, 0); - - } - } #endif return 0; diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 11774301ca..539757ad58 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -206,7 +206,9 @@ typedef struct menu_displaylist_ctx_entry } menu_displaylist_ctx_entry_t; bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data); - +#ifdef HAVE_NETWORKING +void netplay_refresh_rooms_menu(file_list_t *list); +#endif RETRO_END_DECLS #endif diff --git a/msg_hash.h b/msg_hash.h index f6eaf18209..1920cdbdf0 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -922,6 +922,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_discovery.h b/network/netplay/netplay_discovery.h index 6bc2b1eba7..5148a8af9a 100644 --- a/network/netplay/netplay_discovery.h +++ b/network/netplay/netplay_discovery.h @@ -74,6 +74,7 @@ struct netplay_room int host_method; bool has_password; bool has_spectate_password; + bool lan; bool fixed; struct netplay_room *next; }; 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;