Skip to content

Commit

Permalink
Add NcmPatchMetaExtendedHeader struct class
Browse files Browse the repository at this point in the history
  • Loading branch information
TooTallNate committed Dec 29, 2024
1 parent 3d6f979 commit bd1941b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/gorgeous-peas-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nx.js/ncm": minor
---

Add `NcmPatchMetaExtendedHeader` struct class
33 changes: 33 additions & 0 deletions packages/ncm/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export class NcmContentMetaKey extends ArrayBufferStruct {
}
}

/// ContentInfo
export class NcmContentInfo extends ArrayBufferStruct {
//NcmContentId content_id; ///< \ref NcmContentId
//u32 size_low; ///< Content size (low).
Expand Down Expand Up @@ -184,6 +185,7 @@ export class NcmContentInfo extends ArrayBufferStruct {
}
}

/// ContentMetaHeader
export class NcmContentMetaHeader extends ArrayBufferStruct {
// u16 extended_header_size; ///< Size of optional struct that comes after this one.
// u16 content_count; ///< Number of NcmContentInfos after the extra bytes.
Expand Down Expand Up @@ -228,6 +230,7 @@ export class NcmContentMetaHeader extends ArrayBufferStruct {
}
}

/// ApplicationMetaExtendedHeader
export class NcmApplicationMetaExtendedHeader extends ArrayBufferStruct {
// u64 patch_id; ///< PatchId of this application's patch.
// u32 required_system_version; ///< Firmware version required by this application.
Expand Down Expand Up @@ -255,3 +258,33 @@ export class NcmApplicationMetaExtendedHeader extends ArrayBufferStruct {
view(this).setUint32(0xc, v, true);
}
}

/// PatchMetaExtendedHeader
export class NcmPatchMetaExtendedHeader extends ArrayBufferStruct {
// u64 application_id; ///< ApplicationId of this patch's corresponding application.
// u32 required_system_version; ///< Firmware version required by this patch.
// u32 extended_data_size; ///< Size of the extended data following the NcmContentInfos.
// u8 reserved[0x8]; ///< Unused.
static sizeof = 0x18 as const;

get applicationId() {
return view(this).getBigUint64(0x0, true);
}
set applicationId(v: bigint) {
view(this).setBigUint64(0x0, v, true);
}

get requiredSystemVersion() {
return view(this).getUint32(0x8, true);
}
set requiredSystemVersion(v: number) {
view(this).setUint32(0x8, v, true);
}

get extendedDataSize() {
return view(this).getUint32(0xc, true);
}
set extendedDataSize(v: number) {
view(this).setUint32(0xc, v, true);
}
}

0 comments on commit bd1941b

Please sign in to comment.