flips
Apply IPS patches to files
TLDR
Start Flips to create and apply patches interactively
Apply a patch and create a new ROM file
Create a patch from two ROMs
SYNOPSIS
flips --apply [--bps | --ips | --ups] <patch_file> <input_file> <output_file>
flips --create [--bps | --ips | --ups] <original_file> <modified_file> <output_patch>
flips --verify <patch_file> <input_file>
flips --version | --help
PARAMETERS
--apply
Applies the specified patch file to an `input_file`, generating a new `output_file`.
--create
Generates a patch file (`output_patch`) by comparing an `original_file` with a `modified_file`.
--verify
Checks if a given `patch_file` can be correctly applied to an `input_file` without errors, often including checksum validation.
--bps
Explicitly specifies or forces the patch format to be BPS (Binary Patching System). This is the default for creation.
--ips
Explicitly specifies or forces the patch format to be IPS (International Patching System).
--ups
Explicitly specifies or forces the patch format to be UPS (Universal Patching System).
--json
Outputs results, such as verification outcomes or errors, in JSON format for programmatic parsing.
--help
Displays comprehensive help information about the command's usage and options.
--version
Displays the current version of the `flips` utility.
<patch_file>
The path to the binary patch file to be applied or verified.
<input_file>
The path to the original file that will be patched or against which a patch will be verified.
<output_file>
The path where the newly generated, patched file will be saved.
<original_file>
The path to the unmodified base file used when creating a patch.
<modified_file>
The path to the altered version of the file, used in conjunction with the original file to create a patch.
<output_patch>
The path where the newly created patch file will be saved.
DESCRIPTION
The `flips` command (Free Lossless Image Patcher System) is a cross-platform command-line utility designed for applying and creating lossless binary patches. It is commonly used in the context of video game ROM hacking and preservation, but can be utilized for patching any arbitrary file. `flips` supports various patch formats, including its robust native BPS (Binary Patching System) format, as well as the older IPS (International Patching System) and UPS (Universal Patching System) formats.
The utility emphasizes data integrity and efficiency. When applying patches, `flips` ensures that the process is robust, minimizing the risk of data corruption. For creating patches, it uses delta-encoding to generate compact patch files. Its features make it a reliable choice for situations where precise, error-free file modification is critical, particularly for large binary files.
CAVEATS
`flips` is not a standard utility bundled with most mainstream Linux distributions. It typically needs to be downloaded, compiled, or installed separately. Its primary application lies in binary patching, particularly for ROM files, as opposed to general-purpose text file differencing (like `patch(1)`). Users must ensure the correct patch format (`BPS`, `IPS`, `UPS`) is either explicitly specified or correctly inferable by `flips` to avoid errors. While robust, improper usage (e.g., applying a patch to the wrong base file) can still lead to corrupt output, though `flips` often includes integrity checks to mitigate this.
<B>PATCH FORMATS EXPLAINED</B>
`flips` provides support for several binary patch formats. The BPS (Binary Patching System) format is `flips`'s native and most advanced format, offering robust features like checksums for both original and patched files, support for file sizes beyond 4GB, and atomic patching (all-or-nothing application). IPS (International Patching System) is an older, simpler format widely used, but limited to patching files up to 16MB and lacking integrity checks. UPS (Universal Patching System) is another older format that removed the 16MB size limit of IPS but still lacks built-in checksums for robust integrity verification.
<B>INTEGRITY AND VERIFICATION</B>
A core strength of `flips`, particularly when utilizing BPS patches, is its strong emphasis on data integrity. BPS patches embed CRC32 checksums of both the expected original file and the intended patched file. This allows `flips` to perform critical pre-application checks, ensuring the patch is being applied to the correct original file, and post-application verification, confirming that the resulting patched file is free from corruption. This level of verification significantly enhances reliability and reduces the risk of distributing or applying faulty modifications.
HISTORY
The `flips` utility was developed by Alcaro as a modern binary patching solution, addressing limitations present in older formats and tools. It emerged from the need for more robust, efficient, and reliable patching, particularly within the ROM hacking and fan translation communities. Its native BPS format was designed to overcome issues such as the 16MB file size limit of IPS patches and the lack of integral checksums in UPS patches, which could lead to undetected data corruption. Since its inception, `flips` has gained significant traction for its reliability and advanced features, becoming a preferred tool for distributing modifications to large binary files like video game ROMs.
SEE ALSO
patch(1), bsdiff(1), xdelta3(1)