From 0fa1f968c769e1c093bd2a1f2827f43354fe8b87 Mon Sep 17 00:00:00 2001 From: ayuanx Date: Wed, 9 Dec 2009 15:29:39 +0000 Subject: [PATCH] I think this should fix the "Wiimote sudden death after 15 min" issue, actually I announced this was a test in the log message of r4647, but it seems no one has noticed. Added the missing file in last rev. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4664 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp | 35 +++++++++---------- Source/Core/InputCommon/Src/SDL.h | 22 +++++++----- 2 files changed, 29 insertions(+), 28 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 bf4b2cbd8c..43d18e4129 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 @@ -468,25 +468,6 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update() } } -// This seems not necessary at all or at least not helping to avoid de-sync at all??? -/* - // AyuanX: This event should be sent periodically after ACL connection is accepted - // or CPU will disconnect WiiMote automatically - // but don't send too many or it will jam the bus and cost extra CPU time - // - if (m_HCIBuffer.m_address && !WII_IPCInterface::GetAddress() && m_WiiMotes[0].IsConnected()) - { - m_FreqDividerSync++; - if ((m_PacketCount > 0) || (m_FreqDividerSync > 100)) // Feel free to tweak it - { - m_FreqDividerSync = 0; - SendEventNumberOfCompletedPackets(m_WiiMotes[0].GetConnectionHandle(), m_PacketCount); - m_PacketCount = 0; - return true; - } - } -*/ - // The Real Wiimote sends report at a fixed frequency of 100Hz // So let's make it also 100Hz here // Calculation: 15000Hz (IPC_HLE) / 100Hz (WiiMote) = 150 @@ -501,6 +482,22 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update() } } + // This event should be sent periodically after ACL connection is accepted + // or CPU will disconnect WiiMote automatically + // but don't send too many or it will jam the bus and cost extra CPU time + // TODO: Figure out the correct frequency to send this thing + if (m_HCIBuffer.m_address && !WII_IPCInterface::GetAddress() && m_WiiMotes[0].IsConnected()) + { + m_FreqDividerSync++; + if ((m_PacketCount > 0) || (m_FreqDividerSync >= 100)) // Feel free to tweak it + { + m_FreqDividerSync = 0; + SendEventNumberOfCompletedPackets(m_WiiMotes[0].GetConnectionHandle(), m_PacketCount); + m_PacketCount = 0; + return true; + } + } + return false; } diff --git a/Source/Core/InputCommon/Src/SDL.h b/Source/Core/InputCommon/Src/SDL.h index 30f43a94df..e607b7b54d 100644 --- a/Source/Core/InputCommon/Src/SDL.h +++ b/Source/Core/InputCommon/Src/SDL.h @@ -169,14 +169,18 @@ enum }; -struct PadAxis +union PadAxis { - int Lx; - int Ly; - int Rx; - int Ry; - int Tl; // Triggers - int Tr; + int keyForControls[6]; + struct + { + int Lx; + int Ly; + int Rx; + int Ry; + int Tl; // Trigger + int Tr; // Trigger + }; }; struct PadWiimote { @@ -184,7 +188,6 @@ struct PadWiimote // Order is A, B, 1, 2, +, -, Home // L, R, U, D, RollL, RollR, PitchU, PitchD, Shake }; - struct PadNunchuck { int keyForControls[7]; @@ -201,7 +204,8 @@ struct PadGH3Controller { int keyForControls[14]; // Order is Green, Red, Yellow, Blue, Orange, - // +, -, Whammy, Al, Au, Ar, Ad, + // +, -, Whammy, + // Al, Ar, Au, Ad, // StrumUp, StrumDown }; struct CONTROLLER_STATE_NEW // GC PAD INFO/STATE