From 0221839299b395e30de12bcb094852e7de637623 Mon Sep 17 00:00:00 2001 From: d0k3 Date: Thu, 28 Sep 2017 05:08:16 +0200 Subject: [PATCH] Fix ARM9 entrypoint on decrypting encrypted FIRMs ... this makes decrypted N3DS NATIVE_FIRM, AGB_FIRM, TWL_FIRM bootable. --- source/utils/gameutil.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/utils/gameutil.c b/source/utils/gameutil.c index eb0d811..4481d7d 100644 --- a/source/utils/gameutil.c +++ b/source/utils/gameutil.c @@ -908,6 +908,10 @@ u32 DecryptFirmFile(const char* orig, const char* dest) { // write back FIRM header fvx_lseek(&file, 0); memcpy(firm.dec_magic, dec_magic, sizeof(dec_magic)); + // see: https://github.com/AuroraWright/Luma3DS/blob/master/source/firm.c#L349 + // and: https://github.com/AuroraWright/Luma3DS/blob/master/source/firm.c#L424 + // and: https://github.com/AuroraWright/Luma3DS/blob/master/source/firm.c#L463 + firm.entry_arm9 = (firm.sections[3].offset) ? 0x801301C : 0x0801B01C; if (fvx_write(&file, &firm, sizeof(FirmHeader), &btr) != FR_OK) { fvx_close(&file); return 1;