melee_inject

Crates.iomelee_inject
lib.rsmelee_inject
version0.1.0
sourcesrc
created_at2022-06-23 12:10:52.691544
updated_at2022-06-23 12:10:52.691544
descriptionReplace DAT files within v1.02 NTSC GALE01 GCM images.
homepagehttps://github.com/djanatyn/melee-inject
repositoryhttps://github.com/djanatyn/melee-inject
max_upload_size
id611820
size44,952
Jonathan Strickland (djanatyn)

documentation

README

melee-inject

replace DAT files within v1.02 NTSC GALE01 using rust

introduction

Dispatches from RC: Parsing and Transforming Super Smash Bros. Melee

this is a presentation i gave at The Recurse Center!

usage

this example is using dang3r potemkin inspired animelee falcon:

Cargo.toml:

[dependencies]
melee_inject = { git = "https://github.com/djanatyn/melee-inject" }

src/main.rs:

use melee_inject::characters::CaptainFalcon;
use melee_inject::replace::{build_iso, rebuild_fst, Replacement};
use std::io;
use std::path::PathBuf;

const SSBM_ISO: &str = "<path-to-ssbm.iso>";

fn main() -> io::Result<()> {
    let replacements = vec![
        // replace potemkin
        Replacement {
            target_file: CaptainFalcon::PlCaGr,
            replacement: PathBuf::from("<path-to-skin.dat>"),
        },
    ];

    let updates = rebuild_fst(SSBM_ISO, &replacements);
    std::fs::write("modified-fst.bin", &updates.new_fst)?;

    let rebuilt_iso = build_iso(SSBM_ISO, &updates);
    std::fs::write("modified-melee.iso", rebuilt_iso)?;

    Ok(())
}

cargo run:

[src/main.rs:226] matching.original_size - new_data_length as u32 = 123584
...
UpdateFST [offset 0x4f5b0000 -> 0x4f5b0000] [size 0x805cb -> 0x805cb] PlCaBu.dat
UpdateFST [offset 0x4f638000 -> 0x4f638000] [size 0x805ab -> 0x622eb] PlCaGr.dat
UpdateFST [offset 0x4f6c0000 -> 0x4f6a1d40] [size 0x8058b -> 0x8058b] PlCaGy.dat
...
❯ radiff2 ssbm-segment.fst potemkin-segment.fst
0x00000021 0805ab => 0622eb 0x00000021
0x00000029 6c0000 => 6a1d40 0x00000029

after that, you should be able to load the rebuilt ISO in dolphin!

Commit count: 94

cargo fmt