From c087edf2ba20f734f2f38680891d93d1b7de1560 Mon Sep 17 00:00:00 2001 From: Aurora Wright Date: Fri, 28 Apr 2017 12:38:43 +0200 Subject: [PATCH] Minor cleanup --- injector/source/fsldr.c | 15 --------------- injector/source/fsldr.h | 3 +-- injector/source/patcher.c | 13 ++++++------- 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/injector/source/fsldr.c b/injector/source/fsldr.c index 78ea736..cc77f50 100644 --- a/injector/source/fsldr.c +++ b/injector/source/fsldr.c @@ -163,19 +163,4 @@ Result FSLDR_OpenDirectory(Handle* out, FS_Archive archive, FS_Path path) if(out) *out = cmdbuf[3]; return cmdbuf[1]; -} - -Result FSDIRLDR_Close(Handle handle) -{ - u32 *cmdbuf = getThreadCommandBuffer(); - - cmdbuf[0] = IPC_MakeHeader(0x802,0,0); // 0x8020000 - - Result ret = 0; - if(R_FAILED(ret = svcSendSyncRequest(handle))) return ret; - - ret = cmdbuf[1]; - if(R_SUCCEEDED(ret)) ret = svcCloseHandle(handle); - - return ret; } \ No newline at end of file diff --git a/injector/source/fsldr.h b/injector/source/fsldr.h index 08268ce..5886b0c 100644 --- a/injector/source/fsldr.h +++ b/injector/source/fsldr.h @@ -9,5 +9,4 @@ Result FSLDR_SetPriority(u32 priority); Result FSLDR_OpenFileDirectly(Handle* out, FS_ArchiveID archiveId, FS_Path archivePath, FS_Path filePath, u32 openFlags, u32 attributes); Result FSLDR_OpenArchive(FS_Archive* archive, FS_ArchiveID id, FS_Path path); Result FSLDR_CloseArchive(FS_Archive archive); -Result FSLDR_OpenDirectory(Handle* out, FS_Archive archive, FS_Path path); -Result FSDIRLDR_Close(Handle handle); \ No newline at end of file +Result FSLDR_OpenDirectory(Handle* out, FS_Archive archive, FS_Path path); \ No newline at end of file diff --git a/injector/source/patcher.c b/injector/source/patcher.c index 14539bf..c07b7e4 100644 --- a/injector/source/patcher.c +++ b/injector/source/patcher.c @@ -52,7 +52,7 @@ static u32 dirCheck(FS_ArchiveID archiveId, const char *path) else { ret = R_SUCCEEDED(FSLDR_OpenDirectory(&handle, archive, dirPath)) ? 0 : 2; - if(ret) FSDIRLDR_Close(handle); + if(ret) FSDIR_Close(handle); FSLDR_CloseArchive(archive); } @@ -522,8 +522,6 @@ static inline bool patchLayeredFs(u64 progId, u8 *code, u32 size, u32 textSize) if(!archiveId) return true; - static const char *archiveName = "lf:"; - u32 fsMountArchive = 0xFFFFFFFF, fsRegisterArchive = 0xFFFFFFFF, fsTryOpenFile = 0xFFFFFFFF, @@ -534,7 +532,8 @@ static inline bool patchLayeredFs(u64 progId, u8 *code, u32 size, u32 textSize) !findLayeredFsPayloadOffset(code, textSize, &payloadOffset)) return false; static const char *updateRomFsMounts[] = { "patch:", - "ext:" }; + "ext:" }, + patch = 'r'; //Change update RomFS mountpoints to start with "r" for(u32 i = 0, ret = 0; i < sizeof(updateRomFsMounts) / sizeof(char *) && !ret; i++) @@ -542,8 +541,8 @@ static inline bool patchLayeredFs(u64 progId, u8 *code, u32 size, u32 textSize) ret = patchMemory(code, size, updateRomFsMounts[i], strnlen(updateRomFsMounts[i], 255), 0, - "r", - 1, 0 + &patch, + sizeof(patch), 0 ); } @@ -570,7 +569,7 @@ static inline bool patchLayeredFs(u64 progId, u8 *code, u32 size, u32 textSize) payload32[i] = MAKE_BRANCH(payloadOffset + i * 4, fsTryOpenFile + 4); break; case 0xdead0004: - memcpy(payload32 + i, archiveName, 3); + memcpy(payload32 + i, "lf:", 3); memcpy((u8 *)(payload32 + i) + 3, path, sizeof(path)); break; case 0xdead0005: