From dac266623609a6b54df36ea36aebe43b324979fe Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Sun, 15 Aug 2010 23:03:15 +0000 Subject: [PATCH] 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 --- Source/Core/InputUICommon/Src/ConfigDiag.cpp | 22 ++++++++++++------- .../Src/WiimoteReal/WiimoteReal.cpp | 3 --- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Source/Core/InputUICommon/Src/ConfigDiag.cpp b/Source/Core/InputUICommon/Src/ConfigDiag.cpp index 251aa23c52..4dd75f6993 100644 --- a/Source/Core/InputUICommon/Src/ConfigDiag.cpp +++ b/Source/Core/InputUICommon/Src/ConfigDiag.cpp @@ -585,7 +585,7 @@ void GamepadPage::GetProfilePath(std::string& path) } } -void GamepadPage::LoadProfile( wxCommandEvent& event ) +void GamepadPage::LoadProfile(wxCommandEvent& event) { std::string fname; GamepadPage::GetProfilePath(fname); @@ -604,7 +604,7 @@ void GamepadPage::LoadProfile( wxCommandEvent& event ) UpdateGUI(); } -void GamepadPage::SaveProfile( wxCommandEvent& event ) +void GamepadPage::SaveProfile(wxCommandEvent& event) { std::string fname; GamepadPage::GetProfilePath(fname); @@ -615,22 +615,27 @@ void GamepadPage::SaveProfile( wxCommandEvent& event ) IniFile inifile; controller->SaveConfig(inifile.GetOrCreateSection("Profile")); inifile.Save(fname); + + m_config_dialog->UpdateProfileComboBox(); } - - m_config_dialog->UpdateProfileComboBox(); + else + PanicAlert("You must enter a valid profile name."); } -void GamepadPage::DeleteProfile( wxCommandEvent& event ) +void GamepadPage::DeleteProfile(wxCommandEvent& event) { std::string fname; GamepadPage::GetProfilePath(fname); 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); - m_config_dialog->UpdateProfileComboBox(); + m_config_dialog->UpdateProfileComboBox(); + } } void InputConfigDialog::UpdateDeviceComboBox() @@ -641,7 +646,8 @@ void InputConfigDialog::UpdateDeviceComboBox() for ( ; i != e; ++i ) { (*i)->device_cbox->Clear(); - std::vector::const_iterator di = m_plugin.controller_interface.Devices().begin(), + std::vector::const_iterator + di = m_plugin.controller_interface.Devices().begin(), de = m_plugin.controller_interface.Devices().end(); for ( ; di!=de; ++di ) { diff --git a/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteReal/WiimoteReal.cpp b/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteReal/WiimoteReal.cpp index 50ebc64ac8..1f0cae2568 100644 --- a/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteReal/WiimoteReal.cpp +++ b/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteReal/WiimoteReal.cpp @@ -101,9 +101,6 @@ void Wiimote::DisableDataReporting() void Wiimote::ClearReadQueue() { - // might be silly - while (wiiuse_io_read(wiimote)) {}; - if (m_last_data_report) { delete[] m_last_data_report;