New Wiimote Plugin: Fix hang on close issue of my last commit.(thanks to glennrics) Made profile saving/deleting a bit more user friendly.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6097 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak 2010-08-15 23:03:15 +00:00
parent 7c7257b825
commit dac2666236
2 changed files with 14 additions and 11 deletions

View File

@ -585,7 +585,7 @@ void GamepadPage::GetProfilePath(std::string& path)
} }
} }
void GamepadPage::LoadProfile( wxCommandEvent& event ) void GamepadPage::LoadProfile(wxCommandEvent& event)
{ {
std::string fname; std::string fname;
GamepadPage::GetProfilePath(fname); GamepadPage::GetProfilePath(fname);
@ -604,7 +604,7 @@ void GamepadPage::LoadProfile( wxCommandEvent& event )
UpdateGUI(); UpdateGUI();
} }
void GamepadPage::SaveProfile( wxCommandEvent& event ) void GamepadPage::SaveProfile(wxCommandEvent& event)
{ {
std::string fname; std::string fname;
GamepadPage::GetProfilePath(fname); GamepadPage::GetProfilePath(fname);
@ -615,22 +615,27 @@ void GamepadPage::SaveProfile( wxCommandEvent& event )
IniFile inifile; IniFile inifile;
controller->SaveConfig(inifile.GetOrCreateSection("Profile")); controller->SaveConfig(inifile.GetOrCreateSection("Profile"));
inifile.Save(fname); inifile.Save(fname);
m_config_dialog->UpdateProfileComboBox();
} }
else
m_config_dialog->UpdateProfileComboBox(); PanicAlert("You must enter a valid profile name.");
} }
void GamepadPage::DeleteProfile( wxCommandEvent& event ) void GamepadPage::DeleteProfile(wxCommandEvent& event)
{ {
std::string fname; std::string fname;
GamepadPage::GetProfilePath(fname); GamepadPage::GetProfilePath(fname);
const char* const fnamecstr = fname.c_str(); const char* const fnamecstr = fname.c_str();
if (File::Exists(fnamecstr)) if (File::Exists(fnamecstr) && AskYesNo("Are you sure you want to delete \"%s\"?",
STR_FROM_WXSTR(profile_cbox->GetValue()).c_str()))
{
File::Delete(fnamecstr); File::Delete(fnamecstr);
m_config_dialog->UpdateProfileComboBox(); m_config_dialog->UpdateProfileComboBox();
}
} }
void InputConfigDialog::UpdateDeviceComboBox() void InputConfigDialog::UpdateDeviceComboBox()
@ -641,7 +646,8 @@ void InputConfigDialog::UpdateDeviceComboBox()
for ( ; i != e; ++i ) for ( ; i != e; ++i )
{ {
(*i)->device_cbox->Clear(); (*i)->device_cbox->Clear();
std::vector<ControllerInterface::Device*>::const_iterator di = m_plugin.controller_interface.Devices().begin(), std::vector<ControllerInterface::Device*>::const_iterator
di = m_plugin.controller_interface.Devices().begin(),
de = m_plugin.controller_interface.Devices().end(); de = m_plugin.controller_interface.Devices().end();
for ( ; di!=de; ++di ) for ( ; di!=de; ++di )
{ {

View File

@ -101,9 +101,6 @@ void Wiimote::DisableDataReporting()
void Wiimote::ClearReadQueue() void Wiimote::ClearReadQueue()
{ {
// might be silly
while (wiiuse_io_read(wiimote)) {};
if (m_last_data_report) if (m_last_data_report)
{ {
delete[] m_last_data_report; delete[] m_last_data_report;