mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	fixup! fixup! Add a service to announce multiplayer rooms to web service; Add the abiltiy to receive a list of all announced rooms from web service
This commit is contained in:
		
							parent
							
								
									1485093fd9
								
							
						
					
					
						commit
						93742f17b3
					
				
					 6 changed files with 35 additions and 32 deletions
				
			
		|  | @ -77,29 +77,30 @@ void AnnounceMultiplayerSession::AnnounceMultiplayerLoop() { | |||
|     finished = false; | ||||
|     std::future<Common::WebResult> future; | ||||
|     while (announce) { | ||||
|         if (std::shared_ptr<Network::Room> room = Network::GetRoom().lock()) { | ||||
|             if (room->GetState() == Network::Room::State::Open) { | ||||
|                 Network::RoomInformation room_information = room->GetRoomInformation(); | ||||
|                 std::vector<Network::Room::Member> memberlist = room->GetRoomMemberList(); | ||||
|                 backend->SetRoomInformation( | ||||
|                     room_information.guid, room_information.name, room_information.port, | ||||
|                     room_information.member_slots, Network::network_version, room->HasPassword(), | ||||
|                     room_information.preferred_game, room_information.preferred_game_id); | ||||
|                 backend->ClearPlayers(); | ||||
|                 for (const auto& member : memberlist) { | ||||
|                     backend->AddPlayer(member.nickname, member.mac_address, member.game_info.id, | ||||
|                                        member.game_info.name); | ||||
|                 } | ||||
|                 future = backend->Announce(); | ||||
|             } else { | ||||
|                 announce = false; | ||||
|             } | ||||
|         } else { | ||||
|         std::shared_ptr<Network::Room> room = Network::GetRoom().lock(); | ||||
|         if (!room) { | ||||
|             announce = false; | ||||
|             continue; | ||||
|         } | ||||
|         if (room->GetState() != Network::Room::State::Open) { | ||||
|             announce = false; | ||||
|             continue; | ||||
|         } | ||||
|         Network::RoomInformation room_information = room->GetRoomInformation(); | ||||
|         std::vector<Network::Room::Member> memberlist = room->GetRoomMemberList(); | ||||
|         backend->SetRoomInformation( | ||||
|             room_information.uid, room_information.name, room_information.port, | ||||
|             room_information.member_slots, Network::network_version, room->HasPassword(), | ||||
|             room_information.preferred_game, room_information.preferred_game_id); | ||||
|         backend->ClearPlayers(); | ||||
|         for (const auto& member : memberlist) { | ||||
|             backend->AddPlayer(member.nickname, member.mac_address, member.game_info.id, | ||||
|                                member.game_info.name); | ||||
|         } | ||||
|         future = backend->Announce(); | ||||
|         if (future.valid()) { | ||||
|             Common::WebResult result = future.get(); | ||||
|             if (result.result_code != Common::WebResult::Success) { | ||||
|             if (result.result_code != Common::WebResult::Code::Success) { | ||||
|                 std::lock_guard<std::mutex> lock(callback_mutex); | ||||
|                 for (auto callback : error_callbacks) { | ||||
|                     (*callback)(result); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue