mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 21:52:48 +00:00
Improve FIRM v2.1.0 mount code
... maybe all older FIRMS, unsure.
This commit is contained in:
parent
3ac2297f39
commit
c93295df42
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#define FIRM_MAX_SIZE 0x400000 // 4MB, due to FIRM partition size
|
#define FIRM_MAX_SIZE 0x400000 // 4MB, due to FIRM partition size
|
||||||
#define ARM9BIN_OFFSET 0x800
|
#define ARM9BIN_OFFSET 0x800
|
||||||
|
#define ARM11V2_OFFSET 0x2B000
|
||||||
|
|
||||||
// see: https://www.3dbrew.org/wiki/FIRM#Firmware_Section_Headers
|
// see: https://www.3dbrew.org/wiki/FIRM#Firmware_Section_Headers
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -415,23 +415,26 @@ bool BuildVGameFirmDir(void) {
|
|||||||
}
|
}
|
||||||
} else if (section->type == 1) { // ARM11 section, search for modules
|
} else if (section->type == 1) { // ARM11 section, search for modules
|
||||||
NcchHeader firm_ncch;
|
NcchHeader firm_ncch;
|
||||||
for (u32 p = 0; p < section->size; p += firm_ncch.size * NCCH_MEDIA_UNIT) {
|
for (u32 v = 0; v < 2; v++) {
|
||||||
char name[8];
|
u32 start = v ? ARM11V2_OFFSET : 0;
|
||||||
if ((ReadImageBytes((u8*) &firm_ncch, section->offset + p, 0x200) != 0) ||
|
for (u32 p = start; p < section->size; p += firm_ncch.size * NCCH_MEDIA_UNIT) {
|
||||||
(ReadImageBytes((u8*) name, section->offset + p + 0x200, 0x8) != 0) ||
|
char name[8];
|
||||||
(ValidateNcchHeader(&firm_ncch) != 0))
|
if ((ReadImageBytes((u8*) &firm_ncch, section->offset + p, 0x200) != 0) ||
|
||||||
break;
|
(ReadImageBytes((u8*) name, section->offset + p + 0x200, 0x8) != 0) ||
|
||||||
|
(ValidateNcchHeader(&firm_ncch) != 0))
|
||||||
snprintf(templates[n].name, 32, NAME_FIRM_NCCH, firm_ncch.programId, name, ".app");
|
break;
|
||||||
templates[n].offset = section->offset + p;
|
|
||||||
templates[n].size = firm_ncch.size * NCCH_MEDIA_UNIT;
|
snprintf(templates[n].name, 32, NAME_FIRM_NCCH, firm_ncch.programId, name, ".app");
|
||||||
templates[n].keyslot = 0xFF;
|
templates[n].offset = section->offset + p;
|
||||||
templates[n].flags = VFLAG_NCCH;
|
templates[n].size = firm_ncch.size * NCCH_MEDIA_UNIT;
|
||||||
n++;
|
templates[n].keyslot = 0xFF;
|
||||||
memcpy(templates + n, templates + n - 1, sizeof(VirtualFile));
|
templates[n].flags = VFLAG_NCCH;
|
||||||
snprintf(templates[n].name, 32, NAME_FIRM_NCCH, firm_ncch.programId, name, "");
|
n++;
|
||||||
templates[n].flags |= VFLAG_DIR;
|
memcpy(templates + n, templates + n - 1, sizeof(VirtualFile));
|
||||||
n++;
|
snprintf(templates[n].name, 32, NAME_FIRM_NCCH, firm_ncch.programId, name, "");
|
||||||
|
templates[n].flags |= VFLAG_DIR;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user