From 93f5df419521171c11e16d6a8ff84b9d0d8fd6c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Thu, 14 Jul 2016 17:45:59 +0200 Subject: ControllerInterface: Add RemoveDevice() This adds RemoveDevice() to ControllerInterface, fixes ExpressionParser and some other code to support device removals without crashing, and adds an IsValid() method to Device, to prepare for hotplugging. --- Source/Core/DolphinWX/InputConfigDiag.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Source/Core/DolphinWX/InputConfigDiag.cpp') diff --git a/Source/Core/DolphinWX/InputConfigDiag.cpp b/Source/Core/DolphinWX/InputConfigDiag.cpp index 2a5aa997e3..cad5d3496a 100644 --- a/Source/Core/DolphinWX/InputConfigDiag.cpp +++ b/Source/Core/DolphinWX/InputConfigDiag.cpp @@ -315,11 +315,12 @@ bool ControlDialog::Validate() { control_reference->expression = WxStrToStr(textctrl->GetValue()); + auto lock = ControllerEmu::GetStateLock(); g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device); UpdateGUI(); - return (control_reference->parse_error == EXPRESSION_PARSE_SUCCESS); + return control_reference->parse_error == EXPRESSION_PARSE_SUCCESS; } void GamepadPage::SetDevice(wxCommandEvent&) @@ -351,6 +352,7 @@ void ControlDialog::ClearControl(wxCommandEvent&) { control_reference->expression.clear(); + auto lock = ControllerEmu::GetStateLock(); g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device); UpdateGUI(); @@ -408,6 +410,7 @@ void ControlDialog::SetSelectedControl(wxCommandEvent&) textctrl->WriteText(expr); control_reference->expression = textctrl->GetValue(); + auto lock = ControllerEmu::GetStateLock(); g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device); UpdateGUI(); @@ -442,6 +445,7 @@ void ControlDialog::AppendControl(wxCommandEvent& event) textctrl->WriteText(expr); control_reference->expression = textctrl->GetValue(); + auto lock = ControllerEmu::GetStateLock(); g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device); UpdateGUI(); @@ -556,6 +560,7 @@ bool GamepadPage::DetectButton(ControlButton* button) wxString expr; GetExpressionForControl(expr, control_name); button->control_reference->expression = expr; + auto lock = ControllerEmu::GetStateLock(); g_controller_interface.UpdateReference(button->control_reference, controller->default_device); success = true; } -- cgit v1.2.3