mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-04 17:32:47 +00: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:
parent
c2afcb0f6b
commit
b425f86121
10 changed files with 62 additions and 16 deletions
|
@ -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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue