InputSource: Explicitly construct binding key

This commit is contained in:
Stenzek 2024-07-04 21:40:32 +10:00
parent c02bf0f662
commit 9fcc98a60a
No known key found for this signature in database
2 changed files with 5 additions and 4 deletions

View file

@ -165,7 +165,8 @@ void DInputSource::Shutdown()
while (!m_controllers.empty()) while (!m_controllers.empty())
{ {
const u32 index = 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}}, InputManager::OnInputDeviceDisconnected(
InputBindingKey{{.source_type = InputSourceType::DInput, .source_index = index}},
GetDeviceIdentifier(static_cast<u32>(m_controllers.size() - 1))); GetDeviceIdentifier(static_cast<u32>(m_controllers.size() - 1)));
m_controllers.pop_back(); m_controllers.pop_back();
} }
@ -270,7 +271,7 @@ void DInputSource::PollEvents()
if (hr != DI_OK) if (hr != DI_OK)
{ {
InputManager::OnInputDeviceDisconnected( InputManager::OnInputDeviceDisconnected(
{{.source_type = InputSourceType::DInput, .source_index = static_cast<u32>(i)}}, InputBindingKey{{.source_type = InputSourceType::DInput, .source_index = static_cast<u32>(i)}},
GetDeviceIdentifier(static_cast<u32>(i))); GetDeviceIdentifier(static_cast<u32>(i)));
m_controllers.erase(m_controllers.begin() + i); m_controllers.erase(m_controllers.begin() + i);
continue; continue;

View file

@ -822,7 +822,7 @@ bool SDLInputSource::CloseDevice(int joystick_index)
return false; return false;
InputManager::OnInputDeviceDisconnected( InputManager::OnInputDeviceDisconnected(
{{.source_type = InputSourceType::SDL, .source_index = static_cast<u32>(it->player_id)}}, InputBindingKey{{.source_type = InputSourceType::SDL, .source_index = static_cast<u32>(it->player_id)}},
fmt::format("SDL-{}", it->player_id)); fmt::format("SDL-{}", it->player_id));
if (it->haptic) if (it->haptic)