use binrw::{BinRead, NullString};
use xc3_write::{Xc3Write, Xc3WriteOffsets};
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Debug, BinRead, Xc3Write, Xc3WriteOffsets, PartialEq, Clone)]
#[br(magic(b"\x57\xe0\xe0\x57\x10\xc0\xc0\x10"))]
#[xc3(magic(b"\x57\xe0\xe0\x57\x10\xc0\xc0\x10"))]
pub struct Hkt {
pub unk1: [u32; 14],
#[br(map(|x: NullString| x.to_string()))]
#[br(pad_size_to = 16)]
pub unk2: String,
pub unk3: [u32; 8],
#[br(map(|x: NullString| x.to_string()))]
#[br(pad_size_to = 16)]
pub unk4: String,
pub unk5: [u32; 8],
#[br(map(|x: NullString| x.to_string()))]
#[br(pad_size_to = 16)]
pub unk6: String,
pub unk7: [u32; 8],
#[br(count = unk3[2])]
pub unk8_1: Vec<u8>,
pub unk8_2: [u32; 52],
pub count: u32,
pub unk9_2: [u32; 19],
#[br(map(|x: NullString| x.to_string()))]
#[br(pad_size_to = 16)]
pub unk10: String,
#[br(count = count)]
#[br(align_after = 16)]
pub parent_indices: Vec<i16>,
#[br(count = count)]
pub unk11: Vec<u64>,
#[br(count = count)]
pub names: Vec<BoneName>,
#[br(count = count)]
pub transforms: Vec<Transform>,
}
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Debug, BinRead, Xc3Write, Xc3WriteOffsets, PartialEq, Clone)]
pub struct Transform {
pub translation: [f32; 4],
pub rotation_quaternion: [f32; 4],
pub scale: [f32; 4],
}
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Debug, BinRead, Xc3Write, Xc3WriteOffsets, PartialEq, Clone)]
pub struct BoneName {
#[br(map(|x: NullString| x.to_string()))]
#[br(align_after = 16)]
pub name: String,
}