Fix ARM9 entrypoint on decrypting encrypted FIRMs

... this makes decrypted N3DS NATIVE_FIRM, AGB_FIRM, TWL_FIRM bootable.
This commit is contained in:
d0k3 2017-09-28 05:08:16 +02:00
parent 21c1ae30fe
commit 0221839299

View File

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