diff --git a/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp b/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp index b60339a8f1..0b464b13d6 100644 --- a/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp +++ b/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp @@ -96,10 +96,11 @@ std::optional USB_HIDv4::GetDeviceChange(const IOCtlRequest& request) m_devicechange_hook_request = std::make_unique(GetSystem(), request.address); // If there are pending changes, the reply is sent immediately (instead of on device // insertion/removal). - if (m_has_pending_changes) + if (m_has_pending_changes || m_is_shut_down) { TriggerDeviceChangeReply(); m_has_pending_changes = false; + m_is_shut_down = false; } return std::nullopt; } @@ -114,6 +115,7 @@ IPCReply USB_HIDv4::Shutdown(const IOCtlRequest& request) memory.Write_U32(0xffffffff, m_devicechange_hook_request->buffer_out); GetEmulationKernel().EnqueueIPCReply(*m_devicechange_hook_request, -1); m_devicechange_hook_request.reset(); + m_is_shut_down = true; } return IPCReply(IPC_SUCCESS); } diff --git a/Source/Core/Core/IOS/USB/USB_HID/HIDv4.h b/Source/Core/Core/IOS/USB/USB_HID/HIDv4.h index 44c8213ae0..33fc31f461 100644 --- a/Source/Core/Core/IOS/USB/USB_HID/HIDv4.h +++ b/Source/Core/Core/IOS/USB/USB_HID/HIDv4.h @@ -45,6 +45,7 @@ private: static constexpr u8 HID_CLASS = 0x03; bool m_has_pending_changes = true; + bool m_is_shut_down = false; std::mutex m_devicechange_hook_address_mutex; std::unique_ptr m_devicechange_hook_request;