Include ARM9 footer when mounting .nds files

This commit is contained in:
d0k3 2018-06-27 01:33:17 +02:00
parent ff86444e2c
commit f74d9ddfd7
2 changed files with 7 additions and 1 deletions

View File

@ -20,6 +20,9 @@
#define TWL_UNITCODE_TWLNTR 0x02 #define TWL_UNITCODE_TWLNTR 0x02
#define TWL_UNITCODE_TWL 0x03 #define TWL_UNITCODE_TWL 0x03
// see https://github.com/devkitPro/ndstool/blob/313b0be6440d3087b6d433c3ea057605d2c95197/source/header.cpp#L585-L595
#define NDS_ARM9_FOOTER_MAGIC 0xDEC00621
// see: http://problemkaputt.de/gbatek.htm#dscartridgeicontitle // see: http://problemkaputt.de/gbatek.htm#dscartridgeicontitle
typedef struct { typedef struct {
u16 version; u16 version;

View File

@ -497,11 +497,14 @@ bool BuildVGameNdsDir(void) {
n++; n++;
} }
// ARM9 section // ARM9 section (+ ARM9 section footer)
if (twl->arm9_size) { if (twl->arm9_size) {
u32 f = 0;
ReadGameImageBytes(&f, offset_nds + twl->arm9_rom_offset + twl->arm9_size, sizeof(u32));
strncpy(templates[n].name, NAME_NDS_ARM9, 32); strncpy(templates[n].name, NAME_NDS_ARM9, 32);
templates[n].offset = offset_nds + twl->arm9_rom_offset; templates[n].offset = offset_nds + twl->arm9_rom_offset;
templates[n].size = twl->arm9_size; templates[n].size = twl->arm9_size;
if (f == NDS_ARM9_FOOTER_MAGIC) templates[n].size += 0xC;
templates[n].keyslot = 0xFF; templates[n].keyslot = 0xFF;
templates[n].flags = 0; templates[n].flags = 0;
n++; n++;