diff --git a/Source/Core/DolphinWX/Src/InputConfigDiag.cpp b/Source/Core/DolphinWX/Src/InputConfigDiag.cpp index 6a740aae45..33471f9d9b 100644 --- a/Source/Core/DolphinWX/Src/InputConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/InputConfigDiag.cpp @@ -6,6 +6,9 @@ #include "UDPConfigDiag.h" #include "WxUtils.h" #include "HW/Wiimote.h" +#include "ControllerInterface/ExpressionParser.h" + +using namespace ciface::ExpressionParser; void GamepadPage::ConfigUDPWii(wxCommandEvent &event) { @@ -225,6 +228,18 @@ void ControlDialog::UpdateGUI() // updates the "bound controls:" label m_bound_label->SetLabel(wxString::Format(_("Bound Controls: %lu"), (unsigned long)control_reference->BoundCount())); + + switch (control_reference->parse_error) + { + case EXPRESSION_PARSE_SYNTAX_ERROR: + m_error_label->SetLabel("Syntax error"); + break; + case EXPRESSION_PARSE_NO_DEVICE: + m_error_label->SetLabel("Device not found"); + break; + default: + m_error_label->SetLabel(""); + } }; void GamepadPage::UpdateGUI() @@ -560,7 +575,9 @@ wxStaticBoxSizer* ControlDialog::CreateControlChooser(GamepadPage* const parent) range_slider->Bind(wxEVT_SCROLL_CHANGED, &GamepadPage::AdjustControlOption, parent); wxStaticText* const range_label = new wxStaticText(this, -1, _("Range")); + m_bound_label = new wxStaticText(this, -1, wxT("")); + m_error_label = new wxStaticText(this, -1, wxT("")); wxBoxSizer* const range_sizer = new wxBoxSizer(wxHORIZONTAL); range_sizer->Add(range_label, 0, wxCENTER|wxLEFT, 5); @@ -579,6 +596,7 @@ wxStaticBoxSizer* ControlDialog::CreateControlChooser(GamepadPage* const parent) main_szr->Add(textctrl, 1, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 5); main_szr->Add(bottom_btns_sizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5); main_szr->Add(m_bound_label, 0, wxCENTER, 0); + main_szr->Add(m_error_label, 0, wxCENTER, 0); UpdateListContents(); diff --git a/Source/Core/DolphinWX/Src/InputConfigDiag.h b/Source/Core/DolphinWX/Src/InputConfigDiag.h index 475fa9ed5e..0a355c1d2f 100644 --- a/Source/Core/DolphinWX/Src/InputConfigDiag.h +++ b/Source/Core/DolphinWX/Src/InputConfigDiag.h @@ -112,6 +112,7 @@ public: private: GamepadPage* const m_parent; wxStaticText* m_bound_label; + wxStaticText* m_error_label; DeviceQualifier m_devq; bool GetExpressionForSelectedControl(wxString &expr); }; diff --git a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp index f0870a18a4..d2982bba24 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp @@ -228,9 +228,7 @@ void ControllerInterface::UpdateReference(ControllerInterface::ControlReference* ref->parsed_expression = NULL; ControlFinder finder(*this, default_device, ref->is_input); - ExpressionParseStatus status; - status = ParseExpression(ref->expression, finder, &ref->parsed_expression); - // XXX: do something with status? + ref->parse_error = ParseExpression(ref->expression, finder, &ref->parsed_expression); } // diff --git a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h index 711f393894..00b4b2c07d 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h +++ b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h @@ -64,6 +64,7 @@ public: ControlState range; std::string expression; const bool is_input; + ciface::ExpressionParser::ExpressionParseStatus parse_error; virtual ~ControlReference() { delete parsed_expression;