Skip to content
Browse files

Merge pull request #8464 from jordan-woyak/wm-emu-errorcode

WiimoteEmu: Minor accuracy fixes.
  • Loading branch information
leoetlino committed Nov 17, 2019
2 parents bc1aa36 + 4d24f16 commit 97f9f252ccae53ce8abd766a0fb22209b1b47bc6
@@ -62,16 +62,22 @@ enum class AddressSpace : u8
// FYI: The EEPROM address space is offset 0x0070 on i2c slave 0x50.
// However attempting to access this device directly results in an error.
EEPROM = 0x00,
// 0x01 is never used but it does function on a real wiimote:
I2CBusAlt = 0x01,
I2CBus = 0x02,
// I2CBusAlt is never used by games but it does function on a real wiimote.
I2CBus = 0x01,
I2CBusAlt = 0x02,

enum class ErrorCode : u8
// Normal result.
Success = 0,
// Produced by read/write attempts during an active read.
Busy = 4,
// Produced by using something other than the above AddressSpace values.
InvalidSpace = 6,
// Produced by an i2c read/write with a non-responding slave address.
Nack = 7,
// Produced by accessing invalid regions of EEPROM or the EEPROM directly over i2c.
InvalidAddress = 8,

@@ -258,7 +258,12 @@ void Wiimote::HandleRequestStatus(const OutputReportRequestStatus&)

void Wiimote::HandleWriteData(const OutputReportWriteData& wd)
// TODO: Are writes ignored during an active read request?
if (m_read_request.size)
// FYI: Writes during an active read will occasionally produce a "busy" (0x4) ack.
// We won't simulate that as it often does work. Poorly programmed games may rely on it.
WARN_LOG(WIIMOTE, "WriteData: write during active read request.");

u16 address = Common::swap16(wd.address);

@@ -416,9 +421,11 @@ void Wiimote::HandleReadData(const OutputReportReadData& rd)
if (m_read_request.size)
// There is already an active read request.
// A real wiimote ignores the new one.
WARN_LOG(WIIMOTE, "ReadData: ignoring read during active request.");
// There is already an active read being processed.
WARN_LOG(WIIMOTE, "ReadData: attempting read during active request.");

// A real wm+ sends a busy ack in this situation.
SendAck(OutputReportID::ReadData, ErrorCode::Busy);

@@ -437,7 +444,7 @@ void Wiimote::HandleReadData(const OutputReportReadData& rd)
// TODO: should this be removed and let Update() take care of it?

// FYI: No "ACK" is sent.
// FYI: No "ACK" is sent under normal situations.

bool Wiimote::ProcessReadDataRequest()

0 comments on commit 97f9f25

Please sign in to comment.
You can’t perform that action at this time.