38 lines
970 B
Markdown
38 lines
970 B
Markdown
|
# Eyepiece: An IPS patcher
|
||
|
|
||
|
## Usage
|
||
|
```sh
|
||
|
eyepiece patch.ips input.file output.file
|
||
|
```
|
||
|
|
||
|
## Building
|
||
|
```sh
|
||
|
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"
|
||
|
```console
|
||
|
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.
|
||
|
```console
|
||
|
xxxx: 45 4f 46 |EOF|
|
||
|
```
|
||
|
|
||
|
The patchfile matches the following pseudo-grammar
|
||
|
```console
|
||
|
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
|
||
|
```
|