From dff1a8380981cda59d25d4512cd8254a97882d44 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Wed, 17 Apr 2024 17:47:03 -0400 Subject: [PATCH] Fix Dawntrail model loading I figured out some crappy padding I need to add, not sure what these exactly are yet! --- src/model.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/model.rs b/src/model.rs index 730049e..1ee83ab 100755 --- a/src/model.rs +++ b/src/model.rs @@ -312,8 +312,11 @@ struct ModelData { #[br(count = header.shape_value_count)] shape_values: Vec, - // TODO: Dawntrail doesn't seem to have these anymore? Needs more testing - #[br(if(file_header.version < 0x01000006, 0))] + // TODO: Dawntrail mysteries + #[br(if(file_header.version >= 0x01000006))] + #[br(count = 24)] + _padding1: Vec, + submesh_bone_map_size: u32, #[br(count = submesh_bone_map_size / 2)] @@ -323,6 +326,11 @@ struct ModelData { #[br(count = padding_amount)] unknown_padding: Vec, + // TODO: Dawntrail mysteries + #[br(if(file_header.version >= 0x01000006))] + #[br(count = 385)] + _padding2: Vec, + bounding_box: BoundingBox, model_bounding_box: BoundingBox, water_bounding_box: BoundingBox, @@ -426,6 +434,8 @@ impl MDL { let model = ModelData::read_args(&mut cursor, binrw::args! { file_header: &model_file_header }).ok()?; + //println!("{:#?}", model); + let mut affected_bone_names = vec![]; for offset in &model.bone_name_offsets {