YPAK File Format Specification

 

YPAK File Format is a file format for storing directories as a compressed archive. YPAK File Format is very similar in design and usage to the ID Software’s PAK file format for the Quake™ Game Engine and the ubiquitous tar file format. YPAK uses GZIP compression for files.

 

 

 

The YPAK File has two major parts:

 

1)    The file Header

The YPAK File header specifies information like the number of entries in the file and the offset to the first entry and the CRC Checksum of the file.

2)    The Entries

The Entry again has a entry header and a entry data section. The entry header contains the name of the entry, the uncompressed size of the entry data, the compressed size of the entry data, offset to the entry data and whether the entry is a file or a directory.

 

The Entry Data if compressed is just a GZIP compressed byte stream for the original entry data.

 

 

As a better explanation, the YPAK file format can be expressed as the following C-style structures.

 

 

struct YPAK_Header

{

      ubyte magic[5];

      ubyte version[3];

 

      uint32 entry_count;

      uint32 entry_offset;

 

      uint32 reserved1;

      uint32 reserved2;

};

 

struct YPAK_EntryHeader

{

      uint8 entry_flag;

      uint32 entry_name_offset;

      uint32 entry_name_length;     

      uint32 entry_data_offset;

      uint32 entry_data_compressed_length;

      uint32 entry_data_uncompressed_length;

 

 

};


 

 

 

 

 

The YPAK File looks something liek this: