From eb265e9575a2e382f0fc8baa38f92508fc42287b Mon Sep 17 00:00:00 2001 From: d0k3 Date: Thu, 9 Jul 2020 22:53:56 +0200 Subject: [PATCH] NCSD CIA builder: Use proper index --- arm9/source/utils/gameutil.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arm9/source/utils/gameutil.c b/arm9/source/utils/gameutil.c index 7aaf04a..1ea3f58 100644 --- a/arm9/source/utils/gameutil.c +++ b/arm9/source/utils/gameutil.c @@ -1609,13 +1609,14 @@ u32 BuildCiaFromNcsdFile(const char* path_ncsd, const char* path_cia) { // insert NCSD content TmdContentChunk* chunk = cia->content_list; - for (u32 i = 0; i < 3; i++) { + for (u32 i = 0, idx = 0; i < 3; i++) { NcchPartition* partition = ncsd.partitions + i; u32 offset = partition->offset * NCSD_MEDIA_UNIT; u32 size = partition->size * NCSD_MEDIA_UNIT; if (!size) continue; memset(chunk, 0, sizeof(TmdContentChunk)); - chunk->id[3] = chunk->index[1] = i; + chunk->id[3] = i; + chunk->index[1] = idx++; if (InsertCiaContent(path_cia, path_ncsd, offset, size, chunk++, NULL, false, (i == 0), false) != 0) { free(cia); return 1;