#include <stdio.h>
#include <stdlib.h>
int main()
{
unsigned char length1; // Length of section 1 bytse //
unsigned char length2; // Length of section 2 bytse //
unsigned char length3; // Length of section 3 bytse //
unsigned char length4; // Length of section 4 bytse //
unsigned char length5; // Length of section 5 bytse //
unsigned char length6; // Length of section 6 bytse //
unsigned char length7; // Length of section 7 bytse //
unsigned char length8; // Length of section 8 bytse //
unsigned int Filelength; // Length of the file to be loaded o really? //
unsigned int counter;
FILE *oldSavegame;
FILE *Content;
length1 = 0x00;
length2 = 0x00;
length3 = 0x00;
length4 = 0x00;
length5 = 0x00;
length6 = 0x00;
length7 = 0x00;
length8 = 0x00;
counter = 0x00;
oldSavegame=fopen("fw.img","rb");
Content=fopen("newfw.img","wb");
fseek(oldSavegame,0,SEEK_END);
Filelength = ftell(oldSavegame);
fseek(oldSavegame,0,SEEK_SET);
while (ftell(oldSavegame) != Filelength)
{
fread (&length1,1,1,oldSavegame);
if (length8 == 0xD0 && length7 == 0x01 && length6 == 0x20 && length5 == 0x00 && length4 == 0xE0 && length3 == 0x00 && length2 == 0x20 && length1 == 0x07)
{
length1 = 0x00;
counter++;
}
length8 = length7;
length7 = length6;
length6 = length5;
length5 = length4;
length4 = length3;
length3 = length2;
length2 = length1;
fwrite (&length1,1,1,Content);
}
if (counter > 1)
{
printf("found more than one location. Maybe it won't work. Tell Tock about the game.\nPress enter to exit.");
getchar();
}
return 0;
}