Skip to content

Commit

Permalink
Don't attach the camera or speaker to the balance board; use zero'd E…
Browse files Browse the repository at this point in the history
…EPROM for the balance board

Note that Mii data is still loaded into the balance board's EEPROM currently, which probably shoudln't happen.
  • Loading branch information
Pokechu22 committed Jul 31, 2019
1 parent 11940c7 commit 0b47e16
Showing 1 changed file with 35 additions and 28 deletions.
63 changes: 35 additions & 28 deletions Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,39 +77,46 @@ void Wiimote::Reset()
// EEPROM
m_eeprom = {};

// IR calibration and maybe more unknown purposes:
// The meaning of this data needs more investigation.
// Last byte is a checksum.
std::array<u8, 11> ir_calibration = {
0xA1, 0xAA, 0x8B, 0x99, 0xAE, 0x9E, 0x78, 0x30, 0xA7, 0x74, 0x00,
};
// Purposely not updating checksum because using this data results in a weird IR offset..
// UpdateCalibrationDataChecksum(ir_calibration, 1);
m_eeprom.ir_calibration_1 = ir_calibration;
m_eeprom.ir_calibration_2 = ir_calibration;

// Accel calibration:
// Last byte is a checksum.
std::array<u8, 10> accel_calibration = {
ACCEL_ZERO_G, ACCEL_ZERO_G, ACCEL_ZERO_G, 0, ACCEL_ONE_G, ACCEL_ONE_G, ACCEL_ONE_G, 0, 0, 0,
};
UpdateCalibrationDataChecksum(accel_calibration, 1);
m_eeprom.accel_calibration_1 = accel_calibration;
m_eeprom.accel_calibration_2 = accel_calibration;

// TODO: Is this needed?
// Data of unknown purpose:
constexpr std::array<u8, 24> EEPROM_DATA_16D0 = {0x00, 0x00, 0x00, 0xFF, 0x11, 0xEE, 0x00, 0x00,
0x33, 0xCC, 0x44, 0xBB, 0x00, 0x00, 0x66, 0x99,
0x77, 0x88, 0x00, 0x00, 0x2B, 0x01, 0xE8, 0x13};
m_eeprom.unk_2 = EEPROM_DATA_16D0;
// The balance board starts with all-0 EEPROM, while regular remotes have some data.
if (m_index != WIIMOTE_BALANCE_BOARD)
{
// IR calibration and maybe more unknown purposes:
// The meaning of this data needs more investigation.
// Last byte is a checksum.
std::array<u8, 11> ir_calibration = {
0xA1, 0xAA, 0x8B, 0x99, 0xAE, 0x9E, 0x78, 0x30, 0xA7, 0x74, 0x00,
};
// Purposely not updating checksum because using this data results in a weird IR offset..
// UpdateCalibrationDataChecksum(ir_calibration, 1);
m_eeprom.ir_calibration_1 = ir_calibration;
m_eeprom.ir_calibration_2 = ir_calibration;

// Accel calibration:
// Last byte is a checksum.
std::array<u8, 10> accel_calibration = {
ACCEL_ZERO_G, ACCEL_ZERO_G, ACCEL_ZERO_G, 0, ACCEL_ONE_G, ACCEL_ONE_G, ACCEL_ONE_G, 0, 0, 0,
};
UpdateCalibrationDataChecksum(accel_calibration, 1);
m_eeprom.accel_calibration_1 = accel_calibration;
m_eeprom.accel_calibration_2 = accel_calibration;

// TODO: Is this needed?
// Data of unknown purpose:
constexpr std::array<u8, 24> EEPROM_DATA_16D0 = {
0x00, 0x00, 0x00, 0xFF, 0x11, 0xEE, 0x00, 0x00, 0x33, 0xCC, 0x44, 0xBB,
0x00, 0x00, 0x66, 0x99, 0x77, 0x88, 0x00, 0x00, 0x2B, 0x01, 0xE8, 0x13};
m_eeprom.unk_2 = EEPROM_DATA_16D0;
}

m_read_request = {};

// Initialize i2c bus:
m_i2c_bus.Reset();
m_i2c_bus.AddSlave(&m_speaker_logic);
m_i2c_bus.AddSlave(&m_camera_logic);
if (m_index != WIIMOTE_BALANCE_BOARD)
{
m_i2c_bus.AddSlave(&m_speaker_logic);
m_i2c_bus.AddSlave(&m_camera_logic);
}

// Reset extension connections to NONE:
m_is_motion_plus_attached = false;
Expand Down

0 comments on commit 0b47e16

Please sign in to comment.