Add more set:sys Get*/Set* functions (#108)

* Use setsysGetFlag/setsysSetFlag instead of setsysGet*/setsysSet*.
* Added more setsys Flags (now handled via an enum).
This commit is contained in:
Joel 2018-06-07 15:06:36 -05:00 committed by yellows8
parent 3326d5e62d
commit 3c6344d7f3
2 changed files with 34 additions and 167 deletions

View File

@ -35,6 +35,26 @@ typedef enum
SetLanguage_Total, ///< Total languages supported by this enum.
} SetLanguage;
/// Command IDs for setsysGetFlag/setsysSetFlag.
typedef enum {
SetSysFlag_LockScreen = 7,
SetSysFlag_ConsoleInformationUpload = 25,
SetSysFlag_AutomaticApplicationDownload = 27,
SetSysFlag_Quest = 47,
SetSysFlag_Usb30Enable = 65,
SetSysFlag_NfcEnable = 69,
SetSysFlag_WirelessLanEnable = 73,
SetSysFlag_BluetoothEnable = 88,
SetSysFlag_AutoUpdateEnable = 95,
SetSysFlag_BatteryPercentage = 99,
SetSysFlag_ExternalRtcReset = 101,
SetSysFlag_UsbFullKeyEnable = 103,
SetSysFlag_BluetoothAfhEnable = 111,
SetSysFlag_BluetoothBoostEnable = 113,
SetSysFlag_InRepairProcessEnable = 115,
SetSysFlag_HeadphoneVolumeUpdate = 117,
} SetSysFlag;
Result setInitialize(void);
void setExit(void);
@ -88,37 +108,15 @@ Result setsysGetSettingsItemValue(const char *name, const char *item_key, void *
Result setsysGetSerialNumber(char *serial);
/**
* @brief Gets the lockscreen status.
* @param out Pointer to output the status to.
* @brief Gets the status of the specified settings flag.
* @param flag The specified settings flag.
* @param out Output pointer for the status.
*/
Result setsysGetLockScreenFlag(bool *out);
Result setsysGetFlag(SetSysFlag flag, bool *out);
/**
* @brief Gets the console information upload status.
* @param out Pointer to output the status to.
* @brief Enables/disables the specified settings flag.
* @param flag The specified settings flag.
* @param enable To enable/disable the flag.
*/
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);
Result setsysSetFlag(SetSysFlag flag, bool enable);

View File

@ -471,7 +471,7 @@ Result setsysGetSerialNumber(char *serial) {
return rc;
}
Result setsysGetLockScreenFlag(bool *out) {
Result setsysGetFlag(SetSysFlag flag, bool *out) {
IpcCommand c;
ipcInitialize(&c);
@ -483,7 +483,7 @@ Result setsysGetLockScreenFlag(bool *out) {
raw = ipcPrepareHeader(&c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 7;
raw->cmd_id = flag;
Result rc = serviceIpcDispatch(&g_setsysSrv);
@ -504,19 +504,21 @@ Result setsysGetLockScreenFlag(bool *out) {
return rc;
}
Result setsysGetConsoleInformationUploadFlag(bool *out) {
Result setsysSetFlag(SetSysFlag flag, bool enable) {
IpcCommand c;
ipcInitialize(&c);
struct {
u64 magic;
u64 cmd_id;
u8 flag;
} *raw;
raw = ipcPrepareHeader(&c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 25;
raw->cmd_id = flag + 1;
raw->flag = enable;
Result rc = serviceIpcDispatch(&g_setsysSrv);
@ -530,139 +532,6 @@ Result setsysGetConsoleInformationUploadFlag(bool *out) {
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;
}