loader: completely rewrite.

This commit is contained in:
Michael Scire 2019-06-26 15:46:19 -07:00
parent 9217e4c5f9
commit 61fcf5e0f4
49 changed files with 2523 additions and 5817 deletions

View file

@ -15,6 +15,9 @@
*/
#include <switch.h>
#include <stratosphere/ldr.hpp>
#include <stratosphere/ldr/ldr_pm_api.hpp>
#include "pm_registration.hpp"
#include "pm_info.hpp"
@ -22,9 +25,26 @@ Result InformationService::GetTitleId(Out<u64> tid, u64 pid) {
std::scoped_lock<ProcessList &> lk(Registration::GetProcessList());
std::shared_ptr<Registration::Process> proc = Registration::GetProcess(pid);
if (proc != NULL) {
tid.SetValue(proc->tid_sid.title_id);
return ResultSuccess;
if (proc == NULL) {
return ResultPmProcessNotFound;
}
return ResultPmProcessNotFound;
tid.SetValue(proc->tid_sid.title_id);
return ResultSuccess;
}
Result InformationService::AtmosphereGetProcessId(Out<u64> pid, u64 tid) {
std::scoped_lock<ProcessList &> lk(Registration::GetProcessList());
std::shared_ptr<Registration::Process> proc = Registration::GetProcessByTitleId(tid);
if (proc == nullptr) {
return ResultPmProcessNotFound;
}
pid.SetValue(proc->pid);
return ResultSuccess;
}
Result InformationService::AtmosphereHasLaunchedTitle(Out<bool> out, u64 tid) {
return sts::ldr::pm::HasLaunchedTitle(out.GetPointer(), sts::ncm::TitleId{tid});
}