use crate::*;
mod feature_name;
pub use feature_name::*;
#[derive_binread]
#[derive(Debug)]
pub enum HeaderExt {
#[br(magic = 0_u32)]
End,
#[br(magic = 0x6803f857_u32)]
FeatureNameTable (
#[br(temp)]
u32,
#[br(align_after = 8, count = self_0 / 0x30)]
Vec<FeatureName>,
),
#[br(magic = 0xe2792aca_u32)]
BackingFileFormat (
#[br(temp)]
u32,
#[br(temp, count = self_0)]
Vec<u8>,
#[br(calc = {
self_1.retain(|&x| x != 0);
String::from_utf8_lossy(&self_1).into_owned()
})]
String,
),
#[br(magic = 0x44415441_u32)]
ExternalDataPath (
#[br(temp)]
u32,
#[br(temp, count = self_0)]
Vec<u8>,
#[br(calc = {
self_1.retain(|&x| x != 0);
String::from_utf8_lossy(&self_1).into_owned()
})]
String,
),
Unparsed {
kind: HeaderExtKind,
#[br(temp)]
data_len: u32,
#[br(align_after = 8, count = data_len)]
data: Vec<u8>
},
}
impl HeaderExt {
pub(crate) fn is_end(&self) -> bool {
matches!(self, Self::End)
}
}
#[derive_binread]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum HeaderExtKind {
#[br(magic = 0_u32)]
End,
#[br(magic = 0x6803f857_u32)]
FeatureNameTable,
#[br(magic = 0xe2792aca_u32)]
BackingFileFormat,
#[br(magic = 0x23852875_u32)]
BitmapsExtension,
#[br(magic = 0x0537be77_u32)]
FullDiskEncryption,
#[br(magic = 0x44415441_u32)]
ExternalDataPath,
Other(u32),
}