summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2014-12-01 04:19:44 -0500
committerLioncash <mathew1800@gmail.com>2014-12-01 04:19:44 -0500
commit3210a942ecc479f8d1fd6f45ee72a6e53396ed08 (patch)
treea7fd3ec48029cf3180036337f1c445ef858398bf /Source/Core
parent6df67bf38f52151ee5efb64edb4bc60ecce601ef (diff)
parent21d039059eed7dbd23dadb7080fbf0ff1cd14a91 (diff)
Merge pull request #1587 from lioncash/input-move
Unify the controller configuration dialogs.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinWX/CMakeLists.txt2
-rw-r--r--Source/Core/DolphinWX/ConfigMain.cpp114
-rw-r--r--Source/Core/DolphinWX/ConfigMain.h8
-rw-r--r--Source/Core/DolphinWX/ControllerConfigDiag.cpp496
-rw-r--r--Source/Core/DolphinWX/ControllerConfigDiag.h (renamed from Source/Core/DolphinWX/WiimoteConfigDiag.h)18
-rw-r--r--Source/Core/DolphinWX/DolphinWX.vcxproj12
-rw-r--r--Source/Core/DolphinWX/DolphinWX.vcxproj.filters14
-rw-r--r--Source/Core/DolphinWX/Frame.cpp3
-rw-r--r--Source/Core/DolphinWX/Frame.h6
-rw-r--r--Source/Core/DolphinWX/FrameTools.cpp88
-rw-r--r--Source/Core/DolphinWX/Globals.h3
-rw-r--r--Source/Core/DolphinWX/WiimoteConfigDiag.cpp292
12 files changed, 547 insertions, 509 deletions
diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt
index 495299ecc0..cdc503b8fc 100644
--- a/Source/Core/DolphinWX/CMakeLists.txt
+++ b/Source/Core/DolphinWX/CMakeLists.txt
@@ -2,6 +2,7 @@ set(GUI_SRCS
ARCodeAddEdit.cpp
AboutDolphin.cpp
ConfigMain.cpp
+ ControllerConfigDiag.cpp
Cheats/CheatSearchTab.cpp
Cheats/CheatsWindow.cpp
Cheats/CreateCodeDialog.cpp
@@ -45,7 +46,6 @@ set(GUI_SRCS
TASInputDlg.cpp
VideoConfigDiag.cpp
WXInputBase.cpp
- WiimoteConfigDiag.cpp
WxUtils.cpp)
set(NOGUI_SRCS MainNoGUI.cpp)
diff --git a/Source/Core/DolphinWX/ConfigMain.cpp b/Source/Core/DolphinWX/ConfigMain.cpp
index 96c29f2d87..d213a7cbda 100644
--- a/Source/Core/DolphinWX/ConfigMain.cpp
+++ b/Source/Core/DolphinWX/ConfigMain.cpp
@@ -107,13 +107,6 @@ static const wxLanguage langIds[] =
#define DEV_NONE_STR _trans("<Nothing>")
#define DEV_DUMMY_STR _trans("Dummy")
-#define SIDEV_STDCONT_STR _trans("Standard Controller")
-#define SIDEV_STEERING_STR _trans("Steering Wheel")
-#define SIDEV_DANCEMAT_STR _trans("Dance Mat")
-#define SIDEV_BONGO_STR _trans("TaruKonga (Bongos)")
-#define SIDEV_GBA_STR "GBA"
-#define SIDEV_AM_BB_STR _trans("AM-Baseboard")
-
#define EXIDEV_MEMCARD_STR _trans("Memory Card")
#define EXIDEV_MEMDIR_STR _trans("GCI Folder")
#define EXIDEV_MIC_STR _trans("Mic")
@@ -165,11 +158,6 @@ EVT_BUTTON(ID_GC_EXIDEVICE_SLOTA_PATH, CConfigMain::GCSettingsChanged)
EVT_CHOICE(ID_GC_EXIDEVICE_SLOTB, CConfigMain::GCSettingsChanged)
EVT_BUTTON(ID_GC_EXIDEVICE_SLOTB_PATH, CConfigMain::GCSettingsChanged)
EVT_CHOICE(ID_GC_EXIDEVICE_SP1, CConfigMain::GCSettingsChanged)
-EVT_CHOICE(ID_GC_SIDEVICE0, CConfigMain::GCSettingsChanged)
-EVT_CHOICE(ID_GC_SIDEVICE1, CConfigMain::GCSettingsChanged)
-EVT_CHOICE(ID_GC_SIDEVICE2, CConfigMain::GCSettingsChanged)
-EVT_CHOICE(ID_GC_SIDEVICE3, CConfigMain::GCSettingsChanged)
-
EVT_CHECKBOX(ID_WII_IPL_SSV, CConfigMain::WiiSettingsChanged)
EVT_CHECKBOX(ID_WII_IPL_E60, CConfigMain::WiiSettingsChanged)
@@ -404,14 +392,6 @@ void CConfigMain::InitializeGUIValues()
SP1Devices.Add(_(EXIDEV_BBA_STR));
SP1Devices.Add(_(EXIDEV_AM_BB_STR));
- wxArrayString SIDevices;
- SIDevices.Add(_(DEV_NONE_STR));
- SIDevices.Add(_(SIDEV_STDCONT_STR));
- SIDevices.Add(_(SIDEV_STEERING_STR));
- SIDevices.Add(_(SIDEV_DANCEMAT_STR));
- SIDevices.Add(_(SIDEV_BONGO_STR));
- SIDevices.Add(_(SIDEV_GBA_STR));
- SIDevices.Add(_(SIDEV_AM_BB_STR));
for (int i = 0; i < 3; ++i)
{
@@ -454,39 +434,6 @@ void CConfigMain::InitializeGUIValues()
if (!isMemcard && i < 2)
GCMemcardPath[i]->Disable();
}
- for (int i = 0; i < 4; ++i)
- {
- // Add string to the wxChoice list
- GCSIDevice[i]->Append(SIDevices);
-
- switch (SConfig::GetInstance().m_SIDevice[i])
- {
- case SIDEVICE_GC_CONTROLLER:
- GCSIDevice[i]->SetStringSelection(SIDevices[1]);
- break;
- case SIDEVICE_GC_STEERING:
- GCSIDevice[i]->SetStringSelection(SIDevices[2]);
- break;
- case SIDEVICE_DANCEMAT:
- GCSIDevice[i]->SetStringSelection(SIDevices[3]);
- break;
- case SIDEVICE_GC_TARUKONGA:
- GCSIDevice[i]->SetStringSelection(SIDevices[4]);
- break;
- case SIDEVICE_GC_GBA:
- GCSIDevice[i]->SetStringSelection(SIDevices[5]);
- break;
- case SIDEVICE_AM_BASEBOARD:
- GCSIDevice[i]->SetStringSelection(SIDevices[6]);
- break;
- default:
- GCSIDevice[i]->SetStringSelection(SIDevices[0]);
- break;
- }
- // Remove the AM baseboard from the list, only the first list can select it
- if (i == 0)
- SIDevices.RemoveAt(SIDevices.GetCount() - 1);
- }
// Wii - Misc
WiiScreenSaver->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.SSV"));
@@ -729,17 +676,6 @@ void CConfigMain::CreateGUIControls()
GCMemcardPath[1] = new wxButton(GamecubePage, ID_GC_EXIDEVICE_SLOTB_PATH, "...",
wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
- //SI Devices
- wxStaticText* GCSIDeviceText[4];
- GCSIDeviceText[0] = TEXT_BOX(GamecubePage, _("Port 1"));
- GCSIDeviceText[1] = TEXT_BOX(GamecubePage, _("Port 2"));
- GCSIDeviceText[2] = TEXT_BOX(GamecubePage, _("Port 3"));
- GCSIDeviceText[3] = TEXT_BOX(GamecubePage, _("Port 4"));
- GCSIDevice[0] = new wxChoice(GamecubePage, ID_GC_SIDEVICE0);
- GCSIDevice[1] = new wxChoice(GamecubePage, ID_GC_SIDEVICE1);
- GCSIDevice[2] = new wxChoice(GamecubePage, ID_GC_SIDEVICE2);
- GCSIDevice[3] = new wxChoice(GamecubePage, ID_GC_SIDEVICE3);
-
// Populate the GameCube page
sGamecubeIPLSettings = new wxGridBagSizer();
sGamecubeIPLSettings->Add(GCAlwaysHLE_BS2, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
@@ -761,24 +697,11 @@ void CConfigMain::CreateGUIControls()
}
sbGamecubeDeviceSettings->Add(sbGamecubeEXIDevSettings, 0, wxALL, 5);
- wxFlexGridSizer* sbGamecubeDevSettings = new wxFlexGridSizer(2, 10, 10);
- for (int i = 0; i < 4; ++i)
- {
- sbGamecubeDevSettings->Add(GCSIDeviceText[i], 1, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 0);
- sbGamecubeDevSettings->Add(GCSIDevice[i], 1, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 0);
- if (NetPlay::IsNetPlayRunning() || Movie::IsMovieActive())
- {
- GCSIDevice[i]->Disable();
- }
- }
- sbGamecubeDeviceSettings->Add(sbGamecubeDevSettings, 0, wxALL, 5);
-
sGamecubePage = new wxBoxSizer(wxVERTICAL);
sGamecubePage->Add(sbGamecubeIPLSettings, 0, wxEXPAND|wxALL, 5);
sGamecubePage->Add(sbGamecubeDeviceSettings, 0, wxEXPAND|wxALL, 5);
GamecubePage->SetSizer(sGamecubePage);
-
// Wii page
// Misc Settings
WiiScreenSaver = new wxCheckBox(WiiPage, ID_WII_IPL_SSV, _("Enable Screen Saver"));
@@ -1026,7 +949,6 @@ bool CConfigMain::SupportsVolumeChanges(std::string backend)
// -----------------------
void CConfigMain::GCSettingsChanged(wxCommandEvent& event)
{
- int sidevice = 0;
int exidevice = 0;
switch (event.GetId())
{
@@ -1053,15 +975,6 @@ void CConfigMain::GCSettingsChanged(wxCommandEvent& event)
case ID_GC_EXIDEVICE_SLOTB_PATH:
ChooseMemcardPath(SConfig::GetInstance().m_strMemoryCardB, false);
break;
- case ID_GC_SIDEVICE3:
- sidevice++;
- case ID_GC_SIDEVICE2:
- sidevice++;
- case ID_GC_SIDEVICE1:
- sidevice++;
- case ID_GC_SIDEVICE0:
- ChooseSIDevice(event.GetString(), sidevice);
- break;
}
}
@@ -1123,33 +1036,6 @@ void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
}
}
-void CConfigMain::ChooseSIDevice(wxString deviceName, int deviceNum)
-{
- SIDevices tempType;
- if (!deviceName.compare(_(SIDEV_STDCONT_STR)))
- tempType = SIDEVICE_GC_CONTROLLER;
- else if (!deviceName.compare(_(SIDEV_STEERING_STR)))
- tempType = SIDEVICE_GC_STEERING;
- else if (!deviceName.compare(_(SIDEV_DANCEMAT_STR)))
- tempType = SIDEVICE_DANCEMAT;
- else if (!deviceName.compare(_(SIDEV_BONGO_STR)))
- tempType = SIDEVICE_GC_TARUKONGA;
- else if (!deviceName.compare(SIDEV_GBA_STR))
- tempType = SIDEVICE_GC_GBA;
- else if (!deviceName.compare(_(SIDEV_AM_BB_STR)))
- tempType = SIDEVICE_AM_BASEBOARD;
- else
- tempType = SIDEVICE_NONE;
-
- SConfig::GetInstance().m_SIDevice[deviceNum] = tempType;
-
- if (Core::IsRunning())
- {
- // Change plugged device! :D
- SerialInterface::ChangeDevice(tempType, deviceNum);
- }
-}
-
void CConfigMain::ChooseEXIDevice(wxString deviceName, int deviceNum)
{
TEXIDevices tempType;
diff --git a/Source/Core/DolphinWX/ConfigMain.h b/Source/Core/DolphinWX/ConfigMain.h
index bf447b0ace..16341dedce 100644
--- a/Source/Core/DolphinWX/ConfigMain.h
+++ b/Source/Core/DolphinWX/ConfigMain.h
@@ -108,11 +108,6 @@ private:
ID_GC_EXIDEVICE_SLOTB,
ID_GC_EXIDEVICE_SLOTB_PATH,
ID_GC_EXIDEVICE_SP1,
- ID_GC_SIDEVICE0,
- ID_GC_SIDEVICE1,
- ID_GC_SIDEVICE2,
- ID_GC_SIDEVICE3,
-
ID_WII_IPL_SSV,
ID_WII_IPL_E60,
@@ -186,8 +181,6 @@ private:
// Device
wxChoice* GCEXIDevice[3];
wxButton* GCMemcardPath[2];
- wxChoice* GCSIDevice[4];
-
wxBoxSizer* sWiiPage; // Wii settings
wxStaticBoxSizer* /*sbWiimoteSettings, **/sbWiiIPLSettings, *sbWiiDeviceSettings; // Wiimote, Misc and Device sections
@@ -257,7 +250,6 @@ private:
void GCSettingsChanged(wxCommandEvent& event);
void ChooseMemcardPath(std::string& strMemcard, bool isSlotA);
- void ChooseSIDevice(wxString deviceName, int deviceNum);
void ChooseEXIDevice(wxString deviceName, int deviceNum);
void WiiSettingsChanged(wxCommandEvent& event);
diff --git a/Source/Core/DolphinWX/ControllerConfigDiag.cpp b/Source/Core/DolphinWX/ControllerConfigDiag.cpp
new file mode 100644
index 0000000000..bca01cc339
--- /dev/null
+++ b/Source/Core/DolphinWX/ControllerConfigDiag.cpp
@@ -0,0 +1,496 @@
+#include <array>
+#include <map>
+#include <string>
+#include <utility>
+#include <wx/button.h>
+#include <wx/checkbox.h>
+#include <wx/choice.h>
+#include <wx/defs.h>
+#include <wx/dialog.h>
+#include <wx/event.h>
+#include <wx/gdicmn.h>
+#include <wx/sizer.h>
+#include <wx/slider.h>
+#include <wx/stattext.h>
+#include <wx/string.h>
+#include <wx/translation.h>
+#include <wx/window.h>
+#include <wx/windowid.h>
+
+#include "Common/CommonTypes.h"
+#include "Common/FileUtil.h"
+#include "Common/IniFile.h"
+#include "Common/SysConf.h"
+#include "Core/ConfigManager.h"
+#include "Core/Core.h"
+#include "Core/Movie.h"
+#include "Core/NetPlayProto.h"
+#include "Core/HW/GCPad.h"
+#include "Core/HW/SI.h"
+#include "Core/HW/Wiimote.h"
+#include "Core/HW/WiimoteReal/WiimoteReal.h"
+#include "DolphinWX/ControllerConfigDiag.h"
+#include "DolphinWX/InputConfigDiag.h"
+
+#if defined(HAVE_XRANDR) && HAVE_XRANDR
+#include "DolphinWX/X11Utils.h"
+#endif
+
+const std::array<wxString, 7> ControllerConfigDiag::m_gc_pad_type_strs = {{
+ _("None"),
+ _("Standard Controller"),
+ _("Steering Wheel"),
+ _("Dance Mat"),
+ _("TaruKonga (Bongos)"),
+ _("GBA"),
+ _("AM-Baseboard")
+}};
+
+ControllerConfigDiag::ControllerConfigDiag(wxWindow* const parent)
+ : wxDialog(parent, -1, _("Dolphin Controller Configuration"))
+{
+ wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);
+
+ // Combine all UI controls into their own encompassing sizer.
+ wxBoxSizer* control_sizer = new wxBoxSizer(wxVERTICAL);
+ control_sizer->Add(CreateGamecubeSizer(), 0, wxEXPAND | wxALL, 5);
+ control_sizer->Add(CreateWiimoteConfigSizer(), 0, wxEXPAND | wxALL, 5);
+
+ main_sizer->Add(control_sizer, 0, wxEXPAND);
+ main_sizer->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
+
+ Bind(wxEVT_BUTTON, &ControllerConfigDiag::Save, this, wxID_OK);
+ Bind(wxEVT_BUTTON, &ControllerConfigDiag::Cancel, this, wxID_CANCEL);
+
+ SetSizerAndFit(main_sizer);
+ Center();
+}
+
+wxStaticBoxSizer* ControllerConfigDiag::CreateGamecubeSizer()
+{
+ wxStaticBoxSizer* const gamecube_static_sizer = new wxStaticBoxSizer(wxHORIZONTAL, this, _("GameCube Controllers"));
+ wxFlexGridSizer* const gamecube_flex_sizer = new wxFlexGridSizer(3, 5, 5);
+
+ wxStaticText* pad_labels[4];
+ wxChoice* pad_type_choices[4];
+ wxButton* config_buttons[4];
+
+ for (int i = 0; i < 4; i++)
+ {
+ pad_labels[i] = new wxStaticText(this, wxID_ANY, wxString::Format(_("Port %i"), i + 1));
+
+ // Create an ID for the config button.
+ const wxWindowID button_id = wxWindow::NewControlId();
+ m_gc_port_config_ids.insert(std::make_pair(button_id, i));
+ config_buttons[i] = new wxButton(this, button_id, _("Configure"), wxDefaultPosition, wxSize(100, 25));
+ config_buttons[i]->Bind(wxEVT_BUTTON, &ControllerConfigDiag::OnGameCubeConfigButton, this);
+
+ // Create a control ID for the choice boxes on the fly.
+ const wxWindowID choice_id = wxWindow::NewControlId();
+ m_gc_port_choice_ids.insert(std::make_pair(choice_id, i));
+
+ // Only add AM-Baseboard to the first pad.
+ if (i == 0)
+ pad_type_choices[i] = new wxChoice(this, choice_id, wxDefaultPosition, wxDefaultSize, m_gc_pad_type_strs.size(), m_gc_pad_type_strs.data());
+ else
+ pad_type_choices[i] = new wxChoice(this, choice_id, wxDefaultPosition, wxDefaultSize, m_gc_pad_type_strs.size() - 1, m_gc_pad_type_strs.data());
+
+ pad_type_choices[i]->Bind(wxEVT_CHOICE, &ControllerConfigDiag::OnGameCubePortChanged, this);
+
+ // Disable controller type selection for certain circumstances.
+ if (NetPlay::IsNetPlayRunning() || Movie::IsMovieActive())
+ pad_type_choices[i]->Disable();
+
+ // Set the saved pad type as the default choice.
+ switch (SConfig::GetInstance().m_SIDevice[i])
+ {
+ case SIDEVICE_GC_CONTROLLER:
+ pad_type_choices[i]->SetStringSelection(m_gc_pad_type_strs[1]);
+ break;
+ case SIDEVICE_GC_STEERING:
+ pad_type_choices[i]->SetStringSelection(m_gc_pad_type_strs[2]);
+ break;
+ case SIDEVICE_DANCEMAT:
+ pad_type_choices[i]->SetStringSelection(m_gc_pad_type_strs[3]);
+ break;
+ case SIDEVICE_GC_TARUKONGA:
+ pad_type_choices[i]->SetStringSelection(m_gc_pad_type_strs[4]);
+ break;
+ case SIDEVICE_GC_GBA:
+ pad_type_choices[i]->SetStringSelection(m_gc_pad_type_strs[5]);
+ break;
+ case SIDEVICE_AM_BASEBOARD:
+ pad_type_choices[i]->SetStringSelection(m_gc_pad_type_strs[6]);
+ break;
+ default:
+ pad_type_choices[i]->SetStringSelection(m_gc_pad_type_strs[0]);
+ break;
+ }
+
+ // Add to the sizer
+ gamecube_flex_sizer->Add(pad_labels[i], 0, wxALIGN_CENTER_VERTICAL);
+ gamecube_flex_sizer->Add(pad_type_choices[i], 0, wxALIGN_CENTER_VERTICAL);
+ gamecube_flex_sizer->Add(config_buttons[i], 1, wxEXPAND);
+ }
+
+ gamecube_static_sizer->Add(gamecube_flex_sizer, 1, wxEXPAND, 5);
+ return gamecube_static_sizer;
+}
+
+wxStaticBoxSizer* ControllerConfigDiag::CreateWiimoteConfigSizer()
+{
+ wxStaticText* wiimote_label[4];
+ wxChoice* wiimote_source_ch[4];
+
+ for (unsigned int i = 0; i < MAX_WIIMOTES; ++i)
+ {
+ wxString wiimote_str = wxString::Format(_("Wiimote %i"), i + 1);
+
+ static const std::array<wxString, 4> src_choices = {{
+ _("None"), _("Emulated Wiimote"), _("Real Wiimote"), _("Hybrid Wiimote")
+ }};
+
+ // reserve four ids, so that we can calculate the index from the ids later on
+ // Stupid wx 2.8 doesn't support reserving sequential IDs, so we need to do that more complicated..
+ int source_ctrl_id = wxWindow::NewControlId();
+ m_wiimote_index_from_ctrl_id.insert(std::pair<wxWindowID, unsigned int>(source_ctrl_id, i));
+
+ int config_bt_id = wxWindow::NewControlId();
+ m_wiimote_index_from_conf_bt_id.insert(std::pair<wxWindowID, unsigned int>(config_bt_id, i));
+
+ wiimote_label[i] = new wxStaticText(this, wxID_ANY, wiimote_str);
+ wiimote_source_ch[i] = new wxChoice(this, source_ctrl_id, wxDefaultPosition, wxDefaultSize, src_choices.size(), src_choices.data());
+ wiimote_source_ch[i]->Bind(wxEVT_CHOICE, &ControllerConfigDiag::SelectSource, this);
+ wiimote_configure_bt[i] = new wxButton(this, config_bt_id, _("Configure"));
+ wiimote_configure_bt[i]->Bind(wxEVT_BUTTON, &ControllerConfigDiag::ConfigEmulatedWiimote, this);
+
+ // Disable controller type selection for certain circumstances.
+ if (NetPlay::IsNetPlayRunning() || Movie::IsMovieActive())
+ wiimote_source_ch[i]->Disable();
+
+ m_orig_wiimote_sources[i] = g_wiimote_sources[i];
+ wiimote_source_ch[i]->Select(m_orig_wiimote_sources[i]);
+ if (m_orig_wiimote_sources[i] != WIIMOTE_SRC_EMU && m_orig_wiimote_sources[i] != WIIMOTE_SRC_HYBRID)
+ wiimote_configure_bt[i]->Disable();
+ }
+
+ // "Wiimotes" layout
+ wxStaticBoxSizer* const wiimote_group = new wxStaticBoxSizer(wxVERTICAL,this, _("Wiimotes"));
+ wxBoxSizer* const wiimote_control_section = new wxBoxSizer(wxHORIZONTAL);
+ wxFlexGridSizer* const wiimote_sizer = new wxFlexGridSizer(3, 5, 5);
+ for (unsigned int i = 0; i < 4; ++i)
+ {
+ wiimote_sizer->Add(wiimote_label[i], 0, wxALIGN_CENTER_VERTICAL);
+ wiimote_sizer->Add(wiimote_source_ch[i], 0, wxALIGN_CENTER_VERTICAL);
+ wiimote_sizer->Add(wiimote_configure_bt[i]);
+ }
+ wiimote_control_section->Add(wiimote_sizer, 1, wxEXPAND, 5 );
+
+ // Disable some controls when emulation is running
+ if (Core::GetState() != Core::CORE_UNINITIALIZED && NetPlay::IsNetPlayRunning())
+ {
+ for (int i = 0; i < 4; ++i)
+ {
+ wiimote_label[i]->Disable();
+ wiimote_source_ch[i]->Disable();
+ }
+ }
+
+ wiimote_group->Add(wiimote_control_section, 0, wxEXPAND | wxALL);
+ wiimote_group->AddSpacer(5);
+ wiimote_group->Add(CreateBalanceBoardSizer(), 0, wxEXPAND | wxALL);
+ wiimote_group->AddSpacer(5);
+ wiimote_group->Add(CreateRealWiimoteSizer(), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM);
+ wiimote_group->AddSpacer(5);
+ wiimote_group->Add(CreateGeneralWiimoteSettingsSizer(), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM);
+
+ return wiimote_group;
+}
+
+wxStaticBoxSizer* ControllerConfigDiag::CreateBalanceBoardSizer()
+{
+ wxStaticBoxSizer* const bb_group = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Balance Board"));
+ wxFlexGridSizer* const bb_sizer = new wxFlexGridSizer(1, 5, 5);
+ int source_ctrl_id = wxWindow::NewControlId();
+
+ m_wiimote_index_from_ctrl_id.insert(std::pair<wxWindowID, unsigned int>(source_ctrl_id, WIIMOTE_BALANCE_BOARD));
+
+ static const std::array<wxString, 2> src_choices = {{
+ ("None"), _("Real Balance Board")
+ }};
+
+ wxChoice* const bb_source = new wxChoice(this, source_ctrl_id, wxDefaultPosition, wxDefaultSize, src_choices.size(), src_choices.data());
+ bb_source->Bind(wxEVT_CHOICE, &ControllerConfigDiag::SelectSource, this);
+
+ m_orig_wiimote_sources[WIIMOTE_BALANCE_BOARD] = g_wiimote_sources[WIIMOTE_BALANCE_BOARD];
+ bb_source->Select(m_orig_wiimote_sources[WIIMOTE_BALANCE_BOARD] ? 1 : 0);
+
+ bb_sizer->Add(bb_source, 0, wxALIGN_CENTER_VERTICAL);
+
+ bb_group->Add(bb_sizer, 1, wxEXPAND, 5);
+
+ // Disable when emulation is running.
+ if (Core::GetState() != Core::CORE_UNINITIALIZED)
+ bb_source->Disable();
+
+ return bb_group;
+}
+
+wxStaticBoxSizer* ControllerConfigDiag::CreateRealWiimoteSizer()
+{
+ // "Real wiimotes" controls
+ wxButton* const refresh_btn = new wxButton(this, -1, _("Refresh"));
+ refresh_btn->Bind(wxEVT_BUTTON, &ControllerConfigDiag::RefreshRealWiimotes, this);
+
+ wxStaticBoxSizer* const real_wiimotes_group = new wxStaticBoxSizer(wxVERTICAL, this, _("Real Wiimotes"));
+ wxBoxSizer* const real_wiimotes_sizer = new wxBoxSizer(wxHORIZONTAL);
+
+ if (!WiimoteReal::g_wiimote_scanner.IsReady())
+ real_wiimotes_group->Add(new wxStaticText(this, -1, _("A supported bluetooth device could not be found.\n"
+ "You must manually connect your wiimotes.")), 0, wxALIGN_CENTER | wxALL, 5);
+
+ wxCheckBox* const continuous_scanning = new wxCheckBox(this, wxID_ANY, _("Continuous Scanning"));
+ continuous_scanning->Bind(wxEVT_CHECKBOX, &ControllerConfigDiag::OnContinuousScanning, this);
+ continuous_scanning->SetValue(SConfig::GetInstance().m_WiimoteContinuousScanning);
+
+ real_wiimotes_sizer->Add(continuous_scanning, 0, wxALIGN_CENTER_VERTICAL);
+ real_wiimotes_sizer->AddStretchSpacer(1);
+ real_wiimotes_sizer->Add(refresh_btn, 0, wxALL | wxALIGN_CENTER, 5);
+
+ real_wiimotes_group->Add(real_wiimotes_sizer, 0, wxEXPAND);
+
+ return real_wiimotes_group;
+}
+
+wxStaticBoxSizer* ControllerConfigDiag::CreateGeneralWiimoteSettingsSizer()
+{
+ const wxString str[] = { _("Bottom"), _("Top") };
+ wxChoice* const WiiSensBarPos = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 2, str);
+ wxSlider* const WiiSensBarSens = new wxSlider(this, wxID_ANY, 0, 0, 4);
+ wxSlider* const WiimoteSpkVolume = new wxSlider(this, wxID_ANY, 0, 0, 127);
+ wxCheckBox* const WiimoteMotor = new wxCheckBox(this, wxID_ANY, _("Wiimote Motor"));
+
+ auto wiimote_speaker = new wxCheckBox(this, wxID_ANY, _("Enable Speaker Data"));
+ wiimote_speaker->Bind(wxEVT_CHECKBOX, &ControllerConfigDiag::OnEnableSpeaker, this);
+ wiimote_speaker->SetValue(SConfig::GetInstance().m_WiimoteEnableSpeaker);
+
+ wxStaticText* const WiiSensBarPosText = new wxStaticText(this, wxID_ANY, _("Sensor Bar Position:"));
+ wxStaticText* const WiiSensBarSensText = new wxStaticText(this, wxID_ANY, _("IR Sensitivity:"));
+ wxStaticText* const WiiSensBarSensMinText = new wxStaticText(this, wxID_ANY, _("Min"));
+ wxStaticText* const WiiSensBarSensMaxText = new wxStaticText(this, wxID_ANY, _("Max"));
+ wxStaticText* const WiimoteSpkVolumeText = new wxStaticText(this, wxID_ANY, _("Speaker Volume:"));
+ wxStaticText* const WiimoteSpkVolumeMinText = new wxStaticText(this, wxID_ANY, _("Min"));
+ wxStaticText* const WiimoteSpkVolumeMaxText = new wxStaticText(this, wxID_ANY, _("Max"));
+
+ // With some GTK themes, no minimum size will be applied - so do this manually here
+ WiiSensBarSens->SetMinSize(wxSize(100,-1));
+ WiimoteSpkVolume->SetMinSize(wxSize(100,-1));
+
+ // Disable some controls when emulation is running
+ if (Core::GetState() != Core::CORE_UNINITIALIZED)
+ {
+ WiiSensBarPos->Disable();
+ WiiSensBarSens->Disable();
+ WiimoteSpkVolume->Disable();
+ WiimoteMotor->Disable();
+ WiiSensBarPosText->Disable();
+ WiiSensBarSensText->Disable();
+ WiiSensBarSensMinText->Disable();
+ WiiSensBarSensMaxText->Disable();
+ WiimoteSpkVolumeText->Disable();
+ WiimoteSpkVolumeMinText->Disable();
+ WiimoteSpkVolumeMaxText->Disable();
+ }
+
+ // "General Settings" initialization
+ WiiSensBarPos->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("BT.BAR"));
+ WiiSensBarSens->SetValue(SConfig::GetInstance().m_SYSCONF->GetData<u32>("BT.SENS"));
+ WiimoteSpkVolume->SetValue(SConfig::GetInstance().m_SYSCONF->GetData<u8>("BT.SPKV"));
+ WiimoteMotor->SetValue(SConfig::GetInstance().m_SYSCONF->GetData<bool>("BT.MOT"));
+
+ WiiSensBarPos->Bind(wxEVT_CHOICE, &ControllerConfigDiag::OnSensorBarPos, this);
+ WiiSensBarSens->Bind(wxEVT_SLIDER, &ControllerConfigDiag::OnSensorBarSensitivity, this);
+ WiimoteSpkVolume->Bind(wxEVT_SLIDER, &ControllerConfigDiag::OnSpeakerVolume, this);
+ WiimoteMotor->Bind(wxEVT_CHECKBOX, &ControllerConfigDiag::OnMotor, this);
+
+ // "General Settings" layout
+ wxStaticBoxSizer* const general_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("General Settings"));
+ wxFlexGridSizer* const choice_sizer = new wxFlexGridSizer(2, 5, 5);
+
+ wxBoxSizer* const sensbarsens_sizer = new wxBoxSizer(wxHORIZONTAL);
+ sensbarsens_sizer->Add(WiiSensBarSensMinText, 0, wxALIGN_CENTER_VERTICAL);
+ sensbarsens_sizer->Add(WiiSensBarSens);
+ sensbarsens_sizer->Add(WiiSensBarSensMaxText, 0, wxALIGN_CENTER_VERTICAL);
+
+ wxBoxSizer* const spkvol_sizer = new wxBoxSizer(wxHORIZONTAL);
+ spkvol_sizer->Add(WiimoteSpkVolumeMinText, 0, wxALIGN_CENTER_VERTICAL);
+ spkvol_sizer->Add(WiimoteSpkVolume);
+ spkvol_sizer->Add(WiimoteSpkVolumeMaxText, 0, wxALIGN_CENTER_VERTICAL);
+
+ choice_sizer->Add(WiiSensBarPosText, 0, wxALIGN_CENTER_VERTICAL);
+ choice_sizer->Add(WiiSensBarPos);
+ choice_sizer->Add(WiiSensBarSensText, 0, wxALIGN_CENTER_VERTICAL);
+ choice_sizer->Add(sensbarsens_sizer);
+ choice_sizer->Add(WiimoteSpkVolumeText, 0, wxALIGN_CENTER_VERTICAL);
+ choice_sizer->Add(spkvol_sizer);
+
+ wxGridSizer* const general_wiimote_sizer = new wxGridSizer(1, 5, 5);
+ general_wiimote_sizer->Add(WiimoteMotor);
+ general_wiimote_sizer->Add(wiimote_speaker, 0);
+
+ general_sizer->Add(choice_sizer);
+ general_sizer->Add(general_wiimote_sizer);
+
+ return general_sizer;
+}
+
+
+void ControllerConfigDiag::ConfigEmulatedWiimote(wxCommandEvent& ev)
+{
+ InputConfig* const wiimote_plugin = Wiimote::GetConfig();
+ bool was_init = false;
+ if (g_controller_interface.IsInit()) // check if game is running
+ {
+ was_init = true;
+ }
+ else
+ {
+#if defined(HAVE_X11) && HAVE_X11
+ Window win = X11Utils::XWindowFromHandle(GetHandle());
+ Wiimote::Initialize(reinterpret_cast<void*>(win));
+#else
+ Wiimote::Initialize(reinterpret_cast<void*>(GetHandle()));
+#endif
+ }
+ InputConfigDialog m_ConfigFrame(this, *wiimote_plugin, _trans("Dolphin Emulated Wiimote Configuration"), m_wiimote_index_from_conf_bt_id[ev.GetId()]);
+ m_ConfigFrame.ShowModal();
+ m_ConfigFrame.Destroy();
+ if (!was_init) // if game isn't running
+ {
+ Wiimote::Shutdown();
+ }
+
+ //InputConfigDialog* const m_emu_config_diag = new InputConfigDialog(this, *Wiimote::GetConfig(), _trans("Dolphin Emulated Wiimote Configuration"), m_wiimote_index_from_conf_bt_id[ev.GetId()]);
+ //m_emu_config_diag->ShowModal();
+ //m_emu_config_diag->Destroy();
+}
+
+void ControllerConfigDiag::RefreshRealWiimotes(wxCommandEvent&)
+{
+ WiimoteReal::Refresh();
+}
+
+void ControllerConfigDiag::SelectSource(wxCommandEvent& event)
+{
+ // This needs to be changed now in order for refresh to work right.
+ // Revert if the dialog is canceled.
+ int index = m_wiimote_index_from_ctrl_id[event.GetId()];
+
+ if (index != WIIMOTE_BALANCE_BOARD)
+ {
+ WiimoteReal::ChangeWiimoteSource(index, event.GetInt());
+ if (g_wiimote_sources[index] != WIIMOTE_SRC_EMU && g_wiimote_sources[index] != WIIMOTE_SRC_HYBRID)
+ wiimote_configure_bt[index]->Disable();
+ else
+ wiimote_configure_bt[index]->Enable();
+ }
+ else
+ {
+ WiimoteReal::ChangeWiimoteSource(index, event.GetInt() ? WIIMOTE_SRC_REAL : WIIMOTE_SRC_NONE);
+ }
+}
+
+void ControllerConfigDiag::RevertSource()
+{
+ for (int i = 0; i < MAX_BBMOTES; ++i)
+ g_wiimote_sources[i] = m_orig_wiimote_sources[i];
+}
+
+void ControllerConfigDiag::Save(wxCommandEvent& event)
+{
+ std::string ini_filename = File::GetUserPath(D_CONFIG_IDX) + WIIMOTE_INI_NAME ".ini";
+
+ IniFile inifile;
+ inifile.Load(ini_filename);
+
+ for (unsigned int i=0; i<MAX_WIIMOTES; ++i)
+ {
+ std::string secname("Wiimote");
+ secname += (char)('1' + i);
+ IniFile::Section& sec = *inifile.GetOrCreateSection(secname);
+
+ sec.Set("Source", (int)g_wiimote_sources[i]);
+ }
+
+ std::string secname("BalanceBoard");
+ IniFile::Section& sec = *inifile.GetOrCreateSection(secname);
+ sec.Set("Source", (int)g_wiimote_sources[WIIMOTE_BALANCE_BOARD]);
+
+ inifile.Save(ini_filename);
+
+ event.Skip();
+}
+
+void ControllerConfigDiag::Cancel(wxCommandEvent& event)
+{
+ RevertSource();
+ event.Skip();
+}
+
+void ControllerConfigDiag::OnGameCubePortChanged(wxCommandEvent& event)
+{
+ const unsigned int device_num = m_gc_port_choice_ids[event.GetId()];
+ const wxString device_name = event.GetString();
+
+ SIDevices tempType;
+ if (device_name == m_gc_pad_type_strs[1])
+ tempType = SIDEVICE_GC_CONTROLLER;
+ else if (device_name == m_gc_pad_type_strs[2])
+ tempType = SIDEVICE_GC_STEERING;
+ else if (device_name == m_gc_pad_type_strs[3])
+ tempType = SIDEVICE_DANCEMAT;
+ else if (device_name == m_gc_pad_type_strs[4])
+ tempType = SIDEVICE_GC_TARUKONGA;
+ else if (device_name == m_gc_pad_type_strs[5])
+ tempType = SIDEVICE_GC_GBA;
+ else if (device_name == m_gc_pad_type_strs[6])
+ tempType = SIDEVICE_AM_BASEBOARD;
+ else
+ tempType = SIDEVICE_NONE;
+
+ SConfig::GetInstance().m_SIDevice[device_num] = tempType;
+
+ if (Core::IsRunning())
+ SerialInterface::ChangeDevice(tempType, device_num);
+}
+
+void ControllerConfigDiag::OnGameCubeConfigButton(wxCommandEvent& event)
+{
+ InputConfig* const pad_plugin = Pad::GetConfig();
+ const int port_num = m_gc_port_config_ids[event.GetId()];
+
+ bool was_init = false;
+
+ // check if game is running
+ if (g_controller_interface.IsInit())
+ {
+ was_init = true;
+ }
+ else
+ {
+#if defined(HAVE_X11) && HAVE_X11
+ Window win = X11Utils::XWindowFromHandle(GetHandle());
+ Pad::Initialize(reinterpret_cast<void*>(win));
+#else
+ Pad::Initialize(reinterpret_cast<void*>(GetHandle()));
+#endif
+ }
+
+ InputConfigDialog m_ConfigFrame(this, *pad_plugin, _trans("Dolphin GCPad Configuration"), port_num);
+ m_ConfigFrame.ShowModal();
+ m_ConfigFrame.Destroy();
+
+ // if game isn't running
+ if (!was_init)
+ Pad::Shutdown();
+}
diff --git a/Source/Core/DolphinWX/WiimoteConfigDiag.h b/Source/Core/DolphinWX/ControllerConfigDiag.h
index ddad3c36fb..3fbc56fb76 100644
--- a/Source/Core/DolphinWX/WiimoteConfigDiag.h
+++ b/Source/Core/DolphinWX/ControllerConfigDiag.h
@@ -1,5 +1,6 @@
#pragma once
+#include <array>
#include <map>
#include <wx/dialog.h>
#include <wx/event.h>
@@ -11,12 +12,13 @@
class InputConfig;
class wxButton;
+class wxStaticBoxSizer;
class wxWindow;
-class WiimoteConfigDiag : public wxDialog
+class ControllerConfigDiag : public wxDialog
{
public:
- WiimoteConfigDiag(wxWindow* const parent, InputConfig& config);
+ ControllerConfigDiag(wxWindow* const parent);
void RefreshRealWiimotes(wxCommandEvent& event);
@@ -59,9 +61,19 @@ public:
}
private:
+ wxStaticBoxSizer* CreateGamecubeSizer();
+ wxStaticBoxSizer* CreateWiimoteConfigSizer();
+ wxStaticBoxSizer* CreateBalanceBoardSizer();
+ wxStaticBoxSizer* CreateRealWiimoteSizer();
+ wxStaticBoxSizer* CreateGeneralWiimoteSettingsSizer();
+
void Cancel(wxCommandEvent& event);
+ void OnGameCubePortChanged(wxCommandEvent& event);
+ void OnGameCubeConfigButton(wxCommandEvent& event);
- InputConfig& m_config;
+ std::map<wxWindowID, unsigned int> m_gc_port_choice_ids;
+ std::map<wxWindowID, unsigned int> m_gc_port_config_ids;
+ static const std::array<wxString, 7> m_gc_pad_type_strs;
std::map<wxWindowID, unsigned int> m_wiimote_index_from_ctrl_id;
unsigned int m_orig_wiimote_sources[MAX_BBMOTES];
diff --git a/Source/Core/DolphinWX/DolphinWX.vcxproj b/Source/Core/DolphinWX/DolphinWX.vcxproj
index 19adcf43ba..033c70e7d3 100644
--- a/Source/Core/DolphinWX/DolphinWX.vcxproj
+++ b/Source/Core/DolphinWX/DolphinWX.vcxproj
@@ -96,7 +96,7 @@
<ClCompile Include="TASInputDlg.cpp" />
<ClCompile Include="VideoConfigDiag.cpp" />
<ClCompile Include="PostProcessingConfigDiag.cpp" />
- <ClCompile Include="WiimoteConfigDiag.cpp" />
+ <ClCompile Include="ControllerConfigDiag.cpp" />
<ClCompile Include="WXInputBase.cpp" />
<ClCompile Include="WxUtils.cpp" />
</ItemGroup>
@@ -144,7 +144,7 @@
<ClInclude Include="TASInputDlg.h" />
<ClInclude Include="VideoConfigDiag.h" />
<ClInclude Include="PostProcessingConfigDiag.h" />
- <ClInclude Include="WiimoteConfigDiag.h" />
+ <ClInclude Include="ControllerConfigDiag.h" />
<ClInclude Include="WXInputBase.h" />
<ClInclude Include="WxUtils.h" />
</ItemGroup>
@@ -222,12 +222,10 @@
</ItemGroup>
<Target Name="AfterBuild" Inputs="@(AllInputFiles)" Outputs="@(AllInputFiles -> '$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(Extension)')">
<Message Text="Copying Data directory..." Importance="High" />
- <Copy SourceFiles="@(DataDirFiles)" DestinationFolder="$(BinaryOutputDir)%(RecursiveDir)"
- Condition="!Exists('$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(DataDirFiles.Extension)') OR $([System.DateTime]::Parse('%(ModifiedTime)').Ticks) &gt; $([System.IO.File]::GetLastWriteTime('$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(DataDirFiles.Extension)').Ticks)" />
+ <Copy SourceFiles="@(DataDirFiles)" DestinationFolder="$(BinaryOutputDir)%(RecursiveDir)" Condition="!Exists('$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(DataDirFiles.Extension)') OR $([System.DateTime]::Parse('%(ModifiedTime)').Ticks) &gt; $([System.IO.File]::GetLastWriteTime('$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(DataDirFiles.Extension)').Ticks)" />
<Message Text="Copying External .dlls" Importance="High" />
- <Copy SourceFiles="@(ExternalDlls)" DestinationFolder="$(BinaryOutputDir)"
- Condition="!Exists('$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(ExternalDlls.Extension)') OR $([System.DateTime]::Parse('%(ModifiedTime)').Ticks) &gt; $([System.IO.File]::GetLastWriteTime('$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(ExternalDlls.Extension)').Ticks)" />
+ <Copy SourceFiles="@(ExternalDlls)" DestinationFolder="$(BinaryOutputDir)" Condition="!Exists('$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(ExternalDlls.Extension)') OR $([System.DateTime]::Parse('%(ModifiedTime)').Ticks) &gt; $([System.IO.File]::GetLastWriteTime('$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(ExternalDlls.Extension)').Ticks)" />
<Message Text="Copy: @(BinaryFiles) -&gt; $(BinaryOutputDir)" Importance="High" />
<Copy SourceFiles="@(BinaryFiles)" DestinationFolder="$(BinaryOutputDir)" />
</Target>
-</Project>
+</Project> \ No newline at end of file
diff --git a/Source/Core/DolphinWX/DolphinWX.vcxproj.filters b/Source/Core/DolphinWX/DolphinWX.vcxproj.filters
index 1f41f1582f..7bfd1dbb8d 100644
--- a/Source/Core/DolphinWX/DolphinWX.vcxproj.filters
+++ b/Source/Core/DolphinWX/DolphinWX.vcxproj.filters
@@ -160,12 +160,12 @@
<ClCompile Include="TASInputDlg.cpp">
<Filter>GUI</Filter>
</ClCompile>
- <ClCompile Include="WiimoteConfigDiag.cpp">
- <Filter>GUI</Filter>
- </ClCompile>
<ClCompile Include="SoftwareVideoConfigDialog.cpp">
<Filter>GUI\Video</Filter>
</ClCompile>
+ <ClCompile Include="ControllerConfigDiag.cpp">
+ <Filter>GUI</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Main.h" />
@@ -294,12 +294,12 @@
<ClInclude Include="TASInputDlg.h">
<Filter>GUI</Filter>
</ClInclude>
- <ClInclude Include="WiimoteConfigDiag.h">
- <Filter>GUI</Filter>
- </ClInclude>
<ClInclude Include="SoftwareVideoConfigDialog.h">
<Filter>GUI\Video</Filter>
</ClInclude>
+ <ClInclude Include="ControllerConfigDiag.h">
+ <Filter>GUI</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />
@@ -312,4 +312,4 @@
<ItemGroup>
<Image Include="$(CoreDir)..\..\Installer\Dolphin.ico" />
</ItemGroup>
-</Project>
+</Project> \ No newline at end of file
diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp
index 96752dfbcc..8785fa93df 100644
--- a/Source/Core/DolphinWX/Frame.cpp
+++ b/Source/Core/DolphinWX/Frame.cpp
@@ -260,8 +260,7 @@ EVT_MENU(IDM_TOGGLE_DUMPAUDIO, CFrame::OnToggleDumpAudio)
EVT_MENU(wxID_PREFERENCES, CFrame::OnConfigMain)
EVT_MENU(IDM_CONFIG_GFX_BACKEND, CFrame::OnConfigGFX)
EVT_MENU(IDM_CONFIG_DSP_EMULATOR, CFrame::OnConfigDSP)
-EVT_MENU(IDM_CONFIG_PAD_PLUGIN, CFrame::OnConfigPAD)
-EVT_MENU(IDM_CONFIG_WIIMOTE_PLUGIN, CFrame::OnConfigWiimote)
+EVT_MENU(IDM_CONFIG_CONTROLLERS, CFrame::OnConfigControllers)
EVT_MENU(IDM_CONFIG_HOTKEYS, CFrame::OnConfigHotkey)
EVT_MENU(IDM_SAVE_PERSPECTIVE, CFrame::OnPerspectiveMenu)
diff --git a/Source/Core/DolphinWX/Frame.h b/Source/Core/DolphinWX/Frame.h
index 29b3eeb21d..4ce8e39fd2 100644
--- a/Source/Core/DolphinWX/Frame.h
+++ b/Source/Core/DolphinWX/Frame.h
@@ -190,8 +190,7 @@ private:
Toolbar_ConfigMain,
Toolbar_ConfigGFX,
Toolbar_ConfigDSP,
- Toolbar_ConfigPAD,
- Toolbar_Wiimote,
+ Toolbar_Controller,
EToolbar_Max
};
@@ -293,8 +292,7 @@ private:
void OnConfigMain(wxCommandEvent& event); // Options
void OnConfigGFX(wxCommandEvent& event);
void OnConfigDSP(wxCommandEvent& event);
- void OnConfigPAD(wxCommandEvent& event);
- void OnConfigWiimote(wxCommandEvent& event);
+ void OnConfigControllers(wxCommandEvent& event);
void OnConfigHotkey(wxCommandEvent& event);
void OnToggleFullscreen(wxCommandEvent& event);
diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp
index b9aa252275..40f5ee358b 100644
--- a/Source/Core/DolphinWX/FrameTools.cpp
+++ b/Source/Core/DolphinWX/FrameTools.cpp
@@ -64,6 +64,7 @@
#include "DolphinWX/AboutDolphin.h"
#include "DolphinWX/ConfigMain.h"
+#include "DolphinWX/ControllerConfigDiag.h"
#include "DolphinWX/FifoPlayerDlg.h"
#include "DolphinWX/Frame.h"
#include "DolphinWX/GameListCtrl.h"
@@ -75,7 +76,6 @@
#include "DolphinWX/MemcardManager.h"
#include "DolphinWX/NetWindow.h"
#include "DolphinWX/TASInputDlg.h"
-#include "DolphinWX/WiimoteConfigDiag.h"
#include "DolphinWX/WXInputBase.h"
#include "DolphinWX/WxUtils.h"
#include "DolphinWX/Cheats/CheatsWindow.h"
@@ -236,8 +236,7 @@ wxMenuBar* CFrame::CreateMenu()
pOptionsMenu->AppendSeparator();
pOptionsMenu->Append(IDM_CONFIG_GFX_BACKEND, _("&Graphics Settings"));
pOptionsMenu->Append(IDM_CONFIG_DSP_EMULATOR, _("&DSP Settings"));
- pOptionsMenu->Append(IDM_CONFIG_PAD_PLUGIN, _("GameCube &Pad Settings"));
- pOptionsMenu->Append(IDM_CONFIG_WIIMOTE_PLUGIN, _("&Wiimote Settings"));
+ pOptionsMenu->Append(IDM_CONFIG_CONTROLLERS, _("&Controller Settings"));
pOptionsMenu->Append(IDM_CONFIG_HOTKEYS, _("&Hotkey Settings"));
if (g_pCodeWindow)
{
@@ -560,20 +559,19 @@ void CFrame::PopulateToolbar(wxToolBar* ToolBar)
ToolBar->SetToolBitmapSize(wxSize(w, h));
- WxUtils::AddToolbarButton(ToolBar, wxID_OPEN, _("Open"), m_Bitmaps[Toolbar_FileOpen], _("Open file..."));
- WxUtils::AddToolbarButton(ToolBar, wxID_REFRESH, _("Refresh"), m_Bitmaps[Toolbar_Refresh], _("Refresh game list"));
- WxUtils::AddToolbarButton(ToolBar, IDM_BROWSE, _("Browse"), m_Bitmaps[Toolbar_Browse], _("Browse for an ISO directory..."));
+ WxUtils::AddToolbarButton(ToolBar, wxID_OPEN, _("Open"), m_Bitmaps[Toolbar_FileOpen], _("Open file..."));
+ WxUtils::AddToolbarButton(ToolBar, wxID_REFRESH, _("Refresh"), m_Bitmaps[Toolbar_Refresh], _("Refresh game list"));
+ WxUtils::AddToolbarButton(ToolBar, IDM_BROWSE, _("Browse"), m_Bitmaps[Toolbar_Browse], _("Browse for an ISO directory..."));
ToolBar->AddSeparator();
- WxUtils::AddToolbarButton(ToolBar, IDM_PLAY, _("Play"), m_Bitmaps[Toolbar_Play], _("Play"));
- WxUtils::AddToolbarButton(ToolBar, IDM_STOP, _("Stop"), m_Bitmaps[Toolbar_Stop], _("Stop"));
- WxUtils::AddToolbarButton(ToolBar, IDM_TOGGLE_FULLSCREEN, _("FullScr"), m_Bitmaps[Toolbar_FullScreen], _("Toggle Fullscreen"));
- WxUtils::AddToolbarButton(ToolBar, IDM_SCREENSHOT, _("ScrShot"), m_Bitmaps[Toolbar_Screenshot], _("Take Screenshot"));
+ WxUtils::AddToolbarButton(ToolBar, IDM_PLAY, _("Play"), m_Bitmaps[Toolbar_Play], _("Play"));
+ WxUtils::AddToolbarButton(ToolBar, IDM_STOP, _("Stop"), m_Bitmaps[Toolbar_Stop], _("Stop"));
+ WxUtils::AddToolbarButton(ToolBar, IDM_TOGGLE_FULLSCREEN, _("FullScr"), m_Bitmaps[Toolbar_FullScreen], _("Toggle Fullscreen"));
+ WxUtils::AddToolbarButton(ToolBar, IDM_SCREENSHOT, _("ScrShot"), m_Bitmaps[Toolbar_Screenshot], _("Take Screenshot"));
ToolBar->AddSeparator();
- WxUtils::AddToolbarButton(ToolBar, wxID_PREFERENCES, _("Config"), m_Bitmaps[Toolbar_ConfigMain], _("Configure..."));
- WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_GFX_BACKEND, _("Graphics"), m_Bitmaps[Toolbar_ConfigGFX], _("Graphics settings"));
- WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_DSP_EMULATOR, _("DSP"), m_Bitmaps[Toolbar_ConfigDSP], _("DSP settings"));
- WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_PAD_PLUGIN, _("GCPad"), m_Bitmaps[Toolbar_ConfigPAD], _("GameCube Pad settings"));
- WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_WIIMOTE_PLUGIN, _("Wiimote"), m_Bitmaps[Toolbar_Wiimote], _("Wiimote settings"));
+ WxUtils::AddToolbarButton(ToolBar, wxID_PREFERENCES, _("Config"), m_Bitmaps[Toolbar_ConfigMain], _("Configure..."));
+ WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_GFX_BACKEND, _("Graphics"), m_Bitmaps[Toolbar_ConfigGFX], _("Graphics settings"));
+ WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_DSP_EMULATOR, _("DSP"), m_Bitmaps[Toolbar_ConfigDSP], _("DSP settings"));
+ WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_CONTROLLERS, _("Controllers"), m_Bitmaps[Toolbar_Controller], _("Controller settings"));
}
@@ -617,8 +615,7 @@ void CFrame::InitBitmaps()
m_Bitmaps[Toolbar_ConfigMain].LoadFile(dir + "config.png", wxBITMAP_TYPE_PNG);
m_Bitmaps[Toolbar_ConfigGFX ].LoadFile(dir + "graphics.png", wxBITMAP_TYPE_PNG);
m_Bitmaps[Toolbar_ConfigDSP ].LoadFile(dir + "dsp.png", wxBITMAP_TYPE_PNG);
- m_Bitmaps[Toolbar_ConfigPAD ].LoadFile(dir + "gcpad.png", wxBITMAP_TYPE_PNG);
- m_Bitmaps[Toolbar_Wiimote ].LoadFile(dir + "wiimote.png", wxBITMAP_TYPE_PNG);
+ m_Bitmaps[Toolbar_Controller].LoadFile(dir + "classic.png", wxBITMAP_TYPE_PNG);
m_Bitmaps[Toolbar_Screenshot].LoadFile(dir + "screenshot.png", wxBITMAP_TYPE_PNG);
m_Bitmaps[Toolbar_FullScreen].LoadFile(dir + "fullscreen.png", wxBITMAP_TYPE_PNG);
@@ -1346,56 +1343,11 @@ void CFrame::OnConfigDSP(wxCommandEvent& WXUNUSED (event))
m_GameListCtrl->Update();
}
-void CFrame::OnConfigPAD(wxCommandEvent& WXUNUSED (event))
+void CFrame::OnConfigControllers(wxCommandEvent& WXUNUSED (event))
{
- InputConfig* const pad_plugin = Pad::GetConfig();
- bool was_init = false;
- if (g_controller_interface.IsInit()) // check if game is running
- {
- was_init = true;
- }
- else
- {
-#if defined(HAVE_X11) && HAVE_X11
- Window win = X11Utils::XWindowFromHandle(GetHandle());
- Pad::Initialize(reinterpret_cast<void*>(win));
-#else
- Pad::Initialize(reinterpret_cast<void*>(GetHandle()));
-#endif
- }
- InputConfigDialog m_ConfigFrame(this, *pad_plugin, _trans("Dolphin GCPad Configuration"));
- m_ConfigFrame.ShowModal();
- m_ConfigFrame.Destroy();
- if (!was_init) // if game isn't running
- {
- Pad::Shutdown();
- }
-}
-
-void CFrame::OnConfigWiimote(wxCommandEvent& WXUNUSED (event))
-{
- InputConfig* const wiimote_plugin = Wiimote::GetConfig();
- bool was_init = false;
- if (g_controller_interface.IsInit()) // check if game is running
- {
- was_init = true;
- }
- else
- {
-#if defined(HAVE_X11) && HAVE_X11
- Window win = X11Utils::XWindowFromHandle(GetHandle());
- Wiimote::Initialize(reinterpret_cast<void*>(win));
-#else
- Wiimote::Initialize(reinterpret_cast<void*>(GetHandle()));
-#endif
- }
- WiimoteConfigDiag m_ConfigFrame(this, *wiimote_plugin);
- m_ConfigFrame.ShowModal();
- m_ConfigFrame.Destroy();
- if (!was_init) // if game isn't running
- {
- Wiimote::Shutdown();
- }
+ ControllerConfigDiag config_dlg(this);
+ config_dlg.ShowModal();
+ config_dlg.Destroy();
}
void CFrame::OnConfigHotkey(wxCommandEvent& WXUNUSED (event))
@@ -1759,8 +1711,6 @@ void CFrame::UpdateGUI()
m_ToolBar->EnableTool(IDM_STOP, Running || Paused);
m_ToolBar->EnableTool(IDM_TOGGLE_FULLSCREEN, Running || Paused);
m_ToolBar->EnableTool(IDM_SCREENSHOT, Running || Paused);
- // Don't allow wiimote config while in GameCube mode
- m_ToolBar->EnableTool(IDM_CONFIG_WIIMOTE_PLUGIN, !RunningGamecube);
}
// File
@@ -1803,7 +1753,7 @@ void CFrame::UpdateGUI()
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->Enable(RunningWii);
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->Enable(RunningWii);
GetMenuBar()->FindItem(IDM_CONNECT_BALANCEBOARD)->Enable(RunningWii);
- GetMenuBar()->FindItem(IDM_CONFIG_WIIMOTE_PLUGIN)->Enable(!RunningGamecube);
+ GetMenuBar()->FindItem(IDM_CONFIG_CONTROLLERS)->Enable(!RunningGamecube);
if (RunningWii)
{
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Check(GetUsbPointer()->
diff --git a/Source/Core/DolphinWX/Globals.h b/Source/Core/DolphinWX/Globals.h
index edbd89bf6a..42ae34b87a 100644
--- a/Source/Core/DolphinWX/Globals.h
+++ b/Source/Core/DolphinWX/Globals.h
@@ -147,8 +147,7 @@ enum
IDM_CONFIG_GFX_BACKEND,
IDM_CONFIG_DSP_EMULATOR,
- IDM_CONFIG_PAD_PLUGIN,
- IDM_CONFIG_WIIMOTE_PLUGIN,
+ IDM_CONFIG_CONTROLLERS,
IDM_CONFIG_HOTKEYS,
IDM_CONFIG_LOGGER,
diff --git a/Source/Core/DolphinWX/WiimoteConfigDiag.cpp b/Source/Core/DolphinWX/WiimoteConfigDiag.cpp
deleted file mode 100644
index cb4baff7ff..0000000000
--- a/Source/Core/DolphinWX/WiimoteConfigDiag.cpp
+++ /dev/null
@@ -1,292 +0,0 @@
-#include <map>
-#include <string>
-#include <utility>
-#include <wx/button.h>
-#include <wx/checkbox.h>
-#include <wx/choice.h>
-#include <wx/defs.h>
-#include <wx/dialog.h>
-#include <wx/event.h>
-#include <wx/gdicmn.h>
-#include <wx/sizer.h>
-#include <wx/slider.h>
-#include <wx/stattext.h>
-#include <wx/string.h>
-#include <wx/translation.h>
-#include <wx/window.h>
-#include <wx/windowid.h>
-
-#include "Common/CommonTypes.h"
-#include "Common/FileUtil.h"
-#include "Common/IniFile.h"
-#include "Common/SysConf.h"
-#include "Core/ConfigManager.h"
-#include "Core/Core.h"
-#include "Core/NetPlayProto.h"
-#include "Core/HW/Wiimote.h"
-#include "Core/HW/WiimoteReal/WiimoteReal.h"
-#include "DolphinWX/InputConfigDiag.h"
-#include "DolphinWX/WiimoteConfigDiag.h"
-
-WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputConfig& config)
- : wxDialog(parent, -1, _("Dolphin Wiimote Configuration"))
- , m_config(config)
-{
- wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);
-
-
- // "Wiimotes" controls
- wxStaticText* wiimote_label[4];
- wxChoice* wiimote_source_ch[4];
-
- for (unsigned int i = 0; i < MAX_WIIMOTES; ++i)
- {
- wxString wiimote_str = wxString::Format(_("Wiimote %i"), i + 1);
-
- const wxString src_choices[] = { _("None"),
- _("Emulated Wiimote"), _("Real Wiimote"), _("Hybrid Wiimote") };
-
- // reserve four ids, so that we can calculate the index from the ids later on
- // Stupid wx 2.8 doesn't support reserving sequential IDs, so we need to do that more complicated..
- int source_ctrl_id = wxWindow::NewControlId();
- m_wiimote_index_from_ctrl_id.insert(std::pair<wxWindowID, unsigned int>(source_ctrl_id, i));
-
- int config_bt_id = wxWindow::NewControlId();
- m_wiimote_index_from_conf_bt_id.insert(std::pair<wxWindowID, unsigned int>(config_bt_id, i));
-
- wiimote_label[i] = new wxStaticText(this, wxID_ANY, wiimote_str);
- wiimote_source_ch[i] = new wxChoice(this, source_ctrl_id, wxDefaultPosition, wxDefaultSize, sizeof(src_choices)/sizeof(*src_choices), src_choices);
- wiimote_source_ch[i]->Bind(wxEVT_CHOICE, &WiimoteConfigDiag::SelectSource, this);
- wiimote_configure_bt[i] = new wxButton(this, config_bt_id, _("Configure"));
- wiimote_configure_bt[i]->Bind(wxEVT_BUTTON, &WiimoteConfigDiag::ConfigEmulatedWiimote, this);
-
- m_orig_wiimote_sources[i] = g_wiimote_sources[i];
- wiimote_source_ch[i]->Select(m_orig_wiimote_sources[i]);
- if (m_orig_wiimote_sources[i] != WIIMOTE_SRC_EMU && m_orig_wiimote_sources[i] != WIIMOTE_SRC_HYBRID)
- wiimote_configure_bt[i]->Disable();
- }
-
- // "Wiimotes" layout
- wxStaticBoxSizer* const wiimote_group = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Wiimotes"));
- wxFlexGridSizer* const wiimote_sizer = new wxFlexGridSizer(3, 5, 5);
- for (unsigned int i = 0; i < 4; ++i)
- {
- wiimote_sizer->Add(wiimote_label[i], 0, wxALIGN_CENTER_VERTICAL);
- wiimote_sizer->Add(wiimote_source_ch[i], 0, wxALIGN_CENTER_VERTICAL);
- wiimote_sizer->Add(wiimote_configure_bt[i]);
- }
- wiimote_group->Add(wiimote_sizer, 1, wxEXPAND, 5 );
-
-
- // "BalanceBoard" layout
- wxStaticBoxSizer* const bb_group = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Balance Board"));
- wxFlexGridSizer* const bb_sizer = new wxFlexGridSizer(1, 5, 5);
- int source_ctrl_id = wxWindow::NewControlId();
- m_wiimote_index_from_ctrl_id.insert(std::pair<wxWindowID, unsigned int>(source_ctrl_id, WIIMOTE_BALANCE_BOARD));
- const wxString src_choices[] = { _("None"), _("Real Balance Board") };
- wxChoice* bb_source = new wxChoice(this, source_ctrl_id, wxDefaultPosition, wxDefaultSize, sizeof(src_choices)/sizeof(*src_choices), src_choices);
- bb_source->Bind(wxEVT_CHOICE, &WiimoteConfigDiag::SelectSource, this);
-
- m_orig_wiimote_sources[WIIMOTE_BALANCE_BOARD] = g_wiimote_sources[WIIMOTE_BALANCE_BOARD];
- bb_source->Select(m_orig_wiimote_sources[WIIMOTE_BALANCE_BOARD] ? 1 : 0);
-
- bb_sizer->Add(bb_source, 0, wxALIGN_CENTER_VERTICAL);
-
- bb_group->Add(bb_sizer, 1, wxEXPAND, 5 );
-
-
- // "Real wiimotes" controls
- wxButton* const refresh_btn = new wxButton(this, -1, _("Refresh"));
- refresh_btn->Bind(wxEVT_BUTTON, &WiimoteConfigDiag::RefreshRealWiimotes, this);
-
- wxStaticBoxSizer* const real_wiimotes_group = new wxStaticBoxSizer(wxVERTICAL, this, _("Real Wiimotes"));
-
- wxBoxSizer* const real_wiimotes_sizer = new wxBoxSizer(wxHORIZONTAL);
-
- if (!WiimoteReal::g_wiimote_scanner.IsReady())
- real_wiimotes_group->Add(new wxStaticText(this, -1, _("A supported bluetooth device could not be found.\n"
- "You must manually connect your wiimotes.")), 0, wxALIGN_CENTER | wxALL, 5);
-
- wxCheckBox* const continuous_scanning = new wxCheckBox(this, wxID_ANY, _("Continuous Scanning"));
- continuous_scanning->Bind(wxEVT_CHECKBOX, &WiimoteConfigDiag::OnContinuousScanning, this);
- continuous_scanning->SetValue(SConfig::GetInstance().m_WiimoteContinuousScanning);
-
- real_wiimotes_sizer->Add(continuous_scanning, 0, wxALIGN_CENTER_VERTICAL);
- real_wiimotes_sizer->AddStretchSpacer(1);
- real_wiimotes_sizer->Add(refresh_btn, 0, wxALL | wxALIGN_CENTER, 5);
-
- real_wiimotes_group->Add(real_wiimotes_sizer, 0, wxEXPAND);
-
- // "General Settings" controls
- const wxString str[] = { _("Bottom"), _("Top") };
- wxChoice* const WiiSensBarPos = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 2, str);
- wxSlider* const WiiSensBarSens = new wxSlider(this, wxID_ANY, 0, 0, 4);
- wxSlider* const WiimoteSpkVolume = new wxSlider(this, wxID_ANY, 0, 0, 127);
- wxCheckBox* const WiimoteMotor = new wxCheckBox(this, wxID_ANY, _("Wiimote Motor"));
-
- auto wiimote_speaker = new wxCheckBox(this, wxID_ANY, _("Enable Speaker Data"));
- wiimote_speaker->Bind(wxEVT_CHECKBOX, &WiimoteConfigDiag::OnEnableSpeaker, this);
- wiimote_speaker->SetValue(SConfig::GetInstance().m_WiimoteEnableSpeaker);
-
- wxStaticText* const WiiSensBarPosText = new wxStaticText(this, wxID_ANY, _("Sensor Bar Position:"));
- wxStaticText* const WiiSensBarSensText = new wxStaticText(this, wxID_ANY, _("IR Sensitivity:"));
- wxStaticText* const WiiSensBarSensMinText = new wxStaticText(this, wxID_ANY, _("Min"));
- wxStaticText* const WiiSensBarSensMaxText = new wxStaticText(this, wxID_ANY, _("Max"));
- wxStaticText* const WiimoteSpkVolumeText = new wxStaticText(this, wxID_ANY, _("Speaker Volume:"));
- wxStaticText* const WiimoteSpkVolumeMinText = new wxStaticText(this, wxID_ANY, _("Min"));
- wxStaticText* const WiimoteSpkVolumeMaxText = new wxStaticText(this, wxID_ANY, _("Max"));
-
- // With some GTK themes, no minimum size will be applied - so do this manually here
- WiiSensBarSens->SetMinSize(wxSize(100,-1));
- WiimoteSpkVolume->SetMinSize(wxSize(100,-1));
-
-
- // Disable some controls when emulation is running
- if (Core::GetState() != Core::CORE_UNINITIALIZED)
- {
- WiiSensBarPos->Disable();
- WiiSensBarSens->Disable();
- WiimoteSpkVolume->Disable();
- WiimoteMotor->Disable();
- WiiSensBarPosText->Disable();
- WiiSensBarSensText->Disable();
- WiiSensBarSensMinText->Disable();
- WiiSensBarSensMaxText->Disable();
- WiimoteSpkVolumeText->Disable();
- WiimoteSpkVolumeMinText->Disable();
- WiimoteSpkVolumeMaxText->Disable();
- if (NetPlay::IsNetPlayRunning())
- {
- bb_source->Disable();
- for (int i = 0; i < 4; ++i)
- {
- wiimote_label[i]->Disable();
- wiimote_source_ch[i]->Disable();
- }
- }
- }
-
- // "General Settings" initialization
- WiiSensBarPos->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("BT.BAR"));
- WiiSensBarSens->SetValue(SConfig::GetInstance().m_SYSCONF->GetData<u32>("BT.SENS"));
- WiimoteSpkVolume->SetValue(SConfig::GetInstance().m_SYSCONF->GetData<u8>("BT.SPKV"));
- WiimoteMotor->SetValue(SConfig::GetInstance().m_SYSCONF->GetData<bool>("BT.MOT"));
-
- WiiSensBarPos->Bind(wxEVT_CHOICE, &WiimoteConfigDiag::OnSensorBarPos, this);
- WiiSensBarSens->Bind(wxEVT_SLIDER, &WiimoteConfigDiag::OnSensorBarSensitivity, this);
- WiimoteSpkVolume->Bind(wxEVT_SLIDER, &WiimoteConfigDiag::OnSpeakerVolume, this);
- WiimoteMotor->Bind(wxEVT_CHECKBOX, &WiimoteConfigDiag::OnMotor, this);
-
-
- // "General Settings" layout
- wxStaticBoxSizer* const general_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("General Settings"));
- wxFlexGridSizer* const choice_sizer = new wxFlexGridSizer(2, 5, 5);
-
- wxBoxSizer* const sensbarsens_sizer = new wxBoxSizer(wxHORIZONTAL);
- sensbarsens_sizer->Add(WiiSensBarSensMinText, 0, wxALIGN_CENTER_VERTICAL);
- sensbarsens_sizer->Add(WiiSensBarSens);
- sensbarsens_sizer->Add(WiiSensBarSensMaxText, 0, wxALIGN_CENTER_VERTICAL);
-
- wxBoxSizer* const spkvol_sizer = new wxBoxSizer(wxHORIZONTAL);
- spkvol_sizer->Add(WiimoteSpkVolumeMinText, 0, wxALIGN_CENTER_VERTICAL);
- spkvol_sizer->Add(WiimoteSpkVolume);
- spkvol_sizer->Add(WiimoteSpkVolumeMaxText, 0, wxALIGN_CENTER_VERTICAL);
-
- choice_sizer->Add(WiiSensBarPosText, 0, wxALIGN_CENTER_VERTICAL);
- choice_sizer->Add(WiiSensBarPos);
- choice_sizer->Add(WiiSensBarSensText, 0, wxALIGN_CENTER_VERTICAL);
- choice_sizer->Add(sensbarsens_sizer);
- choice_sizer->Add(WiimoteSpkVolumeText, 0, wxALIGN_CENTER_VERTICAL);
- choice_sizer->Add(spkvol_sizer);
-
- wxGridSizer* const general_wiimote_sizer = new wxGridSizer(1, 5, 5);
- general_wiimote_sizer->Add(WiimoteMotor);
- general_wiimote_sizer->Add(wiimote_speaker, 0);
-
- general_sizer->Add(choice_sizer);
- general_sizer->Add(general_wiimote_sizer);
-
-
- // Dialog layout
- main_sizer->Add(wiimote_group, 0, wxEXPAND | wxALL, 5);
- main_sizer->Add(bb_group, 0, wxEXPAND | wxALL, 5);
- main_sizer->Add(real_wiimotes_group, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
- main_sizer->Add(general_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
- main_sizer->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
-
- Bind(wxEVT_BUTTON, &WiimoteConfigDiag::Save, this, wxID_OK);
- Bind(wxEVT_BUTTON, &WiimoteConfigDiag::Cancel, this, wxID_CANCEL);
-
- SetSizerAndFit(main_sizer);
- Center();
-}
-
-
-void WiimoteConfigDiag::ConfigEmulatedWiimote(wxCommandEvent& ev)
-{
- InputConfigDialog* const m_emu_config_diag = new InputConfigDialog(this, m_config, _trans("Dolphin Emulated Wiimote Configuration"), m_wiimote_index_from_conf_bt_id[ev.GetId()]);
- m_emu_config_diag->ShowModal();
- m_emu_config_diag->Destroy();
-}
-
-void WiimoteConfigDiag::RefreshRealWiimotes(wxCommandEvent&)
-{
- WiimoteReal::Refresh();
-}
-
-void WiimoteConfigDiag::SelectSource(wxCommandEvent& event)
-{
- // This needs to be changed now in order for refresh to work right.
- // Revert if the dialog is canceled.
- int index = m_wiimote_index_from_ctrl_id[event.GetId()];
-
- if (index != WIIMOTE_BALANCE_BOARD)
- {
- WiimoteReal::ChangeWiimoteSource(index, event.GetInt());
- if (g_wiimote_sources[index] != WIIMOTE_SRC_EMU && g_wiimote_sources[index] != WIIMOTE_SRC_HYBRID)
- wiimote_configure_bt[index]->Disable();
- else
- wiimote_configure_bt[index]->Enable();
- }
- else
- {
- WiimoteReal::ChangeWiimoteSource(index, event.GetInt() ? WIIMOTE_SRC_REAL : WIIMOTE_SRC_NONE);
- }
-}
-
-void WiimoteConfigDiag::RevertSource()
-{
- for (int i = 0; i < MAX_BBMOTES; ++i)
- g_wiimote_sources[i] = m_orig_wiimote_sources[i];
-}
-
-void WiimoteConfigDiag::Save(wxCommandEvent& event)
-{
- std::string ini_filename = File::GetUserPath(D_CONFIG_IDX) + WIIMOTE_INI_NAME ".ini";
-
- IniFile inifile;
- inifile.Load(ini_filename);
-
- for (unsigned int i=0; i<MAX_WIIMOTES; ++i)
- {
- std::string secname("Wiimote");
- secname += (char)('1' + i);
- IniFile::Section& sec = *inifile.GetOrCreateSection(secname);
-
- sec.Set("Source", (int)g_wiimote_sources[i]);
- }
-
- std::string secname("BalanceBoard");
- IniFile::Section& sec = *inifile.GetOrCreateSection(secname);
- sec.Set("Source", (int)g_wiimote_sources[WIIMOTE_BALANCE_BOARD]);
-
- inifile.Save(ini_filename);
-
- event.Skip();
-}
-
-void WiimoteConfigDiag::Cancel(wxCommandEvent& event)
-{
- RevertSource();
- event.Skip();
-}