diff --git a/Source/Core/Core/HW/WiimoteEmu/Camera.cpp b/Source/Core/Core/HW/WiimoteEmu/Camera.cpp index b208002467..8355c5d377 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Camera.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Camera.cpp @@ -11,6 +11,8 @@ #include "Common/ChunkFile.h" #include "Common/MathUtil.h" #include "Common/Matrix.h" + +#include "Core/Config/SYSCONFSettings.h" #include "Core/HW/WiimoteCommon/WiimoteReport.h" namespace WiimoteEmu @@ -51,7 +53,7 @@ int CameraLogic::BusWrite(u8 slave_addr, u8 addr, int count, const u8* data_in) return RawWrite(®_data, addr, count, data_in); } -void CameraLogic::Update(const Common::Matrix44& transform, bool sensor_bar_on_top) +void CameraLogic::Update(const Common::Matrix44& transform) { using Common::Matrix33; using Common::Matrix44; @@ -81,6 +83,9 @@ void CameraLogic::Update(const Common::Matrix44& transform, bool sensor_bar_on_t // Values are optimized for default settings in "Super Mario Galaxy 2" // This seems to be acceptable for a good number of games. constexpr float SENSOR_BAR_LED_SEPARATION = 0.2f; + + // Emulate a sensor bar height that matches the config. + const bool sensor_bar_on_top = Config::Get(Config::SYSCONF_SENSOR_BAR_POSITION) != 0; const float sensor_bar_height = sensor_bar_on_top ? 0.11 : -0.11; const std::array leds{ diff --git a/Source/Core/Core/HW/WiimoteEmu/Camera.h b/Source/Core/Core/HW/WiimoteEmu/Camera.h index fbc7f6516f..7ad44022f8 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Camera.h +++ b/Source/Core/Core/HW/WiimoteEmu/Camera.h @@ -71,7 +71,7 @@ public: void Reset(); void DoState(PointerWrap& p); - void Update(const Common::Matrix44& transform, bool sensor_bar_on_top); + void Update(const Common::Matrix44& transform); void SetEnabled(bool is_enabled); static constexpr u8 I2C_ADDR = 0x58; diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp index 0de1cc0b16..10f1326f6d 100644 --- a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp @@ -243,13 +243,6 @@ Wiimote::Wiimote(const unsigned int index) : m_index(index) m_hotkeys->AddInput(_trans("Sideways Hold"), false); m_hotkeys->AddInput(_trans("Upright Hold"), false); - auto config_change_callback = [this] { - m_sensor_bar_on_top = Config::Get(Config::SYSCONF_SENSOR_BAR_POSITION) != 0; - }; - Config::AddConfigChangedCallback(config_change_callback); - - config_change_callback(); - Reset(); } @@ -439,7 +432,7 @@ void Wiimote::SendDataReport() // IR Camera: if (rpt_builder.HasIR()) { - m_camera_logic.Update(GetTransformation(), m_sensor_bar_on_top); + m_camera_logic.Update(GetTransformation()); // The real wiimote reads camera data from the i2c bus starting at offset 0x37: const u8 camera_data_offset = diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.h b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.h index f534548d65..863bb8a1e1 100644 --- a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.h +++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.h @@ -268,9 +268,6 @@ private: bool m_speaker_mute; - // This is just for the IR Camera to compensate for the sensor bar position. - bool m_sensor_bar_on_top; - WiimoteCommon::InputReportStatus m_status; ExtensionNumber m_active_extension;