Address review nits and make always_one field always one

This commit is contained in:
anirudhb
2020-04-28 18:39:43 -07:00
parent 7419ac0952
commit c6b03386c0
2 changed files with 12 additions and 11 deletions

View File

@@ -340,9 +340,9 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
cur_entry.timestamp2 = cur_entry.timestamp;
}
const std::array<SixAxisGeneric*, 6> controller_sixaxes{&npad.full, &npad._handheld,
&npad._left_dual, &npad._right_dual,
&npad._left, &npad._right};
const std::array<SixAxisGeneric*, 6> controller_sixaxes{
&npad.full, &npad.handheld, &npad.left_dual, &npad.right_dual, &npad.left, &npad.right,
};
for (auto* sixaxis : controller_sixaxes) {
sixaxis->common.entry_count = 16;
@@ -457,13 +457,14 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
// Set this entry regardless of the controller type, for now.
if (motion_sensors[i] && sixaxis_sensor_enabled) {
auto& sensor = motion_sensors[i];
const auto& sensor = motion_sensors[i];
Common::Vec3f accel, gyro;
std::tie(accel, gyro) = sensor->GetStatus();
// Try to set it for all entries
for (auto* sixaxis : controller_sixaxes) {
sixaxis->sixaxis[sixaxis->common.last_entry_index].accelerometer = accel;
sixaxis->sixaxis[sixaxis->common.last_entry_index].gyroscope = gyro;
sixaxis->sixaxis[sixaxis->common.last_entry_index].always_one = 1;
}
}

View File

@@ -245,7 +245,7 @@ private:
Common::Vec3f gyroscope;
INSERT_PADDING_BYTES(12); // unknown sensor data
std::array<Common::Vec3f, 3> orientation;
s64_le _always_one; // always 1
s64_le always_one; // always 1
};
static_assert(sizeof(SixAxisState) == 0x68, "SixAxisState is an invalid size");
@@ -303,12 +303,12 @@ private:
NPadGeneric pokeball_states;
NPadGeneric libnx; // TODO(ogniK): Find out what this actually is, libnx seems to only be
// relying on this for the time being
SixAxisGeneric full; // used
SixAxisGeneric _handheld; // stub
SixAxisGeneric _left_dual; // stub
SixAxisGeneric _right_dual; // stub
SixAxisGeneric _left; // stub
SixAxisGeneric _right; // stub
SixAxisGeneric full;
SixAxisGeneric handheld;
SixAxisGeneric left_dual;
SixAxisGeneric right_dual;
SixAxisGeneric left;
SixAxisGeneric right;
NPadDevice device_type;
NPadProperties properties;
INSERT_PADDING_WORDS(1);