summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorFearlessTobi <thm.frey@gmail.com>2022-07-15 21:11:09 +0200
committerFearlessTobi <thm.frey@gmail.com>2022-07-25 21:59:30 +0200
commit4b404191cf054ec3206676f1fccc452bc0a0e223 (patch)
tree8a1582246c41260fe82804bf4dcb9abf77176e27 /src/network
parentAddress first part of review comments (diff)
downloadyuzu-4b404191cf054ec3206676f1fccc452bc0a0e223.tar
yuzu-4b404191cf054ec3206676f1fccc452bc0a0e223.tar.gz
yuzu-4b404191cf054ec3206676f1fccc452bc0a0e223.tar.bz2
yuzu-4b404191cf054ec3206676f1fccc452bc0a0e223.tar.lz
yuzu-4b404191cf054ec3206676f1fccc452bc0a0e223.tar.xz
yuzu-4b404191cf054ec3206676f1fccc452bc0a0e223.tar.zst
yuzu-4b404191cf054ec3206676f1fccc452bc0a0e223.zip
Diffstat (limited to 'src/network')
-rw-r--r--src/network/room.cpp7
-rw-r--r--src/network/room.h32
-rw-r--r--src/network/room_member.h4
3 files changed, 14 insertions, 29 deletions
diff --git a/src/network/room.cpp b/src/network/room.cpp
index b82a75749..fe55d194c 100644
--- a/src/network/room.cpp
+++ b/src/network/room.cpp
@@ -1066,8 +1066,8 @@ Room::BanList Room::GetBanList() const {
return {room_impl->username_ban_list, room_impl->ip_ban_list};
}
-std::vector<Room::Member> Room::GetRoomMemberList() const {
- std::vector<Room::Member> member_list;
+std::vector<Member> Room::GetRoomMemberList() const {
+ std::vector<Member> member_list;
std::lock_guard lock(room_impl->member_mutex);
for (const auto& member_impl : room_impl->members) {
Member member;
@@ -1076,7 +1076,8 @@ std::vector<Room::Member> Room::GetRoomMemberList() const {
member.display_name = member_impl.user_data.display_name;
member.avatar_url = member_impl.user_data.avatar_url;
member.mac_address = member_impl.mac_address;
- member.game_info = member_impl.game_info;
+ member.game_name = member_impl.game_info.name;
+ member.game_id = member_impl.game_info.id;
member_list.push_back(member);
}
return member_list;
diff --git a/src/network/room.h b/src/network/room.h
index df2253bf8..f282a5ac3 100644
--- a/src/network/room.h
+++ b/src/network/room.h
@@ -8,11 +8,17 @@
#include <memory>
#include <string>
#include <vector>
+#include "common/announce_multiplayer_room.h"
#include "common/common_types.h"
#include "network/verify_user.h"
namespace Network {
+using AnnounceMultiplayerRoom::GameInfo;
+using AnnounceMultiplayerRoom::MacAddress;
+using AnnounceMultiplayerRoom::Member;
+using AnnounceMultiplayerRoom::RoomInformation;
+
constexpr u32 network_version = 1; ///< The version of this Room and RoomMember
constexpr u16 DefaultRoomPort = 24872;
@@ -24,23 +30,6 @@ static constexpr u32 MaxConcurrentConnections = 254;
constexpr std::size_t NumChannels = 1; // Number of channels used for the connection
-struct RoomInformation {
- std::string name; ///< Name of the server
- std::string description; ///< Server description
- u32 member_slots; ///< Maximum number of members in this room
- u16 port; ///< The port of this room
- std::string preferred_game; ///< Game to advertise that you want to play
- u64 preferred_game_id; ///< Title ID for the advertised game
- std::string host_username; ///< Forum username of the host
- bool enable_yuzu_mods; ///< Allow yuzu Moderators to moderate on this room
-};
-
-struct GameInfo {
- std::string name{""};
- u64 id{0};
-};
-
-using MacAddress = std::array<u8, 6>;
/// A special MAC address that tells the room we're joining to assign us a MAC address
/// automatically.
constexpr MacAddress NoPreferredMac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
@@ -95,15 +84,6 @@ public:
Closed, ///< The room is not opened and can not accept connections.
};
- struct Member {
- std::string nickname; ///< The nickname of the member.
- std::string username; ///< The web services username of the member. Can be empty.
- std::string display_name; ///< The web services display name of the member. Can be empty.
- std::string avatar_url; ///< Url to the member's avatar. Can be empty.
- GameInfo game_info; ///< The current game of the member
- MacAddress mac_address; ///< The assigned mac address of the member.
- };
-
Room();
~Room();
diff --git a/src/network/room_member.h b/src/network/room_member.h
index ee1c921d4..c835ba863 100644
--- a/src/network/room_member.h
+++ b/src/network/room_member.h
@@ -9,11 +9,15 @@
#include <string>
#include <vector>
#include <boost/serialization/vector.hpp>
+#include "common/announce_multiplayer_room.h"
#include "common/common_types.h"
#include "network/room.h"
namespace Network {
+using AnnounceMultiplayerRoom::GameInfo;
+using AnnounceMultiplayerRoom::RoomInformation;
+
/// Information about the received WiFi packets.
/// Acts as our own 802.11 header.
struct WifiPacket {