New code style refactor

This commit is contained in:
Jack Andersen
2018-12-07 19:17:51 -10:00
parent 2c2c72bfd1
commit 058ea23a00
113 changed files with 23305 additions and 27650 deletions

View File

@@ -1,56 +1,44 @@
#include "boo/inputdev/NintendoPowerA.hpp"
#include "boo/inputdev/DeviceSignature.hpp"
#include <memory.h>
namespace boo
{
namespace boo {
NintendoPowerA::NintendoPowerA(DeviceToken* token)
: TDeviceBase<INintendoPowerACallback>(dev_typeid(NintendoPowerA), token)
{
: TDeviceBase<INintendoPowerACallback>(dev_typeid(NintendoPowerA), token) {}
}
NintendoPowerA::~NintendoPowerA() {}
NintendoPowerA::~NintendoPowerA()
{
}
void NintendoPowerA::deviceDisconnected()
{
std::lock_guard<std::mutex> lk(m_callbackLock);
if (m_callback)
m_callback->controllerDisconnected();
void NintendoPowerA::deviceDisconnected() {
std::lock_guard<std::mutex> lk(m_callbackLock);
if (m_callback)
m_callback->controllerDisconnected();
}
void NintendoPowerA::initialCycle() {}
void NintendoPowerA::transferCycle()
{
uint8_t payload[8];
size_t recvSz = receiveUSBInterruptTransfer(payload, sizeof(payload));
if (recvSz != 8)
return;
void NintendoPowerA::transferCycle() {
uint8_t payload[8];
size_t recvSz = receiveUSBInterruptTransfer(payload, sizeof(payload));
if (recvSz != 8)
return;
NintendoPowerAState state = *reinterpret_cast<NintendoPowerAState*>(&payload);
NintendoPowerAState state = *reinterpret_cast<NintendoPowerAState*>(&payload);
std::lock_guard<std::mutex> lk(m_callbackLock);
if (state != m_last && m_callback)
m_callback->controllerUpdate(state);
m_last = state;
std::lock_guard<std::mutex> lk(m_callbackLock);
if (state != m_last && m_callback)
m_callback->controllerUpdate(state);
m_last = state;
}
void NintendoPowerA::finalCycle() {}
void NintendoPowerA::receivedHIDReport(const uint8_t* data, size_t length, HIDReportType tp, uint32_t message)
{
void NintendoPowerA::receivedHIDReport(const uint8_t* data, size_t length, HIDReportType tp, uint32_t message) {}
bool NintendoPowerAState::operator==(const NintendoPowerAState& other) {
return !memcmp(this, &other, sizeof(NintendoPowerAState));
}
bool NintendoPowerAState::operator==(const NintendoPowerAState &other)
{
return !memcmp(this, &other, sizeof(NintendoPowerAState));
bool NintendoPowerAState::operator!=(const NintendoPowerAState& other) {
return memcmp(this, &other, sizeof(NintendoPowerAState));
}
bool NintendoPowerAState::operator!=(const NintendoPowerAState &other)
{
return memcmp(this, &other, sizeof(NintendoPowerAState));
}
}
} // namespace boo