From 334e33d4fa65b0efc25b7b250f0cf4f9e8891bda Mon Sep 17 00:00:00 2001 From: aldelaro5 Date: Fri, 27 Jan 2017 00:05:09 -0500 Subject: [PATCH] InputConfigDialog pass the device_cbox to the wiimote extension dialogs This fixes a crash when trying to open the advanced input config dialog on the wiimote extensions. The device_cbox wasn't initialised and it should have been with the wiimote one. --- .../Core/DolphinWX/Input/ClassicInputConfigDiag.cpp | 6 +++++- .../Core/DolphinWX/Input/ClassicInputConfigDiag.h | 4 +++- .../Core/DolphinWX/Input/DrumsInputConfigDiag.cpp | 5 ++++- Source/Core/DolphinWX/Input/DrumsInputConfigDiag.h | 4 +++- .../Core/DolphinWX/Input/GuitarInputConfigDiag.cpp | 5 ++++- Source/Core/DolphinWX/Input/GuitarInputConfigDiag.h | 4 +++- Source/Core/DolphinWX/Input/InputConfigDiag.cpp | 13 ++++++++----- .../Core/DolphinWX/Input/NunchukInputConfigDiag.cpp | 6 +++++- .../Core/DolphinWX/Input/NunchukInputConfigDiag.h | 4 +++- .../DolphinWX/Input/TurntableInputConfigDiag.cpp | 6 +++++- .../Core/DolphinWX/Input/TurntableInputConfigDiag.h | 4 +++- 11 files changed, 46 insertions(+), 15 deletions(-) diff --git a/Source/Core/DolphinWX/Input/ClassicInputConfigDiag.cpp b/Source/Core/DolphinWX/Input/ClassicInputConfigDiag.cpp index 205bd83952..f3a6bfb0fa 100644 --- a/Source/Core/DolphinWX/Input/ClassicInputConfigDiag.cpp +++ b/Source/Core/DolphinWX/Input/ClassicInputConfigDiag.cpp @@ -8,11 +8,15 @@ #include "Core/HW/WiimoteEmu/WiimoteEmu.h" ClassicInputConfigDialog::ClassicInputConfigDialog(wxWindow* const parent, InputConfig& config, - const wxString& name, const int port_num) + const wxString& name, + wxComboBox* device_cbox_parent, + const int port_num) : InputConfigDialog(parent, config, name, port_num) { const int space5 = FromDIP(5); + device_cbox = device_cbox_parent; + auto* const group_box_buttons = new ControlGroupBox( Wiimote::GetClassicGroup(port_num, WiimoteEmu::ClassicGroup::Buttons), this, this); auto* const group_box_dpad = new ControlGroupBox( diff --git a/Source/Core/DolphinWX/Input/ClassicInputConfigDiag.h b/Source/Core/DolphinWX/Input/ClassicInputConfigDiag.h index 46ddb59e4c..bc556d8399 100644 --- a/Source/Core/DolphinWX/Input/ClassicInputConfigDiag.h +++ b/Source/Core/DolphinWX/Input/ClassicInputConfigDiag.h @@ -6,9 +6,11 @@ #include "DolphinWX/Input/InputConfigDiag.h" +class wxComboBox; + class ClassicInputConfigDialog final : public InputConfigDialog { public: ClassicInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name, - int port_num = 0); + wxComboBox* device_cbox_parent, int port_num = 0); }; diff --git a/Source/Core/DolphinWX/Input/DrumsInputConfigDiag.cpp b/Source/Core/DolphinWX/Input/DrumsInputConfigDiag.cpp index 8acca90c97..37cc668361 100644 --- a/Source/Core/DolphinWX/Input/DrumsInputConfigDiag.cpp +++ b/Source/Core/DolphinWX/Input/DrumsInputConfigDiag.cpp @@ -8,11 +8,14 @@ #include "Core/HW/WiimoteEmu/WiimoteEmu.h" DrumsInputConfigDialog::DrumsInputConfigDialog(wxWindow* const parent, InputConfig& config, - const wxString& name, const int port_num) + const wxString& name, wxComboBox* device_cbox_parent, + const int port_num) : InputConfigDialog(parent, config, name, port_num) { const int space5 = FromDIP(5); + device_cbox = device_cbox_parent; + auto* const group_box_buttons = new ControlGroupBox( Wiimote::GetDrumsGroup(port_num, WiimoteEmu::DrumsGroup::Buttons), this, this); auto* const group_box_pads = new ControlGroupBox( diff --git a/Source/Core/DolphinWX/Input/DrumsInputConfigDiag.h b/Source/Core/DolphinWX/Input/DrumsInputConfigDiag.h index a254e586e0..5a6287380e 100644 --- a/Source/Core/DolphinWX/Input/DrumsInputConfigDiag.h +++ b/Source/Core/DolphinWX/Input/DrumsInputConfigDiag.h @@ -6,9 +6,11 @@ #include "DolphinWX/Input/InputConfigDiag.h" +class wxComboBox; + class DrumsInputConfigDialog final : public InputConfigDialog { public: DrumsInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name, - int port_num = 0); + wxComboBox* device_cbox_parent, int port_num = 0); }; diff --git a/Source/Core/DolphinWX/Input/GuitarInputConfigDiag.cpp b/Source/Core/DolphinWX/Input/GuitarInputConfigDiag.cpp index 24c8ff2f15..aee2f5dedf 100644 --- a/Source/Core/DolphinWX/Input/GuitarInputConfigDiag.cpp +++ b/Source/Core/DolphinWX/Input/GuitarInputConfigDiag.cpp @@ -8,11 +8,14 @@ #include "Core/HW/WiimoteEmu/WiimoteEmu.h" GuitarInputConfigDialog::GuitarInputConfigDialog(wxWindow* const parent, InputConfig& config, - const wxString& name, const int port_num) + const wxString& name, + wxComboBox* device_cbox_parent, const int port_num) : InputConfigDialog(parent, config, name, port_num) { const int space5 = FromDIP(5); + device_cbox = device_cbox_parent; + auto* const group_box_buttons = new ControlGroupBox( Wiimote::GetGuitarGroup(port_num, WiimoteEmu::GuitarGroup::Buttons), this, this); auto* const group_left_strum = new ControlGroupBox( diff --git a/Source/Core/DolphinWX/Input/GuitarInputConfigDiag.h b/Source/Core/DolphinWX/Input/GuitarInputConfigDiag.h index f5e780e723..7a7ddc442b 100644 --- a/Source/Core/DolphinWX/Input/GuitarInputConfigDiag.h +++ b/Source/Core/DolphinWX/Input/GuitarInputConfigDiag.h @@ -6,9 +6,11 @@ #include "DolphinWX/Input/InputConfigDiag.h" +class wxComboBox; + class GuitarInputConfigDialog final : public InputConfigDialog { public: GuitarInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name, - int port_num = 0); + wxComboBox* device_cbox_parent, int port_num = 0); }; diff --git a/Source/Core/DolphinWX/Input/InputConfigDiag.cpp b/Source/Core/DolphinWX/Input/InputConfigDiag.cpp index ed71fd1b3f..9170eca3da 100644 --- a/Source/Core/DolphinWX/Input/InputConfigDiag.cpp +++ b/Source/Core/DolphinWX/Input/InputConfigDiag.cpp @@ -71,31 +71,34 @@ void InputConfigDialog::ConfigExtension(wxCommandEvent& event) { case WiimoteEmu::EXT_NUNCHUK: { - NunchukInputConfigDialog dlg(this, m_config, _("Nunchuk Configuration"), m_port_num); + NunchukInputConfigDialog dlg(this, m_config, _("Nunchuk Configuration"), device_cbox, + m_port_num); dlg.ShowModal(); } break; case WiimoteEmu::EXT_CLASSIC: { - ClassicInputConfigDialog dlg(this, m_config, _("Classic Controller Configuration"), m_port_num); + ClassicInputConfigDialog dlg(this, m_config, _("Classic Controller Configuration"), device_cbox, + m_port_num); dlg.ShowModal(); } break; case WiimoteEmu::EXT_GUITAR: { - GuitarInputConfigDialog dlg(this, m_config, _("Guitar Configuration"), m_port_num); + GuitarInputConfigDialog dlg(this, m_config, _("Guitar Configuration"), device_cbox, m_port_num); dlg.ShowModal(); } break; case WiimoteEmu::EXT_DRUMS: { - DrumsInputConfigDialog dlg(this, m_config, _("Drums Configuration"), m_port_num); + DrumsInputConfigDialog dlg(this, m_config, _("Drums Configuration"), device_cbox, m_port_num); dlg.ShowModal(); } break; case WiimoteEmu::EXT_TURNTABLE: { - TurntableInputConfigDialog dlg(this, m_config, _("Turntable Configuration"), m_port_num); + TurntableInputConfigDialog dlg(this, m_config, _("Turntable Configuration"), device_cbox, + m_port_num); dlg.ShowModal(); } break; diff --git a/Source/Core/DolphinWX/Input/NunchukInputConfigDiag.cpp b/Source/Core/DolphinWX/Input/NunchukInputConfigDiag.cpp index d75d0bd8b2..e93128e70b 100644 --- a/Source/Core/DolphinWX/Input/NunchukInputConfigDiag.cpp +++ b/Source/Core/DolphinWX/Input/NunchukInputConfigDiag.cpp @@ -8,11 +8,15 @@ #include "Core/HW/WiimoteEmu/WiimoteEmu.h" NunchukInputConfigDialog::NunchukInputConfigDialog(wxWindow* const parent, InputConfig& config, - const wxString& name, const int port_num) + const wxString& name, + wxComboBox* device_cbox_parent, + const int port_num) : InputConfigDialog(parent, config, name, port_num) { const int space5 = FromDIP(5); + device_cbox = device_cbox_parent; + auto* const group_box_buttons = new ControlGroupBox( Wiimote::GetNunchukGroup(port_num, WiimoteEmu::NunchukGroup::Buttons), this, this); auto* const group_box_shake = new ControlGroupBox( diff --git a/Source/Core/DolphinWX/Input/NunchukInputConfigDiag.h b/Source/Core/DolphinWX/Input/NunchukInputConfigDiag.h index a3fd64a045..54754db078 100644 --- a/Source/Core/DolphinWX/Input/NunchukInputConfigDiag.h +++ b/Source/Core/DolphinWX/Input/NunchukInputConfigDiag.h @@ -6,9 +6,11 @@ #include "DolphinWX/Input/InputConfigDiag.h" +class wxComboBox; + class NunchukInputConfigDialog final : public InputConfigDialog { public: NunchukInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name, - int port_num = 0); + wxComboBox* device_cbox_parent, int port_num = 0); }; diff --git a/Source/Core/DolphinWX/Input/TurntableInputConfigDiag.cpp b/Source/Core/DolphinWX/Input/TurntableInputConfigDiag.cpp index bc5b627d6c..6f2728525d 100644 --- a/Source/Core/DolphinWX/Input/TurntableInputConfigDiag.cpp +++ b/Source/Core/DolphinWX/Input/TurntableInputConfigDiag.cpp @@ -8,11 +8,15 @@ #include "Core/HW/WiimoteEmu/WiimoteEmu.h" TurntableInputConfigDialog::TurntableInputConfigDialog(wxWindow* const parent, InputConfig& config, - const wxString& name, const int port_num) + const wxString& name, + wxComboBox* device_cbox_parent, + const int port_num) : InputConfigDialog(parent, config, name, port_num) { const int space5 = FromDIP(5); + device_cbox = device_cbox_parent; + auto* const group_box_stick = new ControlGroupBox( Wiimote::GetTurntableGroup(port_num, WiimoteEmu::TurntableGroup::Stick), this, this); auto* const group_box_effect_dial = new ControlGroupBox( diff --git a/Source/Core/DolphinWX/Input/TurntableInputConfigDiag.h b/Source/Core/DolphinWX/Input/TurntableInputConfigDiag.h index 305be6c96f..760ad6562a 100644 --- a/Source/Core/DolphinWX/Input/TurntableInputConfigDiag.h +++ b/Source/Core/DolphinWX/Input/TurntableInputConfigDiag.h @@ -6,9 +6,11 @@ #include "DolphinWX/Input/InputConfigDiag.h" +class wxComboBox; + class TurntableInputConfigDialog final : public InputConfigDialog { public: TurntableInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name, - int port_num = 0); + wxComboBox* device_cbox_parent, int port_num = 0); };