btdrv-mitm: zero motion control data when converting incoming controller reports

This commit is contained in:
ndeadly 2020-09-06 18:24:41 +02:00
parent a2e1e9159f
commit a7c22b451c
6 changed files with 7 additions and 3 deletions

View file

@ -72,6 +72,7 @@ namespace ams::controller {
switch_report->id = 0x30;
switch_report->input0x30.conn_info = 0x0;
switch_report->input0x30.battery = m_battery | m_charging;
std::memset(switch_report->input0x30.motion, 0, sizeof(switch_report->input0x30.motion));
switch_report->input0x30.timer = os::ConvertToTimeSpan(os::GetSystemTick()).GetMilliSeconds() & 0xff;
}

View file

@ -45,6 +45,7 @@ namespace ams::controller {
switch_report->id = 0x30;
switch_report->input0x30.conn_info = 0x0;
switch_report->input0x30.battery = m_battery | m_charging;
std::memset(switch_report->input0x30.motion, 0, sizeof(switch_report->input0x30.motion));
switch_report->input0x30.timer = os::ConvertToTimeSpan(os::GetSystemTick()).GetMilliSeconds() & 0xff;
}

View file

@ -44,6 +44,7 @@ namespace ams::controller {
switch_report->id = 0x30;
switch_report->input0x30.conn_info = 0x0;
switch_report->input0x30.battery = m_battery | m_charging;
std::memset(switch_report->input0x30.motion, 0, sizeof(switch_report->input0x30.motion));
switch_report->input0x30.timer = os::ConvertToTimeSpan(os::GetSystemTick()).GetMilliSeconds() & 0xff;
}

View file

@ -102,9 +102,8 @@ namespace ams::controller {
SwitchStickData right_stick;
uint8_t vibrator;
Switch6AxisData imu_0ms;
Switch6AxisData imu_5ms;
Switch6AxisData imu_10ms;
// IMU samples at 0, 5 and 10ms
Switch6AxisData motion[3];
} __attribute__ ((__packed__));
struct SwitchInputReport0x31;

View file

@ -73,6 +73,7 @@ namespace ams::controller {
switch_report->id = 0x30;
switch_report->input0x30.conn_info = 0x0;
switch_report->input0x30.battery = m_battery | m_charging;
std::memset(switch_report->input0x30.motion, 0, sizeof(switch_report->input0x30.motion));
switch_report->input0x30.timer = os::ConvertToTimeSpan(os::GetSystemTick()).GetMilliSeconds() & 0xff;
}

View file

@ -55,6 +55,7 @@ namespace ams::controller {
switch_report->id = 0x30;
switch_report->input0x30.conn_info = 0x0;
switch_report->input0x30.battery = m_battery | m_charging;
std::memset(switch_report->input0x30.motion, 0, sizeof(switch_report->input0x30.motion));
switch_report->input0x30.timer = os::ConvertToTimeSpan(os::GetSystemTick()).GetMilliSeconds() & 0xff;
}