If you're having problems patching your FH2 installation, please post a thread here including the logfile created by the patcher (fh2-patch-debug.log) in your mods/fh2 directory.
The FH2 patcher ("fh2patch") is built upon xdelta3, an excellent binary delta system by Josh McDonald. It also uses wxWidgets.
A single fh2patch input file defines a collection of steps to take to update an installation from an expected start state to an end state, or from any point between the start and end states (in other words, partial patches do not ruin an installation).
Use xdelta3 to apply xdelta3 diff to target path if hash(target path) == hash(before). Then assert hash(target path) == hash(after) (in other words, the patch is now applied).
Remove target path if it exists.
Write data to the target path.
The file format is very simple. In an ad-hoc syntax:
action:
enum(step type)
if step type == 1: # PATCH
string(target path)
hash(before)
hash(after)
string(xdelta3 diff)
if step type == 2: # DELETE
string(target path)
if step type == 3: # ADD
string(target path)
string(data)
data:
integer(n_actions)
action0
action1
action2
...
actionn_actions - 1
file:
'FH2PATCHbyCTZ\0\0\0'
hash(data)
data
Here, integer() is encoded as unsigned 32-bit little-endian integer. string() is encoded as an integer(n) length followed by n bytes of ASCII. enum() is encoded as for integer(). A hash() is encoded as 16-bytes. The hash function used everywhere is MD5.
fhpatcher.exe <patch file> <base path>
base path is added to the front of all target paths: this is the root of the installation.
fhpatcher.exe exits non-zero on error.
xdelta3 is licensed under the GPLv2. Therefore fh2patch is also licensed under the GPLv2.
fh2patch - compact program installation updating system
Copyright (C) 2008 Joseph Birr-Pixton
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Basic executable for 32-bit Windows.
Sources. Not exceptionally pretty.
Tools. bindiff.py walks two directory trees and creates a fh2patch input file. It can also output a batch file and set of files to apply it to an installation using xdelta3 directly. unpick_patch.py reads a fh2patch input file and tells you what it found.