mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-09 22:56:35 +00:00
Loader: Support loading FsStorageId_None content from SD.
This commit is contained in:
parent
5a63f4e304
commit
b365065a2d
3 changed files with 25 additions and 13 deletions
|
@ -44,6 +44,7 @@ Result ContentManagement::MountCode(u64 tid, FsStorageId sid) {
|
|||
|
||||
fsdevMountDevice("code", g_CodeFileSystem);
|
||||
|
||||
fsldrExit();
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
|
@ -102,10 +102,12 @@ Result ProcessCreation::CreateProcess(Handle *out_process_h, u64 index, char *nc
|
|||
}
|
||||
|
||||
/* Mount the title's exefs. */
|
||||
if (target_process->tid_sid.storage_id != FsStorageId_None) {
|
||||
rc = ContentManagement::MountCodeForTidSid(&target_process->tid_sid);
|
||||
if (R_FAILED(rc)) {
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
/* Load the process's NPDM. */
|
||||
rc = NpdmUtils::LoadNpdmFromCache(target_process->tid_sid.title_id, &npdm_info);
|
||||
|
@ -191,7 +193,7 @@ Result ProcessCreation::CreateProcess(Handle *out_process_h, u64 index, char *nc
|
|||
|
||||
rc = 0;
|
||||
CREATE_PROCESS_END:
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
if (R_SUCCEEDED(rc) && target_process->tid_sid.storage_id != FsStorageId_None) {
|
||||
rc = ContentManagement::UnmountCode();
|
||||
} else {
|
||||
ContentManagement::UnmountCode();
|
||||
|
|
|
@ -42,10 +42,13 @@ std::tuple<Result, MovedHandle> ProcessManagerService::create_process(u64 flags,
|
|||
return {rc, MovedHandle{process_h}};
|
||||
}
|
||||
|
||||
if (tid_sid.storage_id != FsStorageId_None) {
|
||||
rc = ContentManagement::ResolveContentPathForTidSid(nca_path, &tid_sid);
|
||||
if (R_FAILED(rc)) {
|
||||
return {rc, MovedHandle{process_h}};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
launch_item = LaunchQueue::get_item(tid_sid.title_id);
|
||||
|
||||
|
@ -70,7 +73,7 @@ std::tuple<Result> ProcessManagerService::get_program_info(Registration::TidSid
|
|||
return {rc};
|
||||
}
|
||||
|
||||
if (tid_sid.title_id != out_program_info.pointer->title_id) {
|
||||
if (tid_sid.storage_id != FsStorageId_None && tid_sid.title_id != out_program_info.pointer->title_id) {
|
||||
rc = ContentManagement::ResolveContentPathForTidSid(nca_path, &tid_sid);
|
||||
if (R_FAILED(rc)) {
|
||||
return {rc};
|
||||
|
@ -109,17 +112,23 @@ Result ProcessManagerService::populate_program_info_buffer(ProcessManagerService
|
|||
NpdmUtils::NpdmInfo info;
|
||||
Result rc;
|
||||
|
||||
if (tid_sid->storage_id != FsStorageId_None) {
|
||||
rc = ContentManagement::MountCodeForTidSid(tid_sid);
|
||||
if (R_FAILED(rc)) {
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
rc = NpdmUtils::LoadNpdm(tid_sid->title_id, &info);
|
||||
|
||||
if (tid_sid->storage_id != FsStorageId_None) {
|
||||
ContentManagement::UnmountCode();
|
||||
}
|
||||
|
||||
if (R_FAILED(rc)) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
ContentManagement::UnmountCode();
|
||||
|
||||
out->main_thread_priority = info.header->main_thread_prio;
|
||||
out->default_cpu_id = info.header->default_cpuid;
|
||||
|
|
Loading…
Reference in a new issue