Added config for enabling Balance Board.
Fixed other structures that still assumed 4 of everything.
This commit is contained in:
parent
59924d0291
commit
7208823396
|
@ -457,7 +457,10 @@ void LoadSettings()
|
||||||
|
|
||||||
sec.Get("Source", &g_wiimote_sources[i], i ? WIIMOTE_SRC_NONE : WIIMOTE_SRC_EMU);
|
sec.Get("Source", &g_wiimote_sources[i], i ? WIIMOTE_SRC_NONE : WIIMOTE_SRC_EMU);
|
||||||
}
|
}
|
||||||
g_wiimote_sources[WIIMOTE_BALANCE_BOARD] = WIIMOTE_SRC_REAL;
|
|
||||||
|
std::string secname("BalanceBoard");
|
||||||
|
IniFile::Section& sec = *inifile.GetOrCreateSection(secname.c_str());
|
||||||
|
sec.Get("Source", &g_wiimote_sources[WIIMOTE_BALANCE_BOARD], WIIMOTE_SRC_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// config dialog calls this when some settings change
|
// config dialog calls this when some settings change
|
||||||
|
@ -501,14 +504,14 @@ void Shutdown(void)
|
||||||
void ChangeWiimoteSource(unsigned int index, int source)
|
void ChangeWiimoteSource(unsigned int index, int source)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> lk(g_refresh_lock);
|
std::lock_guard<std::recursive_mutex> lk(g_refresh_lock);
|
||||||
g_wiimote_sources[index] = source;
|
g_wiimote_sources[index] = source;
|
||||||
g_wiimote_scanner.WantWiimotes(0 != CalculateWantedWiimotes());
|
g_wiimote_scanner.WantWiimotes(0 != CalculateWantedWiimotes());
|
||||||
g_wiimote_scanner.WantBB(0 != CalculateWantedBB());
|
g_wiimote_scanner.WantBB(0 != CalculateWantedBB());
|
||||||
|
|
||||||
|
|
||||||
// kill real connection (or swap to different slot)
|
// kill real connection (or swap to different slot)
|
||||||
DoneWithWiimote(index);
|
DoneWithWiimote(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
// reconnect to the emulator
|
// reconnect to the emulator
|
||||||
|
@ -635,7 +638,7 @@ void Refresh()
|
||||||
std::vector<Wiimote*> found_wiimotes;
|
std::vector<Wiimote*> found_wiimotes;
|
||||||
Wiimote* found_board = NULL;
|
Wiimote* found_board = NULL;
|
||||||
|
|
||||||
if (0 != CalculateWantedWiimotes())
|
if (0 != CalculateWantedWiimotes() || 0 != CalculateWantedBB())
|
||||||
{
|
{
|
||||||
// Don't hang Dolphin when searching
|
// Don't hang Dolphin when searching
|
||||||
lk.unlock();
|
lk.unlock();
|
||||||
|
@ -646,7 +649,8 @@ void Refresh()
|
||||||
CheckForDisconnectedWiimotes();
|
CheckForDisconnectedWiimotes();
|
||||||
|
|
||||||
// Brief rumble for already connected Wiimotes.
|
// Brief rumble for already connected Wiimotes.
|
||||||
for (int i = 0; i < MAX_BBMOTES; ++i)
|
// Don't do this for Balance Board as it doesn't have rumble anyway.
|
||||||
|
for (int i = 0; i < MAX_WIIMOTES; ++i)
|
||||||
{
|
{
|
||||||
if (g_wiimotes[i])
|
if (g_wiimotes[i])
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,6 +56,23 @@ WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin
|
||||||
wiimote_group->Add(wiimote_sizer, 1, wxEXPAND, 5 );
|
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_COMMAND_CHOICE_SELECTED, &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
|
// "Real wiimotes" controls
|
||||||
wxButton* const refresh_btn = new wxButton(this, -1, _("Refresh"), wxDefaultPosition);
|
wxButton* const refresh_btn = new wxButton(this, -1, _("Refresh"), wxDefaultPosition);
|
||||||
refresh_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &WiimoteConfigDiag::RefreshRealWiimotes, this);
|
refresh_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &WiimoteConfigDiag::RefreshRealWiimotes, this);
|
||||||
|
@ -166,6 +183,7 @@ WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin
|
||||||
|
|
||||||
// Dialog layout
|
// Dialog layout
|
||||||
main_sizer->Add(wiimote_group, 0, wxEXPAND | wxALL, 5);
|
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(real_wiimotes_group, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
|
||||||
main_sizer->Add(general_sizer, 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);
|
main_sizer->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
|
||||||
|
@ -196,17 +214,23 @@ void WiimoteConfigDiag::SelectSource(wxCommandEvent& event)
|
||||||
// Revert if the dialog is canceled.
|
// Revert if the dialog is canceled.
|
||||||
int index = m_wiimote_index_from_ctrl_id[event.GetId()];
|
int index = m_wiimote_index_from_ctrl_id[event.GetId()];
|
||||||
|
|
||||||
WiimoteReal::ChangeWiimoteSource(index, event.GetInt());
|
if(index != WIIMOTE_BALANCE_BOARD)
|
||||||
|
{
|
||||||
if (g_wiimote_sources[index] != WIIMOTE_SRC_EMU && g_wiimote_sources[index] != WIIMOTE_SRC_HYBRID)
|
WiimoteReal::ChangeWiimoteSource(index, event.GetInt());
|
||||||
wiimote_configure_bt[index]->Disable();
|
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
|
else
|
||||||
wiimote_configure_bt[index]->Enable();
|
{
|
||||||
|
WiimoteReal::ChangeWiimoteSource(index, event.GetInt() ? WIIMOTE_SRC_REAL : WIIMOTE_SRC_NONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WiimoteConfigDiag::RevertSource()
|
void WiimoteConfigDiag::RevertSource()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_WIIMOTES; ++i)
|
for (int i = 0; i < MAX_BBMOTES; ++i)
|
||||||
g_wiimote_sources[i] = m_orig_wiimote_sources[i];
|
g_wiimote_sources[i] = m_orig_wiimote_sources[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,6 +250,10 @@ void WiimoteConfigDiag::Save(wxCommandEvent& event)
|
||||||
sec.Set("Source", (int)g_wiimote_sources[i]);
|
sec.Set("Source", (int)g_wiimote_sources[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string secname("BalanceBoard");
|
||||||
|
IniFile::Section& sec = *inifile.GetOrCreateSection(secname.c_str());
|
||||||
|
sec.Set("Source", (int)g_wiimote_sources[WIIMOTE_BALANCE_BOARD]);
|
||||||
|
|
||||||
inifile.Save(ini_filename);
|
inifile.Save(ini_filename);
|
||||||
|
|
||||||
event.Skip();
|
event.Skip();
|
||||||
|
|
|
@ -76,7 +76,7 @@ private:
|
||||||
wxNotebook* m_pad_notebook;
|
wxNotebook* m_pad_notebook;
|
||||||
|
|
||||||
std::map<wxWindowID, unsigned int> m_wiimote_index_from_ctrl_id;
|
std::map<wxWindowID, unsigned int> m_wiimote_index_from_ctrl_id;
|
||||||
unsigned int m_orig_wiimote_sources[MAX_WIIMOTES];
|
unsigned int m_orig_wiimote_sources[MAX_BBMOTES];
|
||||||
|
|
||||||
wxButton* wiimote_configure_bt[MAX_WIIMOTES];
|
wxButton* wiimote_configure_bt[MAX_WIIMOTES];
|
||||||
std::map<wxWindowID, unsigned int> m_wiimote_index_from_conf_bt_id;
|
std::map<wxWindowID, unsigned int> m_wiimote_index_from_conf_bt_id;
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "InputConfig.h"
|
#include "InputConfig.h"
|
||||||
#include "../../Core/Src/ConfigManager.h"
|
#include "../Src/ConfigManager.h"
|
||||||
|
#include "../Src/HW/Wiimote.h"
|
||||||
|
|
||||||
InputPlugin::~InputPlugin()
|
InputPlugin::~InputPlugin()
|
||||||
{
|
{
|
||||||
|
@ -18,9 +19,9 @@ bool InputPlugin::LoadConfig(bool isGC)
|
||||||
{
|
{
|
||||||
IniFile inifile;
|
IniFile inifile;
|
||||||
IniFile game_ini;
|
IniFile game_ini;
|
||||||
bool useProfile[4] = {false, false, false, false};
|
bool useProfile[MAX_BBMOTES] = {false, false, false, false, false};
|
||||||
std::string num[4] = {"1", "2", "3", "4"};
|
std::string num[MAX_BBMOTES] = {"1", "2", "3", "4", "BB"};
|
||||||
std::string profile[4];
|
std::string profile[MAX_BBMOTES];
|
||||||
std::string path;
|
std::string path;
|
||||||
|
|
||||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID() != "00000000")
|
if (SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID() != "00000000")
|
||||||
|
|
Loading…
Reference in New Issue