Line 1: |
Line 1: |
− | [[Category:File formats]]
| |
| NRO is the executable format for non-[[ExeFS]] binaries. | | NRO is the executable format for non-[[ExeFS]] binaries. |
| | | |
| It starts with the NRO-start structure then the "NRO" header and mainly describes .text, .rodata, and .data segments (like a short-form of ELF program headers): | | It starts with the NRO-start structure then the "NRO" header and mainly describes .text, .rodata, and .data segments (like a short-form of ELF program headers): |
| | | |
− | = NRO Start = | + | = Start = |
| {| class="wikitable" border="1" | | {| class="wikitable" border="1" |
| |- | | |- |
Line 13: |
Line 12: |
| | 0x0 | | | 0x0 |
| | 0x4 | | | 0x4 |
− | | Unused | + | | Unused. Originally 0x0, with [17.0.0+] this is set to value 0x1. |
| |- | | |- |
| | 0x4 | | | 0x4 |
Line 20: |
Line 19: |
| |- | | |- |
| | 0x8 | | | 0x8 |
− | | 0x8 | + | | 0x4 |
| + | | [1.0.0-16.1.0] Padding. [17.0.0+] [[NSO|nnSdk version]] offset |
| + | |- |
| + | | 0xC |
| + | | 0x4 |
| | Padding | | | Padding |
| |} | | |} |
| | | |
− | = NRO Header = | + | = Header = |
| {| class="wikitable" border="1" | | {| class="wikitable" border="1" |
| |- | | |- |
Line 37: |
Line 40: |
| | 0x4 | | | 0x4 |
| | 0x4 | | | 0x4 |
− | | ? | + | | Version (always 0) |
| |- | | |- |
| | 0x8 | | | 0x8 |
| | 4 | | | 4 |
− | | size (Total NRO filesize) | + | | Size (total NRO file size) |
| |- | | |- |
| | 0xC | | | 0xC |
| | 0x4 | | | 0x4 |
− | | ? | + | | Flags (unused) |
| |- | | |- |
| | 0x10 | | | 0x10 |
| | 0x8 * 3 | | | 0x8 * 3 |
− | | SegmentHeader[3] | + | | [[#SegmentHeader|SegmentHeader]][3] {.text, .ro, .data} |
| |- | | |- |
| | 0x28 | | | 0x28 |
| | 0x4 | | | 0x4 |
− | | bssSize | + | | BssSize |
| |- | | |- |
| | 0x2C | | | 0x2C |
| | 0x4 | | | 0x4 |
− | | ? | + | | Reserved |
| |- | | |- |
| | 0x30 | | | 0x30 |
| | 0x20 | | | 0x20 |
− | | Value of "build id" from ELF's GNU .note section. Contains variable sized digest, up to 32bytes. | + | | [[#ModuleId|ModuleId]] |
| |- | | |- |
| | 0x50 | | | 0x50 |
− | | 0x10 | + | | 0x04 |
− | | Padding | + | | DsoHandleOffset (unused) |
| + | |- |
| + | | 0x54 |
| + | | 0x04 |
| + | | Reserved (unused) |
| |- | | |- |
− | | 0x60 | + | | 0x58 |
− | | 0x10 | + | | 0x8 * 3 |
− | | ? | + | | [[#SegmentHeader|SegmentHeader]][3] {.apiInfo, .dynstr, .dynsym} |
| |} | | |} |
| | | |
Line 81: |
Line 88: |
| | 0x0 | | | 0x0 |
| | 0x4 | | | 0x4 |
− | | FileOffset | + | | MemoryOffset |
| |- | | |- |
| | 0x4 | | | 0x4 |
Line 88: |
Line 95: |
| |} | | |} |
| | | |
− | =Assets= | + | == ModuleId == |
| + | Value of "build id" from ELF's GNU .note section. Contains variable sized digest, up to 32bytes. |
| + | |
| + | = Assets = |
| This is an optional custom assets section for homebrew, this is located at file offset {NroHeader.size}. See also [https://github.com/switchbrew/switch-tools switch-tools] for implementation. | | This is an optional custom assets section for homebrew, this is located at file offset {NroHeader.size}. See also [https://github.com/switchbrew/switch-tools switch-tools] for implementation. |
| | | |
Line 109: |
Line 119: |
| |- | | |- |
| | 0x8 | | | 0x8 |
− | | 0x8 | + | | 0x10 |
| | AssetSection icon. Used by the Homebrew Launcher. Like official icons, this is a 256x256 JPEG. | | | AssetSection icon. Used by the Homebrew Launcher. Like official icons, this is a 256x256 JPEG. |
| |- | | |- |
| + | | 0x18 |
| | 0x10 | | | 0x10 |
− | | 0x8
| + | | AssetSection [[NACP_Format|NACP]]. Used by the Homebrew Launcher. |
− | | AssetSection [[Control.nacp|nacp]]. Used by the Homebrew Launcher. | |
| |- | | |- |
− | | 0x18 | + | | 0x28 |
− | | 0x8 | + | | 0x10 |
| | AssetSection romfs. Can be used by the application. | | | AssetSection romfs. Can be used by the application. |
− | |-
| |
| |} | | |} |
| | | |
Line 130: |
Line 139: |
| |- | | |- |
| | 0x0 | | | 0x0 |
− | | 0x4 | + | | 0x8 |
| | Offset | | | Offset |
| |- | | |- |
− | | 0x4 | + | | 0x8 |
− | | 0x4 | + | | 0x8 |
| | Size, 0 indicates this section is empty. | | | Size, 0 indicates this section is empty. |
| |} | | |} |