Qt: Add option to pause when controller is disconnected

This commit is contained in:
Stenzek
2024-05-14 15:52:43 +10:00
parent 2b31c08083
commit 18160a8e06
16 changed files with 129 additions and 85 deletions

View File

@ -162,7 +162,9 @@ void DInputSource::Shutdown()
{
while (!m_controllers.empty())
{
InputManager::OnInputDeviceDisconnected(GetDeviceIdentifier(static_cast<u32>(m_controllers.size() - 1)));
const u32 index = static_cast<u32>(m_controllers.size() - 1);
InputManager::OnInputDeviceDisconnected({{.source_type = InputSourceType::DInput, .source_index = index}},
GetDeviceIdentifier(static_cast<u32>(m_controllers.size() - 1)));
m_controllers.pop_back();
}
}
@ -265,7 +267,9 @@ void DInputSource::PollEvents()
if (hr != DI_OK)
{
InputManager::OnInputDeviceDisconnected(GetDeviceIdentifier(static_cast<u32>(i)));
InputManager::OnInputDeviceDisconnected(
{{.source_type = InputSourceType::DInput, .source_index = static_cast<u32>(i)}},
GetDeviceIdentifier(static_cast<u32>(i)));
m_controllers.erase(m_controllers.begin() + i);
continue;
}