From 7c3a3ce46d16375c2cffafa022ec035577d5a636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sat, 23 Jul 2016 11:02:15 +0200 Subject: [PATCH] Fix Wiimotes not reconnecting on button press 5.0-56 broke reconnecting a Wiimote on button press; this is because data reporting was now always stopped for real Wii remotes on disconnect, making it impossible to know a button was pressed in the first place (to reconnect the Wiimote). This semi-reverts to the previous behaviour, where data reporting is never stopped. (Also, control channels now go through WiimoteEmu, just like before, to make sure some things are reset on disconnection.) Hopefully fixes issue 9711. --- Source/Core/Core/HW/Wiimote.cpp | 4 +--- Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp | 2 ++ Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp | 4 +--- Source/Core/Core/HW/WiimoteReal/WiimoteReal.h | 4 ++-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Source/Core/Core/HW/Wiimote.cpp b/Source/Core/Core/HW/Wiimote.cpp index d10620c4fb..69c78448d2 100644 --- a/Source/Core/Core/HW/Wiimote.cpp +++ b/Source/Core/Core/HW/Wiimote.cpp @@ -71,9 +71,7 @@ void Pause() // An L2CAP packet is passed from the Core to the Wiimote on the HID CONTROL channel. void ControlChannel(int number, u16 channel_id, const void* data, u32 size) { - if (WIIMOTE_SRC_REAL & g_wiimote_sources[number]) - WiimoteReal::ControlChannel(number, channel_id, data, size); - else if (WIIMOTE_SRC_HYBRID & g_wiimote_sources[number]) + if (WIIMOTE_SRC_HYBRID & g_wiimote_sources[number]) static_cast(s_config.GetController(number)) ->ControlChannel(channel_id, data, size); } diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp index 039d89679f..276943b578 100644 --- a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp @@ -771,6 +771,8 @@ void Wiimote::ControlChannel(const u16 _channelID, const void* _pData, u32 _Size // Wiimote disconnected // reset eeprom/register/reporting mode Reset(); + if (WIIMOTE_SRC_REAL & g_wiimote_sources[m_index]) + WiimoteReal::ControlChannel(m_index, _channelID, _pData, _Size); return; } diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp index df8e65d0f2..af62ece6ba 100644 --- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp @@ -121,12 +121,10 @@ void Wiimote::ClearReadQueue() void Wiimote::ControlChannel(const u16 channel, const void* const data, const u32 size) { // Check for custom communication - if (99 == channel) + if (channel == 99) { if (m_really_disconnect) DisconnectInternal(); - else - EmuStop(); } else { diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h index e4e823bece..b576788157 100644 --- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h +++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.h @@ -81,8 +81,8 @@ protected: Report m_last_input_report; u16 m_channel; u8 m_last_connect_request_counter; - // If true, the Wiimote will be really disconnected when it is disconnected by Dolphin, - // instead of just pausing data reporting. + // If true, the Wiimote will be really disconnected when it is disconnected by Dolphin. + // In any other case, data reporting is not paused to allow reconnecting on any button press. // This is not enabled on all platforms as connecting a Wiimote can be a pain on some platforms. bool m_really_disconnect = false;