Wiimote: Fixed Issue 517

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2014 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-01-26 07:29:04 +00:00
parent b0736a1508
commit 5ba7952988
3 changed files with 18 additions and 10 deletions

View File

@ -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;

View File

@ -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)
{
}
{}
// ===================================================

View File

@ -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