From a77483379024c23ed1beb4044bf009e59c01d344 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Fri, 1 Oct 2021 19:10:19 -0700 Subject: [PATCH] ro: simplify program id logic --- stratosphere/ro/ro.json | 2 +- stratosphere/ro/source/impl/ro_service_impl.cpp | 10 ++-------- stratosphere/ro/source/ro_main.cpp | 6 ------ 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/stratosphere/ro/ro.json b/stratosphere/ro/ro.json index 9a5b89f9f..57b009592 100644 --- a/stratosphere/ro/ro.json +++ b/stratosphere/ro/ro.json @@ -15,7 +15,7 @@ "filesystem_access": { "permissions": "0xFFFFFFFFFFFFFFFF" }, - "service_access": ["fatal:u", "spl:", "set:sys", "fsp-srv", "pm:info"], + "service_access": ["fatal:u", "spl:", "set:sys", "fsp-srv"], "service_host": ["ldr:ro", "ro:dmnt", "ro:1"], "kernel_capabilities": [{ "type": "kernel_flags", diff --git a/stratosphere/ro/source/impl/ro_service_impl.cpp b/stratosphere/ro/source/impl/ro_service_impl.cpp index 54cd6555a..144af50eb 100644 --- a/stratosphere/ro/source/impl/ro_service_impl.cpp +++ b/stratosphere/ro/source/impl/ro_service_impl.cpp @@ -84,18 +84,12 @@ namespace ams::ro::impl { ncm::ProgramId GetProgramId(Handle other_process_h) const { /* Automatically select a handle, allowing for override. */ Handle process_h = this->process_handle; - if (other_process_h != INVALID_HANDLE) { + if (other_process_h != svc::InvalidHandle) { process_h = other_process_h; } ncm::ProgramId program_id = ncm::InvalidProgramId; - if (hos::GetVersion() >= hos::Version_3_0_0) { - /* 3.0.0+: Use svcGetInfo. */ - R_ABORT_UNLESS(svcGetInfo(&program_id.value, InfoType_ProgramId, process_h, 0)); - } else { - /* 1.0.0-2.3.0: We're not inside loader, so ask pm. */ - R_ABORT_UNLESS(pm::info::GetProgramId(&program_id, os::GetProcessId(process_h))); - } + R_ABORT_UNLESS(svc::GetInfo(std::addressof(program_id.value), svc::InfoType_ProgramId, process_h, 0)); return program_id; } diff --git a/stratosphere/ro/source/ro_main.cpp b/stratosphere/ro/source/ro_main.cpp index 33631290b..fa5968d31 100644 --- a/stratosphere/ro/source/ro_main.cpp +++ b/stratosphere/ro/source/ro_main.cpp @@ -144,9 +144,6 @@ void __appInit(void) { R_ABORT_UNLESS(setsysInitialize()); R_ABORT_UNLESS(fsInitialize()); spl::Initialize(); - if (hos::GetVersion() < hos::Version_3_0_0) { - R_ABORT_UNLESS(pminfoInitialize()); - } R_ABORT_UNLESS(fs::MountSdCard("sdmc")); @@ -155,9 +152,6 @@ void __appInit(void) { void __appExit(void) { fsExit(); - if (hos::GetVersion() < hos::Version_3_0_0) { - pminfoExit(); - } setsysExit(); }