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,33 @@
|
||||
use crate::utils::common;
|
||||
use binrw::BinRead;
|
||||
|
||||
pub static KEY: u32 = 0x94102909; //09 29 10 94
|
||||
// first 4 bytes of header and content are additionally XORed, they have different masks although only differ by half a byte
|
||||
pub static HEADER_XOR_MASK: u32 = 0x04BE7C75; //75 7C BE 04
|
||||
pub static CONTENT_XOR_MASK: u32 = 0x04BE7C72; //72 7C BE 04
|
||||
|
||||
pub static HEADER_SIZE: usize = 0x98;
|
||||
|
||||
#[derive(BinRead)]
|
||||
pub struct Header {
|
||||
pub vendor_magic_bytes: [u8; 4],
|
||||
_mtk_magic: [u8; 8],
|
||||
version_bytes: [u8; 68],
|
||||
pub file_size: u32,
|
||||
_flags: u32,
|
||||
product_name_bytes: [u8; 32],
|
||||
_digest: [u8; 32],
|
||||
}
|
||||
impl Header {
|
||||
pub fn vendor_magic(&self) -> String {
|
||||
common::string_from_bytes(&self.vendor_magic_bytes)
|
||||
}
|
||||
pub fn version(&self) -> String {
|
||||
common::string_from_bytes(&self.version_bytes)
|
||||
}
|
||||
pub fn product_name(&self) -> String {
|
||||
common::string_from_bytes(&self.product_name_bytes)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user