As a Fun Weekend Project, I decided to write an implementation of byuu's UPS patch format in Python.
Download: upspatch-0.1.tar.gz
Currently, the library supports reading patch-files in from disk, writing them out, and applying a patch to a file, with all the CRC-checking and file-validation. It does not yet support creating UPS files, nor does it come with a command-line tool, so for the moment you have to write your own Python code to use it; something like this:
Code: Select all
import upspatch
p = upspatch.patchFromFile('dl-1.02/dl.ups')
p.apply("dl.sfc", "dl-eng.sfc")
On the other hand, I can load the Der Langrisser patch, write it out to a new file, patch the original ROM then un-patch the patched ROM all in under 3 seconds on my PowerMac G5 1.6GHz, and my profiler says the single slowest function is the CRC32 function written in C, so I guess I didn't do too badly there.
I've worked on this code about as much as I want to for myself. I'm happy to work on it further if it's of interest or use to other people, but for the moment I'm done.
[1]: Byuu is awesome, but he has a habit of releasing his code under licences he's made up himself with no legal training. For example, in the UPS announcement thread at romhacking.net, he says the reference UPS implementation is public-domain except if your modified code produces different output. Apart from the problems with 'public domain' licensing in general, I guess this means you can't use it in a tool that creates NINJA patches, or puts UPS patches into a ZIP along with the files it patches, or handles creating patches from multiple sources to a target, or anything else interesting...
By contrast, I've written my code without reading (or even downloading) byuu's reference implementation, so it shouldn't be a derivative work for copyright purposes, and I've released it under the well-known MIT licence so nobody should have any problems using it for their own purposes. That said, please don't use this code to create UPS files that the reference implementation can't read - there's already enough broken file formats in the world, we don't need any more.