Commit some work based off of James333's auto reconnect patch.

This still requires more work, like making the option only per Wiimote then rather the first one counting for them all.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5241 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
death2droid 2010-03-27 04:21:19 +00:00
parent b7f5582e64
commit 1a07772c8f
7 changed files with 60 additions and 18 deletions

View File

@ -248,16 +248,22 @@ void SConfig::LoadSettings()
ini.Get("Core", "TLBHack", &m_LocalCoreStartupParameter.iTLBHack, 0);
ini.Get("Core", "FrameLimit", &m_Framelimit, 1); // auto frame limit by default
//Wiimote configs
ini.Get("Wiimote", "AutoReconnectRealWiimote", &m_WiiAutoReconnect, false);
// Plugins
ini.Get("Core", "GFXPlugin", &m_LocalCoreStartupParameter.m_strVideoPlugin, m_DefaultGFXPlugin.c_str());
ini.Get("Core", "DSPPlugin", &m_LocalCoreStartupParameter.m_strDSPPlugin, m_DefaultDSPPlugin.c_str());
ini.Get("Core", "PadPlugin", &m_LocalCoreStartupParameter.m_strPadPlugin[0], m_DefaultPADPlugin.c_str());
ini.Get("Core", "WiiMotePlugin", &m_LocalCoreStartupParameter.m_strWiimotePlugin[0], m_DefaultWiiMotePlugin.c_str());
}
m_SYSCONF = new SysConf();
}
// Is this still even needed????
void SConfig::LoadSettingsHLE()
{
IniFile ini;

View File

@ -44,6 +44,7 @@ struct SConfig
// Wii Devices
bool m_WiiSDCard;
bool m_WiiKeyboard;
bool m_WiiAutoReconnect;
// DSP HLE Audio fix
bool m_EnableRE0Fix;

View File

@ -173,7 +173,16 @@ CPanel::CPanel(
main_frame->bNoWiimoteMsg = false;
else
{
// The Wiimote has been disconnected, we offer reconnect here
//Auto reconnect if option is turned on.
//TODO: Make this only auto reconnect wiimotes that have the option activated.
if (SConfig::GetInstance().m_WiiAutoReconnect)
{
GetUsbPointer()->AccessWiiMote(lParam | 0x100)->Activate(true);
NOTICE_LOG(WIIMOTE, "Wiimote %i has been auto-reconnected...", lParam + 1);
}
else
{
// The Wiimote has been disconnected, we offer reconnect here.
wxMessageDialog *dlg = new wxMessageDialog(
this,
wxString::Format(wxT("Wiimote %i has been disconnected by system.\n")
@ -191,6 +200,7 @@ CPanel::CPanel(
}
}
}
}
break;
default:
// By default let wxWidgets do what it normally does with this event

View File

@ -326,6 +326,14 @@ void Config::Load()
iniFile.Get(SectionName, "TriggerType", &WiiMoteEmu::WiiMapping[i].TriggerType, 0);
}
iniFile.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "Dolphin.ini").c_str());
for (int i = 0; i < MAX_WIIMOTES; i++)
{
char SectionName[32];
sprintf(SectionName, "Wiimote%i", i + 1);
iniFile.Get(SectionName, "AutoReconnectRealWiimote", &WiiMoteEmu::WiiMapping[i].bWiiAutoReconnect, false);
}
Config::LoadIR();
// Load a few screen settings to. If these are added to the DirectX plugin it's probably
@ -386,7 +394,6 @@ void Config::Save()
iniFile.Set(SectionName, "Upright", WiiMoteEmu::WiiMapping[i].bUpright);
iniFile.Set(SectionName, "ExtensionConnected", WiiMoteEmu::WiiMapping[i].iExtensionConnected);
iniFile.Set(SectionName, "MotionPlusConnected", WiiMoteEmu::WiiMapping[i].bMotionPlusConnected);
iniFile.Set(SectionName, "TiltInputWM", WiiMoteEmu::WiiMapping[i].Tilt.InputWM);
iniFile.Set(SectionName, "TiltInputNC", WiiMoteEmu::WiiMapping[i].Tilt.InputNC);
iniFile.Set(SectionName, "TiltRollDegree", WiiMoteEmu::WiiMapping[i].Tilt.RollDegree);
@ -438,5 +445,10 @@ void Config::Save()
iniFile.Set(TmpSection, "IRLevel", iIRLevel);
iniFile.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "IR Pointer.ini").c_str());
//Save any options that need to be accessed in Dolphin
iniFile.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "Dolphin.ini").c_str());
iniFile.Set("Wiimote" , "AutoReconnectRealWiimote", &WiiMoteEmu::WiiMapping[0].bWiiAutoReconnect);
iniFile.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "Dolphin.ini").c_str());
//DEBUG_LOG(WIIMOTE, "Save()");
}

View File

@ -42,6 +42,7 @@ BEGIN_EVENT_TABLE(WiimoteBasicConfigDialog,wxDialog)
EVT_CHECKBOX(IDC_SIDEWAYSWIIMOTE, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(IDC_UPRIGHTWIIMOTE, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(IDC_MOTIONPLUSCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(IDC_WIIAUTORECONNECT, WiimoteBasicConfigDialog::GeneralSettingsChanged)
EVT_CHOICE(IDC_EXTCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged)
// IR cursor
EVT_COMMAND_SCROLL(IDS_WIDTH, WiimoteBasicConfigDialog::IRCursorChanged)
@ -177,6 +178,9 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
m_ConnectRealWiimote[i] = new wxButton(m_Controller[i], IDB_REFRESH_REAL, wxT("Refresh Real Wiimotes"));
m_ConnectRealWiimote[i]->SetToolTip(wxT("This can only be done when the emulator is paused or stopped."));
m_WiiAutoReconnect[i] = new wxCheckBox(m_Controller[i], IDC_WIIAUTORECONNECT, wxT("Auto reconenct wiimote"), wxDefaultPosition, wxSize(-1, -1), 0, wxDefaultValidator);
m_WiiAutoReconnect[i]->SetToolTip(wxT("This makes dolphin automatically reconnect a wiimote when it has being disconnected.\nThis will cause problems when 2 controllers are connected for a 1 player game."));
//IR Pointer
m_TextScreenWidth[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Width: 000"));
m_TextScreenHeight[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Height: 000"));
@ -211,10 +215,12 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
m_SizeExtensions[i]->Add(m_WiiMotionPlusConnected[i], 0, wxEXPAND | wxALL, 5);
m_SizeExtensions[i]->Add(m_Extension[i], 0, wxEXPAND | wxALL, 5);
m_SizeReal[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Real Wiimote"));
m_SizeReal[i]->Add(m_PairUpRealWiimote[i], 0, wxEXPAND | wxALL, 5);
m_SizeReal[i]->Add(m_TextFoundRealWiimote[i], 0, wxEXPAND | wxALL, 5);
m_SizeReal[i]->Add(m_ConnectRealWiimote[i], 0, wxEXPAND | wxALL, 5);
m_SizeReal[i]->Add(m_WiiAutoReconnect[i], 0, wxEXPAND | wxALL, 5);
m_SizerIRPointerWidth[i] = new wxBoxSizer(wxHORIZONTAL);
m_SizerIRPointerWidth[i]->Add(m_TextScreenLeft[i], 0, wxEXPAND | (wxTOP), 3);
@ -407,6 +413,9 @@ void WiimoteBasicConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
case IDC_MOTIONPLUSCONNECTED:
WiiMoteEmu::WiiMapping[m_Page].bMotionPlusConnected = m_WiiMotionPlusConnected[m_Page]->IsChecked();
break;
case IDC_WIIAUTORECONNECT:
WiiMoteEmu::WiiMapping[m_Page].bWiiAutoReconnect = m_WiiAutoReconnect[m_Page]->IsChecked();
break;
case IDC_EXTCONNECTED:
// Disconnect the extension so that the game recognize the change
DoExtensionConnectedDisconnected(WiiMoteEmu::EXT_NONE);
@ -483,6 +492,7 @@ void WiimoteBasicConfigDialog::UpdateGUI()
m_SidewaysWiimote[m_Page]->SetValue(WiiMoteEmu::WiiMapping[m_Page].bSideways);
m_UprightWiimote[m_Page]->SetValue(WiiMoteEmu::WiiMapping[m_Page].bUpright);
m_WiiMotionPlusConnected[m_Page]->SetValue(WiiMoteEmu::WiiMapping[m_Page].bMotionPlusConnected);
m_WiiAutoReconnect[m_Page]->SetValue(WiiMoteEmu::WiiMapping[m_Page].bWiiAutoReconnect);
m_Extension[m_Page]->SetSelection(WiiMoteEmu::WiiMapping[m_Page].iExtensionConnected);
// Update the Wiimote IR pointer calibration

View File

@ -83,7 +83,8 @@ class WiimoteBasicConfigDialog : public wxDialog
*m_WiiMotionPlusConnected[MAX_WIIMOTES],
*m_CheckAR43[MAX_WIIMOTES],
*m_CheckAR169[MAX_WIIMOTES],
*m_Crop[MAX_WIIMOTES];
*m_Crop[MAX_WIIMOTES],
*m_WiiAutoReconnect[MAX_WIIMOTES];
wxStaticText *m_TextScreenWidth[MAX_WIIMOTES],
*m_TextScreenHeight[MAX_WIIMOTES],
@ -127,6 +128,7 @@ class WiimoteBasicConfigDialog : public wxDialog
IDC_SIDEWAYSWIIMOTE,
IDC_UPRIGHTWIIMOTE,
IDC_MOTIONPLUSCONNECTED,
IDC_WIIAUTORECONNECT,
IDC_EXTCONNECTED,
// Real

View File

@ -295,6 +295,7 @@ struct CONTROLLER_MAPPING_WII // WII PAD MAPPING
bool bSideways;
bool bUpright;
bool bMotionPlusConnected;
bool bWiiAutoReconnect;
int iExtensionConnected;
STiltMapping Tilt;