Added content region parsing and content encryption/decryption

This commit is contained in:
2025-03-18 09:13:34 -04:00
parent 247f120da4
commit 93f2103763
9 changed files with 202 additions and 32 deletions

View File

@@ -130,7 +130,7 @@ impl TMD {
}
pub fn to_vec(&self) -> Result<Vec<u8>, std::io::Error> {
let mut buf = Vec::new();
let mut buf: Vec<u8> = Vec::new();
buf.write_u32::<BigEndian>(self.signature_type)?;
buf.write_all(&self.signature)?;
buf.write_all(&self.padding1)?;
@@ -164,22 +164,4 @@ impl TMD {
}
Ok(buf)
}
pub fn title_version(&self) -> u16 {
self.title_version
}
}
#[cfg(test)]
mod tests {
use super::*;
use std::fs;
#[test]
fn test_load_tmd() {
let data = fs::read("title.tmd").unwrap();
let tmd = TMD::from_bytes(&data).unwrap();
assert_eq!(tmd.tmd_version, 1);
}
}