PKG files

From PS3 Developer wiki
Revision as of 21:13, 18 January 2012 by Euss (talk | contribs)
Jump to navigation Jump to search

Firmware Packages

[...]

Game Packages

File Header

All values are in big endian format.

 typedef struct {
   u32 magic;
   u32 pkg_type;
   u32 pkg_info_offset;
   u32 unknown3;
   u32 header_size;
   u32 item_count;
   u64 total_size;
   u64 data_offset;
   u64 data_size;
   char contentid[0x30];
   u8 digest[0x10];
   u8 k_licensee[0x10];
 } PKG_HEADER;


field offset type notes
Unencrypted header
magic 0x0 u32 Magic value of 0x7f504b47 "\x7fPKG"
pkg_type 0x4 u32 The package type is 1 for PS3 pkg and 2 for PSP packages. the flag 0x80000000 is used for retail.
pkg_info_offset 0x8 u32 offset of the pkg_info structure
unknown 0xC u32 unknown
header_size 0x10 u32 Size of the header
item_count 0x14 u32
total_size 0x18 u64
data_offset 0x20 u64
data_size 0x28 u64
contentid 0x30 u8[48]
digest 0x60 u8[16]
k_licensee 0x70 u8[16]


File Entry

All values are in big endian format

 typedef struct {
   u32 filename_offset;
   u32 filename_size;
   u64 data_offset;
   u64 data_size;
   u32 flags;
   u32 padding;
 } PKG_FILE_HEADER;
field offset type notes
filename_offset 0x0 u32
filename_size 0x4 u32
data_offset 0x8 u64
data_size 0x10 u64
flags 0x18 u32 The file type
padding 0x1C u32 zero