Unreal Engine 4 PAK: Difference between revisions

From XentaxWiki
Jump to navigation Jump to search
imported>Ikskoks
(Created page with "{{GRAFPageHeader}} == PAK == * ''' Format Type ''': Archive <br> * ''' [http://en.wikipedia.org/wiki/Endianness Endian Order] ''': Little Endian <br> * ''' Signature '''...")
 
imported>Ikskoks
 
(102 intermediate revisions by the same user not shown)
Line 4: Line 4:
* ''' Format Type ''':    Archive <br>  
* ''' Format Type ''':    Archive <br>  
* ''' [http://en.wikipedia.org/wiki/Endianness Endian Order] ''': Little Endian <br>
* ''' [http://en.wikipedia.org/wiki/Endianness Endian Order] ''': Little Endian <br>
* ''' Signature ''':    None <br>  
* ''' Signature ''':    E1 12 6F 5A <br>  




=== Format Specifications ===  
=== Format Specifications ===  


<div class="toccolours mw-collapsible" id="mw-customcollapsible-myDivision" style="width:800px; overflow:auto;">
<div style="border:solid 1px #AAAAAA; padding:4px; background-color:#F9F9F9; font-weight:bold;">
<pre>
<tt>
// TODO
<font color="blue"><i>// Unreal Engine 4 PAK file format</i></font><br />
</pre>
<font color="blue"><i>FILE DATA</i></font><br />
&nbsp;&nbsp;<font color="blue"><i>for each file</i></font><br />
&nbsp;&nbsp;&nbsp;&nbsp;uint64 {8}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;null<br />
&nbsp;&nbsp;&nbsp;&nbsp;uint64 {8}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Compressed Length  <font color="purple">(not including the file header fields or padding)</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;uint64 {8}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Decompressed Length<br />
&nbsp;&nbsp;&nbsp;&nbsp;uint32 {4}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Compression Type  <font color="purple">(0=uncompressed, 1=ZLib, 2=GZip, 4=Snappy, 16=bias memory, 32=bias speed)</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;byte {20}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;data sha1 hash<br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="blue"><i>if (compressed){</i></font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 {4}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Number of Compressed Blocks<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="blue"><i>for each compressed block</i></font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint64 {8}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Offset to the start of the compressed data block  <font color="purple">(relative to the start of the archive)</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint64 {8}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Offset to the end of the compressed data block  <font color="purple">(relative to the start of the archive)</font><br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;byte {1}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;null<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="blue"><i>for each compressed block</i></font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 {4}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Decompressed Length of thie block<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;byte {X}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;File Data  <font color="purple">(ZLib Compression)</font><br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;byte {0-2047}&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;null Padding to a multiple of 2048 bytes  <font color="purple">(sometimes, not always)</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="blue"><i>}</i></font><br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="blue"><i>else if (uncompressed){</i></font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 {4}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;null<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;byte {1}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;null<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;byte {X}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;File Data<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;byte {0-2047}&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;null Padding to a multiple of 2048 bytes  <font color="purple">(sometimes, not always)</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="blue"><i>}</i></font><br />
<br />
<font color="blue"><i>DIRECTORY</i></font><br />
&nbsp;&nbsp;uint32 {4}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Relative Directory Name Length  <font color="purple">(including null terminator)</font> <font color="purple">(10)</font><br />
&nbsp;&nbsp;byte {9}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Relative Directory Name  <font color="purple">(../../../)</font><br />
&nbsp;&nbsp;byte {1}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;null Relative Directory Name Terminator<br />
&nbsp;&nbsp;uint32 {4}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Number of Files<br />
&nbsp;&nbsp;<font color="blue"><i>for each file</i></font><br />
&nbsp;&nbsp;&nbsp;&nbsp;uint32 {4}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Filename Length  <font color="purple">(including null terminator)</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;byte {X}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Filename<br />
&nbsp;&nbsp;&nbsp;&nbsp;byte {1}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;null Filename Terminator<br />
&nbsp;&nbsp;&nbsp;&nbsp;uint64 {8}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;File Offset<br />
&nbsp;&nbsp;&nbsp;&nbsp;uint64 {8}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Compressed Length  <font color="purple">(not including the file header fields or padding)</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;uint64 {8}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Decompressed Length<br />
&nbsp;&nbsp;&nbsp;&nbsp;uint32 {4}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Compression Type  <font color="purple">(0=uncompressed, 1=ZLib, 2=GZip, 4=Snappy)</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;byte {20}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;<font color="red">Unknown</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="blue"><i>if (compressed){</i></font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 {4}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Number of Compressed Blocks<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="blue"><i>for each compressed block</i></font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint64 {8}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Offset to the start of the compressed data block  <font color="purple">(relative to the start of the archive)</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint64 {8}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Offset to the end of the compressed data block  <font color="purple">(relative to the start of the archive)</font><br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;byte {1}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;null<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 {4}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Decompressed Block Size  <font color="purple">(65536 if multiple blocks, otherwise the same as the decompressed length)</font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="blue"><i>}</i></font><br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;<font color="blue"><i>else if (uncompressed){</i></font><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 {4}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;null<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;byte {1}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;null<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="blue"><i>}</i></font><br />
<br />
<font color="blue"><i>FOOTER (44 bytes)</i></font><br />
&nbsp;&nbsp;uint32 {4}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Signature  <font color="purple">((bytes)225,18,111,90) // E1 12 6F 5A  // "..oZ" </font><br />
&nbsp;&nbsp;uint32 {4}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Version  <font color="purple">// 1, 2, 3, 4, 7, 8, 9 or 11</font><br />
&nbsp;&nbsp;uint64 {8}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Directory Offset<br />
&nbsp;&nbsp;uint64 {8}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Directory Length  <font color="purple">(not including FOOTER)</font><br />
&nbsp;&nbsp;byte {20}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;directory sha1 hash<br />
&nbsp;&nbsp;<font color="blue"><i>if (version) == 11</i></font><br />
&nbsp;&nbsp;&nbsp;&nbsp;char {160} - compression string + padding  // e.g. "Zlib"
<br />
</tt>
</div>
</div>
=== MultiEx BMS Script ===
Not written yet.


=== Notes and Comments ===  
=== Notes and Comments ===  


None.
* It is popular file format used in many games made on '''Unreal Engine 4'''.
* These files normally occur in path such as "\<game_name>\<build_name>\Content\Paks\<build_name>-WindowsNoEditor.pak"
* This archive type uses '''ZLIB''', '''GZIP''' or '''Snappy''' compression method.
* Data may be encrypted with '''AES''' encryption.
* To parse the archive, footer needs to be read first, because it has important info about offsets.


=== Games ===  
=== Games ===  
List of games using this file format:
List of games using this file format:
* Little Nightmares II (PC) (*.PAK)
 
* Backbone (PC) (*.PAK) (version 11)
* Little Nightmares II (PC) (*.PAK) (version 8)
* Poppy Playtime (PC) (*.PAK) (version 11)
* Pumpkin Jack (PC) (*.PAK) (version 9)
* Styx: Shards of Darkness
* Tekken 7 (PC) (*.PAK) (version 3)
* The Fall of Lazarus
* Many more...
 
=== QuickBMS Scripts ===
 
See [[List of Unreal Engine Tools]] article on this wiki.


=== Compatible Programs ===  
=== Compatible Programs ===  


* [https://github.com/allcoolthingsatoneplace/UnrealPakTool UnrealPakTool]<br>
See [[List of Unreal Engine Tools]] article on this wiki.
// TODO
 
=== See Also ===
 
* [https://cs.rin.ru/forum/viewtopic.php?t=100672 UE4 keys collection]
* [[Unreal Engine 4 UASSET|Unreal Engine 4 UASSET (xentax wiki)]]
 
=== Gallery ===
<gallery bordercolor="transparent" spacing="small" orientation="landscape">
fmodel.png|FModel
ue4_pak_unpacker.png|UE4 PAK Unpacker
</gallery>
<br><br>
<br/><br>
<br/><br>




[[Category:Complete WIP|Unreal Engine 4 PAK]]
[[Category:Complete Almost Done|Unreal Engine 4 PAK]]
[[Category:Platform PC|Unreal Engine 4 PAK]]
[[Category:Platform PC|Unreal Engine 4 PAK]]
[[Category:CE None|Unreal Engine 4 PAK]]
[[Category:CE None|Unreal Engine 4 PAK]]
[[Category:Format_Archive | Type: Archive]]
[[Category:Format_Archive | Type: Archive]]
[[Category:Extension_pak | Extension: pak]]
[[Category:Extension_pak | Extension: pak]]
[[Category:BMS_None | BMS: None]]
[[Category:ZLIB compression]]
[[Category:GZIP compression]]
[[Category:SNAPPY compression]]
[[Category:AES encryption]]
[[Category:File Format]]
[[Category:File Format]]

Latest revision as of 11:04, 24 June 2022

Back to index | Edit this page

PAK

  • Format Type : Archive
  • Endian Order : Little Endian
  • Signature : E1 12 6F 5A


Format Specifications

// Unreal Engine 4 PAK file format
FILE DATA
  for each file
    uint64 {8}       - null
    uint64 {8}       - Compressed Length (not including the file header fields or padding)
    uint64 {8}       - Decompressed Length
    uint32 {4}       - Compression Type (0=uncompressed, 1=ZLib, 2=GZip, 4=Snappy, 16=bias memory, 32=bias speed)
    byte {20}        - data sha1 hash
    if (compressed){
      uint32 {4}       - Number of Compressed Blocks
      for each compressed block
        uint64 {8}       - Offset to the start of the compressed data block (relative to the start of the archive)
        uint64 {8}       - Offset to the end of the compressed data block (relative to the start of the archive)

      byte {1}         - null
      for each compressed block
        uint32 {4}       - Decompressed Length of thie block
        byte {X}         - File Data (ZLib Compression)

      byte {0-2047}    - null Padding to a multiple of 2048 bytes (sometimes, not always)
      }

    else if (uncompressed){
      uint32 {4}       - null
      byte {1}         - null
      byte {X}         - File Data
      byte {0-2047}    - null Padding to a multiple of 2048 bytes (sometimes, not always)
      }

DIRECTORY
  uint32 {4}       - Relative Directory Name Length (including null terminator) (10)
  byte {9}         - Relative Directory Name (../../../)
  byte {1}         - null Relative Directory Name Terminator
  uint32 {4}       - Number of Files
  for each file
    uint32 {4}       - Filename Length (including null terminator)
    byte {X}         - Filename
    byte {1}         - null Filename Terminator
    uint64 {8}       - File Offset
    uint64 {8}       - Compressed Length (not including the file header fields or padding)
    uint64 {8}       - Decompressed Length
    uint32 {4}       - Compression Type (0=uncompressed, 1=ZLib, 2=GZip, 4=Snappy)
    byte {20}        - Unknown
    if (compressed){
      uint32 {4}       - Number of Compressed Blocks
      for each compressed block
        uint64 {8}       - Offset to the start of the compressed data block (relative to the start of the archive)
        uint64 {8}       - Offset to the end of the compressed data block (relative to the start of the archive)

      byte {1}         - null
      uint32 {4}       - Decompressed Block Size (65536 if multiple blocks, otherwise the same as the decompressed length)
      }

    else if (uncompressed){
      uint32 {4}       - null
      byte {1}         - null
      }

FOOTER (44 bytes)
  uint32 {4}       - Signature ((bytes)225,18,111,90) // E1 12 6F 5A // "..oZ"
  uint32 {4}       - Version // 1, 2, 3, 4, 7, 8, 9 or 11
  uint64 {8}       - Directory Offset
  uint64 {8}       - Directory Length (not including FOOTER)
  byte {20}        - directory sha1 hash
  if (version) == 11
    char {160} - compression string + padding // e.g. "Zlib"

Notes and Comments

  • It is popular file format used in many games made on Unreal Engine 4.
  • These files normally occur in path such as "\<game_name>\<build_name>\Content\Paks\<build_name>-WindowsNoEditor.pak"
  • This archive type uses ZLIB, GZIP or Snappy compression method.
  • Data may be encrypted with AES encryption.
  • To parse the archive, footer needs to be read first, because it has important info about offsets.

Games

List of games using this file format:

  • Backbone (PC) (*.PAK) (version 11)
  • Little Nightmares II (PC) (*.PAK) (version 8)
  • Poppy Playtime (PC) (*.PAK) (version 11)
  • Pumpkin Jack (PC) (*.PAK) (version 9)
  • Styx: Shards of Darkness
  • Tekken 7 (PC) (*.PAK) (version 3)
  • The Fall of Lazarus
  • Many more...

QuickBMS Scripts

See List of Unreal Engine Tools article on this wiki.

Compatible Programs

See List of Unreal Engine Tools article on this wiki.

See Also

Gallery