Applied by tools/build_hactool.py to SciresM/hactool (ISC) at 1d64a83450e025622f3468c28fc4164dad2c5ef6. From MacNativeGames build_app.py build_hactool() (MIT, Copyright (c) 2026 MacNativeGames contributors), the parts that run on Windows: MNG_TITLE_KEYS names the title-key file, and the BKTR checks accept the subsection table padding and the subsection layout of newer cumulative updates. Its funopen base-range hook is macOS-only and left out. diff --git a/main.c b/main.c index 07f53cb..7921cc4 100644 --- a/main.c +++ b/main.c @@ -472,7 +472,7 @@ int main(int argc, char **argv) { } /* Try to load titlekeys. */ - FILE *titlekeyfile = open_key_file("title"); + FILE *titlekeyfile = getenv("MNG_TITLE_KEYS") ? fopen(getenv("MNG_TITLE_KEYS"), "rb") : open_key_file("title"); if (titlekeyfile != NULL) { extkeys_parse_titlekeys(&tool_ctx.settings, titlekeyfile); } diff --git a/nca.c b/nca.c index 8a84366..2fe877f 100644 --- a/nca.c +++ b/nca.c @@ -1149,7 +1149,8 @@ void nca_process_bktr_section(nca_section_ctx_t *ctx) { /* Validate magics. */ if (sb->relocation_header.magic == MAGIC_BKTR && sb->subsection_header.magic == MAGIC_BKTR) { if (sb->relocation_header.offset + sb->relocation_header.size != sb->subsection_header.offset || - sb->subsection_header.offset + sb->subsection_header.size != ctx->size) { + sb->subsection_header.offset + sb->subsection_header.size > ctx->size || + (ctx->size - (sb->subsection_header.offset + sb->subsection_header.size)) % 0x200 != 0) { fprintf(stderr, "Invalid BKTR layout!\n"); exit(EXIT_FAILURE); } @@ -1180,7 +1181,9 @@ void nca_process_bktr_section(nca_section_ctx_t *ctx) { ctx->bktr_ctx.relocation_block = relocs; ctx->bktr_ctx.subsection_block = subs; - if (ctx->bktr_ctx.subsection_block->total_size != sb->subsection_header.offset) { + if (ctx->bktr_ctx.subsection_block->total_size != sb->subsection_header.offset && + (sb->relocation_header.size > sb->subsection_header.offset || + ctx->bktr_ctx.subsection_block->total_size != sb->subsection_header.offset - sb->relocation_header.size)) { free(relocs); free(subs); ctx->bktr_ctx.relocation_block = NULL;