Merge pull request #10014 from OatmealDome/wiimote-disconnect-crash

WiimoteReal: Fix Wiimote disconnection causing Dolphin to crash on macOS
This commit is contained in:
Léo Lam
2021-09-13 15:26:02 +02:00
committed by GitHub
4 changed files with 139 additions and 14 deletions

View File

@ -280,6 +280,14 @@ void Wiimote::Read()
Report rpt(MAX_PAYLOAD);
auto const result = IORead(rpt.data());
if (0 == result)
{
ERROR_LOG_FMT(WIIMOTE, "Wiimote::IORead failed. Disconnecting Wii Remote {}.", m_index + 1);
DisconnectInternal();
return;
}
// Drop the report if not connected.
if (!m_is_linked)
return;
@ -297,11 +305,6 @@ void Wiimote::Read()
rpt.resize(result);
m_read_reports.Push(std::move(rpt));
}
else if (0 == result)
{
ERROR_LOG_FMT(WIIMOTE, "Wiimote::IORead failed. Disconnecting Wii Remote {}.", m_index + 1);
DisconnectInternal();
}
}
bool Wiimote::Write()