diff options
Diffstat (limited to 'src/network')
| -rw-r--r-- | src/network/room.cpp | 7 | ||||
| -rw-r--r-- | src/network/room.h | 32 | ||||
| -rw-r--r-- | src/network/room_member.h | 4 |
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 { | |||
| 1066 | return {room_impl->username_ban_list, room_impl->ip_ban_list}; | 1066 | return {room_impl->username_ban_list, room_impl->ip_ban_list}; |
| 1067 | } | 1067 | } |
| 1068 | 1068 | ||
| 1069 | std::vector<Room::Member> Room::GetRoomMemberList() const { | 1069 | std::vector<Member> Room::GetRoomMemberList() const { |
| 1070 | std::vector<Room::Member> member_list; | 1070 | std::vector<Member> member_list; |
| 1071 | std::lock_guard lock(room_impl->member_mutex); | 1071 | std::lock_guard lock(room_impl->member_mutex); |
| 1072 | for (const auto& member_impl : room_impl->members) { | 1072 | for (const auto& member_impl : room_impl->members) { |
| 1073 | Member member; | 1073 | Member member; |
| @@ -1076,7 +1076,8 @@ std::vector<Room::Member> Room::GetRoomMemberList() const { | |||
| 1076 | member.display_name = member_impl.user_data.display_name; | 1076 | member.display_name = member_impl.user_data.display_name; |
| 1077 | member.avatar_url = member_impl.user_data.avatar_url; | 1077 | member.avatar_url = member_impl.user_data.avatar_url; |
| 1078 | member.mac_address = member_impl.mac_address; | 1078 | member.mac_address = member_impl.mac_address; |
| 1079 | member.game_info = member_impl.game_info; | 1079 | member.game_name = member_impl.game_info.name; |
| 1080 | member.game_id = member_impl.game_info.id; | ||
| 1080 | member_list.push_back(member); | 1081 | member_list.push_back(member); |
| 1081 | } | 1082 | } |
| 1082 | return member_list; | 1083 | 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 @@ | |||
| 8 | #include <memory> | 8 | #include <memory> |
| 9 | #include <string> | 9 | #include <string> |
| 10 | #include <vector> | 10 | #include <vector> |
| 11 | #include "common/announce_multiplayer_room.h" | ||
| 11 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 12 | #include "network/verify_user.h" | 13 | #include "network/verify_user.h" |
| 13 | 14 | ||
| 14 | namespace Network { | 15 | namespace Network { |
| 15 | 16 | ||
| 17 | using AnnounceMultiplayerRoom::GameInfo; | ||
| 18 | using AnnounceMultiplayerRoom::MacAddress; | ||
| 19 | using AnnounceMultiplayerRoom::Member; | ||
| 20 | using AnnounceMultiplayerRoom::RoomInformation; | ||
| 21 | |||
| 16 | constexpr u32 network_version = 1; ///< The version of this Room and RoomMember | 22 | constexpr u32 network_version = 1; ///< The version of this Room and RoomMember |
| 17 | 23 | ||
| 18 | constexpr u16 DefaultRoomPort = 24872; | 24 | constexpr u16 DefaultRoomPort = 24872; |
| @@ -24,23 +30,6 @@ static constexpr u32 MaxConcurrentConnections = 254; | |||
| 24 | 30 | ||
| 25 | constexpr std::size_t NumChannels = 1; // Number of channels used for the connection | 31 | constexpr std::size_t NumChannels = 1; // Number of channels used for the connection |
| 26 | 32 | ||
| 27 | struct RoomInformation { | ||
| 28 | std::string name; ///< Name of the server | ||
| 29 | std::string description; ///< Server description | ||
| 30 | u32 member_slots; ///< Maximum number of members in this room | ||
| 31 | u16 port; ///< The port of this room | ||
| 32 | std::string preferred_game; ///< Game to advertise that you want to play | ||
| 33 | u64 preferred_game_id; ///< Title ID for the advertised game | ||
| 34 | std::string host_username; ///< Forum username of the host | ||
| 35 | bool enable_yuzu_mods; ///< Allow yuzu Moderators to moderate on this room | ||
| 36 | }; | ||
| 37 | |||
| 38 | struct GameInfo { | ||
| 39 | std::string name{""}; | ||
| 40 | u64 id{0}; | ||
| 41 | }; | ||
| 42 | |||
| 43 | using MacAddress = std::array<u8, 6>; | ||
| 44 | /// A special MAC address that tells the room we're joining to assign us a MAC address | 33 | /// A special MAC address that tells the room we're joining to assign us a MAC address |
| 45 | /// automatically. | 34 | /// automatically. |
| 46 | constexpr MacAddress NoPreferredMac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; | 35 | constexpr MacAddress NoPreferredMac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
| @@ -95,15 +84,6 @@ public: | |||
| 95 | Closed, ///< The room is not opened and can not accept connections. | 84 | Closed, ///< The room is not opened and can not accept connections. |
| 96 | }; | 85 | }; |
| 97 | 86 | ||
| 98 | struct Member { | ||
| 99 | std::string nickname; ///< The nickname of the member. | ||
| 100 | std::string username; ///< The web services username of the member. Can be empty. | ||
| 101 | std::string display_name; ///< The web services display name of the member. Can be empty. | ||
| 102 | std::string avatar_url; ///< Url to the member's avatar. Can be empty. | ||
| 103 | GameInfo game_info; ///< The current game of the member | ||
| 104 | MacAddress mac_address; ///< The assigned mac address of the member. | ||
| 105 | }; | ||
| 106 | |||
| 107 | Room(); | 87 | Room(); |
| 108 | ~Room(); | 88 | ~Room(); |
| 109 | 89 | ||
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 @@ | |||
| 9 | #include <string> | 9 | #include <string> |
| 10 | #include <vector> | 10 | #include <vector> |
| 11 | #include <boost/serialization/vector.hpp> | 11 | #include <boost/serialization/vector.hpp> |
| 12 | #include "common/announce_multiplayer_room.h" | ||
| 12 | #include "common/common_types.h" | 13 | #include "common/common_types.h" |
| 13 | #include "network/room.h" | 14 | #include "network/room.h" |
| 14 | 15 | ||
| 15 | namespace Network { | 16 | namespace Network { |
| 16 | 17 | ||
| 18 | using AnnounceMultiplayerRoom::GameInfo; | ||
| 19 | using AnnounceMultiplayerRoom::RoomInformation; | ||
| 20 | |||
| 17 | /// Information about the received WiFi packets. | 21 | /// Information about the received WiFi packets. |
| 18 | /// Acts as our own 802.11 header. | 22 | /// Acts as our own 802.11 header. |
| 19 | struct WifiPacket { | 23 | struct WifiPacket { |