From dfce0f3b0bc2e407ee190a4b59f4625dc2ab509f Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Tue, 3 Sep 2013 03:58:27 +0000 Subject: [PATCH] [ARM] Merge all store instructions in to one. This disables fastmem on stores currently. Hit isn't noticeable since I've also implemented 5 more store instructions with this. --- Source/Core/Core/Src/NetPlayClient.cpp | 19 +++++++++++++++ Source/Core/Core/Src/NetPlayClient.h | 1 + Source/Core/Core/Src/NetPlayServer.cpp | 31 +++++++++++-------------- Source/Core/Core/Src/NetPlayServer.h | 1 - Source/Core/DolphinWX/Src/NetWindow.cpp | 6 ++--- 5 files changed, 36 insertions(+), 22 deletions(-) diff --git a/Source/Core/Core/Src/NetPlayClient.cpp b/Source/Core/Core/Src/NetPlayClient.cpp index 46acca6b94..428a217fed 100644 --- a/Source/Core/Core/Src/NetPlayClient.cpp +++ b/Source/Core/Core/Src/NetPlayClient.cpp @@ -564,6 +564,25 @@ bool NetPlayClient::StopGame() return true; } +void NetPlayClient::Stop() +{ + if (m_is_running == false) + return; + bool isPadMapped = false; + for (unsigned int i = 0; i < 4; ++i) + { + if (m_pad_map[i] == m_local_player->pid) + isPadMapped = true; + } + // tell the server to stop if we have a pad mapped in game. + if (isPadMapped) + { + sf::Packet spac; + spac << (MessageId)NP_MSG_STOP_GAME; + m_socket.Send(spac); + } +} + // called from ---CPU--- thread u8 NetPlayClient::GetPadNum(u8 numPAD) { diff --git a/Source/Core/Core/Src/NetPlayClient.h b/Source/Core/Core/Src/NetPlayClient.h index 59d5742b18..a5aea6e472 100644 --- a/Source/Core/Core/Src/NetPlayClient.h +++ b/Source/Core/Core/Src/NetPlayClient.h @@ -74,6 +74,7 @@ public: bool StartGame(const std::string &path); bool StopGame(); + void Stop(); bool ChangeGame(const std::string& game); void SendChatMessage(const std::string& msg); diff --git a/Source/Core/Core/Src/NetPlayServer.cpp b/Source/Core/Core/Src/NetPlayServer.cpp index d8f2a7dd09..c4d2f583ea 100644 --- a/Source/Core/Core/Src/NetPlayServer.cpp +++ b/Source/Core/Core/Src/NetPlayServer.cpp @@ -376,6 +376,20 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, sf::SocketTCP& socket) } break; + case NP_MSG_STOP_GAME: + { + // tell clients to stop game + sf::Packet spac; + spac << (MessageId)NP_MSG_STOP_GAME; + + std::lock_guard lkp(m_crit.players); + std::lock_guard lks(m_crit.send); + SendToClients(spac); + + m_is_running = false; + } + break; + default : PanicAlertT("Unknown message with id:%d received from player:%d Kicking player!", mid, player.pid); // unknown message, kick the client @@ -451,23 +465,6 @@ bool NetPlayServer::StartGame(const std::string &path) return true; } - -// called from ---GUI--- thread -bool NetPlayServer::StopGame() -{ - // tell clients to stop game - sf::Packet spac; - spac << (MessageId)NP_MSG_STOP_GAME; - - std::lock_guard lkp(m_crit.players); - std::lock_guard lks(m_crit.send); - SendToClients(spac); - - m_is_running = false; - - return true; -} - // called from multiple threads void NetPlayServer::SendToClients(sf::Packet& packet, const PlayerId skip_pid) { diff --git a/Source/Core/Core/Src/NetPlayServer.h b/Source/Core/Core/Src/NetPlayServer.h index 5fbdb42802..5349764790 100644 --- a/Source/Core/Core/Src/NetPlayServer.h +++ b/Source/Core/Core/Src/NetPlayServer.h @@ -33,7 +33,6 @@ public: void SetNetSettings(const NetSettings &settings); bool StartGame(const std::string &path); - bool StopGame(); void GetPadMapping(PadMapping map[]); void SetPadMapping(const PadMapping map[]); diff --git a/Source/Core/DolphinWX/Src/NetWindow.cpp b/Source/Core/DolphinWX/Src/NetWindow.cpp index f962b58590..a31f9c1cb1 100644 --- a/Source/Core/DolphinWX/Src/NetWindow.cpp +++ b/Source/Core/DolphinWX/Src/NetWindow.cpp @@ -650,8 +650,6 @@ void PadMapDiag::OnAdjust(wxCommandEvent& event) void NetPlay::StopGame() { - if (netplay_server != NULL) - netplay_server->StopGame(); - - // TODO: allow non-hosting clients to close the window + if (netplay_client != NULL) + netplay_client->Stop(); }