From 2e561f7ea943bc18560c17dfce9ecfa1686ccabe Mon Sep 17 00:00:00 2001 From: Aurora Wright Date: Sun, 23 Apr 2017 05:40:02 +0200 Subject: [PATCH] Cleanup --- injector/patches/romfsredir.s | 30 +++++++++++++++--------------- injector/source/patcher.c | 5 +---- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/injector/patches/romfsredir.s b/injector/patches/romfsredir.s index 2bf5db9..0636829 100644 --- a/injector/patches/romfsredir.s +++ b/injector/patches/romfsredir.s @@ -14,8 +14,8 @@ _start: ; Jumps here before the fsOpenFileDirectly call - _mountSd: - b mountSd + _mountArchive: + b mountArchive .word 0xdead0000 ; Substituted opcode .word 0xdead0001 ; Branch to hooked function @@ -25,10 +25,10 @@ _start: .word 0xdead0002 ; Substituted opcode .word 0xdead0003 ; Branch to hooked function - ; Mounts SDMC and registers the archive as 'sdmc:' - mountSd: + ; Mounts the archive and registers it as 'lfs:' + mountArchive: cmp r3, #3 - bne _mountSd+4 + bne _mountArchive + 4 stmfd sp!, {r0-r4, lr} sub sp, sp, #4 load r1, archiveId @@ -43,18 +43,18 @@ _start: blx r4 add sp, sp, #4 ldmfd sp!, {r0-r4, lr} - b _mountSd+4 + b _mountArchive + 4 ; Check the path passed to iFileOpen. ; If it is trying to access a RomFS file, we try to - ; open it from the title folder on the sdcard. - ; If the file cannot be opened from the sdcard, we just open + ; open it from the LayeredFS folder. + ; If the file cannot be opened, we just open ; it from its original archive like nothing happened fsRedir: stmfd sp!, {r0-r12, lr} ldrb r12, [r1] - cmp r12, #0x72 ; 'r', should include "rom:" and "rom2:" - cmpne r12, #0x70 ; 'p', should include "patch:" + cmp r12, #0x72 ; 'r', should include "rom:" and "rom2:" + cmpne r12, #0x70 ; 'p', should include "patch:" bne endRedir sub sp, sp, #0x400 pathRedir: @@ -69,7 +69,7 @@ _start: sub r0, r0, #2 pathRedir_2: ldrh r2, [r1], #2 - cmp r2, #0x3A ; ':' + cmp r2, #0x3A ; ':' bne pathRedir_2 pathRedir_3: ldrh r2, [r1], #2 @@ -78,7 +78,7 @@ _start: bne pathRedir_3 ldmfd sp!, {r0-r3} mov r1, sp - bl _fsRedir+4 + bl _fsRedir + 4 add sp, sp, #0x400 cmp r0, #0 @@ -86,14 +86,14 @@ _start: ldmfd sp!, {r0-r12, lr} moveq r0, #0 bxeq lr - b _fsRedir+4 + b _fsRedir + 4 .pool .align 4 - archiveName : .word 0xdead0007 + archiveName : .dcb "lfs:" fsMountArchive : .word 0xdead0005 fsRegisterArchive : .word 0xdead0006 - archiveId : .word 0xdead0008 + archiveId : .word 0xdead0007 customPath : .word 0xdead0004 .close diff --git a/injector/source/patcher.c b/injector/source/patcher.c index 3907478..7743b17 100644 --- a/injector/source/patcher.c +++ b/injector/source/patcher.c @@ -520,7 +520,7 @@ static inline bool patchLayeredFs(u64 progId, u8* code, u32 size) if(!archiveId) return true; - const char *archiveName = archiveId == ARCHIVE_SDMC ? "sdc:" : "nnd:"; + static const char *archiveName = "lfs:"; u32 fsMountArchive = 0xFFFFFFFF, fsRegisterArchive = 0xFFFFFFFF, @@ -564,9 +564,6 @@ static inline bool patchLayeredFs(u64 progId, u8* code, u32 size) payload32[i] = 0x100000 + fsRegisterArchive; break; case 0xdead0007: - memcpy(payload32 + i, archiveName, 4); - break; - case 0xdead0008: payload32[i] = archiveId; break; }