Skip to content

Commit

Permalink
Use NcmPackagedContentInfo from "@nx.js/ncm"
Browse files Browse the repository at this point in the history
  • Loading branch information
TooTallNate committed Jan 5, 2025
1 parent fef6098 commit 225a2f7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/mean-lies-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nx.js/install-title": patch
---

Use `NcmPackagedContentInfo` from "@nx.js/ncm"
7 changes: 4 additions & 3 deletions packages/install-title/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
NcmContentStorageRecord,
NcmContentMetaType,
NcmPatchMetaExtendedHeader,
NcmPackagedContentInfo,
NcmApplicationMetaExtendedHeader,
} from '@nx.js/ncm';
import { parseNsp, type FileEntry } from '@tootallnate/nsp';
Expand All @@ -24,7 +25,7 @@ import {
nsPushApplicationRecord,
} from './ipc/ns';
import { esImportTicket } from './ipc/es';
import { PackagedContentMetaHeader, PackagedContentInfo } from './types';
import { PackagedContentMetaHeader } from './types';

export interface StepStart {
type: 'start';
Expand Down Expand Up @@ -277,8 +278,8 @@ async function installContentMetaRecords(
const packagedContentInfoOffset =
PackagedContentMetaHeader.sizeof +
extendedHeaderSize +
i * PackagedContentInfo.sizeof;
const packagedContentInfo = new PackagedContentInfo(
i * NcmPackagedContentInfo.sizeof;
const packagedContentInfo = new NcmPackagedContentInfo(
cnmtData,
packagedContentInfoOffset,
);
Expand Down
17 changes: 2 additions & 15 deletions packages/install-title/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NcmContentInfo, NcmContentMetaType } from '@nx.js/ncm';
import { ArrayBufferStruct, view, u8 } from '@nx.js/util';
import { NcmContentMetaType } from '@nx.js/ncm';
import { ArrayBufferStruct, view } from '@nx.js/util';

export class PackagedContentMetaHeader extends ArrayBufferStruct {
//u64 title_id;
Expand Down Expand Up @@ -33,16 +33,3 @@ export class PackagedContentMetaHeader extends ArrayBufferStruct {
return view(this).getUint16(0x10, true);
}
}

export class PackagedContentInfo extends ArrayBufferStruct {
//u8 hash[0x20];
//NcmContentInfo content_info;
static sizeof = 0x38 as const;

get hash() {
return u8(this).subarray(0x0, 0x20);
}
get contentInfo() {
return new NcmContentInfo(this, 0x20);
}
}

0 comments on commit 225a2f7

Please sign in to comment.