mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-22 20:06:40 +00:00
ro: simplify program id logic
This commit is contained in:
parent
65fd967550
commit
a774833790
3 changed files with 3 additions and 15 deletions
|
@ -15,7 +15,7 @@
|
||||||
"filesystem_access": {
|
"filesystem_access": {
|
||||||
"permissions": "0xFFFFFFFFFFFFFFFF"
|
"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"],
|
"service_host": ["ldr:ro", "ro:dmnt", "ro:1"],
|
||||||
"kernel_capabilities": [{
|
"kernel_capabilities": [{
|
||||||
"type": "kernel_flags",
|
"type": "kernel_flags",
|
||||||
|
|
|
@ -84,18 +84,12 @@ namespace ams::ro::impl {
|
||||||
ncm::ProgramId GetProgramId(Handle other_process_h) const {
|
ncm::ProgramId GetProgramId(Handle other_process_h) const {
|
||||||
/* Automatically select a handle, allowing for override. */
|
/* Automatically select a handle, allowing for override. */
|
||||||
Handle process_h = this->process_handle;
|
Handle process_h = this->process_handle;
|
||||||
if (other_process_h != INVALID_HANDLE) {
|
if (other_process_h != svc::InvalidHandle) {
|
||||||
process_h = other_process_h;
|
process_h = other_process_h;
|
||||||
}
|
}
|
||||||
|
|
||||||
ncm::ProgramId program_id = ncm::InvalidProgramId;
|
ncm::ProgramId program_id = ncm::InvalidProgramId;
|
||||||
if (hos::GetVersion() >= hos::Version_3_0_0) {
|
R_ABORT_UNLESS(svc::GetInfo(std::addressof(program_id.value), svc::InfoType_ProgramId, process_h, 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)));
|
|
||||||
}
|
|
||||||
return program_id;
|
return program_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,9 +144,6 @@ void __appInit(void) {
|
||||||
R_ABORT_UNLESS(setsysInitialize());
|
R_ABORT_UNLESS(setsysInitialize());
|
||||||
R_ABORT_UNLESS(fsInitialize());
|
R_ABORT_UNLESS(fsInitialize());
|
||||||
spl::Initialize();
|
spl::Initialize();
|
||||||
if (hos::GetVersion() < hos::Version_3_0_0) {
|
|
||||||
R_ABORT_UNLESS(pminfoInitialize());
|
|
||||||
}
|
|
||||||
|
|
||||||
R_ABORT_UNLESS(fs::MountSdCard("sdmc"));
|
R_ABORT_UNLESS(fs::MountSdCard("sdmc"));
|
||||||
|
|
||||||
|
@ -155,9 +152,6 @@ void __appInit(void) {
|
||||||
|
|
||||||
void __appExit(void) {
|
void __appExit(void) {
|
||||||
fsExit();
|
fsExit();
|
||||||
if (hos::GetVersion() < hos::Version_3_0_0) {
|
|
||||||
pminfoExit();
|
|
||||||
}
|
|
||||||
|
|
||||||
setsysExit();
|
setsysExit();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue