From e763cbaf728c27b58fa808803d5c5d2aa9ca74d2 Mon Sep 17 00:00:00 2001 From: luigoalma Date: Mon, 3 Feb 2020 22:06:44 +0000 Subject: [PATCH] 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. --- arm9/source/utils/gameutil.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arm9/source/utils/gameutil.c b/arm9/source/utils/gameutil.c index c4750af..8fd2569 100644 --- a/arm9/source/utils/gameutil.c +++ b/arm9/source/utils/gameutil.c @@ -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++) { FILINFO fno; TmdContentChunk* chunk = &(content_list[i]); + TicketRightsCheck rights_ctx; + TicketRightsCheck_InitContext(&rights_ctx, (Ticket*)&(cia->ticket)); snprintf(name_content, 256 - (name_content - path_content), (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); u16 index = getbe16(chunk->index);