Skip to content

Commit

Permalink
Changes to CIA building for DLC on legit cases
Browse files Browse the repository at this point in the history
Ignore unowned content implied by ticket.
Standard building still should include everything due to fake ticket.
  • Loading branch information
luigoalma authored and Wolfvak committed Mar 28, 2020
1 parent 978c4f8 commit e763cba
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion arm9/source/utils/gameutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e763cba

Please sign in to comment.