Allright, I heard your plee, my son.
I have found the time to take a brief look at your .dat format. And you are going to love this.
The way to unpack or create the .dat archives has been right under your nose all the time!
But let's keep you in suspence just a little while longer. The format of the .dat archives (or NKZIP files) is as follows:
Code: Select all
// Header
byte{16} Magic Word (NKZIP)
byte{16} Version or Name of the current .dat file
uint32{4} Total size of actual filedata
uint32{4} Number of files in the archive
// For each file
untin32{4} Size of file in bytes
byte{260} Name of file (260 bytes reserved)
And this MexScript will open them and let you replace all files with your own (not changing names or anything, as the game will expect them to be in order right?).
Code: Select all
ImpType SFileSize ;
GetDString MW 16 0 ;
GetDString AN 16 0 ;
Get AllData Long 0 ;
Get FileNum Long 0 ;
For T = 1 To FileNum ;
SavePos FSO 0 ;
Get FS Long 0 ;
SavePos PO 0 ;
Math PO += 1 ;
GoTo PO 0 ;
GetDString FileName 259 0 ;
SavePos FO 0 ;
Log FileName FO FS 0 FSO ;
Math FO += FS ;
GoTo FO 0 ;
Next T ;
See the attached example of a PNG and DDS file I could extract with MexCom from PAK008.dat and pak001.dat.
Now here comes the funny bit.
All of these .dat archives carry the way to pack and unpack .dat archives (or NKZIP files as I prefer calling them)! Cryptic? Not in the least, what they all contain is the program that created them in the first place!
CRDat.exe is the packer/unpacker the authors used to create the .dat archives. I assume it's short for CreateDat.
I extracted the executable immediately with a hex editor when I saw it (and that's easy, as executables usually start with "MZ"). I tried to run it from command line and got a help response.
Code: Select all
CRDat e out-file version
CRDat d in-file
At that time I thought it a little strange, but tried to run it anyway.
This I then figured out :
The d stands for "decode". I tried it on the pak008.dat file and it neatly extracted all the files.
To pack all the files in a directory, copy the CRDat.exe to that directory and start this from command line:
Code: Select all
CRDat e YourPakFile.dat ThePakFileTitle
Brilliant isn't it! Well, the authors call it encode/decode, but there's nothing encoded or whatever, it's just a packer that does not even compress or anything.
The CRDat.exe also packs itself in the new archive, along with stuff like a Windows link/short-cut to the CRDat.exe file and the Thumbs.dat system file.
Sloppy! Sloppy! Sloppy!
When I looked at the properties of the CRDat.lnk file I saw the original paths of the authors as well as the syntax to use the CRDat file: