Wiimote: Added timeout for Eeprom data reading, it should fail very rarely, but if it would we now stop waiting for it after two seconds. If it fails it will break the functionality of the real wiimote because g_WiiMotes[i]->ReadData() will not be called by ReadWiimote_ThreadFunc() while we are waiting for it.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2115 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-02-05 00:02:54 +00:00
parent a0724e8321
commit c9c95534c8
5 changed files with 111 additions and 15 deletions

View File

@ -248,6 +248,21 @@ void ReadWiimote()
handle_event(g_WiiMotesFromWiiUse[0]);
std::string Temp;
/* Timeout for data reading. This is used in Initialize() to read the Eeprom, if we have not gotten
what we wanted in the WIIUSE_READ_DATA case we stop this loop to avoid interference with the regular
wiiuse_io_read() and wiiuse_io_write() communication. */
if (g_RunTemporary)
{
// This holds if the update rate of wiiuse_poll() is kept at the default value of 10 ms
static const int SecondsToWait = 2;
g_RunTemporaryCountdown++;
if(g_RunTemporaryCountdown > (SecondsToWait * 100))
{
g_RunTemporaryCountdown = 0;
g_RunTemporary = false;
}
}
// Read formatted Wiimote data
if (wiiuse_poll(g_WiiMotesFromWiiUse, MAX_WIIMOTES))
{