Full mount compatibility for all known FIRM versions

This commit is contained in:
d0k3 2017-02-12 16:00:59 +01:00
parent ea00a3217a
commit 7a7bc96a9b
2 changed files with 4 additions and 3 deletions

View File

@ -8,8 +8,8 @@
#define SECRET_NAME "secret_sector.bin"
#define FIRM_MAX_SIZE 0x400000 // 4MB, due to FIRM partition size
#define ARM11NCCH_OFFSET 0, 0x2A000, 0x2B000, 0x2C000
#define ARM9BIN_OFFSET 0x800
#define ARM11V2_OFFSET 0x2B000
// see: https://www.3dbrew.org/wiki/FIRM#Firmware_Section_Headers
typedef struct {

View File

@ -414,9 +414,10 @@ bool BuildVGameFirmDir(void) {
n++;
}
} else if (section->type == 1) { // ARM11 section, search for modules
const u32 arm11_ncch_offset[] = { ARM11NCCH_OFFSET };
NcchHeader firm_ncch;
for (u32 v = 0; v < 2; v++) {
u32 start = v ? ARM11V2_OFFSET : 0;
for (u32 v = 0; v < sizeof(arm11_ncch_offset) / sizeof(u32); v++) {
u32 start = arm11_ncch_offset[v];
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) ||