int CheckDeviceType_Read(HANDLE &dev_handle, u8* buf, int attempts) { OVERLAPPED hid_overlap_read = OVERLAPPED(); hid_overlap_read.hEvent = CreateEvent(nullptr, true, false, nullptr); int read = 0; for (; attempts>0; --attempts) { read = _IORead(dev_handle, hid_overlap_read, buf, 1); if (read > 0) break; } CloseHandle(hid_overlap_read.hEvent); return read; }
// positive = read packet // negative = didn't read packet // zero = error int WiimoteWindows::IORead(u8* buf) { return _IORead(m_dev_handle, m_hid_overlap_read, buf, m_index); }
// positive = read packet // negative = didn't read packet // zero = error int Wiimote::IORead(u8* buf) { return _IORead(dev_handle, hid_overlap_read, buf, index); }