DAT (Ever17): Difference between revisions
No edit summary |
No edit summary |
||
Line 42: | Line 42: | ||
|} | |} | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> |
Revision as of 23:34, 15 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 files inside this archive appear to have been processed before being put inside the archive. Every *.JPG file has a 256 byte chunk of data from offset 4352 to 4608 (base 10) that differs from the same file that is saved from the in-game wallpaper menu (special features). This effectively breaks/corrupts the picture. To fix this , you have to subtract each byte in the obstructed area by a specific number, which is different for each byte and for each picture. This array of difference numbers is calculate by first adding the filename's characters together by treating them as a 1 byte number, and truncate the number to just 8-bits/1 Byte. This is the first difference number of the 256 needed to be generated. The rest are generated using a series of calculations using the previously generated number.
'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 |
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;
}
}
Current task-> Rewrite archive tool for packing and unpacking. Fix flaws in wallpaper fix tool. Also think about renamming wallpaper fix tool if other files extracted show same thing, such as scripts.
Why do I have to be so OCD...? >.< First it's 'arctool', then 'dattool'... datTool? :T