Skip to content

Commit

Permalink
HW/WiimoteEmu: Fill IR data with 0xFF on failed bus read.
Browse files Browse the repository at this point in the history
  • Loading branch information
jordan-woyak committed Feb 25, 2020
1 parent a706baa commit 3861f9c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,15 @@ void Wiimote::SendDataReport()
const u8 camera_data_offset =
CameraLogic::REPORT_DATA_OFFSET + rpt_builder.GetIRDataFormatOffset();

m_i2c_bus.BusRead(CameraLogic::I2C_ADDR, camera_data_offset, rpt_builder.GetIRDataSize(),
rpt_builder.GetIRDataPtr());
u8* ir_data = rpt_builder.GetIRDataPtr();
const u8 ir_size = rpt_builder.GetIRDataSize();

if (ir_size != m_i2c_bus.BusRead(CameraLogic::I2C_ADDR, camera_data_offset, ir_size, ir_data))
{
// This happens when IR reporting is enabled but the camera hardware is disabled.
// It commonly occurs when changing IR sensitivity.
std::fill_n(ir_data, ir_size, 0xff);
}
}

// Extension port:
Expand Down

0 comments on commit 3861f9c

Please sign in to comment.