mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-06-21 11:02:45 +02:00
sm: add api for forward declaring a service mitm
This commit is contained in:
parent
b9e5305273
commit
69dbb69e0b
@ -24,7 +24,7 @@ namespace sts::sm::mitm {
|
|||||||
/* Mitm API. */
|
/* Mitm API. */
|
||||||
Result InstallMitm(Handle *out_port, Handle *out_query, ServiceName name);
|
Result InstallMitm(Handle *out_port, Handle *out_query, ServiceName name);
|
||||||
Result UninstallMitm(ServiceName name);
|
Result UninstallMitm(ServiceName name);
|
||||||
Result AssociateProcessIdAndTitleId(u64 process_id, u64 title_id);
|
Result DeclareFutureMitm(ServiceName name);
|
||||||
Result AcknowledgeSession(Service *out_service, u64 *out_pid, ncm::TitleId *out_tid, ServiceName name);
|
Result AcknowledgeSession(Service *out_service, u64 *out_pid, ncm::TitleId *out_tid, ServiceName name);
|
||||||
Result HasMitm(bool *out, ServiceName name);
|
Result HasMitm(bool *out, ServiceName name);
|
||||||
Result WaitMitm(ServiceName name);
|
Result WaitMitm(ServiceName name);
|
||||||
|
@ -301,7 +301,7 @@ Result smAtmosphereMitmUninstall(const char *name) {
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result smAtmosphereMitmAssociateProcessIdAndTitleId(u64 pid, u64 tid) {
|
Result smAtmosphereMitmDeclareFuture(const char *name) {
|
||||||
IpcCommand c;
|
IpcCommand c;
|
||||||
ipcInitialize(&c);
|
ipcInitialize(&c);
|
||||||
Service *srv = &g_smMitmSrv;
|
Service *srv = &g_smMitmSrv;
|
||||||
@ -309,15 +309,13 @@ Result smAtmosphereMitmAssociateProcessIdAndTitleId(u64 pid, u64 tid) {
|
|||||||
struct {
|
struct {
|
||||||
u64 magic;
|
u64 magic;
|
||||||
u64 cmd_id;
|
u64 cmd_id;
|
||||||
u64 pid;
|
u64 service_name;
|
||||||
u64 tid;
|
|
||||||
} *raw;
|
} *raw;
|
||||||
|
|
||||||
raw = serviceIpcPrepareHeader(srv, &c, sizeof(*raw));
|
raw = serviceIpcPrepareHeader(srv, &c, sizeof(*raw));
|
||||||
raw->magic = SFCI_MAGIC;
|
raw->magic = SFCI_MAGIC;
|
||||||
raw->cmd_id = 65002;
|
raw->cmd_id = 65006;
|
||||||
raw->pid = pid;
|
raw->service_name = smEncodeName(name);
|
||||||
raw->tid = tid;
|
|
||||||
|
|
||||||
Result rc = serviceIpcDispatch(srv);
|
Result rc = serviceIpcDispatch(srv);
|
||||||
|
|
||||||
@ -330,7 +328,6 @@ Result smAtmosphereMitmAssociateProcessIdAndTitleId(u64 pid, u64 tid) {
|
|||||||
|
|
||||||
serviceIpcParse(srv, &r, sizeof(*resp));
|
serviceIpcParse(srv, &r, sizeof(*resp));
|
||||||
resp = r.Raw;
|
resp = r.Raw;
|
||||||
|
|
||||||
rc = resp->result;
|
rc = resp->result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ void smAtmosphereMitmExit(void);
|
|||||||
|
|
||||||
Result smAtmosphereMitmInstall(Handle *handle_out, Handle *query_out, const char *name);
|
Result smAtmosphereMitmInstall(Handle *handle_out, Handle *query_out, const char *name);
|
||||||
Result smAtmosphereMitmUninstall(const char *name);
|
Result smAtmosphereMitmUninstall(const char *name);
|
||||||
Result smAtmosphereMitmAssociateProcessIdAndTitleId(u64 pid, u64 tid);
|
Result smAtmosphereMitmDeclareFuture(const char *name);
|
||||||
Result smAtmosphereMitmAcknowledgeSession(Service *srv_out, u64 *pid_out, u64 *tid_out, const char *name);
|
Result smAtmosphereMitmAcknowledgeSession(Service *srv_out, u64 *pid_out, u64 *tid_out, const char *name);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -36,9 +36,9 @@ namespace sts::sm::mitm {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Result AssociateProcessIdAndTitleId(u64 process_id, u64 title_id) {
|
Result DeclareFutureMitm(ServiceName name) {
|
||||||
return impl::DoWithMitmSession([&]() {
|
return impl::DoWithMitmSession([&]() {
|
||||||
return smAtmosphereMitmAssociateProcessIdAndTitleId(process_id, title_id);
|
return smAtmosphereMitmDeclareFuture(name.name);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user