|
aetsby_patcher.c:
/*
* quick binary-patching code - this code is able to patch AND *unpatch* a
* desired binary file, when given the proper patching information.
*
* you'll need to make a list of each byte that you want modified, in
* the format specified below (a nx3 array), where n bytes will be changed.
* unix's cmp, or windows' comp.exe are two examples of p
rograms that should
* be able to do this for you. you'll also need the exact filename, and
file
* size in bytes.
*
* now, fill in your custom patch information below.
*
*/
#define FILENAME "X-Plane 700.exe" // the file you'd li
ke patched
#define FILESIZE 2397696 // the real file size in bytes
#define NUM_BYTES_TO_FIX 10 // how many bytes will be changed?
int EDIT[NUM_BYTES_TO_FIX][3] = { // {OFFSET, ORiGbyte, NEWbyte}
{0x173CB2, 0xF, 0x90},
{0x173CB3, 0xB6, 0x90},
{0x173CB4, 0x4F, 0x90},
{0x173CB5, 0x32, 0x90},
{0x173CB6, 0x88, 0x90},
{0x173CB7, 0xCB, 0x90},
{0x173CB8, 0xF, 0x90},
{0x173CB9, 0xB6, 0x90},
{0x173CBA, 0xC3, 0x90},
{0x173CBB, 0x83, 0xB8}};
/*
* you're now ready to compile. modify the independent code below if you
* like, but it's not required - unless you want to improve it =)
*
* ie. "gcc aetsby_patcher.c -o FILENAME.aetsby_patcher.exe"
*
*/
#define VERSION "2008-09-04"
#define EDIT_OFF 0
#define EDIT_ORG 1
#define EDIT_NEW 2
#include <stdio.h>
int main () {
printf ("Aetsby Patcher/Unpatcher, %s\n", VERSION);
printf ("file: [%s]\n", FILENAME);
printf ("filesize: [%d]\n", FILESIZE);
FILE * File = fopen ( FILENAME, "r+b" );
if (!File) {
printf ("Could not find the file in current dir =(.");
getchar();
return 1;
}
fseek ( File, 0, SEEK_END );
if ( ftell(File) != FILESIZE ) {
printf ("Filesize mismatch! Cannot apply patch.");
getchar();
return 1;
}
printf ("actions:\n");
int i;
int c;
for ( i = 0; i < NUM_BYTES_TO_FIX; i++ ) {
fseek ( File, EDIT[i][EDIT_OFF], SEEK_SET );
c = fgetc ( File );
fseek ( File, -1, SEEK_CUR );
if ( c == EDIT[i][EDIT_ORG] ) {
fputc ( EDIT[i][EDIT_NEW], File );
printf ("patched offset %d from %d to %d\n",
EDIT[i][EDIT_OFF],
EDIT[i][EDIT_ORG],
EDIT[i][EDIT_NEW]);
}
else if ( c == EDIT[i][EDIT_NEW] ) {
fputc ( EDIT[i][EDIT_ORG], File );
printf ("UNpatched offset %d from %d to %d\n",
EDIT[i][EDIT_OFF],
EDIT[i][EDIT_NEW],
EDIT[i][EDIT_ORG]);
}
else {
printf ("ERROR: unidentified byte!!! (%d)\n", c);
}
}
fclose ( File );
printf ("Enjoy! Press enter to exit.");
getchar();
return 0;
}
README.txt:
NOCD Crack for X-Plane 700 RC4, by aEtSbY
FILENAME "X-Plane 700.exe"
FILESIZE 2397696
Just run the patcher exe in x-plane's "main" folder - the
one that includes
the above FILENAME. If you'd like to undo the changes, repeat the above
operation.
Sourcecode for the patcher is included - and is easily customizable ;)
Enjoy life!
|