diff --git a/Source/Core/Core/HW/WiimoteEmu/Camera.cpp b/Source/Core/Core/HW/WiimoteEmu/Camera.cpp index 593c7bc87f..7b68ab9d5f 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Camera.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Camera.cpp @@ -59,7 +59,7 @@ CameraLogic::GetCameraPoints(const Common::Matrix44& transform, Common::Vec2 fie using Common::Vec3; using Common::Vec4; - const std::array leds{ + const std::array leds{ Vec3{-SENSOR_BAR_LED_SEPARATION / 2, 0, 0}, Vec3{SENSOR_BAR_LED_SEPARATION / 2, 0, 0}, }; @@ -68,7 +68,7 @@ CameraLogic::GetCameraPoints(const Common::Matrix44& transform, Common::Vec2 fie Matrix44::Perspective(field_of_view.y, field_of_view.x / field_of_view.y, 0.001f, 1000) * Matrix44::FromMatrix33(Matrix33::RotateX(float(MathUtil::TAU / 4))) * transform; - std::array camera_points; + std::array camera_points; std::transform(leds.begin(), leds.end(), camera_points.begin(), [&](const Vec3& v) { const auto point = camera_view * Vec4(v, 1.0); diff --git a/Source/Core/Core/HW/WiimoteEmu/Camera.h b/Source/Core/Core/HW/WiimoteEmu/Camera.h index 693b07e515..316ee5ec3b 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Camera.h +++ b/Source/Core/Core/HW/WiimoteEmu/Camera.h @@ -126,7 +126,7 @@ public: // FYI: A real wiimote normally only returns 1 point for each LED cluster (2 total). // Sending all 4 points can actually cause some stuttering issues. - static constexpr int NUM_POINTS = 2; + static constexpr int NUM_POINTS = 4; // Range from 0-15. Small values (2-4) seem to be very typical. // This is reduced based on distance from sensor bar. diff --git a/Source/Core/Core/HW/WiimoteEmu/DesiredWiimoteState.cpp b/Source/Core/Core/HW/WiimoteEmu/DesiredWiimoteState.cpp index 3157e8b9c8..a5a223712c 100644 --- a/Source/Core/Core/HW/WiimoteEmu/DesiredWiimoteState.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/DesiredWiimoteState.cpp @@ -82,7 +82,7 @@ SerializedWiimoteState SerializeDesiredState(const DesiredWiimoteState& state) if (has_camera) { - for (size_t i = 0; i < 2; ++i) + for (size_t i = 0; i < state.camera_points.size(); ++i) { const u16 camera_x = state.camera_points[i].position.x; // 10 bits const u16 camera_y = state.camera_points[i].position.y; // 10 bits @@ -178,7 +178,7 @@ bool DeserializeDesiredState(DesiredWiimoteState* state, const SerializedWiimote else if (has_accel) s += 4; if (has_camera) - s += 6; + s += 12; if (has_motion_plus) s += 6; switch (extension) @@ -260,7 +260,7 @@ bool DeserializeDesiredState(DesiredWiimoteState* state, const SerializedWiimote if (has_camera) { - for (size_t i = 0; i < 2; ++i) + for (size_t i = 0; i < state->camera_points.size(); ++i) { const u8 camera_misc = d[pos]; const u8 camera_x_high = d[pos + 1]; diff --git a/Source/Core/Core/HW/WiimoteEmu/DesiredWiimoteState.h b/Source/Core/Core/HW/WiimoteEmu/DesiredWiimoteState.h index 3cde05f7a9..6ef25675f3 100644 --- a/Source/Core/Core/HW/WiimoteEmu/DesiredWiimoteState.h +++ b/Source/Core/Core/HW/WiimoteEmu/DesiredWiimoteState.h @@ -21,11 +21,12 @@ struct DesiredWiimoteState {Wiimote::ACCEL_ZERO_G << 2, Wiimote::ACCEL_ZERO_G << 2, Wiimote::ACCEL_ONE_G << 2}); // No light detected by the IR camera. - static constexpr std::array DEFAULT_CAMERA = {CameraPoint(), CameraPoint()}; + static constexpr std::array DEFAULT_CAMERA = {CameraPoint(), CameraPoint(), + CameraPoint(), CameraPoint()}; WiimoteCommon::ButtonData buttons{}; // non-button state in this is ignored WiimoteCommon::AccelData acceleration = DEFAULT_ACCELERATION; - std::array camera_points = DEFAULT_CAMERA; + std::array camera_points = DEFAULT_CAMERA; std::optional motion_plus = std::nullopt; DesiredExtensionState extension; }; @@ -34,7 +35,7 @@ struct DesiredWiimoteState struct SerializedWiimoteState { u8 length; - std::array data; // 12 bytes Wiimote, 6 bytes MotionPlus, 6 bytes Extension + std::array data; // 18 bytes Wiimote, 6 bytes MotionPlus, 6 bytes Extension }; SerializedWiimoteState SerializeDesiredState(const DesiredWiimoteState& state);