From f49e479d09949dd230a1b719a82b2234a9fcfccd Mon Sep 17 00:00:00 2001 From: Sonicadvance1 Date: Sun, 28 Jun 2009 10:40:19 +0000 Subject: [PATCH] Tiny work in Wiimote Linux, with an extension plugged in, the game tries reading accel data and maybe extension data, too bad the games fail to actually read the information though git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3565 8ced0084-cf51-0410-be5f-012b33b47a6e --- Externals/WiiUseSrc/Src/io_nix.c | 2 +- .../Plugins/Plugin_Wiimote/Src/wiimote_real.cpp | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Externals/WiiUseSrc/Src/io_nix.c b/Externals/WiiUseSrc/Src/io_nix.c index 9689bd02f4..31de48ba02 100644 --- a/Externals/WiiUseSrc/Src/io_nix.c +++ b/Externals/WiiUseSrc/Src/io_nix.c @@ -317,7 +317,7 @@ int wiiuse_io_read(struct wiimote_t* wm) { wiiuse_disconnected(wm); return 0; } - memcpy(wm->event_buf, &wm->event_buf[1], sizeof(wm->event_buf) - 1); + memcpy(wm->event_buf, &wm->event_buf[1], r - 1); return 1; } return 0; diff --git a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp index f33d397ba4..b4ecafc4c0 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp @@ -147,7 +147,7 @@ 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); + wiiuse_io_write(m_pWiiMote, (byte*)rEvent.m_PayLoad, m_EventWriteQueue.size()); m_EventWriteQueue.pop(); #ifdef _WIN32 @@ -349,12 +349,6 @@ int Initialize() g_NumberOfWiiMotes = wiiuse_find(g_WiiMotesFromWiiUse, MAX_WIIMOTES, 5); if (g_NumberOfWiiMotes > 0) g_RealWiiMotePresent = true; INFO_LOG(CONSOLE, "Found No of Wiimotes: %i\n", g_NumberOfWiiMotes); - // WiiUse initializes the Wiimotes in Windows right from the wiiuse_find function - // The Functionality should REALLY be changed - #ifndef _WIN32 - int Connect = wiiuse_connect(g_WiiMotesFromWiiUse, MAX_WIIMOTES); - INFO_LOG(CONSOLE, "Connected: %i\n", Connect); - #endif for (int i = 0; i < g_NumberOfWiiMotes; i++) { @@ -367,6 +361,12 @@ int Initialize() // Set flags //wiiuse_set_flags(g_WiiMotesFromWiiUse[i], NULL, WIIUSE_SMOOTHING); } + // WiiUse initializes the Wiimotes in Windows right from the wiiuse_find function + // The Functionality should REALLY be changed + #ifndef _WIN32 + int Connect = wiiuse_connect(g_WiiMotesFromWiiUse, MAX_WIIMOTES); + INFO_LOG(CONSOLE, "Connected: %i\n", Connect); + #endif // If we are connecting from the config window without a game running we flash the lights if (!g_EmulatorRunning && g_RealWiiMotePresent) FlashLights(true); @@ -475,7 +475,8 @@ void Update() // We need g_ThreadGoing to do a manual WaitForSingleObject() from the configuration window g_ThreadGoing = true; if(g_Config.bUseRealWiimote && !g_RunTemporary) - for (int i = 0; i < g_NumberOfWiiMotes; i++) g_WiiMotes[i]->ReadData(); + for (int i = 0; i < g_NumberOfWiiMotes; i++) + g_WiiMotes[i]->ReadData(); else ReadWiimote(); g_ThreadGoing = false;