mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-31 23:08:22 -04:00
libstrat: namespace remaining non-namespaced code. more new-ipc updates
This commit is contained in:
parent
ae2fa2fa60
commit
0b22af1206
68 changed files with 1257 additions and 2118 deletions
|
@ -18,124 +18,35 @@
|
|||
#include "pm_ams.h"
|
||||
|
||||
Result pminfoAtmosphereGetProcessId(u64 *out_pid, u64 tid) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
Service *srv = pminfoGetServiceSession();
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 cmd_id;
|
||||
u64 title_id;
|
||||
} *raw;
|
||||
|
||||
raw = serviceIpcPrepareHeader(srv, &c, sizeof(*raw));
|
||||
raw->magic = SFCI_MAGIC;
|
||||
raw->cmd_id = 65000;
|
||||
raw->title_id = tid;
|
||||
|
||||
Result rc = serviceIpcDispatch(srv);
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
IpcParsedCommand r;
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 result;
|
||||
u64 pid;
|
||||
} *resp;
|
||||
|
||||
serviceIpcParse(srv, &r, sizeof(*resp));
|
||||
resp = r.Raw;
|
||||
|
||||
rc = resp->result;
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
*out_pid = resp->pid;
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
return serviceDispatchInOut(pminfoGetServiceSession(), 65000, tid, *out_pid);
|
||||
}
|
||||
|
||||
Result pminfoAtmosphereHasLaunchedTitle(bool *out, u64 tid) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
Service *srv = pminfoGetServiceSession();
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 cmd_id;
|
||||
u64 title_id;
|
||||
} *raw;
|
||||
|
||||
raw = serviceIpcPrepareHeader(srv, &c, sizeof(*raw));
|
||||
raw->magic = SFCI_MAGIC;
|
||||
raw->cmd_id = 65001;
|
||||
raw->title_id = tid;
|
||||
|
||||
Result rc = serviceIpcDispatch(srv);
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
IpcParsedCommand r;
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 result;
|
||||
u8 has_launched_title;
|
||||
} *resp;
|
||||
|
||||
serviceIpcParse(srv, &r, sizeof(*resp));
|
||||
resp = r.Raw;
|
||||
|
||||
rc = resp->result;
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
*out = resp->has_launched_title != 0;
|
||||
}
|
||||
}
|
||||
|
||||
u8 tmp;
|
||||
Result rc = serviceDispatchInOut(pminfoGetServiceSession(), 65001, tid, tmp);
|
||||
if (R_SUCCEEDED(rc) && out) *out = tmp & 1;
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result pmdmntAtmosphereGetProcessInfo(Handle* out, u64 *tid_out, u8 *sid_out, u64 pid) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
Service *s = pmdmntGetServiceSession();
|
||||
|
||||
Result pmdmntAtmosphereGetProcessInfo(Handle* handle_out, u64 *tid_out, u8 *sid_out, u64 pid) {
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 cmd_id;
|
||||
u64 pid;
|
||||
} *raw;
|
||||
u64 title_id;
|
||||
u8 storage_id;
|
||||
} out;
|
||||
Handle tmp_handle;
|
||||
|
||||
raw = serviceIpcPrepareHeader(s, &c, sizeof(*raw));
|
||||
|
||||
raw->magic = SFCI_MAGIC;
|
||||
raw->cmd_id = 65000;
|
||||
raw->pid = pid;
|
||||
|
||||
Result rc = serviceIpcDispatch(s);
|
||||
Result rc = serviceDispatchInOut(pmdmntGetServiceSession(), 65000, pid, out,
|
||||
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
|
||||
.out_handles = &tmp_handle,
|
||||
);
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
IpcParsedCommand r;
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 result;
|
||||
u64 title_id;
|
||||
FsStorageId storage_id;
|
||||
} *resp;
|
||||
|
||||
serviceIpcParse(s, &r, sizeof(*resp));
|
||||
resp = r.Raw;
|
||||
|
||||
rc = resp->result;
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
if (out) {
|
||||
*out = r.Handles[0];
|
||||
} else {
|
||||
svcCloseHandle(r.Handles[0]);
|
||||
}
|
||||
if (tid_out) *tid_out = resp->title_id;
|
||||
if (sid_out) *sid_out = resp->storage_id;
|
||||
if (tid_out) *tid_out = out.title_id;
|
||||
if (sid_out) *sid_out = out.storage_id;
|
||||
if (handle_out) {
|
||||
*handle_out = tmp_handle;
|
||||
} else {
|
||||
svcCloseHandle(tmp_handle);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,44 +54,20 @@ Result pmdmntAtmosphereGetProcessInfo(Handle* out, u64 *tid_out, u8 *sid_out, u6
|
|||
}
|
||||
|
||||
Result pmdmntAtmosphereGetCurrentLimitInfo(u64 *out_cur, u64 *out_lim, u32 group, u32 resource) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
Service *s = pmdmntGetServiceSession();
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 cmd_id;
|
||||
const struct {
|
||||
u32 group;
|
||||
u32 resource;
|
||||
} *raw;
|
||||
} in = { group, resource };
|
||||
struct {
|
||||
u64 cur;
|
||||
u64 lim;
|
||||
} out;
|
||||
|
||||
raw = serviceIpcPrepareHeader(s, &c, sizeof(*raw));
|
||||
|
||||
raw->magic = SFCI_MAGIC;
|
||||
raw->cmd_id = 65001;
|
||||
raw->group = group;
|
||||
raw->resource = resource;
|
||||
|
||||
Result rc = serviceIpcDispatch(s);
|
||||
Result rc = serviceDispatchInOut(pmdmntGetServiceSession(), 65001, in, out);
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
IpcParsedCommand r;
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 result;
|
||||
u64 cur_value;
|
||||
u64 lim_value;
|
||||
} *resp;
|
||||
|
||||
serviceIpcParse(s, &r, sizeof(*resp));
|
||||
resp = r.Raw;
|
||||
|
||||
rc = resp->result;
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
if (out_cur) *out_cur = resp->cur_value;
|
||||
if (out_lim) *out_lim = resp->lim_value;
|
||||
}
|
||||
if (out_cur) *out_cur = out.cur;
|
||||
if (out_lim) *out_lim = out.lim;
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue