Alhexx' Zanzarah PAK Format Description 1.0 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Zanzarah's PAK format is quite easy. It consist of some very simple types: -= The Header =- // C++-Style typedef struct { int ID; // = 0 int NumEntries; } zan_pak_header_t; ' VB-Style Type zan_pak_header_t ID As Long ' = 0 NumEntries As Long End Type The Entries aren't that easy, b'cause they're variable-sized, however, they're not too complicated: -= Entries =- // C++-Style typedef struct { int LenName; char Name[LenName]; // variable-sized int OffSet; int FileSize; } zan_pak_entry_t; ' VB-Style Type zan_pak_entry_t LenName As Long Name As String * LenName Offset As Long FileSize As Long End Type -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= You know, that neither C++ nor VB can handle such variable sized Strings (AFAIK). So you'll have to build your own procedures to read out those strings. There's something important you should know 'bout the offset: These are NOT the offsets within the File itself! These offsets indicate how many Bytes the data follows after the Header !! So you'll have to add the Length of the Header to the offset of a file! First, let's see how to calculate the size of the Header: --------------------------------------------------------- Base Header Size: 8 Bytes Size of Entry Base: 12 Bytes Size of Entry FileNames: x Bytes Size of "Footer": 4 Bytes You see, you'll have to calculate like this: 8 Bytes + (NumEntries * 12) + (Size_of_every_single_FileName) + 4 You might wonder what that "Footer" is? Directly after the header, and before the first file data block, there is a 4-Byte Integer. I don't know for what it stands for, but that's not so important. If you're interested: The size of the Header from Zanzarah English Demo is: 223679 Bytes If you want to write your own ripper/packer, try around with the demo, so that you get this value :) The File data itself is stored as raw data, no compression or things like that. You simply have to create an Byte array (at least under VB) or create a buffer, and write the data from the calculated offset + FileOffset_from_Entry to a new file. I think that's all. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ~~ Greetings Fly Out To: ~~ Darkness Ficedula Kaddy #17 Kaoru S. Night Mirex Phaeron Qhimm Sephiroth 3D ShinRa Inc. The SaiNt ... and everyone I've forgotten! Visit or contact me: -------------------- Home : http://www.alhexx.com Forum : http://forums.alhexx.com Mail : alhexx@alhexx.com - Alhexx 16:53 2002-11-16