mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-06-28 14:02:40 +02:00
sm: supercede ams extension via DetachClient
This commit is contained in:
parent
efe104b0ea
commit
fdd1ccf87a
@ -28,6 +28,11 @@ static Result _smAtmosphereCmdInServiceNameNoOut(SmServiceName name, Service *sr
|
||||
return serviceDispatchIn(srv, cmd_id, name);
|
||||
}
|
||||
|
||||
static Result _smAtmosphereDetachClient(Service *srv) {
|
||||
u64 pid_placeholder = 0;
|
||||
return serviceDispatchIn(srv, 4, pid_placeholder, .in_send_pid = true);
|
||||
}
|
||||
|
||||
Result smAtmosphereHasService(bool *out, SmServiceName name) {
|
||||
return _smAtmosphereCmdHas(out, name, 65100);
|
||||
}
|
||||
@ -81,6 +86,10 @@ Result smAtmosphereOpenSession(Service *out) {
|
||||
}
|
||||
|
||||
void smAtmosphereCloseSession(Service *srv) {
|
||||
Result rc = _smAtmosphereDetachClient(srv);
|
||||
if (R_FAILED(rc)) {
|
||||
svcBreak(BreakReason_Panic, (uintptr_t)&rc, sizeof(rc));
|
||||
}
|
||||
serviceClose(srv);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,10 @@ namespace ams::sm::impl {
|
||||
std::scoped_lock lk(GetUserSessionMutex());
|
||||
{
|
||||
R_ABORT_UNLESS(smInitialize());
|
||||
ON_SCOPE_EXIT { smExit(); };
|
||||
ON_SCOPE_EXIT {
|
||||
R_ABORT_UNLESS(smDetachClient());
|
||||
smExit();
|
||||
};
|
||||
|
||||
return f();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user