Changes

Jump to navigation Jump to search
267 bytes added ,  19:47, 4 July 2017
Added some more comments to both headers
Line 20: Line 20:  
  {
 
  {
 
     uint128 headerMD5;
 
     uint128 headerMD5;
     uint32 metaDataOffset;
+
     uint32 gbxHeadersStart; // offset to metadata section
     uint32 dataOffset;
+
     uint32 dataStart;
 
     if version >= 2:
 
     if version >= 2:
 
     {
 
     {
         uint32 metaDataUncompressedSize;
+
         uint32 gbxHeadersSize;
         uint32 metaDataCompressedSize;
+
         uint32 gbxHeadersComprSize;
 
     }
 
     }
 
     if version >= 3:
 
     if version >= 3:
Line 90: Line 90:  
     if (version >= 7)
 
     if (version >= 7)
 
     {
 
     {
         SAuthorInfo AuthorInfo; // uint32 version = 0, string login, string nick, string zone, string extra
+
         struct SAuthorInfo
 +
        {
 +
            uint32 Version;
 +
            string Login;
 +
            string Nick;
 +
            string Zone;
 +
            string ExtraInfo;
 +
        };
 
         if (version < 9)
 
         if (version < 9)
 
         {
 
         {
Line 106: Line 113:  
             if (version >= 13)
 
             if (version >= 13)
 
                 string DownloadUrl;
 
                 string DownloadUrl;
             uint64 CreationDate;
+
             uint64 CreationDate; // Win32 FILETIME structure
 
             string Comment;
 
             string Comment;
 
             if (version >= 12)
 
             if (version >= 12)
Line 133: Line 140:  
         }
 
         }
 
     }
 
     }
     Blowfish encrypted:   // Unencrypted, if DecryptFlags & 0x3 == 0
+
     Blowfish encrypted: // Unencrypted, if (DecryptFlags & 0x3) == 0
 
     {
 
     {
 
         uint128 Checksum;
 
         uint128 Checksum;
         uint32 GbxHeadersStart;
+
         uint32 GbxHeadersStart; // Offset to the metadata section
 
         if version < 15:
 
         if version < 15:
             uint32 DataStart;
+
             uint32 DataStart;     // If version >= 15: DataStart = HeaderMaxSize
 
         if version >= 2:
 
         if version >= 2:
 
         {
 
         {
Line 179: Line 186:     
===Data===
 
===Data===
The content of each file starts at Header.dataOffset + FileDesc.offset in the .pak file. First, an 8-byte plaintext IV is read. Then, FileDesc.compressedSize bytes are read and decrypted using Blowfish in CBC mode, using the same key that was used to decrypt the header. If FileDesc.flags & 0x7C is not zero, the file is compressed and should be decompressed using zlib deflate after decryption (it will end up at FileDesc.uncompressedSize bytes).
+
The content of each file starts at Header.dataStart + FileDesc.offset in the .pak file. From version 15, the data block starts at HeaderMaxSize. First, an 8-byte plaintext IV is read. Then, FileDesc.compressedSize bytes are read and decrypted using Blowfish in CBC mode, using the same key that was used to decrypt the header. If FileDesc.flags & 0x7C is not zero, the file is compressed and should be decompressed using zlib deflate after decryption (it will end up at FileDesc.uncompressedSize bytes).
    
The type of the file can be found from the extension in the name, or, if this is not available (many file names are actually just hashes), from the [[Class IDs|class ID]].
 
The type of the file can be found from the extension in the name, or, if this is not available (many file names are actually just hashes), from the [[Class IDs|class ID]].

Navigation menu