Merge pull request #7564 from Techjar/netplay-sync-wii-shutdown

NetPlay: Sync power button event
This commit is contained in:
Pierre Bourdon
2018-11-13 22:33:59 +01:00
committed by GitHub
7 changed files with 44 additions and 0 deletions

View File

@@ -569,6 +569,12 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
}
break;
case NP_MSG_POWER_BUTTON:
{
m_dialog->OnMsgPowerButton();
}
break;
case NP_MSG_PING:
{
u32 ping_key = 0;
@@ -1702,6 +1708,13 @@ void NetPlayClient::RequestStopGame()
SendStopGamePacket();
}
void NetPlayClient::SendPowerButtonEvent()
{
sf::Packet packet;
packet << static_cast<MessageId>(NP_MSG_POWER_BUTTON);
SendAsync(std::move(packet));
}
// called from ---GUI--- thread
bool NetPlayClient::LocalPlayerHasControllerMapped() const
{
@@ -1884,6 +1897,12 @@ void SetSIPollBatching(bool state)
s_si_poll_batching = state;
}
void SendPowerButtonEvent()
{
ASSERT(IsNetPlayRunning());
netplay_client->SendPowerButtonEvent();
}
void NetPlay_Enable(NetPlayClient* const np)
{
std::lock_guard<std::mutex> lk(crit_netplay_client);