[][src]Crate ips

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

Structs

Error

IPS parsing error.

Hunk

A patch hunk.

Patch

The contents of an IPS patch.