mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-13 00:58:29 +02:00
ControllerInterface: Allow hotplug callbacks to be unregistered and don't reload the entire config from the ini file on hotplug, just update the control references. This should fix a crash on shutdown on Android.
This commit is contained in:
@ -147,6 +147,21 @@ std::size_t InputConfig::GetControllerCount() const
|
||||
return m_controllers.size();
|
||||
}
|
||||
|
||||
void InputConfig::RegisterHotplugCallback()
|
||||
{
|
||||
// Update control references on all controllers
|
||||
// as configured devices may have been added or removed.
|
||||
m_hotplug_callback_handle = g_controller_interface.RegisterDevicesChangedCallback([this] {
|
||||
for (auto& controller : m_controllers)
|
||||
controller->UpdateReferences(g_controller_interface);
|
||||
});
|
||||
}
|
||||
|
||||
void InputConfig::UnregisterHotplugCallback()
|
||||
{
|
||||
g_controller_interface.UnregisterDevicesChangedCallback(m_hotplug_callback_handle);
|
||||
}
|
||||
|
||||
bool InputConfig::IsControllerControlledByGamepadDevice(int index) const
|
||||
{
|
||||
if (static_cast<size_t>(index) >= m_controllers.size())
|
||||
|
Reference in New Issue
Block a user