just use best guesses for _unknown fields since it doesn't super matter at this point

This commit is contained in:
lifning 2021-01-16 20:13:03 -08:00
parent ce190ea641
commit 16fef3e88a
1 changed files with 11 additions and 11 deletions

View File

@ -18,14 +18,14 @@ fn string_binwrite_helper(pad_to_len: usize) -> impl Fn(&String) -> Vec<u8> {
}
}
// stats on _unknown1, _unknown2, and category:
// stats on version, comment, and category:
// $ find . -name \*.one -exec bash -c "onear tf "{}" > "{}".txt" \;
// $ fd one.txt | xargs cat | sed 's/count: .*/..}/' | grep '^JodOne{' | sort | uniq -c
// 1 JodOne{_unknown1: 0xca, _unknown2: " ", category: Default, ..}
// 11 JodOne{_unknown1: 0xca, _unknown2: " ", category: landData, ..}
// 4 JodOne{_unknown1: 0xcb, _unknown2: " ", category: landData, ..}
// 988 JodOne{_unknown1: 0xcc, _unknown2: " ", category: Default, ..}
// 1579 JodOne{_unknown1: 0xcc, _unknown2: " ", category: landData, ..}
// 1 JodOne{version: 0xca, comment: " ", category: Default, ..}
// 11 JodOne{version: 0xca, comment: " ", category: landData, ..}
// 4 JodOne{version: 0xcb, comment: " ", category: landData, ..}
// 988 JodOne{version: 0xcc, comment: " ", category: Default, ..}
// 1579 JodOne{version: 0xcc, comment: " ", category: landData, ..}
const JOD_ONE_MAGIC: &'static [u8; 16] = b"ThisIsOneFile\0\0\0";
@ -39,7 +39,7 @@ const SIZE_OF_JOD_ONE_ENTRY: usize = 6 * size_of::<u32>() + 192;
pub struct JodOne {
// usually 0xCC... archive creator version maybe?
// but i've seen 0xCA in Test04/disp/Test04.one and 0xCB in Test05/disp/stg2010_sun.one
_unknown1: u32,
pub version: u32,
// "Default" or "landData"
#[br(pad_size_to = 32, map = string_binread_helper)]
#[binwrite(preprocessor(string_binwrite_helper(32)))]
@ -48,7 +48,7 @@ pub struct JodOne {
// always " "
#[br(pad_size_to = 132, map = string_binread_helper)]
#[binwrite(preprocessor(string_binwrite_helper(132)))]
_unknown2: String,
pub comment: String,
#[br(count = count)]
pub entries: Vec<JodOneEntry>
}
@ -73,7 +73,7 @@ pub struct JodOneEntry {
impl std::fmt::Debug for JodOne {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "JodOne{{_unknown1: 0x{:x}, _unknown2: {:?}, category: {}, count: {}, ..}}", self._unknown1, self._unknown2, self.category, self.count)
write!(f, "JodOne{{version: 0x{:x}, comment: {:?}, category: {}, count: {}, ..}}", self.version, self.comment, self.category, self.count)
}
}
@ -136,10 +136,10 @@ impl JodOne {
}
JodOne {
_unknown1: 0xCC,
version: 0xCC,
category: category.unwrap_or("Default").to_string(),
count: entries.len() as u32,
_unknown2: " ".to_string(),
comment: " ".to_string(),
entries,
}
}