void Wiimote::StopThread() { m_run_thread.store(false); IOWakeup(); if (m_wiimote_thread.joinable()) m_wiimote_thread.join(); }
void Wiimote::StopThread() { if (!m_run_thread.TestAndClear()) return; IOWakeup(); m_wiimote_thread.join(); }
void Wiimote::StopThread() { m_run_thread = false; IOWakeup(); if (m_wiimote_thread.joinable()) m_wiimote_thread.join(); #if defined(__APPLE__) #endif }
// to be called from CPU thread void Wiimote::WriteReport(Report rpt) { if (rpt.size() >= 3) { bool const new_rumble_state = (rpt[2] & 0x1) != 0; // If this is a rumble report and the rumble state didn't change, ignore. if (WM_RUMBLE == rpt[1] && new_rumble_state == m_rumble_state) return; m_rumble_state = new_rumble_state; } m_write_reports.Push(std::move(rpt)); IOWakeup(); }
void Wiimote::Write() { if (m_write_reports.Empty()) return; Report const& rpt = m_write_reports.Front(); if (SConfig::GetInstance().iBBDumpPort > 0 && m_index == WIIMOTE_BALANCE_BOARD) { static sf::UdpSocket Socket; Socket.send((char*)rpt.data(), rpt.size(), sf::IpAddress::LocalHost, SConfig::GetInstance().iBBDumpPort); } IOWrite(rpt.data(), rpt.size()); m_write_reports.Pop(); if (!m_write_reports.Empty()) IOWakeup(); }
void Wiimote::Prepare() { m_need_prepare.store(true); IOWakeup(); }
void Wiimote::Prepare() { m_need_prepare.Set(); IOWakeup(); }