ips 0.1.0

Parser for the IPS file format.
Documentation
  • Coverage
  • 100%
    9 out of 9 items documented1 out of 9 items with examples
  • Size
  • Source code size: 7.97 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.75 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 18s Average build duration of successful builds.
  • all releases: 18s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • euclio/ips
    1 4 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • euclio

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

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