Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion arma-file-formats/src/real_virtuality/p3d/model_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ pub struct ModelInfo {
pub property_frequent: bool,

#[br(if(args.version >= 31))]
pub unknown_int: u32,
unknown_string_count: u32,

/// Names after a count, usually none. Only seen in FFAA's `invisibletargetvehicle.p3d`
/// (`component01`), every Arma 3 model has a count of 0.
#[br(count = unknown_string_count)]
pub unknown_strings: Vec<NullString>,

#[br(if(args.version >= 57))]
#[br(count = lod_count)]
Expand Down
27 changes: 27 additions & 0 deletions arma-file-formats/tests/real_virtuality/p3d_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,30 @@ fn section_unk_floats() {
assert!(lod.section_faces().iter().all(Option::is_some));
}
}

/// The u32 after `property_frequent` counts names that follow it, a model with one used to throw
/// off everything after it.
#[test]
fn model_info_unknown_strings() {
let odol = ODOL::from_path(format!(
"{}ffaa_invisibletargetvehicle.p3d",
INPUT_PATH_PREFIX
))
.unwrap();
assert_eq!(odol.version, 73);
let strings: Vec<String> = odol
.model_info
.unknown_strings
.iter()
.map(ToString::to_string)
.collect();
assert_eq!(strings, ["component01"]);
assert_eq!(odol.lods.len(), 4);
assert_eq!(odol.has_anims, Some(false));

for (name, odol) in test_models() {
if name != "ffaa_invisibletargetvehicle.p3d" {
assert!(odol.model_info.unknown_strings.is_empty(), "{name}");
}
}
}
Binary file modified arma-file-formats/tests/test-data/rv-test-data-part-4.7z
Binary file not shown.
Loading