2 //Patcher generator 0.3
5 This will parse output from my HexCmp tool and
6 create the code, than can be directly pasted to
8 Making of patcher was never easier.
11 ///SETINGS///////////////////////////////////////////////////////
12 $proc = "hexcmp orig.exe crac.exe"; //HexCmp command
13 $fp = "bin"; //FILE pointer to handle with
15 ///CODE//////////////////////////////////////////////////////////
16 $pp = popen($proc, "r");
18 $line = trim(fgets($pp));
20 if(ereg("Difference", $line)) {
21 $offset = explode("H: ", $line);
23 echo("fseek($fp, $offset"."L, SEEK_SET); //Seek to $offset\n");
26 if(ereg("\\\\x.", $line)) {
27 $bytes = substr_count($line, "\\x");
28 echo(" fwrite(\"$line\", $bytes, 1, $fp); //Patch $bytes bytes\n");
33 ///EXAMPLE///////////////////////////////////////////////////////
35 //Example output from HexCmp:
36 Difference @ D: 222313 H: 0x36469
40 Difference @ D: 317430 H: 0x4d7f6
44 //Will be turned to something like this:
45 fseek(bin, 0x36469L, SEEK_SET); //Seek to 0x36469
46 fwrite("\x90\x90\x90\x90\x90", 5, 1, bin); //Patch 5 bytes
47 fseek(bin, 0x4d7f6L, SEEK_SET); //Seek to 0x4d7f6
48 fwrite("\x13\x37\xc0\xde", 4, 1, bin); //Patch 4 bytes
This page took 0.360951 seconds and 4 git commands to generate.