sm: add smDetachClient

This commit is contained in:
Michael Scire 2020-12-02 08:15:38 -08:00
parent ab71d6033a
commit 44dcabd214
2 changed files with 12 additions and 0 deletions

View File

@ -124,6 +124,12 @@ Result smRegisterService(Handle* handle_out, SmServiceName name, bool is_light,
*/ */
Result smUnregisterService(SmServiceName name); Result smUnregisterService(SmServiceName name);
/**
* @brief Detaches the current SM session.
* @note After this function is called, the rest of the SM API cannot be used.
*/
Result smDetachClient(void);
/** /**
* @brief Gets the Service session used to communicate with SM. * @brief Gets the Service session used to communicate with SM.
* @return Pointer to service session used to communicate with SM. * @return Pointer to service session used to communicate with SM.

View File

@ -1,5 +1,6 @@
#define NX_SERVICE_ASSUME_NON_DOMAIN #define NX_SERVICE_ASSUME_NON_DOMAIN
#include "service_guard.h" #include "service_guard.h"
#include "runtime/hosversion.h"
#include "runtime/diag.h" #include "runtime/diag.h"
static Service g_smSrv; static Service g_smSrv;
@ -105,3 +106,8 @@ Result smRegisterService(Handle* handle_out, SmServiceName name, bool is_light,
Result smUnregisterService(SmServiceName name) { Result smUnregisterService(SmServiceName name) {
return serviceDispatchIn(&g_smSrv, 3, name); return serviceDispatchIn(&g_smSrv, 3, name);
} }
Result smDetachClient(void) {
if (hosversionBefore(11,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return serviceDispatch(&g_smSrv, 4);
}