refactor(switch): share NSO and NRO header fields (#16954)

This commit is contained in:
Vincent Koc authored and GitHub committed 2026-12-05 13:44:42 +08:00
1 parent 070362bf24
commit d98d463ccf
1 file changed
+9 -14
+9 -14
View File
@@ -42,18 +42,21 @@ export interface NsoSegment {
readonly truncated: boolean;
}
export interface NsoHeader {
readonly format: "nso";
interface SwitchModuleHeader<Segment> {
readonly version: number;
readonly flags: number;
/** Flag bits outside the six that name compression and hash checks. */
readonly unknownFlags: number;
readonly moduleId: string;
readonly bssSize: number;
readonly embedded: SwitchExtent;
readonly dynstr: SwitchExtent;
readonly dynsym: SwitchExtent;
readonly segments: readonly NsoSegment[];
readonly segments: readonly Segment[];
}
export interface NsoHeader extends SwitchModuleHeader<NsoSegment> {
readonly format: "nso";
/** Flag bits outside the six that name compression and hash checks. */
readonly unknownFlags: number;
}
export interface NroSegment {
@@ -64,19 +67,11 @@ export interface NroSegment {
readonly truncated: boolean;
}
export interface NroHeader {
export interface NroHeader extends SwitchModuleHeader<NroSegment> {
readonly format: "nro";
readonly version: number;
readonly flags: number;
/** Total NRO image size; an asset section, when present, starts here. */
readonly size: number;
readonly mod0Offset: number;
readonly moduleId: string;
readonly bssSize: number;
readonly embedded: SwitchExtent;
readonly dynstr: SwitchExtent;
readonly dynsym: SwitchExtent;
readonly segments: readonly NroSegment[];
}
export type SwitchAssetName = "icon" | "nacp" | "romfs";