Real Wiimote: Don't delay speaker data.
This commit is contained in:
parent
c1b2eba82b
commit
94ae134bf4
|
@ -11,7 +11,6 @@
|
|||
#include "Common/IniFile.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Common/Thread.h"
|
||||
#include "Common/Timer.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
||||
|
@ -190,7 +189,7 @@ void Wiimote::InterruptChannel(const u16 channel, const void* const _data, const
|
|||
WriteReport(std::move(rpt));
|
||||
}
|
||||
|
||||
bool Wiimote::Read()
|
||||
void Wiimote::Read()
|
||||
{
|
||||
Report rpt(MAX_PAYLOAD);
|
||||
auto const result = IORead(rpt.data());
|
||||
|
@ -210,27 +209,21 @@ bool Wiimote::Read()
|
|||
// Add it to queue
|
||||
rpt.resize(result);
|
||||
m_read_reports.Push(std::move(rpt));
|
||||
return true;
|
||||
}
|
||||
else if (0 == result)
|
||||
{
|
||||
ERROR_LOG(WIIMOTE, "Wiimote::IORead failed. Disconnecting Wiimote %d.", m_index + 1);
|
||||
DisconnectInternal();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Wiimote::Write()
|
||||
{
|
||||
if (!m_write_reports.Empty())
|
||||
void Wiimote::Write()
|
||||
{
|
||||
if (m_write_reports.Empty())
|
||||
return;
|
||||
|
||||
Report const& rpt = m_write_reports.Front();
|
||||
|
||||
bool const is_speaker_data = rpt[1] == WM_WRITE_SPEAKER_DATA;
|
||||
|
||||
if (!is_speaker_data || m_last_audio_report.GetTimeDifference() > 5)
|
||||
{
|
||||
if (SConfig::GetInstance().iBBDumpPort > 0 && m_index == WIIMOTE_BALANCE_BOARD)
|
||||
{
|
||||
static sf::UdpSocket Socket;
|
||||
|
@ -238,17 +231,10 @@ bool Wiimote::Write()
|
|||
}
|
||||
IOWrite(rpt.data(), rpt.size());
|
||||
|
||||
if (is_speaker_data)
|
||||
{
|
||||
m_last_audio_report.Update();
|
||||
}
|
||||
|
||||
m_write_reports.Pop();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
if (!m_write_reports.Empty())
|
||||
IOWakeup();
|
||||
}
|
||||
|
||||
static bool IsDataReport(const Report& rpt)
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "Common/Common.h"
|
||||
#include "Common/FifoQueue.h"
|
||||
#include "Common/NonCopyable.h"
|
||||
#include "Common/Timer.h"
|
||||
#include "Core/HW/Wiimote.h"
|
||||
#include "Core/HW/WiimoteReal/WiimoteRealBase.h"
|
||||
|
||||
|
@ -39,8 +38,8 @@ public:
|
|||
|
||||
const Report& ProcessReadQueue();
|
||||
|
||||
bool Read();
|
||||
bool Write();
|
||||
void Read();
|
||||
void Write();
|
||||
|
||||
void StartThread();
|
||||
void StopThread();
|
||||
|
@ -109,8 +108,6 @@ private:
|
|||
|
||||
Common::FifoQueue<Report> m_read_reports;
|
||||
Common::FifoQueue<Report> m_write_reports;
|
||||
|
||||
Common::Timer m_last_audio_report;
|
||||
};
|
||||
|
||||
class WiimoteScanner
|
||||
|
|
Loading…
Reference in New Issue