Add some setsysGet* functions (#98)

* Add some setsysGet* functions
This commit is contained in:
Joel 2018-05-22 10:33:45 -05:00 committed by yellows8
parent 7223994aa6
commit deab92d486
2 changed files with 234 additions and 0 deletions

View File

@ -72,3 +72,39 @@ Result setsysGetColorSetId(ColorSetId* out);
* @param serial Pointer to output the serial to. (The buffer size needs to be at least 0x19 bytes)
*/
Result setsysGetSerialNumber(char *serial);
/**
* @brief Gets the lockscreen status.
* @param out Pointer to output the status to.
*/
Result setsysGetLockScreenFlag(bool *out);
/**
* @brief Gets the console information upload status.
* @param out Pointer to output the status to.
*/
Result setsysGetConsoleInformationUploadFlag(bool *out);
/**
* @brief Gets the automatic application download status.
* @param out Pointer to output the status to.
*/
Result setsysGetAutomaticApplicationDownloadFlag(bool *out);
/**
* @brief Gets the NFC status.
* @param out Pointer to output the status to.
*/
Result setsysGetNfcEnableFlag(bool *out);
/**
* @brief Gets the wireless LAN status.
* @param out Pointer to output the status to.
*/
Result setsysGetWirelessLanEnableFlag(bool *out);
/**
* @brief Gets the bluetooth status.
* @param out Pointer to output the status to.
*/
Result setsysGetBluetoothEnableFlag(bool *out);

View File

@ -384,3 +384,201 @@ Result setsysGetSerialNumber(char *serial) {
return rc;
}
Result setsysGetLockScreenFlag(bool *out) {
IpcCommand c;
ipcInitialize(&c);
struct {
u64 magic;
u64 cmd_id;
} *raw;
raw = ipcPrepareHeader(&c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 7;
Result rc = serviceIpcDispatch(&g_setsysSrv);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
ipcParse(&r);
struct {
u64 magic;
u64 result;
u8 flag;
} *resp = r.Raw;
*out = resp->flag;
rc = resp->result;
}
return rc;
}
Result setsysGetConsoleInformationUploadFlag(bool *out) {
IpcCommand c;
ipcInitialize(&c);
struct {
u64 magic;
u64 cmd_id;
} *raw;
raw = ipcPrepareHeader(&c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 25;
Result rc = serviceIpcDispatch(&g_setsysSrv);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
ipcParse(&r);
struct {
u64 magic;
u64 result;
u8 flag;
} *resp = r.Raw;
*out = resp->flag;
rc = resp->result;
}
return rc;
}
Result setsysGetAutomaticApplicationDownloadFlag(bool *out) {
IpcCommand c;
ipcInitialize(&c);
struct {
u64 magic;
u64 cmd_id;
} *raw;
raw = ipcPrepareHeader(&c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 27;
Result rc = serviceIpcDispatch(&g_setsysSrv);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
ipcParse(&r);
struct {
u64 magic;
u64 result;
u8 flag;
} *resp = r.Raw;
*out = resp->flag;
rc = resp->result;
}
return rc;
}
Result setsysGetNfcEnableFlag(bool *out) {
IpcCommand c;
ipcInitialize(&c);
struct {
u64 magic;
u64 cmd_id;
} *raw;
raw = ipcPrepareHeader(&c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 69;
Result rc = serviceIpcDispatch(&g_setsysSrv);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
ipcParse(&r);
struct {
u64 magic;
u64 result;
u8 flag;
} *resp = r.Raw;
*out = resp->flag;
rc = resp->result;
}
return rc;
}
Result setsysGetWirelessLanEnableFlag(bool *out) {
IpcCommand c;
ipcInitialize(&c);
struct {
u64 magic;
u64 cmd_id;
} *raw;
raw = ipcPrepareHeader(&c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 73;
Result rc = serviceIpcDispatch(&g_setsysSrv);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
ipcParse(&r);
struct {
u64 magic;
u64 result;
u8 flag;
} *resp = r.Raw;
*out = resp->flag;
rc = resp->result;
}
return rc;
}
Result setsysGetBluetoothEnableFlag(bool *out) {
IpcCommand c;
ipcInitialize(&c);
struct {
u64 magic;
u64 cmd_id;
} *raw;
raw = ipcPrepareHeader(&c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 88;
Result rc = serviceIpcDispatch(&g_setsysSrv);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
ipcParse(&r);
struct {
u64 magic;
u64 result;
u8 flag;
} *resp = r.Raw;
*out = resp->flag;
rc = resp->result;
}
return rc;
}