yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

service: pm: Implement AtmosphereGetProcessId

- Used by Skyline modding framework
This commit is contained in:
Morph 2021-11-20 19:52:25 -05:00
parent 3dc38d185b
commit 9173f07a51
1 changed files with 24 additions and 0 deletions

View File

@ -134,6 +134,9 @@ public:
: ServiceFramework{system_, "pm:info"}, process_list{process_list_} {
static const FunctionInfo functions[] = {
{0, &Info::GetProgramId, "GetProgramId"},
{65000, &Info::AtmosphereGetProcessId, "AtmosphereGetProcessId"},
{65001, nullptr, "AtmosphereHasLaunchedProgram"},
{65002, nullptr, "AtmosphereGetProcessInfo"},
};
RegisterHandlers(functions);
}
@ -160,6 +163,27 @@ private:
rb.Push((*process)->GetProgramID());
}
void AtmosphereGetProcessId(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto program_id = rp.PopRaw<u64>();
LOG_DEBUG(Service_PM, "called, program_id={:016X}", program_id);
const auto process = SearchProcessList(process_list, [program_id](const auto& proc) {
return proc->GetProgramID() == program_id;
});
if (!process.has_value()) {
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultProcessNotFound);
return;
}
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(ResultSuccess);
rb.Push((*process)->GetProcessID());
}
const std::vector<Kernel::KProcess*>& process_list;
};