CommonHostInterface: Clear input map before changing interface
Should hopefully fix the crash when changing controller backends.
This commit is contained in:
parent
9254fc9e63
commit
5115c75f88
|
@ -461,6 +461,7 @@ void CommonHostInterface::UpdateControllerInterface()
|
||||||
|
|
||||||
if (m_controller_interface)
|
if (m_controller_interface)
|
||||||
{
|
{
|
||||||
|
ClearInputMap();
|
||||||
m_controller_interface->Shutdown();
|
m_controller_interface->Shutdown();
|
||||||
m_controller_interface.reset();
|
m_controller_interface.reset();
|
||||||
}
|
}
|
||||||
|
@ -939,15 +940,20 @@ bool CommonHostInterface::HandleHostMouseEvent(HostMouseButton button, bool pres
|
||||||
|
|
||||||
void CommonHostInterface::UpdateInputMap(SettingsInterface& si)
|
void CommonHostInterface::UpdateInputMap(SettingsInterface& si)
|
||||||
{
|
{
|
||||||
m_keyboard_input_handlers.clear();
|
ClearInputMap();
|
||||||
m_mouse_input_handlers.clear();
|
|
||||||
if (m_controller_interface)
|
|
||||||
m_controller_interface->ClearBindings();
|
|
||||||
|
|
||||||
UpdateControllerInputMap(si);
|
UpdateControllerInputMap(si);
|
||||||
UpdateHotkeyInputMap(si);
|
UpdateHotkeyInputMap(si);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CommonHostInterface::ClearInputMap()
|
||||||
|
{
|
||||||
|
m_keyboard_input_handlers.clear();
|
||||||
|
m_mouse_input_handlers.clear();
|
||||||
|
m_controller_vibration_motors.clear();
|
||||||
|
if (m_controller_interface)
|
||||||
|
m_controller_interface->ClearBindings();
|
||||||
|
}
|
||||||
|
|
||||||
void CommonHostInterface::AddControllerRumble(u32 controller_index, u32 num_motors, ControllerRumbleCallback callback)
|
void CommonHostInterface::AddControllerRumble(u32 controller_index, u32 num_motors, ControllerRumbleCallback callback)
|
||||||
{
|
{
|
||||||
ControllerRumbleState rumble;
|
ControllerRumbleState rumble;
|
||||||
|
|
|
@ -217,6 +217,7 @@ protected:
|
||||||
bool HandleHostKeyEvent(HostKeyCode code, bool pressed);
|
bool HandleHostKeyEvent(HostKeyCode code, bool pressed);
|
||||||
bool HandleHostMouseEvent(HostMouseButton button, bool pressed);
|
bool HandleHostMouseEvent(HostMouseButton button, bool pressed);
|
||||||
void UpdateInputMap(SettingsInterface& si);
|
void UpdateInputMap(SettingsInterface& si);
|
||||||
|
void ClearInputMap();
|
||||||
|
|
||||||
void AddControllerRumble(u32 controller_index, u32 num_motors, ControllerRumbleCallback callback);
|
void AddControllerRumble(u32 controller_index, u32 num_motors, ControllerRumbleCallback callback);
|
||||||
void UpdateControllerRumble();
|
void UpdateControllerRumble();
|
||||||
|
|
Loading…
Reference in New Issue