IPS Format

      ____

      \__/____)\____)\

      ___\____  \.___/1.1 - 12/24/94

     /   .\|  __/__ .\ International Patching System Format

    /    _>\  |/  . _>\MindRape

    \_  : ./  |\  :   /

      : .  :  ::     :

      .    .  ..     .

        .         .


Abstract

This goal of this document is to detail the internals of the International Patching System (IPS) format.

IPS is a simple patching system that is used to change certain bytes that have been changed. Instead of redistributing large binaries around, one can distribute a much smaller IPS patch (depending on the number of changes). It originated on the Amiga platform, where it was mainly used for distributing cracks to pirated console games. However due to the generalization of the format it can be used patch anything.

I would give the original author credit for creation of this format, but I don't know who he is! If you can email me the correct information, I'll promptly update this document.

In this version of this documentation the RLE compression scheme has been left out. I have never seen an IPS implementation use this before.


Details

An IPS patch can be of a variable size, but it can only address 16777215 bytes. This is because of the address bytes only being 3 bytes. And since there isn't strong support on other platforms that use the IPS format, i doubt people will switch to a 4 byte addressing scheme.

An IPS file is made up of individual patches, which we will call clusters. Each cluster can only be 64K max in size, due to the patch size being defined as 2 bytes.

The only way to determine how many clusters there are is to go though the file, reading the Patch Size and skipping those bytes until you read the address, and patch size again. Then skip those byte, and keep going until you hit EOF marker and it is at the end of the file.

IPS files have the extension of .IPS (i.e. smworld.ips).
Here is the format to an IPS file.

IPS Element Description
Majic This is the signature of a IPS patch. It is 5 bytes and should be the word "PATCH".
Address The location in the binary to patch. 3 chars.
Patch Size The number of bytes to patch for this cluster. It is 2 bytes, therefore 64K maximum in size.
Bytes to patch These are the modified bytes that need to be patched. They are patched at the above address.
Its size is variable, you can determine it's length by looking at the Patch Size.
... Address, Patch and Bytes to patch, repeated as many times as it wants.
EOF This is the end of file marker. It is always located at the end of a IPS patch. It could also be used
to validate whether a IPS patch is complete. 3 chars = "EOF"


Examples

Here are some example patches to give you an idea of what is going on inside an IPS file. The following example contains 10 patches, each patch is exactly one byte.

PATCHaaappbaaappbaaappbaaappbaaappbaaappbaaappbaaappbaaappbaaappbEOF

The following example contains 3 patches, each patch is of the following byte sizes: 3, 10 and 5 bytes.

PATCHaaappbbbaaappbbbbbbbbbbaaappbbbbbEOF

Keys Description
PATCH This is the signature of a IPS file. It always resides at the start of every IPS file.
aaa Address (3 Bytes)
pp Patch Size (2 Bytes)
b These are the changed bytes that need to replace the one in the orginal binary. There are pp number of these.
EOF End of file marker.
*Legend for IPS examples.

OR

You can download some IPS patches that Damaged Cybernetics has done.
File Name Game / Copyright Owner Notes
DRMARIO.IPS Tetris & Dr. Mario © Nintendo Save Ram Crack
SMURF.IPS Smurfs © Infogames PAL Fix
MWARIO.IPS Mario & Wario © Nintendo Save Ram Crack : Notes still needs
the mouse to be remapped to the joypad!


Closing Remarks

Good luck on writing your own IPS patcher or template maker.

If you notice any errors in this document or you develop anything with this information please send me some email.

Damaged Cybernetics is not connected or affiliated with any mentioned company in any way. The opinions of Damaged Cybernetics do not reflect the views of the various companies mentioned here. Companies and all products pertaining to that company are trademarks of that company. Please contact that company for trademark and copyright information.

© 1996 Damaged Cybernetics All Rights Reserved