mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-15 08:51:26 +02:00
Android: Don't grab wiimote report if size is < 1
Fixes crash when using official wiimotes with the dolphin bar.
This commit is contained in:
parent
b14e540671
commit
831ab64e1c
@ -95,10 +95,13 @@ bool WiimoteAndroid::IsConnected() const
|
|||||||
int WiimoteAndroid::IORead(u8* buf)
|
int WiimoteAndroid::IORead(u8* buf)
|
||||||
{
|
{
|
||||||
int read_size = m_env->CallStaticIntMethod(s_adapter_class, m_input_func, m_mayflash_index);
|
int read_size = m_env->CallStaticIntMethod(s_adapter_class, m_input_func, m_mayflash_index);
|
||||||
|
if (read_size > 0)
|
||||||
|
{
|
||||||
jbyte* java_data = m_env->GetByteArrayElements(m_java_wiimote_payload, nullptr);
|
jbyte* java_data = m_env->GetByteArrayElements(m_java_wiimote_payload, nullptr);
|
||||||
memcpy(buf + 1, java_data, std::min(MAX_PAYLOAD - 1, read_size));
|
memcpy(buf + 1, java_data, std::min(MAX_PAYLOAD - 1, read_size));
|
||||||
buf[0] = 0xA1;
|
buf[0] = 0xA1;
|
||||||
m_env->ReleaseByteArrayElements(m_java_wiimote_payload, java_data, 0);
|
m_env->ReleaseByteArrayElements(m_java_wiimote_payload, java_data, 0);
|
||||||
|
}
|
||||||
return read_size <= 0 ? read_size : read_size + 1;
|
return read_size <= 0 ? read_size : read_size + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user