ips 0.1.0

Parser for the IPS file format.

Parser for the IPS patch format.

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


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))?;

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

# Ok::<_, Box<dyn std::error::Error>>(())