diff --git a/Source/Plugins/Plugin_Wiimote/Src/Config.cpp b/Source/Plugins/Plugin_Wiimote/Src/Config.cpp index 94c6f28e84..57fb709175 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/Config.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/Config.cpp @@ -44,9 +44,9 @@ static const char* wmControlNames[] = "WmR", "WmU", "WmD", - "WmShake", "WmPitchL", "WmPitchR", + "WmShake", }; static int wmDefaultControls[] = { @@ -62,17 +62,17 @@ static int wmDefaultControls[] = VK_RIGHT, VK_UP, VK_DOWN, - VK_OEM_2, // /? VK_OEM_COMMA, - VK_OEM_PERIOD + VK_OEM_PERIOD, + VK_OEM_2 // / #elif defined(HAVE_X11) && HAVE_X11 XK_Left, XK_Right, XK_Up, XK_Down, - XK_slash, XK_comma, - XK_period + XK_period, + XK_slash #else 0,0,0,0,0,0,0 #endif diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.cpp index 827e1c4edd..172de37f03 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.cpp @@ -67,21 +67,8 @@ WiimoteBasicConfigDialog::WiimoteBasicConfigDialog(wxWindow *parent, wxWindowID void WiimoteBasicConfigDialog::OnClose(wxCloseEvent& event) { - event.Skip(); g_FrameOpen = false; g_Config.Save(); - if (m_PadConfigFrame) - { - delete m_PadConfigFrame; - m_PadConfigFrame = NULL; - } - if (m_RecordingConfigFrame) - { - delete m_RecordingConfigFrame; - m_RecordingConfigFrame = NULL; - } - if (!g_EmulatorRunning) - Shutdown(); EndModal(wxID_CLOSE); } @@ -90,13 +77,10 @@ void WiimoteBasicConfigDialog::OnClose(wxCloseEvent& event) We must therefore shut down the thread from here and wait for that before we can call ShutDown(). */ void WiimoteBasicConfigDialog::ShutDown(wxTimerEvent& WXUNUSED(event)) { - // Wait for the Wiimote thread to stop, then close and shutdown - WiiMoteReal::g_Shutdown = true; - m_ShutDownTimer->Start(10); - if(!WiiMoteReal::g_ThreadGoing) { m_ShutDownTimer->Stop(); + Close(); } } @@ -105,24 +89,32 @@ void WiimoteBasicConfigDialog::ButtonClick(wxCommandEvent& event) switch(event.GetId()) { case ID_CLOSE: - // Close() is a wxWidgets function that will trigger EVT_CLOSE() and then call this->Destroy(). - Close(); + // Wait for the Wiimote thread to stop, then close and shutdown + if(!g_EmulatorRunning) + { + WiiMoteReal::g_Shutdown = true; + m_ShutDownTimer->Start(10); + } + // Close directly + else + { + Close(); + } break; case ID_APPLY: g_Config.Save(); break; case ID_BUTTONMAPPING: - if (!m_PadConfigFrame) - m_PadConfigFrame = new WiimotePadConfigDialog(this); - if (!m_PadConfigFrame->IsShown()) - m_PadConfigFrame->ShowModal(); + m_PadConfigFrame = new WiimotePadConfigDialog(this); + m_PadConfigFrame->ShowModal(); + m_PadConfigFrame->Destroy(); + m_PadConfigFrame = NULL; break; case ID_BUTTONRECORDING: - if (!m_RecordingConfigFrame) - m_RecordingConfigFrame = new WiimoteRecordingConfigDialog(this); - - if (!m_RecordingConfigFrame->IsShown()) - m_RecordingConfigFrame->ShowModal(); + m_RecordingConfigFrame = new WiimoteRecordingConfigDialog(this); + m_RecordingConfigFrame->ShowModal(); + m_RecordingConfigFrame->Destroy(); + m_RecordingConfigFrame = NULL; break; } } diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp index 1fa9c476cf..fee51a7d2a 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp @@ -445,8 +445,9 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId) // Check for buttons // If there is a timer but we should not create a new one - else + else if (WiiMoteEmu::NumGoodPads >0) { + InputCommon::GetButton( WiiMoteEmu::joyinfo[PadID].joy, PadID, WiiMoteEmu::joyinfo[PadID].NumButtons, WiiMoteEmu::joyinfo[PadID].NumAxes, WiiMoteEmu::joyinfo[PadID].NumHats, g_Pressed, value, type, pressed, Succeed, Stop, diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp index 1652b1ee62..ee6c949421 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp @@ -214,10 +214,10 @@ void WiimotePadConfigDialog::OnButtonClick(wxCommandEvent& event) void WiimotePadConfigDialog::OnClose(wxCloseEvent& event) { - event.Skip(); - g_FrameOpen = false; - if(m_UpdatePad) + if (m_UpdatePad) m_UpdatePad->Stop(); + if (m_ButtonMappingTimer) + m_ButtonMappingTimer->Stop(); SaveButtonMappingAll(Page); EndModal(wxID_CLOSE); } @@ -681,9 +681,9 @@ void WiimotePadConfigDialog::CreatePadGUIControls() wxT("Right"), wxT("Up"), wxT("Down"), - wxT("Shake"), wxT("Pitch Left"), wxT("Pitch Right"), + wxT("Shake"), }; diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigRecordingDlg.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigRecordingDlg.cpp index 8f21d07077..341c03f11d 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigRecordingDlg.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigRecordingDlg.cpp @@ -85,8 +85,6 @@ WiimoteRecordingConfigDialog::WiimoteRecordingConfigDialog(wxWindow *parent, wxW void WiimoteRecordingConfigDialog::OnClose(wxCloseEvent& event) { - event.Skip(); - g_FrameOpen = false; SaveFile(); EndModal(wxID_CLOSE); } diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h index ef622533ed..f8b6f65699 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h @@ -181,8 +181,8 @@ struct KeyboardWiimote ONE, TWO, P, M, H, L, R, U, D, - SHAKE, PITCH_L, PITCH_R, + SHAKE, MA, MB, LAST_CONSTANT }; diff --git a/Source/Plugins/Plugin_Wiimote/Src/main.cpp b/Source/Plugins/Plugin_Wiimote/Src/main.cpp index 5165eb61b0..326ed4ee49 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/main.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/main.cpp @@ -191,9 +191,13 @@ void DllConfig(HWND _hParent) if (!m_BasicConfigFrame) m_BasicConfigFrame = new WiimoteBasicConfigDialog(GetParentedWxWindow(_hParent)); + else if (!m_BasicConfigFrame->GetParent()->IsShown()) + m_BasicConfigFrame->Close(true); // Only allow one open at a time if (!m_BasicConfigFrame->IsShown()) m_BasicConfigFrame->ShowModal(); + else + m_BasicConfigFrame->Hide(); #endif }