early-access version 1636
This commit is contained in:
@@ -155,12 +155,19 @@ void Adapter::UpdateStateAxes(std::size_t port, const AdapterPayload& adapter_pa
|
||||
for (const PadAxes axis : axes) {
|
||||
const auto index = static_cast<std::size_t>(axis);
|
||||
const u8 axis_value = adapter_payload[offset + 3 + index];
|
||||
if (pads[port].axis_origin[index] == 255) {
|
||||
if (pads[port].reset_origin_counter <= 3) {
|
||||
if (pads[port].axis_origin[index] != axis_value) {
|
||||
pads[port].reset_origin_counter = 0;
|
||||
}
|
||||
pads[port].axis_origin[index] = axis_value;
|
||||
}
|
||||
pads[port].axis_values[index] =
|
||||
static_cast<s16>(axis_value - pads[port].axis_origin[index]);
|
||||
}
|
||||
|
||||
if (pads[port].reset_origin_counter <= 3) {
|
||||
pads[port].reset_origin_counter++;
|
||||
}
|
||||
}
|
||||
|
||||
void Adapter::UpdateYuzuSettings(std::size_t port) {
|
||||
@@ -375,7 +382,7 @@ void Adapter::ResetDevice(std::size_t port) {
|
||||
pads[port].buttons = 0;
|
||||
pads[port].last_button = PadButton::Undefined;
|
||||
pads[port].axis_values.fill(0);
|
||||
pads[port].axis_origin.fill(255);
|
||||
pads[port].reset_origin_counter = 0;
|
||||
}
|
||||
|
||||
void Adapter::Reset() {
|
||||
|
@@ -70,6 +70,7 @@ struct GCController {
|
||||
PadButton last_button{};
|
||||
std::array<s16, 6> axis_values{};
|
||||
std::array<u8, 6> axis_origin{};
|
||||
u8 reset_origin_counter{};
|
||||
};
|
||||
|
||||
class Adapter {
|
||||
|
@@ -195,7 +195,8 @@ Input::MotionStatus MotionInput::GetMotion() const {
|
||||
const Common::Vec3f accelerometer = GetAcceleration();
|
||||
const Common::Vec3f rotation = GetRotations();
|
||||
const std::array<Common::Vec3f, 3> orientation = GetOrientation();
|
||||
return {accelerometer, gyroscope, rotation, orientation};
|
||||
const Common::Quaternion<f32> quaternion = GetQuaternion();
|
||||
return {accelerometer, gyroscope, rotation, orientation, quaternion};
|
||||
}
|
||||
|
||||
Input::MotionStatus MotionInput::GetRandomMotion(int accel_magnitude, int gyro_magnitude) const {
|
||||
@@ -218,7 +219,12 @@ Input::MotionStatus MotionInput::GetRandomMotion(int accel_magnitude, int gyro_m
|
||||
Common::Vec3f{0.0f, 1.0f, 0.0f},
|
||||
Common::Vec3f{0.0f, 0.0f, 1.0f},
|
||||
};
|
||||
return {accelerometer * accel_magnitude, gyroscope * gyro_magnitude, rotation, orientation};
|
||||
constexpr Common::Quaternion<f32> quaternion{
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
1.0f,
|
||||
};
|
||||
return {accelerometer * accel_magnitude, gyroscope * gyro_magnitude, rotation, orientation,
|
||||
quaternion};
|
||||
}
|
||||
|
||||
void MotionInput::ResetOrientation() {
|
||||
|
Reference in New Issue
Block a user