loader: update for new-ipc

This commit is contained in:
Michael Scire 2019-10-14 21:40:05 -07:00 committed by SciresM
parent 88a86a3363
commit 2f959785e1
13 changed files with 124 additions and 84 deletions

View file

@ -26,8 +26,8 @@
namespace sts::ldr {
/* Official commands. */
Result LoaderService::CreateProcess(Out<MovedHandle> proc_h, PinId id, u32 flags, CopiedHandle reslimit) {
os::ManagedHandle reslimit_holder(reslimit.GetValue());
Result LoaderService::CreateProcess(sf::OutMoveHandle proc_h, PinId id, u32 flags, sf::CopyHandle reslimit_h) {
os::ManagedHandle reslimit_holder(reslimit_h.GetValue());
ncm::TitleLocation loc;
char path[FS_MAX_PATH];
@ -41,12 +41,11 @@ namespace sts::ldr {
return ldr::CreateProcess(proc_h.GetHandlePointer(), id, loc, path, flags, reslimit_holder.Get());
}
Result LoaderService::GetProgramInfo(OutPointerWithServerSize<ProgramInfo, 0x1> out_program_info, ncm::TitleLocation loc) {
Result LoaderService::GetProgramInfo(sf::Out<ProgramInfo> out, const ncm::TitleLocation &loc) {
/* Zero output. */
ProgramInfo *out = out_program_info.pointer;
std::memset(out, 0, sizeof(*out));
std::memset(out.GetPointer(), 0, sizeof(*out.GetPointer()));
R_TRY(ldr::GetProgramInfo(out, loc));
R_TRY(ldr::GetProgramInfo(out.GetPointer(), loc));
if (loc.storage_id != static_cast<u8>(ncm::StorageId::None) && loc.title_id != out->title_id) {
char path[FS_MAX_PATH];
@ -64,7 +63,7 @@ namespace sts::ldr {
return ResultSuccess;
}
Result LoaderService::PinTitle(Out<PinId> out_id, ncm::TitleLocation loc) {
Result LoaderService::PinTitle(sf::Out<PinId> out_id, const ncm::TitleLocation &loc) {
return ldr::ro::PinTitle(out_id.GetPointer(), loc);
}
@ -72,24 +71,24 @@ namespace sts::ldr {
return ldr::ro::UnpinTitle(id);
}
Result LoaderService::SetTitleArguments(ncm::TitleId title_id, InPointer<char> args, u32 args_size) {
return args::Set(title_id, args.pointer, std::min(args.num_elements, size_t(args_size)));
Result LoaderService::SetTitleArguments(ncm::TitleId title_id, const sf::InPointerBuffer &args, u32 args_size) {
return args::Set(title_id, args.GetPointer(), std::min(args.GetSize(), size_t(args_size)));
}
Result LoaderService::ClearArguments() {
return args::Clear();
}
Result LoaderService::GetProcessModuleInfo(Out<u32> count, OutPointerWithClientSize<ModuleInfo> out, u64 process_id) {
if (out.num_elements > std::numeric_limits<s32>::max()) {
Result LoaderService::GetProcessModuleInfo(sf::Out<u32> count, const sf::OutPointerArray<ModuleInfo> &out, os::ProcessId process_id) {
if (out.GetSize() > std::numeric_limits<s32>::max()) {
return ResultLoaderInvalidSize;
}
return ldr::ro::GetProcessModuleInfo(count.GetPointer(), out.pointer, out.num_elements, process_id);
return ldr::ro::GetProcessModuleInfo(count.GetPointer(), out.GetPointer(), out.GetSize(), process_id);
}
/* Atmosphere commands. */
Result LoaderService::AtmosphereSetExternalContentSource(Out<MovedHandle> out, ncm::TitleId title_id) {
Result LoaderService::AtmosphereSetExternalContentSource(sf::OutMoveHandle out, ncm::TitleId title_id) {
return ecs::Set(out.GetHandlePointer(), title_id);
}
@ -97,7 +96,7 @@ namespace sts::ldr {
R_ASSERT(ecs::Clear(title_id));
}
void LoaderService::AtmosphereHasLaunchedTitle(Out<bool> out, ncm::TitleId title_id) {
void LoaderService::AtmosphereHasLaunchedTitle(sf::Out<bool> out, ncm::TitleId title_id) {
out.SetValue(ldr::HasLaunchedTitle(title_id));
}