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

@ -93,6 +93,7 @@ Result ProcessCreation::CreateProcess(Handle *out_process_h, u64 index, char *nc
Registration::Process *target_process;
Handle process_h = 0;
u64 process_id = 0;
bool mounted_code = false;
Result rc;
/* Get the process from the registration queue. */
@ -107,6 +108,11 @@ Result ProcessCreation::CreateProcess(Handle *out_process_h, u64 index, char *nc
if (R_FAILED(rc)) {
return rc;
}
mounted_code = true;
} else {
if (R_SUCCEEDED(ContentManagement::MountCodeNspOnSd(target_process->tid_sid.title_id))) {
mounted_code = true;
}
}
/* Load the process's NPDM. */
@ -193,10 +199,12 @@ Result ProcessCreation::CreateProcess(Handle *out_process_h, u64 index, char *nc
rc = 0;
CREATE_PROCESS_END:
if (R_SUCCEEDED(rc) && target_process->tid_sid.storage_id != FsStorageId_None) {
rc = ContentManagement::UnmountCode();
} else {
ContentManagement::UnmountCode();
if (mounted_code) {
if (R_SUCCEEDED(rc) && target_process->tid_sid.storage_id != FsStorageId_None) {
rc = ContentManagement::UnmountCode();
} else {
ContentManagement::UnmountCode();
}
}
if (R_SUCCEEDED(rc)) {
*out_process_h = process_h;