To support legally modding software, assuming I already have a way to legally extract the source code and/or embedded content, I need a way to patch the data without distributing any of the original content.

Is there a generic patching tool or system that supports the following?

Required:

Deltas that don’t contain any of the original content (unlike unix-style textual patches).

Support for both textual and binary deltas.

Support for Windows.

No-cost license for the tool.

Optional:

Automated copy and rename of files. This is so you can effectively make a separate modded copy of content, rather than completely replacing it with the patched version.

Dealing with compressed data (like png files). This might be difficult, as the diff and patch programs would be responsible for uncompressing and recompressing the data. This can be worked around with other tools (like png -> bmp converters).

Smart detection of ideal block sizes for binary deltas.

Support for some sort of checksum or one-way hashing so you can validate that the source data is correct before applying the patch, without distributing copies of that data.

Support for combining multiple versions of deltas, so you can distribute one patch that will apply to multiple versions of the source software.

Support for non-Windows OSs.

Open source.

Background:

This seems like a common problem to solve for legal, but unsupported game modding. Before I create my own tools I’d like to see if there are existing ones. This is not for a game that has any modding tools available yet.

A combination of tools that I could string together with shell scripts/batch files would be perfectly acceptable, as long as I can get all the required features I’ve listed.

One Response to “Is there a generic patching utility that can create deltas that don't contain source bits?”

rdiff (which is open source and has a Windows port) seems to do the job, though it will require a lot of wrapping to automate its usage.

It doesn’t seem to automatically detect an ideal block size to make a minimal diff, and it doesn’t automatically decompress the source file before taking the delta.

Both of these features are necessary if you want to keep your patches small. More importantly, both are necessary to avoid accidents like creating deltas that can be applied to any file. Such a delta would violate the requirement that you don’t simply distribute a modified copy of the original content.

A wrapper application or shell script could be used to detect whether files are compressed or not (simple extension filter) and potentially decompress the file, or refuse to work. It could also try different block sizes to figure out a value that makes a small delta, or have specific block sizes programmed in for specific types of files (ala a gzip file made with –rsync that takes rsync’s default 512b block size into account).