From e36757bec1bc5d4c4ad037e9f7f1ae68db8f4015 Mon Sep 17 00:00:00 2001 From: John Peterson Date: Thu, 11 Jul 2013 07:16:02 +0200 Subject: [PATCH 1/2] Adding read data reply to the real Wiimote because the emulated program expect it --- Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index f518cebf7f..93f9a4eae6 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -299,6 +299,11 @@ void Wiimote::Update() return; } + WiimoteEmu::Wiimote *const wm = (WiimoteEmu::Wiimote*)::Wiimote::GetPlugin()->controllers[index]; + + if (wm->Step()) + return; + // Pop through the queued reports const Report& rpt = ProcessReadQueue(); From fd4a4410e56d0f92c91408bbb353eea43ccbda89 Mon Sep 17 00:00:00 2001 From: John Peterson Date: Thu, 11 Jul 2013 08:17:00 +0200 Subject: [PATCH 2/2] Removing wait for real Wiimote connection when * opening the Wiimote configuration dialog * booting from the emulated program entry point rather than a state because * it doesn't have meaning in these scenarios * it has meaning when booting from a state --- Source/Core/Core/Src/Core.cpp | 2 +- Source/Core/Core/Src/HW/Wiimote.cpp | 4 ++-- Source/Core/Core/Src/HW/Wiimote.h | 4 ++-- .../Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 21 +++++++++++-------- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index e3addf2f59..721bcbf3e3 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -391,7 +391,7 @@ void EmuThread() // Load and Init Wiimotes - only if we are booting in wii mode if (g_CoreStartupParameter.bWii) { - Wiimote::Initialize(g_pWindowHandle); + Wiimote::Initialize(g_pWindowHandle, !g_stateFileName.empty()); // Activate wiimotes which don't have source set to "None" for (unsigned int i = 0; i != MAX_BBMOTES; ++i) diff --git a/Source/Core/Core/Src/HW/Wiimote.cpp b/Source/Core/Core/Src/HW/Wiimote.cpp index 8cbe62dfcd..0bf10b343d 100644 --- a/Source/Core/Core/Src/HW/Wiimote.cpp +++ b/Source/Core/Core/Src/HW/Wiimote.cpp @@ -38,7 +38,7 @@ void Shutdown() } // if plugin isn't initialized, init and load config -void Initialize(void* const hwnd) +void Initialize(void* const hwnd, bool wait) { // add 4 wiimotes for (unsigned int i = WIIMOTE_CHAN_0; i found_wiimotes; - Wiimote* found_board = NULL; - g_wiimote_scanner.FindWiimotes(found_wiimotes, found_board); - if (SConfig::GetInstance().m_WiimoteContinuousScanning) + if (wait) { - while(CalculateWantedWiimotes() && CalculateConnectedWiimotes() < found_wiimotes.size() && timeout) + int timeout = 100; + std::vector found_wiimotes; + Wiimote* found_board = NULL; + g_wiimote_scanner.FindWiimotes(found_wiimotes, found_board); + if (SConfig::GetInstance().m_WiimoteContinuousScanning) { - Common::SleepCurrentThread(100); - timeout--; + while(CalculateWantedWiimotes() && CalculateConnectedWiimotes() < found_wiimotes.size() && timeout) + { + Common::SleepCurrentThread(100); + timeout--; + } } }