mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Smaller Netplay Changes (#13387)
Lobby Viewer: Filter out rooms that are not running RetroArch Lobby Viewer: Display a non-connectable tag to non-connectable rooms. Host: Display warning if we are announcing to the internet but our room isn't connectable from there.
This commit is contained in:
parent
3f7d279acf
commit
966335e367
@ -10869,6 +10869,10 @@ MSG_HASH(
|
||||
MSG_WAITING_FOR_CLIENT,
|
||||
"Waiting for client ..."
|
||||
)
|
||||
MSG_HASH(
|
||||
MSG_ROOM_NOT_CONNECTABLE,
|
||||
"Your room is not connectable from the internet."
|
||||
)
|
||||
MSG_HASH(
|
||||
MSG_NETPLAY_YOU_HAVE_LEFT_THE_GAME,
|
||||
"You have left the game"
|
||||
@ -12771,6 +12775,10 @@ MSG_HASH(
|
||||
MSG_INTERNET_RELAY,
|
||||
"Internet (Relay)"
|
||||
)
|
||||
MSG_HASH(
|
||||
MSG_INTERNET_NOT_CONNECTABLE,
|
||||
"Internet (Not Connectable)"
|
||||
)
|
||||
MSG_HASH(
|
||||
MSG_LOCAL,
|
||||
"Local"
|
||||
|
@ -5927,6 +5927,8 @@ static void netplay_refresh_lan_cb(retro_task_t *task,
|
||||
sizeof(room->address));
|
||||
room->has_password = host->has_password;
|
||||
room->has_spectate_password = host->has_spectate_password;
|
||||
room->connectable = true;
|
||||
room->is_retroarch = true;
|
||||
room->lan = true;
|
||||
}
|
||||
}
|
||||
|
@ -9740,6 +9740,10 @@ unsigned menu_displaylist_netplay_refresh_rooms(file_list_t *list)
|
||||
const char *room_type;
|
||||
struct netplay_room *room = &net_st->room_list[i];
|
||||
|
||||
/* Get rid of any room that is not running RetroArch. */
|
||||
if (!room->is_retroarch)
|
||||
continue;
|
||||
|
||||
if (room->has_password || room->has_spectate_password)
|
||||
snprintf(passworded, sizeof(passworded), "[%s] ",
|
||||
msg_hash_to_str(MSG_ROOM_PASSWORDED));
|
||||
@ -9756,8 +9760,10 @@ unsigned menu_displaylist_netplay_refresh_rooms(file_list_t *list)
|
||||
room_type = msg_hash_to_str(MSG_LOCAL);
|
||||
else if (room->host_method == NETPLAY_HOST_METHOD_MITM)
|
||||
room_type = msg_hash_to_str(MSG_INTERNET_RELAY);
|
||||
else
|
||||
else if (room->connectable)
|
||||
room_type = msg_hash_to_str(MSG_INTERNET);
|
||||
else
|
||||
room_type = msg_hash_to_str(MSG_INTERNET_NOT_CONNECTABLE);
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s%s: %s%s",
|
||||
passworded, room_type,
|
||||
|
@ -170,6 +170,7 @@ enum msg_hash_enums
|
||||
MSG_ROOM_PASSWORDED,
|
||||
MSG_INTERNET,
|
||||
MSG_INTERNET_RELAY,
|
||||
MSG_INTERNET_NOT_CONNECTABLE,
|
||||
MSG_READ_WRITE,
|
||||
MSG_READ_ONLY,
|
||||
MSG_LOCAL,
|
||||
@ -186,6 +187,7 @@ enum msg_hash_enums
|
||||
MSG_NETPLAY_LAN_SCAN_COMPLETE,
|
||||
MSG_NETPLAY_LAN_SCANNING,
|
||||
MSG_WAITING_FOR_CLIENT,
|
||||
MSG_ROOM_NOT_CONNECTABLE,
|
||||
MSG_NETPLAY_YOU_HAVE_LEFT_THE_GAME,
|
||||
MSG_NETPLAY_YOU_HAVE_JOINED_AS_PLAYER_N,
|
||||
MSG_NETPLAY_YOU_HAVE_JOINED_WITH_INPUT_DEVICES_S,
|
||||
|
@ -164,6 +164,8 @@ struct netplay_room
|
||||
char mitm_session [33];
|
||||
bool has_password;
|
||||
bool has_spectate_password;
|
||||
bool connectable;
|
||||
bool is_retroarch;
|
||||
bool lan;
|
||||
};
|
||||
|
||||
|
@ -7747,6 +7747,7 @@ static void netplay_announce_cb(retro_task_t *task,
|
||||
net_driver_state_t *net_st = &networking_driver_st;
|
||||
struct netplay_room *host_room = &net_st->host_room;
|
||||
http_transfer_data_t *data = task_data;
|
||||
bool first = !host_room->id;
|
||||
|
||||
if (error)
|
||||
return;
|
||||
@ -7813,6 +7814,9 @@ static void netplay_announce_cb(retro_task_t *task,
|
||||
sizeof(host_room->retroarch_version));
|
||||
else if (string_is_equal(key, "country"))
|
||||
strlcpy(host_room->country, value, sizeof(host_room->country));
|
||||
else if (string_is_equal(key, "connectable"))
|
||||
host_room->connectable = string_is_equal_noncase(value, "true") ||
|
||||
string_is_equal(value, "1");
|
||||
}
|
||||
}
|
||||
|
||||
@ -7822,6 +7826,16 @@ static void netplay_announce_cb(retro_task_t *task,
|
||||
|
||||
free(buf_start);
|
||||
|
||||
/* Warn only on the first announce. */
|
||||
if (!host_room->connectable && first)
|
||||
{
|
||||
const char *dmsg = msg_hash_to_str(MSG_ROOM_NOT_CONNECTABLE);
|
||||
|
||||
RARCH_WARN("[Netplay] %s\n", dmsg);
|
||||
runloop_msg_queue_push(dmsg, 1, 180, false, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
}
|
||||
|
||||
#ifdef HAVE_DISCORD
|
||||
if (discord_state_get_ptr()->inited)
|
||||
{
|
||||
@ -8239,6 +8253,7 @@ bool init_netplay(const char *server, unsigned port, const char *mitm_session)
|
||||
struct netplay_room *host_room = &net_st->host_room;
|
||||
|
||||
memset(host_room, 0, sizeof(*host_room));
|
||||
host_room->connectable = true;
|
||||
|
||||
server = NULL;
|
||||
|
||||
|
@ -109,6 +109,9 @@ static bool netplay_json_start_object(void* ctx)
|
||||
net_st->rooms_data->cur->next = (struct netplay_room*)calloc(1, sizeof(*net_st->rooms_data->cur->next));
|
||||
net_st->rooms_data->cur = net_st->rooms_data->cur->next;
|
||||
}
|
||||
|
||||
net_st->rooms_data->cur->connectable = true;
|
||||
net_st->rooms_data->cur->is_retroarch = true;
|
||||
}
|
||||
else if (p_ctx->state == STATE_ARRAY_START)
|
||||
p_ctx->state = STATE_OBJECT_START;
|
||||
@ -227,6 +230,14 @@ static bool netplay_json_object_member(void *ctx, const char *p_value,
|
||||
p_ctx->cur_member_string = net_st->rooms_data->cur->subsystem_name;
|
||||
p_ctx->cur_member_size = sizeof(net_st->rooms_data->cur->subsystem_name);
|
||||
}
|
||||
else if (string_is_equal(p_value, "connectable"))
|
||||
{
|
||||
p_ctx->cur_member_bool = &net_st->rooms_data->cur->connectable;
|
||||
}
|
||||
else if (string_is_equal(p_value, "is_retroarch"))
|
||||
{
|
||||
p_ctx->cur_member_bool = &net_st->rooms_data->cur->is_retroarch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user