1 unstable release

0.1.0 Feb 8, 2020

#5 in #truncation

Download history 10/week @ 2024-11-13 35/week @ 2024-11-20 19/week @ 2024-11-27 24/week @ 2024-12-04 33/week @ 2024-12-11 18/week @ 2024-12-18 20/week @ 2024-12-25 7/week @ 2025-01-01 16/week @ 2025-01-08 22/week @ 2025-01-15 263/week @ 2025-01-22 25/week @ 2025-01-29 16/week @ 2025-02-05 25/week @ 2025-02-12 10/week @ 2025-02-19 25/week @ 2025-02-26

83 downloads per month

MIT/Apache

5KB
77 lines

Parser for the IPS patch format.

Handles run-length encoded hunks as well as the truncation extension.

Example

Patching a ROM from an IPS file:

use std::fs::{self, File};
use std::io::{Seek, SeekFrom, Write};

use ips::Patch;

let mut rom = File::open("Super Metroid.sfc")?;
let patch_contents = fs::read("Hyper Metroid.ips")?;
let patch = Patch::parse(&patch_contents)?;

for hunk in patch.hunks() {
    rom.seek(SeekFrom::Start(hunk.offset() as u64))?;
    rom.write_all(hunk.payload())?;
}

if let Some(truncation) = patch.truncation() {
    rom.set_len(truncation as u64)?;
}

Dependencies

~1MB
~18K SLoC