void Wiimote::Update() { // Pop through the queued reports Report const rpt = ProcessReadQueue(); // Send the report if (rpt.first != NULL && m_channel > 0) Core::Callback_WiimoteInterruptChannel(index, m_channel, rpt.first, rpt.second); // Delete the data if it isn't also the last data rpt if (rpt != m_last_data_report) delete[] rpt.first; }
void Wiimote::Update() { if (!IsConnected()) { HandleWiimoteDisconnect(m_index); return; } // Pop through the queued reports const Report& rpt = ProcessReadQueue(); // Send the report if (!rpt.empty() && m_channel > 0) { Core::Callback_WiimoteInterruptChannel(m_index, m_channel, rpt.data(), (u32)rpt.size()); } }
void Wiimote::ConnectOnInput() { if (m_last_connect_request_counter > 0) { --m_last_connect_request_counter; return; } const Report& rpt = ProcessReadQueue(); if (rpt.size() >= 4) { switch (rpt[1]) { case WM_REPORT_CORE: case WM_REPORT_CORE_ACCEL: case WM_REPORT_CORE_EXT8: case WM_REPORT_CORE_ACCEL_IR12: case WM_REPORT_CORE_EXT19: case WM_REPORT_CORE_ACCEL_EXT16: case WM_REPORT_CORE_IR10_EXT9: case WM_REPORT_CORE_ACCEL_IR10_EXT6: case WM_REPORT_INTERLEAVE1: case WM_REPORT_INTERLEAVE2: // check any button without checking accelerometer data if ((rpt[2] & 0x1F) != 0 || (rpt[3] & 0x9F) != 0) { Host_ConnectWiimote(m_index, true); // see WiimoteEmu::Wiimote::ConnectOnInput(), same idea here m_last_connect_request_counter = 100; } break; default: break; } } }