Minor cleanup
This commit is contained in:
parent
db33c315f2
commit
c087edf2ba
@ -164,18 +164,3 @@ Result FSLDR_OpenDirectory(Handle* out, FS_Archive archive, FS_Path path)
|
|||||||
|
|
||||||
return cmdbuf[1];
|
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;
|
|
||||||
}
|
|
@ -10,4 +10,3 @@ Result FSLDR_OpenFileDirectly(Handle* out, FS_ArchiveID archiveId, FS_Path archi
|
|||||||
Result FSLDR_OpenArchive(FS_Archive* archive, FS_ArchiveID id, FS_Path path);
|
Result FSLDR_OpenArchive(FS_Archive* archive, FS_ArchiveID id, FS_Path path);
|
||||||
Result FSLDR_CloseArchive(FS_Archive archive);
|
Result FSLDR_CloseArchive(FS_Archive archive);
|
||||||
Result FSLDR_OpenDirectory(Handle* out, FS_Archive archive, FS_Path path);
|
Result FSLDR_OpenDirectory(Handle* out, FS_Archive archive, FS_Path path);
|
||||||
Result FSDIRLDR_Close(Handle handle);
|
|
@ -52,7 +52,7 @@ static u32 dirCheck(FS_ArchiveID archiveId, const char *path)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = R_SUCCEEDED(FSLDR_OpenDirectory(&handle, archive, dirPath)) ? 0 : 2;
|
ret = R_SUCCEEDED(FSLDR_OpenDirectory(&handle, archive, dirPath)) ? 0 : 2;
|
||||||
if(ret) FSDIRLDR_Close(handle);
|
if(ret) FSDIR_Close(handle);
|
||||||
FSLDR_CloseArchive(archive);
|
FSLDR_CloseArchive(archive);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -522,8 +522,6 @@ static inline bool patchLayeredFs(u64 progId, u8 *code, u32 size, u32 textSize)
|
|||||||
|
|
||||||
if(!archiveId) return true;
|
if(!archiveId) return true;
|
||||||
|
|
||||||
static const char *archiveName = "lf:";
|
|
||||||
|
|
||||||
u32 fsMountArchive = 0xFFFFFFFF,
|
u32 fsMountArchive = 0xFFFFFFFF,
|
||||||
fsRegisterArchive = 0xFFFFFFFF,
|
fsRegisterArchive = 0xFFFFFFFF,
|
||||||
fsTryOpenFile = 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;
|
!findLayeredFsPayloadOffset(code, textSize, &payloadOffset)) return false;
|
||||||
|
|
||||||
static const char *updateRomFsMounts[] = { "patch:",
|
static const char *updateRomFsMounts[] = { "patch:",
|
||||||
"ext:" };
|
"ext:" },
|
||||||
|
patch = 'r';
|
||||||
|
|
||||||
//Change update RomFS mountpoints to start with "r"
|
//Change update RomFS mountpoints to start with "r"
|
||||||
for(u32 i = 0, ret = 0; i < sizeof(updateRomFsMounts) / sizeof(char *) && !ret; i++)
|
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,
|
ret = patchMemory(code, size,
|
||||||
updateRomFsMounts[i],
|
updateRomFsMounts[i],
|
||||||
strnlen(updateRomFsMounts[i], 255), 0,
|
strnlen(updateRomFsMounts[i], 255), 0,
|
||||||
"r",
|
&patch,
|
||||||
1, 0
|
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);
|
payload32[i] = MAKE_BRANCH(payloadOffset + i * 4, fsTryOpenFile + 4);
|
||||||
break;
|
break;
|
||||||
case 0xdead0004:
|
case 0xdead0004:
|
||||||
memcpy(payload32 + i, archiveName, 3);
|
memcpy(payload32 + i, "lf:", 3);
|
||||||
memcpy((u8 *)(payload32 + i) + 3, path, sizeof(path));
|
memcpy((u8 *)(payload32 + i) + 3, path, sizeof(path));
|
||||||
break;
|
break;
|
||||||
case 0xdead0005:
|
case 0xdead0005:
|
||||||
|
Reference in New Issue
Block a user