Revert "fix" for DolphinSmashAdapter (incorrect, problem lies elsewhere)

This commit is contained in:
Phillip Stephens 2017-02-10 20:20:41 -08:00
parent 27a455c61d
commit ee60772b39
3 changed files with 14 additions and 33 deletions

View File

@ -4,7 +4,6 @@
namespace boo
{
/*
* Reference: https://github.com/ToadKing/wii-u-gc-adapter/blob/master/wii-u-gc-adapter.c
*/
@ -37,10 +36,10 @@ static inline EDolphinControllerType parseState(DolphinControllerState* stateOut
stateOut->m_btns = (uint16_t)payload[1] << 8 | (uint16_t)payload[2];
stateOut->m_leftStick[0] = payload[4];
stateOut->m_leftStick[1] = payload[3];
stateOut->m_rightStick[0] = payload[6];
stateOut->m_rightStick[1] = payload[5];
stateOut->m_leftStick[0] = int8_t(payload[3]);
stateOut->m_leftStick[1] = int8_t(payload[4]);
stateOut->m_rightStick[0] = int8_t(payload[5]);
stateOut->m_rightStick[1] = int8_t(payload[6]);
stateOut->m_analogTriggers[0] = payload[7];
stateOut->m_analogTriggers[1] = payload[8];
@ -59,6 +58,7 @@ void DolphinSmashAdapter::transferCycle()
size_t recvSz = receiveUSBInterruptTransfer(payload, sizeof(payload));
if (recvSz != 37 || payload[0] != 0x21)
return;
// printf("RECEIVED DATA %zu %02X\n", recvSz, payload[0]);
if (!m_callback)
@ -67,7 +67,7 @@ void DolphinSmashAdapter::transferCycle()
/* Parse controller states */
uint8_t* controller = &payload[1];
uint8_t rumbleMask = 0;
for (int i = 0; i < 4; i++, controller += 9)
for (uint32_t i = 0; i < 4; i++, controller += 9)
{
DolphinControllerState state;
bool rumble = false;
@ -117,7 +117,7 @@ void DolphinSmashAdapter::deviceDisconnected()
{
if (!m_callback)
return;
for (int i = 0; i < 4; i++)
for (uint32_t i = 0; i < 4; i++)
{
if (m_knownControllers & 1 << i)
{
@ -242,8 +242,8 @@ static void pad_clamptrigger(uint8_t& trigger)
void DolphinControllerState::clamp()
{
pad_clampstick(m_leftStick[0], m_leftStick[1], pad_clampregion[3], pad_clampregion[4], pad_clampregion[2]);
pad_clampstick(m_rightStick[0], m_rightStick[1], pad_clampregion[6], pad_clampregion[7], pad_clampregion[5]);
pad_clampstick(m_leftStick[0], m_leftStick[1], int8_t(pad_clampregion[3]), int8_t(pad_clampregion[4]), int8_t(pad_clampregion[2]));
pad_clampstick(m_rightStick[0], m_rightStick[1], int8_t(pad_clampregion[6]), int8_t(pad_clampregion[7]), int8_t(pad_clampregion[5]));
pad_clamptrigger(m_analogTriggers[0]);
pad_clamptrigger(m_analogTriggers[1]);
}

View File

@ -15,25 +15,6 @@ static inline uint16_t bswap16(uint16_t val) {return __builtin_byteswap(val);}
#define RAD_TO_DEG (180.0/M_PI)
void hexdump(void *ptr, int buflen) {
unsigned char *buf = (unsigned char*)ptr;
int i, j;
for (i=0; i<buflen; i+=16) {
printf("%06x: ", i);
for (j=0; j<16; j++)
if (i+j < buflen)
printf("%02x ", buf[i+j]);
else
printf(" ");
printf(" ");
for (j=0; j<16; j++)
if (i+j < buflen)
printf("%c", isprint(buf[i+j]) ? buf[i+j] : '.');
printf("\n");
}
}
namespace boo
{
static const uint8_t defaultReport[35] = {

View File

@ -17,18 +17,18 @@ class DolphinSmashAdapterCallback : public IDolphinSmashAdapterCallback
{
void controllerConnected(unsigned idx, EDolphinControllerType)
{
printf("CONTROLLER %u CONNECTED\n", idx);
// printf("CONTROLLER %u CONNECTED\n", idx);
}
void controllerDisconnected(unsigned idx, EDolphinControllerType)
{
printf("CONTROLLER %u DISCONNECTED\n", idx);
// printf("CONTROLLER %u DISCONNECTED\n", idx);
}
void controllerUpdate(unsigned idx, EDolphinControllerType,
const DolphinControllerState& state)
{
printf("CONTROLLER %u UPDATE %d %d\n", idx, state.m_leftStick[0], state.m_leftStick[1]);
printf(" %d %d\n", state.m_rightStick[0], state.m_rightStick[1]);
printf(" %d %d\n", state.m_analogTriggers[0], state.m_analogTriggers[1]);
// printf("CONTROLLER %u UPDATE %d %d\n", idx, state.m_leftStick[0], state.m_leftStick[1]);
// printf(" %d %d\n", state.m_rightStick[0], state.m_rightStick[1]);
// printf(" %d %d\n", state.m_analogTriggers[0], state.m_analogTriggers[1]);
}
};