1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-23 02:36:41 +00:00

Set base RomFS dependance after initializing the BKTR context, not before.

This commit is contained in:
Pablo Curiel 2020-10-01 05:45:22 -04:00
parent 686155e764
commit 38fd9144c0
3 changed files with 4 additions and 6 deletions

View file

@ -1874,7 +1874,7 @@ int parseRomFsEntryFromNca(NcmContentStorage *ncmStorage, const NcmContentId *nc
return 0; 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))) 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; romfs_header romFsHeader;
initBktrContext(); initBktrContext();
bktrContext.use_base_romfs = use_base_romfs;
memcpy(&(bktrContext.ncmStorage), ncmStorage, sizeof(NcmContentStorage)); memcpy(&(bktrContext.ncmStorage), ncmStorage, sizeof(NcmContentStorage));
memcpy(&(bktrContext.ncaId), ncaId, sizeof(NcmContentId)); memcpy(&(bktrContext.ncaId), ncaId, sizeof(NcmContentId));

View file

@ -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); 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); bool generateProgramInfoXml(NcmContentStorage *ncmStorage, const NcmContentId *ncaId, nca_header_t *dec_nca_header, u8 *decrypted_nca_keys, bool useCustomAcidRsaPubKey, char **outBuf, u64 *outBufSize);

View file

@ -2914,11 +2914,8 @@ int readNcaRomFsSection(u32 titleIndex, selectedRomFsType curRomFsType, int desi
// Remove missing base RomFS error message if needed // 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); 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 // 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) if (ret == 0)
{ {
bktrContext.storageId = curStorageId; bktrContext.storageId = curStorageId;