From 0b47e1651e30ec84a9d915382badf87815def081 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Tue, 30 Jul 2019 16:03:29 -0700 Subject: [PATCH] Don't attach the camera or speaker to the balance board; use zero'd EEPROM for the balance board Note that Mii data is still loaded into the balance board's EEPROM currently, which probably shoudln't happen. --- Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp | 63 ++++++++++--------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp index a36ad92a715d..1d6e2f9a2c75 100644 --- a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp @@ -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 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 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 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 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 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 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;