Improved docs. Added nsGetServiceSession_GetterInterface, nsGetServiceSession_ApplicationManagerInterface, nsvmGetServiceSession, nsdevGetServiceSession, and nssuGetServiceSession.

This commit is contained in:
yellows8 2019-09-30 19:23:36 -04:00
parent 33d8c83ddc
commit 08272ed12e
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 47 additions and 0 deletions

View File

@ -118,9 +118,18 @@ typedef struct {
///@name ns
///@{
/// Initialize ns services. Uses ns:am on pre-3.0.0, ns:am2 on [3.0.0+].
Result nsInitialize(void);
/// Exit ns services.
void nsExit(void);
/// Gets the Service object for the actual ns:* service session. Only initialized on [3.0.0+], on pre-3.0.0 see \ref nsGetServiceSession_ApplicationManagerInterface.
Service* nsGetServiceSession_GetterInterface(void);
/// Gets the Service object for IApplicationManagerInterface.
Service* nsGetServiceSession_ApplicationManagerInterface(void);
/**
* @brief Gets an listing of \ref NsApplicationRecord.
* @param[out] records Output array of \ref NsApplicationRecord.
@ -169,9 +178,15 @@ Result nsGetFreeSpaceSize(FsStorageId storage_id, u64 *size);
///@name ns:vm
///@{
/// Initialize ns:vm. On pre-3.0.0 this must be used with \ref nsInitialize.
Result nsvmInitialize(void);
/// Exit ns:vm.
void nsvmExit(void);
/// Gets the Service object for ns:vm. This is only initialized on [3.0.0+].
Service* nsvmGetServiceSession(void);
Result nsvmNeedsUpdateVulnerability(bool *out);
Result nsvmGetSafeSystemVersion(NcmContentMetaKey *out); ///< [4.0.0+]
@ -180,9 +195,15 @@ Result nsvmGetSafeSystemVersion(NcmContentMetaKey *out); ///< [4.0.0+]
///@name ns:dev
///@{
/// Initialize ns:dev.
Result nsdevInitialize(void);
/// Initialize ns:dev.
void nsdevExit(void);
/// Gets the Service object for ns:dev.
Service* nsdevGetServiceSession(void);
Result nsdevLaunchProgram(u64* out_pid, const NsLaunchProperties* properties, u32 flags);
Result nsdevTerminateProcess(u64 pid);
Result nsdevTerminateProgram(u64 tid);
@ -201,9 +222,15 @@ Result nsdevSetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop(bool can
///@name ns:su
///@{
/// Initialize ns:su.
Result nssuInitialize(void);
/// Exit ns:su.
void nssuExit(void);
/// Gets the Service object for ns:su.
Service* nssuGetServiceSession(void);
/**
* @brief Gets the \ref NsBackgroundNetworkUpdateState.
* @note Internally this uses nim commands ListSystemUpdateTask and GetSystemUpdateTaskInfo to determine the output state.

View File

@ -44,6 +44,14 @@ void _nsCleanup(void)
serviceClose(&g_nsGetterSrv);
}
Service* nsGetServiceSession_GetterInterface(void) {
return &g_nsGetterSrv;
}
Service* nsGetServiceSession_ApplicationManagerInterface(void) {
return &g_nsAppManSrv;
}
static Result _nsGetSession(Service* srv, Service* srv_out, u32 cmd_id) {
return serviceDispatch(srv, cmd_id,
.out_num_objects = 1,
@ -230,6 +238,10 @@ void _nsvmCleanup(void)
serviceClose(&g_nsvmSrv);
}
Service* nsvmGetServiceSession(void) {
return &g_nsvmSrv;
}
Result nsvmNeedsUpdateVulnerability(bool *out) {
Service *srv = &g_nsAppManSrv;
if (hosversionAtLeast(3,0,0)) srv = &g_nsvmSrv;
@ -256,6 +268,10 @@ void _nsdevCleanup(void) {
serviceClose(&g_nsdevSrv);
}
Service* nsdevGetServiceSession(void) {
return &g_nsdevSrv;
}
Result nsdevLaunchProgram(u64* out_pid, const NsLaunchProperties* properties, u32 flags) {
const struct {
u32 flags;
@ -352,6 +368,10 @@ void _nssuCleanup(void) {
serviceClose(&g_nssuSrv);
}
Service* nssuGetServiceSession(void) {
return &g_nssuSrv;
}
Result nssuGetBackgroundNetworkUpdateState(NsBackgroundNetworkUpdateState *out) {
u8 tmpout=0;
Result rc = _nsCmdNoInOutU8(&g_nssuSrv, &tmpout, 0);