WiimoteEmu: Minor accuracy fixes.

This commit is contained in:
Jordan Woyak 2019-02-20 17:44:55 -06:00
parent 286aafd4ed
commit 58f1ff3773
2 changed files with 11 additions and 4 deletions

View File

@ -84,8 +84,9 @@ static_assert(sizeof(OutputReportRequestStatus) == 1, "Wrong size");
struct OutputReportWriteData
{
u8 rumble : 1;
u8 : 1;
u8 space : 2;
u8 : 5;
u8 : 4;
// A real wiimote ignores the i2c read/write bit.
u8 i2c_rw_ignored : 1;
// Used only for register space (i2c bus) (7-bits):
@ -100,8 +101,9 @@ static_assert(sizeof(OutputReportWriteData) == 21, "Wrong size");
struct OutputReportReadData
{
u8 rumble : 1;
u8 : 1;
u8 space : 2;
u8 : 5;
u8 : 4;
// A real wiimote ignores the i2c read/write bit.
u8 i2c_rw_ignored : 1;
// Used only for register space (i2c bus) (7-bits):
@ -114,7 +116,8 @@ static_assert(sizeof(OutputReportReadData) == 6, "Wrong size");
struct OutputReportSpeakerData
{
u8 unknown : 3;
u8 rumble : 1;
u8 : 2;
u8 length : 5;
u8 data[20];
};

View File

@ -45,7 +45,8 @@ void Wiimote::HandleReportMode(const OutputReportMode& dr)
m_reporting_continuous = dr.continuous;
m_reporting_mode = dr.mode;
SendAck(OutputReportID::ReportMode, ErrorCode::Success);
if (dr.ack)
SendAck(OutputReportID::ReportMode, ErrorCode::Success);
}
// Tests that we have enough bytes for the report before we run the handler.
@ -322,6 +323,7 @@ void Wiimote::HandleWriteData(const OutputReportWriteData& wd)
break;
}
// Real wiimotes seem to always ACK data writes.
SendAck(OutputReportID::WriteData, error_code);
}
@ -426,6 +428,8 @@ void Wiimote::HandleReadData(const OutputReportReadData& rd)
// If more data needs to be sent it will happen on the next "Update()"
// TODO: should this be removed and let Update() take care of it?
ProcessReadDataRequest();
// FYI: No "ACK" is sent.
}
bool Wiimote::ProcessReadDataRequest()