From ca7683a9117479458f47fd1b7631044b22e547c4 Mon Sep 17 00:00:00 2001 From: Sonicadvance1 Date: Wed, 1 Apr 2009 20:37:18 +0000 Subject: [PATCH] Fixed a bug in FillReport.cpp that caused the emulated Wiimote under Linux to case every button to be pressed(FillReport.cpp). Moving the read packet data one byte forward to match what is received under Windows. Don't know why the Wiimote doesn't work still git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2818 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Plugins/Plugin_Wiimote/Src/FillReport.cpp | 2 +- .../Plugin_Wiimote/Src/wiimote_real.cpp | 19 +++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp b/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp index e874bfc991..885cc632bf 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp @@ -381,7 +381,7 @@ int IsKey(int Key) default: PanicAlert("There is syntax error in a function that is calling IsKey(%i)", Key); return false; } #else - return true; + return false; #endif } ////////////////////////////////////////// diff --git a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp index 224a9db245..9291938468 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp @@ -148,8 +148,8 @@ void ReadData() //INFO_LOG(CONSOLE, "Writing data to the Wiimote\n"); SEvent& rEvent = m_EventWriteQueue.front(); wiiuse_io_write(m_pWiiMote, (byte*)rEvent.m_PayLoad, MAX_PAYLOAD); - m_EventWriteQueue.pop(); - + m_EventWriteQueue.pop(); + #ifdef _WIN32 // Debugging. Move the data one step to the right first. memcpy(rEvent.m_PayLoad + 1, rEvent.m_PayLoad, sizeof(rEvent.m_PayLoad) - 1); @@ -164,12 +164,15 @@ void ReadData() if (wiiuse_io_read(m_pWiiMote)) { const byte* pBuffer = m_pWiiMote->event_buf; - + #ifndef _WIN32 + // The Linux packets are starting out one spot before the Windows one. This should really be handled in the wiiuse library + pBuffer++; + #endif // Check if we have a channel (connection) if so save the data... if (m_channelID > 0) { m_pCriticalSection->Enter(); - + // Filter out data reports if (pBuffer[0] >= 0x30) { @@ -188,14 +191,6 @@ void ReadData() } m_pCriticalSection->Leave(); } -#ifdef _WIN32 - /* Debugging - //if(GetAsyncKeyState('V')) - { - std::string Temp = ArrayToString(pBuffer, 20, 0, 30); - INFO_LOG(CONSOLE, "Data: %s\n", Temp.c_str()); - } */ -#endif } }; /////////////////////