Loader: Add support for exefs redirection to code nsp on SD.

This commit is contained in:
Michael Scire 2018-07-29 16:35:43 -07:00
parent 44e2412ae6
commit 3a2520a3b7
4 changed files with 34 additions and 5 deletions

View file

@ -19,6 +19,10 @@ Result ContentManagement::MountCode(u64 tid, FsStorageId sid) {
if (!g_has_initialized_fs_dev) {
TryMountSdCard();
}
if (kernelAbove200() && g_has_initialized_fs_dev && R_SUCCEEDED(MountCodeNspOnSd(tid))) {
return 0x0;
}
if (R_FAILED(rc = ResolveContentPath(path, tid, sid))) {
@ -53,6 +57,18 @@ Result ContentManagement::UnmountCode() {
return 0;
}
Result ContentManagement::MountCodeNspOnSd(u64 tid) {
char path[FS_MAX_PATH+1] = {0};
snprintf(path, FS_MAX_PATH, "sdmc:/atmosphere/titles/%016lx/exefs.nsp", tid);
Result rc = fsOpenFileSystemWithId(&g_CodeFileSystem, 0, FsFileSystemType_ApplicationPackage, path);
if (R_SUCCEEDED(rc)) {
fsdevMountDevice("code", g_CodeFileSystem);
}
return rc;
}
Result ContentManagement::MountCodeForTidSid(Registration::TidSid *tid_sid) {
return MountCode(tid_sid->title_id, tid_sid->storage_id);
}