DAT (Ever17): Difference between revisions
No edit summary |
No edit summary |
||
Line 28: | Line 28: | ||
Notes for 'wallpaper.dat'<br /> | Notes for 'wallpaper.dat'<br /> | ||
The files inside this archive | The *.JPG files inside this archive have had a small chunk data obfuscated. From offset 0x1100 to 0x1200 (256 bytes), data has been modified which effectively breaks/corrupts the image. To undo this modification requires generating numbers to subtract from each byte in the affected area. | ||
To generate these numbers, start off by adding each character in the file name of the file in question together, byte-by-byte. For example: 'test' 0x74 0x65 0x73 0x74 = 0x1C0 and then truncate the number down to 1 byte so 0xC0. This would be the first difference number out of the 256. The rest of the numbers are generated by using the previous number in a series of calculations. | |||
'a' starts off as the value of the previous number. | 'a' starts off as the value of the previous number. | ||
Line 42: | Line 44: | ||
|} | |} | ||
A C++ representation. | |||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
unsigned char diff_array[256]; | unsigned char diff_array[256]; | ||
Line 65: | Line 67: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== Tools == | |||
Coming soon... | |||
Revision as of 09:21, 16 July 2014
Seen/used in the follow game(s):
- Ever17
Structure
Header | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Size | Content | Description | ||||||||||||
4Bytes | Magic/ID | |||||||||||||
4Bytes | File Count | |||||||||||||
8Bytes | Padding | 0x00 | ||||||||||||
Index | ||||||||||||||
Size | Content | Description | ||||||||||||
4Bytes | Offset | Starts from zero. | ||||||||||||
4Bytes | File Size | Stored value is actual size doubled | ||||||||||||
24Bytes | File name | Unused space will be padding (0x00). |
Notes for 'wallpaper.dat'
The *.JPG files inside this archive have had a small chunk data obfuscated. From offset 0x1100 to 0x1200 (256 bytes), data has been modified which effectively breaks/corrupts the image. To undo this modification requires generating numbers to subtract from each byte in the affected area.
To generate these numbers, start off by adding each character in the file name of the file in question together, byte-by-byte. For example: 'test' 0x74 0x65 0x73 0x74 = 0x1C0 and then truncate the number down to 1 byte so 0xC0. This would be the first difference number out of the 256. The rest of the numbers are generated by using the previous number in a series of calculations.
'a' starts off as the value of the previous number.
Order | Expression |
---|---|
1 | d = a + (a*2) |
2 | d = d + (d*8) |
3 | a = a+(d*4)+1243 |
A C++ representation.
unsigned char diff_array[256];
void diff_gen(std::string &incoming_filename)
{
char firstValue = 0;
for (unsigned int i = 0; i < incoming_filename.size(); i++) //Better be 14 bytes... Though adding 0x00 shouldn't affect output.
{
firstValue += incoming_filename[i];
}
diff_array[0] = firstValue;
for (int i = 1; i < 255; i++)
{
char temp = diff_array[i - 1] + (diff_array[i - 1] * 2);
temp = temp + (temp * 8);
diff_array[i] = diff_array[i - 1] + (temp * 4) + 1243;
}
}
Tools
Coming soon...