Check if all players have the game before starting netplay

https://bugs.dolphin-emu.org/issues/8885
This commit is contained in:
Aestek
2016-07-10 10:13:34 +02:00
parent 7ee6d08213
commit cd9a58b704
7 changed files with 116 additions and 7 deletions

View File

@ -318,9 +318,14 @@ unsigned int NetPlayServer::OnConnect(ENetPeer* socket)
for (const auto& p : m_players)
{
spac.clear();
spac << (MessageId)NP_MSG_PLAYER_JOIN;
spac << static_cast<MessageId>(NP_MSG_PLAYER_JOIN);
spac << p.second.pid << p.second.name << p.second.revision;
Send(player.socket, spac);
spac.clear();
spac << static_cast<MessageId>(NP_MSG_GAME_STATUS);
spac << p.second.pid << static_cast<u32>(p.second.game_status);
Send(player.socket, spac);
}
// add client to the player list
@ -592,6 +597,23 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player)
}
break;
case NP_MSG_GAME_STATUS:
{
u32 status;
packet >> status;
m_players[player.pid].game_status = static_cast<PlayerGameStatus>(status);
// send msg to other clients
sf::Packet spac;
spac << static_cast<MessageId>(NP_MSG_GAME_STATUS);
spac << player.pid;
spac << status;
SendToClients(spac);
}
break;
case NP_MSG_TIMEBASE:
{
u32 x, y, frame;