1. Make the domains of EmuWiimote & RealWiimote clearly separated, so I won't get tons of "Negative" and complaints about RealWiimote when I'm committing updates for EmuWiimote that has nothing to do with RealWiimote.

2. Change the frequency of WiiMote report sending to 100Hz which complies with real Wiimote hardware.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4655 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
ayuanx 2009-12-07 12:48:39 +00:00
parent 0238727c52
commit 85a9b3dc2c
3 changed files with 16 additions and 17 deletions

View File

@ -177,8 +177,7 @@ void IPC_HLE_UpdateCallback(u64 userdata, int cyclesLate)
{ {
if (Core::GetStartupParameter().bWii) if (Core::GetStartupParameter().bWii)
WII_IPC_HLE_Interface::Update(); WII_IPC_HLE_Interface::Update();
CoreTiming::ScheduleEvent(IPC_HLE_PERIOD - cyclesLate, et_IPC_HLE);
CoreTiming::ScheduleEvent(VideoInterface::GetTicksPerLine()-cyclesLate, et_IPC_HLE);
} }
void VICallback(u64 userdata, int cyclesLate) void VICallback(u64 userdata, int cyclesLate)
@ -253,9 +252,12 @@ void Init()
DSP_PERIOD = (int)(GetTicksPerSecond() * 0.003f); DSP_PERIOD = (int)(GetTicksPerSecond() * 0.003f);
// AyuanX: TO BE TWEAKED // AyuanX: TO BE TWEAKED
// If this update frequency is too high, WiiMote could easily jam the IPC Bus // Now the 15000 is a pure assumption
// but if it is too low, sometimes IPC gets overflown by CPU :~~~( // We need to figure out the real frequency though
IPC_HLE_PERIOD = (int)(GetTicksPerSecond() * 0.003f); // PS: When this period is tweaked, the FreqDividerMote
// in WII_IPC_HLE_Device_usb.cpp should also be tweaked accordingly
// to guarantee WiiMote updates at a fixed 100Hz
IPC_HLE_PERIOD = GetTicksPerSecond() / 15000;
} }
else else
{ {

View File

@ -477,7 +477,7 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
if (m_HCIBuffer.m_address && !WII_IPCInterface::GetAddress() && m_WiiMotes[0].IsConnected()) if (m_HCIBuffer.m_address && !WII_IPCInterface::GetAddress() && m_WiiMotes[0].IsConnected())
{ {
m_FreqDividerSync++; m_FreqDividerSync++;
if ((m_PacketCount > 0) || (m_FreqDividerSync > 60)) // Feel free to tweak it if ((m_PacketCount > 0) || (m_FreqDividerSync > 100)) // Feel free to tweak it
{ {
m_FreqDividerSync = 0; m_FreqDividerSync = 0;
SendEventNumberOfCompletedPackets(m_WiiMotes[0].GetConnectionHandle(), m_PacketCount); SendEventNumberOfCompletedPackets(m_WiiMotes[0].GetConnectionHandle(), m_PacketCount);
@ -487,16 +487,13 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
} }
*/ */
// AyuanX: If we let this Wiimote_Update function running freely // The Real Wiimote sends report at a fixed frequency of 100Hz
// it will exaust all the HLE time slots and block further CPU commands // So let's make it also 100Hz here
// so we have to make sure CPU and other things get the privilege to bypass this // Calculation: 15000Hz (IPC_HLE) / 100Hz (WiiMote) = 150
// Besides, decreasing its reporting frequency also brings us great FPS boost
// Now I am making it running at 1/100 frequency of IPC which is already fast enough for human input
//
if (m_ACLBuffer.m_address && !m_LastCmd && m_WiiMotes[0].IsLinked()) if (m_ACLBuffer.m_address && !m_LastCmd && m_WiiMotes[0].IsLinked())
{ {
m_FreqDividerMote++; m_FreqDividerMote++;
if(m_FreqDividerMote > 99) // Feel free to tweak it if(m_FreqDividerMote >= 150)
{ {
m_FreqDividerMote = 0; m_FreqDividerMote = 0;
CPluginManager::GetInstance().GetWiimote(0)->Wiimote_Update(); CPluginManager::GetInstance().GetWiimote(0)->Wiimote_Update();

View File

@ -313,10 +313,10 @@ void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
} }
// Decice where to send the message // Decice where to send the message
//if (!g_RealWiiMotePresent) if (!g_Config.bUseRealWiimote || !g_RealWiiMotePresent)
WiiMoteEmu::InterruptChannel(_channelID, _pData, _Size); WiiMoteEmu::InterruptChannel(_channelID, _pData, _Size);
#if HAVE_WIIUSE #if HAVE_WIIUSE
if (g_RealWiiMotePresent) else if (g_RealWiiMotePresent)
WiiMoteReal::InterruptChannel(_channelID, _pData, _Size); WiiMoteReal::InterruptChannel(_channelID, _pData, _Size);
#endif #endif
} }
@ -348,10 +348,10 @@ void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
DEBUG_LOG(WIIMOTE, " Data: %s", Temp.c_str()); DEBUG_LOG(WIIMOTE, " Data: %s", Temp.c_str());
} }
//if (!g_RealWiiMotePresent) if (!g_Config.bUseRealWiimote || !g_RealWiiMotePresent)
WiiMoteEmu::ControlChannel(_channelID, _pData, _Size); WiiMoteEmu::ControlChannel(_channelID, _pData, _Size);
#if HAVE_WIIUSE #if HAVE_WIIUSE
if (g_RealWiiMotePresent) else if (g_RealWiiMotePresent)
WiiMoteReal::ControlChannel(_channelID, _pData, _Size); WiiMoteReal::ControlChannel(_channelID, _pData, _Size);
#endif #endif
} }