From 48c23f2a4331e689501f297650ddad5641cc6b32 Mon Sep 17 00:00:00 2001 From: Aurora Wright Date: Sun, 23 Apr 2017 03:11:02 +0200 Subject: [PATCH] Attempt to fix NSMB2 by changing archive name --- injector/patches/romfsredir.s | 18 ++++++++---------- injector/source/patcher.c | 6 +++--- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/injector/patches/romfsredir.s b/injector/patches/romfsredir.s index 7e56a8f..2bf5db9 100644 --- a/injector/patches/romfsredir.s +++ b/injector/patches/romfsredir.s @@ -31,14 +31,14 @@ _start: bne _mountSd+4 stmfd sp!, {r0-r4, lr} sub sp, sp, #4 - load r1, archive + load r1, archiveId mov r0, sp load r4, fsMountArchive blx r4 mov r3, #0 mov r2, #0 ldr r1, [sp] - addr r0, sdmcArchiveName + addr r0, archiveName load r4, fsRegisterArchive blx r4 add sp, sp, #4 @@ -60,7 +60,7 @@ _start: pathRedir: stmfd sp!, {r0-r3} add r0, sp, #0x10 - addr r3, sdmcCustomPath + addr r3, customPath pathRedir_1: ldrb r2, [r3], #1 strh r2, [r0], #2 @@ -90,12 +90,10 @@ _start: .pool .align 4 - sdmcArchiveName : .word 0xdead0007 - .dcb ":", 0 - .align 4 - fsMountArchive : .word 0xdead0005 - fsRegisterArchive : .word 0xdead0006 - archive : .word 0xdead0008 - sdmcCustomPath : .word 0xdead0004 + archiveName : .word 0xdead0007 + fsMountArchive : .word 0xdead0005 + fsRegisterArchive : .word 0xdead0006 + archiveId : .word 0xdead0008 + customPath : .word 0xdead0004 .close diff --git a/injector/source/patcher.c b/injector/source/patcher.c index d8dc05f..aed594f 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(!archive) return true; - const char *mount = archive == ARCHIVE_SDMC ? "sdmc:" : "nand:"; + const char *mount = archive == ARCHIVE_SDMC ? "sdc:" : "nnd:"; u32 fsMountArchive = 0xFFFFFFFF, fsRegisterArchive = 0xFFFFFFFF, @@ -554,8 +554,8 @@ static inline bool patchLayeredFs(u64 progId, u8* code, u32 size) payload32[i] = MAKE_BRANCH(payloadOffset + i * 4, fsTryOpenFile + 4); break; case 0xdead0004: - memcpy(payload32 + i, mount, 5); - memcpy((u8 *)(payload32 + i) + 5, path, sizeof(path)); + memcpy(payload32 + i, mount, 4); + memcpy((u8 *)(payload32 + i) + 4, path, sizeof(path)); break; case 0xdead0005: payload32[i] = 0x100000 + fsMountArchive;