mirror of
https://github.com/Ap0dexMe0/unixtract.git
synced 2026-07-16 05:04:22 +02:00
RESTRUCTURING 1
- change formats to have their own folders with mod + include files + anything they want - change format list to be defined in formats.rs instead of in each format - move utils to their respective formats - some minor code changes in some formats
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
use crate::utils::common;
|
||||
use binrw::BinRead;
|
||||
|
||||
#[derive(BinRead)]
|
||||
pub struct Header {
|
||||
_magic_bytes: [u8; 4],
|
||||
version_bytes: [u8; 8],
|
||||
model_bytes: [u8; 16],
|
||||
firmware_bytes: [u8; 16],
|
||||
_unk: u32,
|
||||
check: [u8; 8],
|
||||
_unk2: [u8; 8],
|
||||
}
|
||||
impl Header {
|
||||
pub fn version(&self) -> String {
|
||||
common::string_from_bytes(&self.version_bytes)
|
||||
}
|
||||
pub fn model(&self) -> String {
|
||||
common::string_from_bytes(&self.model_bytes)
|
||||
}
|
||||
pub fn firmware(&self) -> String {
|
||||
common::string_from_bytes(&self.firmware_bytes)
|
||||
}
|
||||
pub fn is_new_type(&self) -> bool {
|
||||
&self.check == b"\x01VER_PR1"
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(BinRead)]
|
||||
pub struct EntryOld {
|
||||
pub size: u32,
|
||||
pub _unk: u32,
|
||||
pub offset: u32,
|
||||
pub _unk2: u32,
|
||||
}
|
||||
|
||||
#[derive(BinRead)]
|
||||
pub struct EntryNew {
|
||||
pub size: u32,
|
||||
_unk: u32,
|
||||
pub offset: u32,
|
||||
_unk2: [u8; 12],
|
||||
}
|
||||
Reference in New Issue
Block a user