Browse Source

controllers/npad: Simplify motion entry assignment

Simplifies the motion assignment in the Dual Joycon entry and assigns index 1 of the motion entry (Motion 2) for the right joycon.
pull/15/merge
Morph 5 years ago
committed by german
parent
commit
df3cbd4758
  1. 31
      src/core/hle/service/hid/controllers/npad.cpp

31
src/core/hle/service/hid/controllers/npad.cpp

@ -490,31 +490,20 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
libnx_entry.connection_status.IsLeftJoyConnected.Assign(1); libnx_entry.connection_status.IsLeftJoyConnected.Assign(1);
libnx_entry.connection_status.IsRightJoyConnected.Assign(1); libnx_entry.connection_status.IsRightJoyConnected.Assign(1);
if (sixaxis_sensors_enabled) {
if (motions[i][0] && motions[i][1]) {
// set both
if (sixaxis_sensors_enabled && motions[i][0]) {
// Set motion for the left joycon
dual_left_sixaxis_entry.accel = motion_devices[0].accel; dual_left_sixaxis_entry.accel = motion_devices[0].accel;
dual_left_sixaxis_entry.gyro = motion_devices[0].gyro; dual_left_sixaxis_entry.gyro = motion_devices[0].gyro;
dual_left_sixaxis_entry.rotation = motion_devices[0].rotation; dual_left_sixaxis_entry.rotation = motion_devices[0].rotation;
dual_left_sixaxis_entry.orientation = motion_devices[0].orientation; dual_left_sixaxis_entry.orientation = motion_devices[0].orientation;
dual_right_sixaxis_entry.accel = motion_devices[1].accel;
dual_right_sixaxis_entry.gyro = motion_devices[1].gyro;
dual_right_sixaxis_entry.rotation = motion_devices[1].rotation;
dual_right_sixaxis_entry.orientation = motion_devices[1].orientation;
} else if (motions[i][0]) {
// set right
dual_right_sixaxis_entry.accel = motion_devices[0].accel;
dual_right_sixaxis_entry.gyro = motion_devices[0].gyro;
dual_right_sixaxis_entry.rotation = motion_devices[0].rotation;
dual_right_sixaxis_entry.orientation = motion_devices[0].orientation;
} else if (motions[i][1]) {
// set right
}
if (sixaxis_sensors_enabled && motions[i][1]) {
// Set motion for the right joycon
dual_right_sixaxis_entry.accel = motion_devices[1].accel; dual_right_sixaxis_entry.accel = motion_devices[1].accel;
dual_right_sixaxis_entry.gyro = motion_devices[1].gyro; dual_right_sixaxis_entry.gyro = motion_devices[1].gyro;
dual_right_sixaxis_entry.rotation = motion_devices[1].rotation; dual_right_sixaxis_entry.rotation = motion_devices[1].rotation;
dual_right_sixaxis_entry.orientation = motion_devices[1].orientation; dual_right_sixaxis_entry.orientation = motion_devices[1].orientation;
} }
}
break; break;
case NPadControllerType::JoyLeft: case NPadControllerType::JoyLeft:
left_entry.connection_status.raw = 0; left_entry.connection_status.raw = 0;
@ -543,11 +532,11 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
libnx_entry.connection_status.IsRightJoyConnected.Assign(1); libnx_entry.connection_status.IsRightJoyConnected.Assign(1);
if (sixaxis_sensors_enabled && motions[i][0]) {
right_sixaxis_entry.accel = motion_devices[0].accel;
right_sixaxis_entry.gyro = motion_devices[0].gyro;
right_sixaxis_entry.rotation = motion_devices[0].rotation;
right_sixaxis_entry.orientation = motion_devices[0].orientation;
if (sixaxis_sensors_enabled && motions[i][1]) {
right_sixaxis_entry.accel = motion_devices[1].accel;
right_sixaxis_entry.gyro = motion_devices[1].gyro;
right_sixaxis_entry.rotation = motion_devices[1].rotation;
right_sixaxis_entry.orientation = motion_devices[1].orientation;
} }
break; break;
case NPadControllerType::Pokeball: case NPadControllerType::Pokeball:

Loading…
Cancel
Save