From 89594b173111b1185babe65ea9b5d596cc443458 Mon Sep 17 00:00:00 2001 From: skidau Date: Sun, 6 Feb 2011 05:42:58 +0000 Subject: [PATCH] Automatically disconnect and reconnect the Wiimotes after a save state has been loaded. This makes the save states a bit more stable for Wii games. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7090 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp index 78541e609e..da8b06748c 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp @@ -111,13 +111,22 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::DoState(PointerWrap &p) p.Do(m_NumCompPackets_Freq); p.Do(m_WiimoteUpdate_Freq); - for (int i = 0; i < 4; i++) + if (p.GetMode() == PointerWrap::MODE_READ) { - p.Do(m_PacketCount[i]); + // Reset the connection of all connected wiimotes + for (unsigned int i = 0; i < 4; i++) + { + if (m_WiiMotes[i].IsConnected()) + { + m_WiiMotes[i].Activate(false); + m_WiiMotes[i].Activate(true); + } + else + { + m_WiiMotes[i].Activate(false); + } + } } - - for (unsigned int i = 0; i < m_WiiMotes.size(); i++) - m_WiiMotes[i].DoState(p); } bool CWII_IPC_HLE_Device_usb_oh1_57e_305::RemoteDisconnect(u16 _connectionHandle)