From f51cb0b7eb9c0f261abd3f5d68707ba1f93e3888 Mon Sep 17 00:00:00 2001 From: Rachel Bryk Date: Wed, 7 Aug 2013 18:00:38 -0400 Subject: [PATCH] Fix multiplayer wiimote netplay. --- Source/Core/Core/Src/NetPlayClient.cpp | 14 ++++++-------- Source/Core/Core/Src/NetPlayClient.h | 2 -- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Source/Core/Core/Src/NetPlayClient.cpp b/Source/Core/Core/Src/NetPlayClient.cpp index 6a8086869a..1504498c1f 100644 --- a/Source/Core/Core/Src/NetPlayClient.cpp +++ b/Source/Core/Core/Src/NetPlayClient.cpp @@ -500,8 +500,6 @@ void NetPlayClient::ClearBuffers() while (m_wiimote_buffer[i].Size()) m_wiimote_buffer[i].Pop(); - - m_wiimote_input[i].data.clear(); } } @@ -565,6 +563,7 @@ bool NetPlayClient::GetNetPads(const u8 pad_nb, const SPADStatus* const pad_stat // called from ---CPU--- thread bool NetPlayClient::WiimoteUpdate(int _number, u8* data, u8 size) { + NetWiimote nw; { std::lock_guard lkp(m_crit.players); @@ -579,25 +578,24 @@ bool NetPlayClient::WiimoteUpdate(int _number, u8* data, u8 size) if (previousSize != size && m_wiimote_buffer[in_game_num].Size() > 0) { // Reporting mode changed, so previous buffer is no good. - m_wiimote_buffer[_number].Clear(); + m_wiimote_buffer[in_game_num].Clear(); } - m_wiimote_input[in_game_num].data.assign(data, data + size); - m_wiimote_input[in_game_num].size = size; + nw.data.assign(data, data + size); + nw.size = size; while (m_wiimote_buffer[in_game_num].Size() <= m_target_buffer_size) { // add to buffer - m_wiimote_buffer[in_game_num].Push(m_wiimote_input[in_game_num]); + m_wiimote_buffer[in_game_num].Push(nw); // send - SendWiimoteState(_number, m_wiimote_input[_number]); + SendWiimoteState(_number, nw); } previousSize = size; } } // unlock players - NetWiimote nw; while (!m_wiimote_buffer[_number].Pop(nw)) { // wait for receiving thread to push some data diff --git a/Source/Core/Core/Src/NetPlayClient.h b/Source/Core/Core/Src/NetPlayClient.h index 625c20b951..0783fdf439 100644 --- a/Source/Core/Core/Src/NetPlayClient.h +++ b/Source/Core/Core/Src/NetPlayClient.h @@ -100,8 +100,6 @@ protected: Common::FifoQueue m_pad_buffer[4]; Common::FifoQueue m_wiimote_buffer[4]; - NetWiimote m_wiimote_input[4]; - NetPlayUI* m_dialog; sf::SocketTCP m_socket; std::thread m_thread;