knuckle cracker

This project is a response to the urge to make small changes to the big binary files. For text files, there are diff/patch utilities; and for big changes, rsync is perfect. Now, if  you're sharing something like a game mod, where you need to swap a single bit inside a huge data file (just like in a Hot Coffee Mod for GTA San Andreas Eye-wink, you're frequently forced to share the entire file. By the other side, if you need to update some firmware glitch, why should you rewrite the entire flash chip?! So, here's my proposal.
bin_diff utility will compare two binary files and output a human-readable (and writable Smiling script file, just like this:

[bb35cc23dda6737d181a63ea3203f0ff engine.dll]
50 "This program must be run under Win32\xd\xa$"
d60a EB
d77b 90 90
da3f E9
da41 1 0
ea44 90
# Patch length: 0000007A
First line contains a name of the file to be patched, and it's MD5 checksum value. Following lines start with a hex offset inside this file, and the new byte(s) value. Note that strings with C-like escaping style are supported! You may also comment each line, using the hash character (#). Several files may be patched by a single patch-script. The last string in the last line is a hex value of the patch data length. It is useful to make self-applicable patches.
Then, knuckle_cracker may be used to parse the patch-script and apply modifications to the files. It will check the MD5 checksum for each file automatically (and will refuse to patch unmatched files). You can also make the self-applicable patches, concatenating the patch-script directly at the end of the knuckle_cracker executable (following example works on UN*X systems, for Windows box, use any hex editor, it works just the same):
cat knuckle_cracker engine.bin_patch > engine_patcher
Both bin_diff & knuckle_cracker are very portable: I tested them on Linux, FreeBSD (gcc) & Win32 (Borland C/CYGWIN/MinGW/MSVC).

P.S. - all sources has DOS line endings (CRLF), use
"unzip -aa knuckle_cracker.zip" to extract on UN*X systems.


Filename/TitleSize
knuckle_cracker.zip30.19 KB

stas » April 19, 2006 » 02:42

Post new comment

*
*
The content of this field is kept private and will not be shown publicly.


*

  • Allowed HTML tags: <a> <i> <b> <u> <img> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre>
  • Lines and paragraphs break automatically.
  • Textual smileys will be replaced with graphical ones.