sanchez's patch for real wiimote pair-up, unexpected disconnect, and wiiuse resource leakage.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5313 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman
2010-04-10 14:39:54 +00:00
parent 474363bc27
commit 4b5b074b81
7 changed files with 56 additions and 15 deletions

View File

@ -140,7 +140,11 @@ void ReadData()
//DEBUG_LOG(WIIMOTE, "Writing data to the Wiimote");
SEvent& rEvent = m_EventWriteQueue.front();
wiiuse_io_write(m_pWiiMote, (byte*)rEvent.m_PayLoad, rEvent._Size);
m_EventWriteQueue.pop();
if (m_pWiiMote->event == WIIUSE_UNEXPECTED_DISCONNECT)
{
NOTICE_LOG(WIIMOTE, "wiiuse_io_write: unexpected disconnect. handle: %08x", m_pWiiMote->dev_handle);
}
m_EventWriteQueue.pop();
// InterruptDebugging(false, rEvent.m_PayLoad);
}
@ -176,6 +180,10 @@ void ReadData()
m_pCriticalSection->Leave();
}
}
else if (m_pWiiMote->event == WIIUSE_UNEXPECTED_DISCONNECT)
{
NOTICE_LOG(WIIMOTE, "wiiuse_io_read: unexpected disconnect. handle: %08x", m_pWiiMote->dev_handle);
}
};
@ -339,6 +347,8 @@ int Initialize()
// and also connecting in Linux/OSX.
// Windows connects to Wiimote in the wiiuse_find function
g_pReadThread = new Common::Thread(ReadWiimote_ThreadFunc, NULL);
// Don't run the Wiimote thread if no wiimotes were found
g_Shutdown = false;
NeedsConnect.Set();
Connected.Wait();
}
@ -384,10 +394,6 @@ int Initialize()
wiiuse_read_data(g_WiiMotesFromWiiUse[i], data, 0, sizeof(WiiMoteEmu::EepromData_0));
}
// Don't run the Wiimote thread if no wiimotes were found
if (g_NumberOfWiiMotes > 0)
g_Shutdown = false;
// Initialized, even if we didn't find a Wiimote
g_RealWiiMoteInitialized = true;