[help] Decoding file formats
Hello, I'm working on decoding some .dat files that this game client runs. And I cant seem to find many tuts on decoding file formats. The only suggestion I can come up with is debugging the client and programming the data like the client does to read the .dat files.
this is the only thing i came up with off the top of my head but i believe it wont work..
Of course i still need to add in the function that would convert this to a txt file or whatever file format I want.
So what suggestions do you have on reverse engineering file formats. (DECODE and ENCODE)....
this is the only thing i came up with off the top of my head but i believe it wont work..
Code:
unsigned char GetCharVal( char mychar )
{
switch( mychar )
{
case '0': return 0;
case '1': return 1;
case '2': return 2;
case '3': return 3;
case '4': return 4;
case '5': return 5;
case '6': return 6;
case '7': return 7;
case '8': return 8;
case '9': return 9;
case 'a': return 10;
case 'b': return 11;
case 'c': return 12;
case 'd': return 13;
case 'e': return 14;
case 'f': return 15;
case 'A': return 10;
case 'B': return 11;
case 'C': return 12;
case 'D': return 13;
case 'E': return 14;
case 'F': return 15;
}
return 0;
}
// MY Decoded class...
void DecodeBinary( char* encoded, unsigned char* data )
{
unsigned curbit = 0;
for( unsigned i = 0; i < (unsigned)strlen(encoded); i+=2 )
{
data[curbit] = GetCharVal( encoded[i] ) << 4;
data[curbit] += GetCharVal( encoded[i+1] );
curbit++;
}
}
So what suggestions do you have on reverse engineering file formats. (DECODE and ENCODE)....

