This commit is contained in:
Aurora Wright 2017-04-29 18:05:30 +02:00
parent 725a825762
commit 1887c6fae3
2 changed files with 6 additions and 19 deletions

View File

@ -54,6 +54,8 @@ _start:
stmfd sp!, {r0-r12, lr}
ldrb r12, [r1]
cmp r12, #0x72 ; 'r', should include "rom:", "rom2:" and "rex:"
cmpne r12, #0x70 ; 'p', should include "patch:"
cmpne r12, #0x65 ; 'e', should include "ext:"
bne endRedir
sub sp, sp, #0x400
pathRedir:

View File

@ -514,7 +514,7 @@ exit:
return ret;
}
static inline bool patchLayeredFs(u64 progId, u8 *code, u32 size, u32 textSize)
static inline bool patchLayeredFs(u64 progId, u8 *code, u32 size)
{
/* Here we look for "/luma/titles/[u64 titleID in hex, uppercase]/romfs"
If it exists it should be a folder containing ROMFS files */
@ -532,23 +532,8 @@ static inline bool patchLayeredFs(u64 progId, u8 *code, u32 size, u32 textSize)
fsOpenFileDirectly = 0xFFFFFFFF,
payloadOffset;
if(!findLayeredFsSymbols(code, textSize, &fsMountArchive, &fsRegisterArchive, &fsTryOpenFile, &fsOpenFileDirectly) ||
!findLayeredFsPayloadOffset(code, textSize, &payloadOffset)) return false;
static const char *updateRomFsMounts[] = { "patch:",
"ext:" },
patch = 'r';
//Change update RomFS mountpoints to start with "r"
for(u32 i = 0, ret = 0; i < sizeof(updateRomFsMounts) / sizeof(char *) && !ret; i++)
{
ret = patchMemory(code, size,
updateRomFsMounts[i],
strnlen(updateRomFsMounts[i], 255), 0,
&patch,
sizeof(patch), 0
);
}
if(!findLayeredFsSymbols(code, size, &fsMountArchive, &fsRegisterArchive, &fsTryOpenFile, &fsOpenFileDirectly) ||
!findLayeredFsPayloadOffset(code, size, &payloadOffset)) return false;
//Setup the payload
u8 *payload = code + payloadOffset;
@ -857,7 +842,7 @@ void patchCode(u64 progId, u16 progVer, u8 *code, u32 size, u32 textSize, u32 ro
if(!loadTitleCodeSection(progId, code, size) ||
!applyCodeIpsPatch(progId, code, size) ||
!loadTitleLocaleConfig(progId, &regionId, &languageId) ||
!patchLayeredFs(progId, code, size, textSize)) goto error;
!patchLayeredFs(progId, code, textSize)) goto error;
if(regionId != 0xFF)
{