diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2026-11-20 22:11:45 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-11-20 22:11:45 -0600 |
| commit | b2c2c21e58d4acc5de49e8c7d3bc76c8e34f6476 (patch) | |
| tree | d08464cf462cf59a86504bbc179e0ee6ce2096f2 /Source | |
| parent | 7dac5ec790496bb0b10944bcbf7eade65aad671d (diff) | |
| parent | 9f62f12d570b0a6a10af4b653144166d399a8d9c (diff) | |
Merge pull request #15008 from jordan-woyak/wm-real-remove-config-change-callback
HW/WiimoteReal: Fix crash when UI disconnects a Balance Board.
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp | 20 | ||||
| -rw-r--r-- | Source/Core/Core/HW/WiimoteReal/WiimoteReal.h | 9 |
2 files changed, 5 insertions, 24 deletions
diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp index a824725b79..8f2dff9aca 100644 --- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp @@ -143,16 +143,8 @@ void AddWiimoteToPool(std::unique_ptr<Wiimote> wiimote) s_wiimote_pool.emplace_back(WiimotePoolEntry{std::move(wiimote)}); } -Wiimote::Wiimote() -{ - m_config_changed_callback_id = Config::AddConfigChangedCallback([this] { RefreshConfig(); }); - RefreshConfig(); -} - -Wiimote::~Wiimote() -{ - Config::RemoveConfigChangedCallback(m_config_changed_callback_id); -} +Wiimote::Wiimote() = default; +Wiimote::~Wiimote() = default; void Wiimote::Shutdown() { @@ -268,7 +260,8 @@ void Wiimote::InterruptDataOutput(const u8* data, const u32 size) leds_rpt.leds = 0xf; } } - else if (rpt[1] == u8(OutputReportID::SpeakerData) && !m_speaker_enabled_in_dolphin_config) + else if (rpt[1] == u8(OutputReportID::SpeakerData) && + !Config::Get(Config::MAIN_WIIMOTE_ENABLE_SPEAKER)) { rpt.resize(3); // Translate undesired speaker data reports into rumble reports. @@ -844,11 +837,6 @@ void Wiimote::WriteThreadFunc() DisconnectInternal(); } -void Wiimote::RefreshConfig() -{ - m_speaker_enabled_in_dolphin_config = Config::Get(Config::MAIN_WIIMOTE_ENABLE_SPEAKER); -} - int Wiimote::GetIndex() const { return m_index; diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h index e285d2bcdb..6934e85ecf 100644 --- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h +++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h @@ -11,7 +11,6 @@ #include <thread> #include <vector> -#include "Common/Config/Config.h" #include "Common/Event.h" #include "Common/Flag.h" #include "Common/SPSCQueue.h" @@ -65,7 +64,7 @@ public: bool IsBalanceBoard(); - void InterruptDataOutput(const u8* data, const u32 size) override; + void InterruptDataOutput(const u8* data, u32 size) override; u8 GetWiimoteDeviceIndex() const override; void SetWiimoteDeviceIndex(u8 index) override; @@ -147,8 +146,6 @@ private: void ReadThreadFunc(); void WriteThreadFunc(); - void RefreshConfig(); - std::atomic<bool> m_is_linked = false; // And we track the rumble state to drop unnecessary rumble reports. @@ -164,10 +161,6 @@ private: Common::SPSCQueue<TimedReport> m_write_reports; // Kick the write thread. Common::Event m_write_event; - - bool m_speaker_enabled_in_dolphin_config = false; - - Config::ConfigChangedCallbackID m_config_changed_callback_id; }; class WiimoteScannerBackend |
