diff --git a/source/nca.c b/source/nca.c index c31f89b..59774e4 100644 --- a/source/nca.c +++ b/source/nca.c @@ -1874,7 +1874,7 @@ int parseRomFsEntryFromNca(NcmContentStorage *ncmStorage, const NcmContentId *nc return 0; } -bool parseBktrEntryFromNca(NcmContentStorage *ncmStorage, const NcmContentId *ncaId, nca_header_t *dec_nca_header, u8 *decrypted_nca_keys) +bool parseBktrEntryFromNca(NcmContentStorage *ncmStorage, const NcmContentId *ncaId, nca_header_t *dec_nca_header, u8 *decrypted_nca_keys, bool use_base_romfs) { if (!ncmStorage || !ncaId || !dec_nca_header || !decrypted_nca_keys || (bktrContext.use_base_romfs && (!romFsContext.section_offset || !romFsContext.section_size || !romFsContext.romfs_dir_entries || !romFsContext.romfs_file_entries))) { @@ -1890,6 +1890,7 @@ bool parseBktrEntryFromNca(NcmContentStorage *ncmStorage, const NcmContentId *nc romfs_header romFsHeader; initBktrContext(); + bktrContext.use_base_romfs = use_base_romfs; memcpy(&(bktrContext.ncmStorage), ncmStorage, sizeof(NcmContentStorage)); memcpy(&(bktrContext.ncaId), ncaId, sizeof(NcmContentId)); diff --git a/source/nca.h b/source/nca.h index a633724..19ea6db 100644 --- a/source/nca.h +++ b/source/nca.h @@ -751,7 +751,7 @@ bool parseExeFsEntryFromNca(NcmContentStorage *ncmStorage, const NcmContentId *n int parseRomFsEntryFromNca(NcmContentStorage *ncmStorage, const NcmContentId *ncaId, nca_header_t *dec_nca_header, u8 *decrypted_nca_keys); -bool parseBktrEntryFromNca(NcmContentStorage *ncmStorage, const NcmContentId *ncaId, nca_header_t *dec_nca_header, u8 *decrypted_nca_keys); +bool parseBktrEntryFromNca(NcmContentStorage *ncmStorage, const NcmContentId *ncaId, nca_header_t *dec_nca_header, u8 *decrypted_nca_keys, bool use_base_romfs); bool generateProgramInfoXml(NcmContentStorage *ncmStorage, const NcmContentId *ncaId, nca_header_t *dec_nca_header, u8 *decrypted_nca_keys, bool useCustomAcidRsaPubKey, char **outBuf, u64 *outBufSize); diff --git a/source/util.c b/source/util.c index ccd1605..d749525 100644 --- a/source/util.c +++ b/source/util.c @@ -2914,11 +2914,8 @@ int readNcaRomFsSection(u32 titleIndex, selectedRomFsType curRomFsType, int desi // Remove missing base RomFS error message if needed if (ret == -2) uiFill(0, STRING_Y_POS(breaks), FB_WIDTH, FB_HEIGHT - STRING_Y_POS(breaks), BG_COLOR_RGB); - // Update BKTR context to use the base RomFS if available - bktrContext.use_base_romfs = (ret == 0); - // Read BKTR entry data in the Program NCA from the update - ret = (parseBktrEntryFromNca(&ncmStorage, &ncaId, &dec_nca_header, decrypted_nca_keys) ? 0 : -1); + ret = (parseBktrEntryFromNca(&ncmStorage, &ncaId, &dec_nca_header, decrypted_nca_keys, ret == 0) ? 0 : -1); if (ret == 0) { bktrContext.storageId = curStorageId;