Editing PKG files
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
= Firmware Packages = | |||
[...] | |||
= Game Packages = | |||
== File Header == | |||
All values are in big endian format. | |||
All | |||
typedef struct { | typedef struct { | ||
u32 magic; | u32 magic; | ||
u32 pkg_type; | |||
u32 pkg_info_offset; | |||
u32 | u32 unknown3; | ||
u32 | u32 header_size; | ||
u32 | |||
u32 item_count; | u32 item_count; | ||
u64 total_size; | u64 total_size; | ||
u64 data_offset; | u64 data_offset; | ||
u64 data_size; | u64 data_size; | ||
char contentid[0x30]; | |||
u8 digest[0x10]; | u8 digest[0x10]; | ||
u8 | u8 k_licensee[0x10]; | ||
} PKG_HEADER; | } PKG_HEADER; | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! field !! offset !! type !! notes | |||
! | |||
|- | |- | ||
| | ! colspan="4"| 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 | |||
= | |||
== File | |||
=== | |||
All values are in big endian format | |||
typedef struct { | typedef struct { | ||
Line 696: | Line 66: | ||
u32 flags; | u32 flags; | ||
u32 padding; | u32 padding; | ||
} | } PKG_FILE_HEADER; | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |||
! field !! offset !! type !! notes | ! field !! offset !! type !! notes | ||
|- | |- | ||
Line 709: | Line 80: | ||
| data_size || 0x10 || u64 || | | data_size || 0x10 || u64 || | ||
|- | |- | ||
| flags || 0x18 || u32 || The file type | | flags || 0x18 || u32 || The file type | ||
|- | |- | ||
| padding || 0x1C || u32 || zero | | padding || 0x1C || u32 || zero | ||
|- | |- | ||
|} | |} | ||