mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-24 14:24:54 +00:00
Merge pull request #13491 from JosJuice/oh0-removed-opened
IOS: Remove from m_opened_devices in OH0::OnDeviceChange
This commit is contained in:
commit
3025cd472c
1 changed files with 13 additions and 3 deletions
|
@ -81,10 +81,10 @@ void OH0::DoState(PointerWrap& p)
|
|||
5000);
|
||||
Core::DisplayMessage("If USB doesn't work properly, an emulation reset may be needed.", 5000);
|
||||
}
|
||||
}
|
||||
p.Do(m_insertion_hooks);
|
||||
p.Do(m_removal_hooks);
|
||||
p.Do(m_opened_devices);
|
||||
}
|
||||
USBHost::DoState(p);
|
||||
}
|
||||
|
||||
|
@ -243,9 +243,18 @@ bool OH0::HasDeviceWithVidPid(const u16 vid, const u16 pid) const
|
|||
void OH0::OnDeviceChange(const ChangeEvent event, std::shared_ptr<USB::Device> device)
|
||||
{
|
||||
if (event == ChangeEvent::Inserted)
|
||||
{
|
||||
TriggerHook(m_insertion_hooks, {device->GetVid(), device->GetPid()}, IPC_SUCCESS);
|
||||
}
|
||||
else if (event == ChangeEvent::Removed)
|
||||
{
|
||||
TriggerHook(m_removal_hooks, device->GetId(), IPC_SUCCESS);
|
||||
|
||||
// This fixes a problem where Rock Band 3 randomly fails to detect reconnected microphones.
|
||||
// Real IOS behavior untested.
|
||||
std::lock_guard lk(m_devices_mutex);
|
||||
m_opened_devices.erase(device->GetId());
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -286,6 +295,7 @@ std::pair<ReturnCode, u64> OH0::DeviceOpen(const u16 vid, const u16 pid)
|
|||
void OH0::DeviceClose(const u64 device_id)
|
||||
{
|
||||
TriggerHook(m_removal_hooks, device_id, IPC_ENOENT);
|
||||
std::lock_guard lk(m_devices_mutex);
|
||||
m_opened_devices.erase(device_id);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue