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:
theubusu
2026-02-17 17:28:59 +01:00
parent 9fe39280cd
commit aa2249f024
69 changed files with 1678 additions and 1629 deletions
+33
View File
@@ -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)
}
}