Get rid of GetUsbPointer for emulated Bluetooth

It held a raw pointer to a IOS::HLE::Device::BluetoothEmu that is not
guaranteed to exist (and of course, nothing checked that it wasn't
nullptr), but what is more, it's totally unnecessary because we have
IOS::HLE::GetDeviceByName().

Since we cannot always inform the host that Wii remotes are
disconnected from ES, that is now done in BluetoothEmu's destructor.
This commit is contained in:
Léo Lam
2017-01-28 22:57:43 +01:00
parent 5fd5eeb82a
commit fd49a1b2d5
8 changed files with 43 additions and 51 deletions

View File

@ -143,7 +143,10 @@ void Host_ConnectWiimote(int wm_idx, bool connect)
{
Core::QueueHostJob([=] {
bool was_unpaused = Core::PauseAndLock(true);
IOS::HLE::GetUsbPointer()->AccessWiiMote(wm_idx | 0x100)->Activate(connect);
const auto bt = std::static_pointer_cast<IOS::HLE::Device::BluetoothEmu>(
IOS::HLE::GetDeviceByName("/dev/usb/oh1/57e/305"));
if (bt)
bt->AccessWiiMote(wm_idx | 0x100)->Activate(connect);
Host_UpdateMainFrame();
Core::PauseAndLock(false, was_unpaused);
});