970 B
970 B
Eyepiece: An IPS patcher
Usage
eyepiece patch.ips input.file output.file
Building
cargo build
cargo run -- patch.ips in_file out_file
Description
The IPS(24/16) patchfile format is one of the simplest possible patchfile formats. It contains no way to identify the correct target file, and cannot insert or remove bytes.
An IPS file starts with the magic number "PATCH"
0000: 50 41 54 43 48 |PATCH|
Patches are encoded linearly with no padding or alignment, and all numeric values are encoded big-endian. Patches cannot have a length of b"EOF", as "EOF" marks the end of the patchfile.
xxxx: 45 4f 46 |EOF|
The patchfile matches the following pseudo-grammar
IPS = "PATCH" Patch* "EOF"
Patch = { offset: u24 != "EOF", data: Data }
Data = { len: u16 != 0, data: [u8; len] }
| { _: u16 == 0, len: u16, byte: u8 } // Run-length-encoded data