Merge pull request #8985 from jordan-woyak/btemu-cleanup

BTEmu/Wiimote: Fixes and Cleanups.
This commit is contained in:
JMC47 2020-09-14 02:09:27 -04:00 committed by GitHub
commit 4f1f849c9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 907 additions and 1066 deletions

View file

@ -1706,10 +1706,12 @@ void MainWindow::OnConnectWiiRemote(int id)
if (!ios || SConfig::GetInstance().m_bt_passthrough_enabled)
return;
Core::RunAsCPUThread([&] {
const auto bt = std::static_pointer_cast<IOS::HLE::Device::BluetoothEmu>(
ios->GetDeviceByName("/dev/usb/oh1/57e/305"));
const bool is_connected = bt && bt->AccessWiimoteByIndex(id)->IsConnected();
Wiimote::Connect(id, !is_connected);
if (const auto bt = std::static_pointer_cast<IOS::HLE::Device::BluetoothEmu>(
ios->GetDeviceByName("/dev/usb/oh1/57e/305")))
{
const auto wm = bt->AccessWiimoteByIndex(id);
wm->Activate(!wm->IsConnected());
}
});
}