mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-17 17:36:44 +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,9 +102,11 @@ Result ProcessCreation::CreateProcess(Handle *out_process_h, u64 index, char *nc
|
|||
}
|
||||
|
||||
/* Mount the title's exefs. */
|
||||
rc = ContentManagement::MountCodeForTidSid(&target_process->tid_sid);
|
||||
if (R_FAILED(rc)) {
|
||||
return rc;
|
||||
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. */
|
||||
|
@ -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}};
|
||||
}
|
||||
|
||||
rc = ContentManagement::ResolveContentPathForTidSid(nca_path, &tid_sid);
|
||||
if (R_FAILED(rc)) {
|
||||
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;
|
||||
|
||||
rc = ContentManagement::MountCodeForTidSid(tid_sid);
|
||||
if (R_FAILED(rc)) {
|
||||
return 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