diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2022-09-13 01:22:51 +0200 |
|---|---|---|
| committer | Admiral H. Curtiss <pikachu025@gmail.com> | 2022-09-13 01:26:45 +0200 |
| commit | 35f6d12accd1cf2ba0ce60037e98bbe58bf5e5ae (patch) | |
| tree | 51d94aa9a05e8236524f25688e6e1dbcb6c3622b /Source/Core | |
| parent | c4b3f2302a1b389935427f903d83a9538c6400f2 (diff) | |
NetPlayClient: Consolidate stopping code to function.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/NetPlayClient.cpp | 17 | ||||
| -rw-r--r-- | Source/Core/Core/NetPlayClient.h | 1 |
2 files changed, 9 insertions, 9 deletions
diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index 8165c5b1ec..cfe22dc2f2 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -2244,8 +2244,7 @@ void NetPlayClient::SendPadHostPoll(const PadIndex pad_num) SendAsync(std::move(packet)); } -// called from ---GUI--- thread and ---NETPLAY--- thread (client side) -bool NetPlayClient::StopGame() +void NetPlayClient::InvokeStop() { m_is_running.Clear(); @@ -2254,6 +2253,12 @@ bool NetPlayClient::StopGame() m_wii_pad_event.Set(); m_first_pad_status_received_event.Set(); m_wait_on_input_event.Set(); +} + +// called from ---GUI--- thread and ---NETPLAY--- thread (client side) +bool NetPlayClient::StopGame() +{ + InvokeStop(); NetPlay_Disable(); @@ -2269,13 +2274,7 @@ void NetPlayClient::Stop() if (!m_is_running.IsSet()) return; - m_is_running.Clear(); - - // stop waiting for input - m_gc_pad_event.Set(); - m_wii_pad_event.Set(); - m_first_pad_status_received_event.Set(); - m_wait_on_input_event.Set(); + InvokeStop(); // Tell the server to stop if we have a pad mapped in game. if (LocalPlayerHasControllerMapped()) diff --git a/Source/Core/Core/NetPlayClient.h b/Source/Core/Core/NetPlayClient.h index d09648f173..36fa2cc31a 100644 --- a/Source/Core/Core/NetPlayClient.h +++ b/Source/Core/Core/NetPlayClient.h @@ -117,6 +117,7 @@ public: // Called from the GUI thread. bool IsConnected() const { return m_is_connected; } bool StartGame(const std::string& path); + void InvokeStop(); bool StopGame(); void Stop(); bool ChangeGame(const std::string& game); |
