Skip to content

Commit 11417c5

Browse files
author
N3xoX1
committed
Loader: Update new magic numbers for dxci files
1 parent fa87a85 commit 11417c5

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/nxemu-loader/core/file_sys/card_image.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ LoaderResultStatus XCI::TryReadHeader() {
313313
}
314314

315315
// Ensure the header magic matches. If it doesn't, this isn't a card image header.
316-
if (header.magic != Common::MakeMagic('H', 'E', 'A', 'D')) {
316+
if (header.magic != Common::MakeMagic('D', 'X', 'C', 'I')) {
317317
return LoaderResultStatus::ErrorBadXCIHeader;
318318
}
319319

src/nxemu-loader/core/file_sys/fssystem/fssystem_nca_header.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ struct NcaHeader {
7272
static constexpr u32 Magic1 = Common::MakeMagic('N', 'C', 'A', '1');
7373
static constexpr u32 Magic2 = Common::MakeMagic('N', 'C', 'A', '2');
7474
static constexpr u32 Magic3 = Common::MakeMagic('N', 'C', 'A', '3');
75+
static constexpr u32 MagicDecrypted = Common::MakeMagic('D', 'N', 'C', 'A');
7576

7677
static constexpr u32 Magic = Magic3;
7778

src/nxemu-loader/core/file_sys/fssystem/fssystem_nca_reader.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ constexpr Result CheckNcaMagic(u32 magic) {
1717
R_UNLESS(magic != NcaHeader::Magic0, ResultUnsupportedSdkVersion);
1818
R_UNLESS(magic != NcaHeader::Magic1, ResultUnsupportedSdkVersion);
1919
R_UNLESS(magic != NcaHeader::Magic2, ResultUnsupportedSdkVersion);
20+
R_UNLESS(magic != NcaHeader::Magic3, ResultInvalidNcaSignature);
2021

2122
// Verify the magic is the current one.
22-
R_UNLESS(magic == NcaHeader::Magic3, ResultInvalidNcaSignature);
23+
R_UNLESS(magic == NcaHeader::MagicDecrypted, ResultInvalidNcaSignature);
2324

2425
R_SUCCEED();
2526
}

0 commit comments

Comments
 (0)