void MainWindow::OnConnectWiiRemote(int id) { const auto ios = IOS::HLE::GetIOS(); 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->AccessWiiMote(id | 0x100)->IsConnected(); Wiimote::Connect(id, !is_connected); }); }
void Host_ConnectWiimote(int wm_idx, bool connect) { Core::QueueHostJob([=] { const auto ios = IOS::HLE::GetIOS(); if (!ios || SConfig::GetInstance().m_bt_passthrough_enabled) return; bool was_unpaused = Core::PauseAndLock(true); const auto bt = std::static_pointer_cast<IOS::HLE::Device::BluetoothEmu>( ios->GetDeviceByName("/dev/usb/oh1/57e/305")); if (bt) bt->AccessWiiMote(wm_idx | 0x100)->Activate(connect); Host_UpdateMainFrame(); Core::PauseAndLock(false, was_unpaused); }); }
void Connect(unsigned int index, bool connect) { if (SConfig::GetInstance().m_bt_passthrough_enabled || index >= MAX_BBMOTES) return; const auto ios = IOS::HLE::GetIOS(); if (!ios) return; const auto bluetooth = std::static_pointer_cast<IOS::HLE::Device::BluetoothEmu>( ios->GetDeviceByName("/dev/usb/oh1/57e/305")); if (bluetooth) bluetooth->AccessWiiMote(index | 0x100)->Activate(connect); const char* message = connect ? "Wii Remote %i connected" : "Wii Remote %i disconnected"; Core::DisplayMessage(StringFromFormat(message, index + 1), 3000); }