summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2020-12-12 12:18:10 -0600
committerJordan Woyak <jordan.woyak@gmail.com>2020-12-12 12:18:10 -0600
commit0fa6bde374f1cc54fefc75aac6a12bcbde91db5d (patch)
treeeeaa227466e853b947490b8ed7514dc12c143dcc /Source
parentfa0e5e36c74c4c761d1598c20702187a7b44b6dd (diff)
HW/WiimoteReal: Drop stale data reports to prevent read queue from filling up and causing input delays.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp
index c47700d13c..005be23c76 100644
--- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp
+++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp
@@ -411,11 +411,16 @@ bool Wiimote::GetNextReport(Report* report)
// Returns the next report that should be sent
Report& Wiimote::ProcessReadQueue(bool repeat_last_data_report)
{
- if (!GetNextReport(&m_last_input_report) &&
- !(IsDataReport(m_last_input_report) && repeat_last_data_report))
- {
- // If we didn't get a new report and it's not a data report to repeat, it's irrelevant.
+ // If we're not repeating data reports or had a non-data report, any old report is irrelevant.
+ if (!repeat_last_data_report || !IsDataReport(m_last_input_report))
m_last_input_report.clear();
+
+ // Step through the read queue.
+ while (GetNextReport(&m_last_input_report))
+ {
+ // Stop on a non-data report.
+ if (!IsDataReport(m_last_input_report))
+ break;
}
return m_last_input_report;