SirWaddles / JohnWickParse

A parser for Fortnite uasset, uexp and pak files
MIT License
89 stars 26 forks source link

FRichCurveKey missing "value" #20

Closed apocalyptech closed 3 years ago

apocalyptech commented 3 years ago

Hello! It looks like your parsing for FRichCurveKey is missing the "value" parameter, which causes arrays of these keys to get increasingly offset in the serializations. See, for instance, FModel's parsing of these: https://github.com/iAmAsval/FModel/blob/master/FModel/PakReader/Parsers/Objects/FRichCurveKey.cs#L26-L34

I believe this patch should do it:

diff --git a/src/assets.rs b/src/assets.rs
index 0fc6a34..23d1de3 100644
--- a/src/assets.rs
+++ b/src/assets.rs
@@ -1679,6 +1679,7 @@ struct FRichCurveKey {
     tangent_mode: u8,
     tangent_weight_mode: u8,
     time: f32,
+    value: f32,
     arrive_tangent: f32,
     arrive_tangent_weight: f32,
     leave_tangent: f32,
@@ -1692,6 +1693,7 @@ impl NewableWithNameMap for FRichCurveKey {
             tangent_mode: reader.read_u8()?,
             tangent_weight_mode: reader.read_u8()?,
             time: reader.read_f32::<LittleEndian>()?,
+            value: reader.read_f32::<LittleEndian>()?,
             arrive_tangent: reader.read_f32::<LittleEndian>()?,
             arrive_tangent_weight: reader.read_f32::<LittleEndian>()?,
             leave_tangent: reader.read_f32::<LittleEndian>()?,

(I can verify that that works for me on an older version of JWP -- I can't really test out on current JWP HEAD 'cause the more recent Fortnite changes have meant that JWP no longer works on the non-Fortnite paks that I've been working with)

SirWaddles commented 3 years ago

Thanks! I'll make that change.