Merge pull request #15008 from jordan-woyak/wm-real-remove-config-change-callback

HW/WiimoteReal: Fix crash when UI disconnects a Balance Board.
This commit is contained in:
Jordan Woyak authored and GitHub committed 2026-11-20 22:11:45 -06:00
commit b2c2c21e58
2 files changed
+5 -24

No files matched your search

@@ -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;
@@ -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