mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-06 11:22:15 +02:00
Update nifm.c
This commit is contained in:
parent
d2e41e16e2
commit
cc18ea8cd3
@ -10,13 +10,13 @@
|
|||||||
#include "runtime/hosversion.h"
|
#include "runtime/hosversion.h"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
nifmPrivilegeLevel_NotInitialized = 0,
|
NifmServiceType_NotInitialized = 0,
|
||||||
nifmPrivilegeLevel_User = 1,
|
NifmServiceType_User = 1,
|
||||||
nifmPrivilegeLevel_Applet = 2,
|
NifmServiceType_Applet = 2,
|
||||||
nifmPrivilegeLevel_System = 3,
|
NifmServiceType_System = 3,
|
||||||
} nifmPrivilegeLevel;
|
} NifmServiceType;
|
||||||
|
|
||||||
static nifmPrivilegeLevel g_nifmPrivilegeLevel = nifmPrivilegeLevel_NotInitialized;
|
static NifmServiceType g_nifmServiceType = NifmServiceType_NotInitialized;
|
||||||
|
|
||||||
static Service g_nifmSrv;
|
static Service g_nifmSrv;
|
||||||
static Service g_nifmIGS;
|
static Service g_nifmIGS;
|
||||||
@ -32,18 +32,18 @@ Result nifmInitialize(void) {
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
Result rc = smGetService(&g_nifmSrv, "nifm:s");
|
Result rc = smGetService(&g_nifmSrv, "nifm:s");
|
||||||
g_nifmPrivilegeLevel = nifmPrivilegeLevel_System;
|
g_nifmServiceType = NifmServiceType_System;
|
||||||
|
|
||||||
if (R_FAILED(rc))
|
if (R_FAILED(rc))
|
||||||
{
|
{
|
||||||
rc = smGetService(&g_nifmSrv, "nifm:a");
|
rc = smGetService(&g_nifmSrv, "nifm:a");
|
||||||
g_nifmPrivilegeLevel = nifmPrivilegeLevel_Applet;
|
g_nifmServiceType = NifmServiceType_Applet;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (R_FAILED(rc))
|
if (R_FAILED(rc))
|
||||||
{
|
{
|
||||||
rc = smGetService(&g_nifmSrv, "nifm:u");
|
rc = smGetService(&g_nifmSrv, "nifm:u");
|
||||||
g_nifmPrivilegeLevel = nifmPrivilegeLevel_User;
|
g_nifmServiceType = NifmServiceType_User;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc)) rc = serviceConvertToDomain(&g_nifmSrv);
|
if (R_SUCCEEDED(rc)) rc = serviceConvertToDomain(&g_nifmSrv);
|
||||||
@ -65,7 +65,7 @@ void nifmExit(void) {
|
|||||||
if (atomicDecrement64(&g_refCnt) == 0) {
|
if (atomicDecrement64(&g_refCnt) == 0) {
|
||||||
serviceClose(&g_nifmIGS);
|
serviceClose(&g_nifmIGS);
|
||||||
serviceClose(&g_nifmSrv);
|
serviceClose(&g_nifmSrv);
|
||||||
g_nifmPrivilegeLevel = nifmPrivilegeLevel_NotInitialized;
|
g_nifmServiceType = NifmServiceType_NotInitialized;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ Result nifmIsWirelessCommunicationEnabled(bool* out) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result nifmSetWirelessCommunicationEnabled(bool enable) {
|
Result nifmSetWirelessCommunicationEnabled(bool enable) {
|
||||||
if (g_nifmPrivilegeLevel < nifmPrivilegeLevel_Applet)
|
if (g_nifmServiceType < NifmServiceType_Applet)
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||||
|
|
||||||
IpcCommand c;
|
IpcCommand c;
|
||||||
|
Loading…
Reference in New Issue
Block a user