NCSD CIA builder: Use proper index

This commit is contained in:
d0k3 2020-07-09 22:53:56 +02:00
parent 8ee0fac6c4
commit eb265e9575

View File

@ -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;