Improve FIRM v2.1.0 mount code

... maybe all older FIRMS, unsure.
This commit is contained in:
d0k3 2017-02-10 17:06:16 +01:00
parent 3ac2297f39
commit c93295df42
2 changed files with 21 additions and 17 deletions

View File

@ -9,6 +9,7 @@
#define FIRM_MAX_SIZE 0x400000 // 4MB, due to FIRM partition size
#define ARM9BIN_OFFSET 0x800
#define ARM11V2_OFFSET 0x2B000
// see: https://www.3dbrew.org/wiki/FIRM#Firmware_Section_Headers
typedef struct {

View File

@ -415,7 +415,9 @@ bool BuildVGameFirmDir(void) {
}
} else if (section->type == 1) { // ARM11 section, search for modules
NcchHeader firm_ncch;
for (u32 p = 0; p < section->size; p += firm_ncch.size * NCCH_MEDIA_UNIT) {
for (u32 v = 0; v < 2; v++) {
u32 start = v ? ARM11V2_OFFSET : 0;
for (u32 p = start; p < section->size; p += firm_ncch.size * NCCH_MEDIA_UNIT) {
char name[8];
if ((ReadImageBytes((u8*) &firm_ncch, section->offset + p, 0x200) != 0) ||
(ReadImageBytes((u8*) name, section->offset + p + 0x200, 0x8) != 0) ||
@ -435,6 +437,7 @@ bool BuildVGameFirmDir(void) {
}
}
}
}
n_templates_firm = n;
return true;