Skip to content
Permalink
Browse files

Merge pull request #7751 from zackhow/motefix

Android: Don't grab wiimote report if size is < 1
  • Loading branch information...
JMC47 committed Jan 29, 2019
2 parents 4cd5667 + 831ab64 commit cf8da5629759514d07482ae7455ee89505dcab14
Showing with 7 additions and 4 deletions.
  1. +7 −4 Source/Core/Core/HW/WiimoteReal/IOAndroid.cpp
@@ -95,10 +95,13 @@ bool WiimoteAndroid::IsConnected() const
int WiimoteAndroid::IORead(u8* buf)
{
int read_size = m_env->CallStaticIntMethod(s_adapter_class, m_input_func, m_mayflash_index);
jbyte* java_data = m_env->GetByteArrayElements(m_java_wiimote_payload, nullptr);
memcpy(buf + 1, java_data, std::min(MAX_PAYLOAD - 1, read_size));
buf[0] = 0xA1;
m_env->ReleaseByteArrayElements(m_java_wiimote_payload, java_data, 0);
if (read_size > 0)
{
jbyte* java_data = m_env->GetByteArrayElements(m_java_wiimote_payload, nullptr);
memcpy(buf + 1, java_data, std::min(MAX_PAYLOAD - 1, read_size));
buf[0] = 0xA1;
m_env->ReleaseByteArrayElements(m_java_wiimote_payload, java_data, 0);
}
return read_size <= 0 ? read_size : read_size + 1;
}

0 comments on commit cf8da56

Please sign in to comment.
You can’t perform that action at this time.