diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.cpp index 9373705007..ecf75053cc 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.cpp @@ -146,8 +146,8 @@ void ConfigDialog::CreateGUIControls() wxStaticBoxSizer * sbRealBasic = new wxStaticBoxSizer(wxVERTICAL, m_PageReal, wxT("Basic Settings")); m_ConnectRealWiimote = new wxCheckBox(m_PageReal, ID_CONNECT_REAL, wxT("Connect real Wiimote")); m_UseRealWiimote = new wxCheckBox(m_PageReal, ID_USE_REAL, wxT("Use real Wiimote")); - m_ConnectRealWiimote->SetToolTip(wxT("Connected to the real wiimote")); - m_UseRealWiimote->SetToolTip(wxT("Use the real Wiimote in the game")); + m_ConnectRealWiimote->SetToolTip(wxT("Connected to the real wiimote. This can not be changed during gameplay.")); + m_UseRealWiimote->SetToolTip(wxT("Use the real Wiimote in the game. This can be changed during gameplay.")); m_ConnectRealWiimote->SetValue(g_Config.bConnectRealWiimote); m_UseRealWiimote->SetValue(g_Config.bUseRealWiimote); @@ -284,6 +284,9 @@ void ConfigDialog::DoConnectReal() // ---------------- void ConfigDialog::DoExtensionConnectedDisconnected() { + // There is no need for this if no game is running + if(!g_EmulatorRunning) return; + u8 DataFrame[8]; // make a blank report for it wm_request_status *rs = (wm_request_status*)DataFrame; @@ -318,16 +321,18 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event) DoExtensionConnectedDisconnected(); /* It doesn't seem to be needed but shouldn't it at least take 25 ms to reconnect an extension after we disconnected another? */ - Sleep(25); + if(g_EmulatorRunning) Sleep(25); } // Update status g_Config.bNunchuckConnected = m_NunchuckConnected->IsChecked(); - // Generate connect/disconnect status event + // Copy the calibration data memcpy(WiiMoteEmu::g_RegExt + 0x20, WiiMoteEmu::nunchuck_calibration, sizeof(WiiMoteEmu::nunchuck_calibration)); memcpy(WiiMoteEmu::g_RegExt + 0xfa, WiiMoteEmu::nunchuck_id, sizeof(WiiMoteEmu::nunchuck_id)); + + // Generate connect/disconnect status event DoExtensionConnectedDisconnected(); break; @@ -343,10 +348,11 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event) g_Config.bClassicControllerConnected = m_ClassicControllerConnected->IsChecked(); - // Generate connect/disconnect status event + // Copy the calibration data memcpy(WiiMoteEmu::g_RegExt + 0x20, WiiMoteEmu::classic_calibration, sizeof(WiiMoteEmu::classic_calibration)); memcpy(WiiMoteEmu::g_RegExt + 0xfa, WiiMoteEmu::classic_id, sizeof(WiiMoteEmu::classic_id)); + // Generate connect/disconnect status event DoExtensionConnectedDisconnected(); break; diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp index 4303ac74c6..f83f656ac5 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp @@ -152,8 +152,7 @@ void DoState(void* ptr, int mode) /* We don't need to do anything here. All values will be reset as FreeLibrary() is called when we stop a game */ void Shutdown(void) -{ -} +{} // =================================================== diff --git a/Source/Plugins/Plugin_Wiimote/Src/main.cpp b/Source/Plugins/Plugin_Wiimote/Src/main.cpp index 7d887f881f..6b8487441a 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/main.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/main.cpp @@ -164,20 +164,23 @@ extern "C" void Initialize(void *init) DoInitialize(); } +// If a game is not running this is called by the Configuration window when it's closed extern "C" void Shutdown(void) { + // Not running + g_EmulatorRunning = false; + // We will only shutdown when both a game and the frame is closed if (g_FrameOpen) { #if defined(HAVE_WX) && HAVE_WX if(frame) frame->UpdateGUI(); #endif + + // Don't shut down the wiimote when we still have the window open return; } - // Not running - g_EmulatorRunning = false; - #if HAVE_WIIUSE if(g_RealWiiMoteInitialized) WiiMoteReal::Shutdown(); #endif