mirror of
https://github.com/NinjaCheetah/rustii.git
synced 2026-03-03 03:15:28 -05:00
Added WAD packing command to rustii CLI
Also added lots of required library magic to make WAD packing possible. This includes the high-level Title object from libWiiPy, the ability to set content in a WAD, the ability to generate a WADHeader from a WADBody, and more.
This commit is contained in:
@@ -7,6 +7,7 @@ use std::io::{Cursor, Read, Write};
|
||||
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Clone)]
|
||||
pub struct ContentRecord {
|
||||
pub content_id: u32,
|
||||
pub index: u16,
|
||||
@@ -44,6 +45,7 @@ pub struct TMD {
|
||||
}
|
||||
|
||||
impl TMD {
|
||||
/// Creates a new TMD instance from the binary data of a TMD file.
|
||||
pub fn from_bytes(data: &[u8]) -> Result<Self, std::io::Error> {
|
||||
let mut buf = Cursor::new(data);
|
||||
let signature_type = buf.read_u32::<BigEndian>()?;
|
||||
@@ -129,6 +131,7 @@ impl TMD {
|
||||
})
|
||||
}
|
||||
|
||||
/// Dumps the data in a TMD back into binary data that can be written to a file.
|
||||
pub fn to_bytes(&self) -> Result<Vec<u8>, std::io::Error> {
|
||||
let mut buf: Vec<u8> = Vec::new();
|
||||
buf.write_u32::<BigEndian>(self.signature_type)?;
|
||||
|
||||
Reference in New Issue
Block a user