149 lines
4.1 KiB
Rust
149 lines
4.1 KiB
Rust
#[derive(Debug)]
|
|
#[cfg_attr(feature = "read", derive(binrw::BinRead), br(little, repr = u32))]
|
|
#[cfg_attr(feature = "write", derive(binrw::BinWrite), bw(little, repr = u32))]
|
|
#[repr(u32)]
|
|
pub enum FileKind {
|
|
Empty = 1,
|
|
Standard = 2,
|
|
Model = 3,
|
|
Texture = 4,
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
#[cfg_attr(feature = "read", derive(binrw::BinRead), br(little, repr = i32))]
|
|
#[cfg_attr(feature = "write", derive(binrw::BinWrite), bw(little, repr = i32))]
|
|
#[repr(i32)]
|
|
pub enum LodLevel {
|
|
All = -1,
|
|
Highest = 0,
|
|
High = 1,
|
|
Low = 2,
|
|
Max = 3,
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
#[cfg_attr(feature = "read", derive(binrw::BinRead), br(little))]
|
|
#[cfg_attr(feature = "write", derive(binrw::BinWrite), bw(little))]
|
|
pub struct SqPackFileInfoHeader {
|
|
pub size: u32,
|
|
pub kind: FileKind,
|
|
pub raw_file_size: u32,
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
#[cfg_attr(feature = "read", derive(binrw::BinRead), br(little))]
|
|
#[cfg_attr(feature = "write", derive(binrw::BinWrite), bw(little))]
|
|
pub struct SqPackFileInfo {
|
|
pub _unk_0: [u32; 2],
|
|
pub number_of_blocks: u32,
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
#[cfg_attr(feature = "read", derive(binrw::BinRead), br(little))]
|
|
#[cfg_attr(feature = "write", derive(binrw::BinWrite), bw(little))]
|
|
pub struct DatStdFileBlockInfos {
|
|
pub offset: u32,
|
|
pub compressed_size: u16,
|
|
pub uncompressed_size: u16,
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
#[cfg_attr(feature = "read", derive(binrw::BinRead), br(little))]
|
|
#[cfg_attr(feature = "write", derive(binrw::BinWrite), bw(little))]
|
|
pub struct DatBlockHeader {
|
|
pub size: u32,
|
|
pub _unk_0: u32,
|
|
pub compressed_size: u32,
|
|
pub uncompressed_size: u32,
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
#[cfg_attr(feature = "read", derive(binrw::BinRead), br(little))]
|
|
#[cfg_attr(feature = "write", derive(binrw::BinWrite), bw(little))]
|
|
pub struct LodBlock {
|
|
pub compressed_offset: u32,
|
|
pub compressed_size: u32,
|
|
pub decompressed_size: u32,
|
|
pub block_offset: u32,
|
|
pub block_count: u32,
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
#[cfg_attr(feature = "read", derive(binrw::BinRead), br(little))]
|
|
#[cfg_attr(feature = "write", derive(binrw::BinWrite), bw(little))]
|
|
pub struct ReferenceBlockRange {
|
|
pub begin: u32,
|
|
pub end: u32,
|
|
}
|
|
|
|
#[derive(Debug, Default)]
|
|
#[cfg(all(feature = "read", feature = "write"))]
|
|
#[derive(binrw::BinRead, binrw::BinWrite)]
|
|
pub struct ModelSectionInfo<T>
|
|
where T: Default + binrw::BinRead + binrw::BinWrite<Args=()>,
|
|
<T as binrw::BinRead>::Args: Default,
|
|
{
|
|
pub stack: T,
|
|
pub runtime: T,
|
|
pub vertex_buffer: [T; 3],
|
|
pub edge_geometry_vertex_buffer: [T; 3],
|
|
pub index_buffer: [T; 3],
|
|
}
|
|
|
|
#[derive(Debug, Default)]
|
|
#[cfg(all(feature = "write", not(feature = "read")))]
|
|
#[derive(binrw::BinWrite)]
|
|
pub struct ModelSectionInfo<T>
|
|
where T: Default + binrw::BinWrite<Args=()>,
|
|
{
|
|
pub stack: T,
|
|
pub runtime: T,
|
|
pub vertex_buffer: [T; 3],
|
|
pub edge_geometry_vertex_buffer: [T; 3],
|
|
pub index_buffer: [T; 3],
|
|
}
|
|
|
|
#[derive(Debug, Default)]
|
|
#[cfg(all(feature = "read", not(feature = "write")))]
|
|
#[derive(binrw::BinRead)]
|
|
pub struct ModelSectionInfo<T>
|
|
where T: Default + binrw::BinRead,
|
|
<T as binrw::BinRead>::Args: Default,
|
|
{
|
|
pub stack: T,
|
|
pub runtime: T,
|
|
pub vertex_buffer: [T; 3],
|
|
pub edge_geometry_vertex_buffer: [T; 3],
|
|
pub index_buffer: [T; 3],
|
|
}
|
|
|
|
#[derive(Debug, Default)]
|
|
#[cfg(not(any(feature = "read", feature = "write")))]
|
|
pub struct ModelSectionInfo<T: Default> {
|
|
pub stack: T,
|
|
pub runtime: T,
|
|
pub vertex_buffer: [T; 3],
|
|
pub edge_geometry_vertex_buffer: [T; 3],
|
|
pub index_buffer: [T; 3],
|
|
}
|
|
|
|
#[derive(Debug, Default)]
|
|
#[cfg_attr(feature = "read", derive(binrw::BinRead), br(little))]
|
|
#[cfg_attr(feature = "write", derive(binrw::BinWrite), bw(little))]
|
|
pub struct ModelBlock {
|
|
pub number_of_blocks: u32,
|
|
pub used_number_of_blocks: u32,
|
|
pub version: u32,
|
|
pub size: ModelSectionInfo<u32>,
|
|
pub compressed_size: ModelSectionInfo<u32>,
|
|
pub offset: ModelSectionInfo<u32>,
|
|
pub block_index: ModelSectionInfo<u16>,
|
|
pub block_num: ModelSectionInfo<u16>,
|
|
pub vertex_declaration_num: u16,
|
|
pub material_num: u16,
|
|
pub num_lods: u8,
|
|
pub index_buffer_streaming_enabled: u8,
|
|
pub edge_geometry_enabled: u8,
|
|
pub padding: u8,
|
|
}
|