KIP1

Offset Size Description
0x0 0x4 Magic "KIP1"
0x4 0xC Name
0x10 0x8 Program ID
0x18 0x4 Version
0x1C 0x1 Main Thread Priority
0x1D 0x1 Main Thread Core Number
0x1E 0x1 Reserved
0x1F 0x1 Flags (bit0=TextCompress, bit1=RoCompress, bit2=DataCompress, bit3=Is64BitInstruction, bit4=ProcessAddressSpace64Bit, bit5=[2.0.0+] UseSecureMemory, bit6=[12.0.0+] IsImmortal)
0x20 0xC Text Segment Header
0x2C 0x4 Main Thread Affinity Mask
0x30 0xC Ro Segment Header
0x3C 0x4 Main Thread Stack Size
0x40 0xC Data Segment Header
0x4C 0x4 Reserved
0x50 0xC Bss Segment Header
0x5C 0x24 Reserved
0x80 0x80 Kernel Capability Data
Segment Header
Offset Size Description
0x0 0x4 Offset
0x4 0x4 Size
0x8 0x4 Compressed/Binary Size

Compressed/Binary size can be 0 or lower than expected, this is the case for BSS for example.

Compression

The compression used here is BLZ, with a modified footer since 3ds. The footer is now 0xC bytes instead of 0x8, and has the form u32 compressed_data_len; u32 footer_size; u32 additional_len_when_uncompressed;