From 1e9f711278eb510d96d5c4ad7b6b0b5dff2bca1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=27=C3=A9lectron=20rare?= <108685187+electron-rare@users.noreply.github.com> Date: Fri, 26 Jun 2026 11:47:21 +0200 Subject: [PATCH] fix(avlivewire): encoder prefix + reader hoist HandsPayload.encoded() wrote min(count,255) in the header but looped over all hands; use hands.prefix(255) so header and body agree. Hoist the float reader func f() to the outer hand loop, matching FacePayload style; declared once per hand instead of per point. --- .../AVLiveWire/Sources/AVLiveWire/WirePayloads.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/shared/AVLiveWire/Sources/AVLiveWire/WirePayloads.swift b/shared/AVLiveWire/Sources/AVLiveWire/WirePayloads.swift index 9ba575f..5f9396e 100644 --- a/shared/AVLiveWire/Sources/AVLiveWire/WirePayloads.swift +++ b/shared/AVLiveWire/Sources/AVLiveWire/WirePayloads.swift @@ -83,7 +83,7 @@ public struct HandsPayload: Equatable { public func encoded() -> Data { var d = Data() d.append(UInt8(min(hands.count, 255))) - for hand in hands { + for hand in hands.prefix(255) { d.append(hand.isRight ? 1 : 0) for i in 0.. Float { + let v = Float(bitPattern: + UInt32(bigEndianBytes: b[o..] = [] for _ in 0.. Float { - let v = Float(bitPattern: - UInt32(bigEndianBytes: b[o..