Skip to content

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vifterpreter

This crate allows you to parse binary format DMA packets and VIF commands.

Example usage:

#[derive(BinRead, Debug)]
pub struct SubMesh {
    pub material_id: u8,
    pub qword_count: u32,
    #[br(args(qword_count*16))]
    pub dma_packet: DmaPacket,
}

then you can do something like:

let binary_file = File::open("dmaPacket.bin")?;
let mut binary_file_reader = BufReader::new(binary_file);

let sub_mesh_count = u32::read_le(&mut binary_file_reader)?;
let sub_meshes = Vec::<SubMesh>::read_options(
    &mut binary_file_reader,
    Endian::Little,
    args! {count: sub_mesh_count as usize},
)?;

for i in 0..sub_mesh_count {
    println!(
        "dma tag count: {}",
        sub_meshes[i as usize].dma_packet.dma_tags.len()
    );
    for dma_tag in sub_meshes[i as usize].dma_packet.dma_tags.iter() {
        println!("dma tag vif code count: {}", dma_tag.vif_codes.len());
        for vif_code in dma_tag.vif_codes.iter() {
            // do stuff with the VIF commands
        }
    }
}

About

An interpreter for PS2 VIF1 DMA Packets

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages