Changes to CIA building for DLC on legit cases

Ignore unowned content implied by ticket.
Standard building still should include everything due to fake ticket.
This commit is contained in:
luigoalma 2020-02-03 22:06:44 +00:00 committed by Wolfvak
parent 978c4f8b86
commit e763cbaf72

View File

@ -1430,9 +1430,12 @@ u32 BuildCiaFromTmdFileBuffered(const char* path_tmd, const char* path_cia, bool
if (dlc) for (u32 i = 0; (i < content_count) && (i < TMD_MAX_CONTENTS); i++) { if (dlc) for (u32 i = 0; (i < content_count) && (i < TMD_MAX_CONTENTS); i++) {
FILINFO fno; FILINFO fno;
TmdContentChunk* chunk = &(content_list[i]); TmdContentChunk* chunk = &(content_list[i]);
TicketRightsCheck rights_ctx;
TicketRightsCheck_InitContext(&rights_ctx, (Ticket*)&(cia->ticket));
snprintf(name_content, 256 - (name_content - path_content), snprintf(name_content, 256 - (name_content - path_content),
(cdn) ? "%08lx" : (dlc && !cdn) ? "00000000/%08lx.app" : "%08lx.app", getbe32(chunk->id)); (cdn) ? "%08lx" : (dlc && !cdn) ? "00000000/%08lx.app" : "%08lx.app", getbe32(chunk->id));
if ((fvx_stat(path_content, &fno) != FR_OK) || (fno.fsize != (u32) getbe64(chunk->size))) { if ((fvx_stat(path_content, &fno) != FR_OK) || (fno.fsize != (u32) getbe64(chunk->size)) ||
!TicketRightsCheck_CheckIndex(&rights_ctx, getbe16(chunk->index))) {
present[i / 8] ^= 1 << (i % 8); present[i / 8] ^= 1 << (i % 8);
u16 index = getbe16(chunk->index); u16 index = getbe16(chunk->index);