Add setGetSerialNumber

This commit is contained in:
Joel16 2018-05-18 18:56:00 -05:00
parent df203f0697
commit 2075261f1e
2 changed files with 38 additions and 0 deletions

View File

@ -66,3 +66,6 @@ void setsysExit(void);
/// Gets the current system theme. /// Gets the current system theme.
Result setsysGetColorSetId(ColorSetId* out); Result setsysGetColorSetId(ColorSetId* out);
/// Gets the serial number.
Result setGetSerialNumber(char *serial);

View File

@ -346,3 +346,38 @@ Result setsysGetColorSetId(ColorSetId* out)
return rc; return rc;
} }
Result setGetSerialNumber(char *serial) {
IpcCommand c;
ipcInitialize(&c);
struct {
u64 magic;
u64 cmd_id;
} *raw;
raw = ipcPrepareHeader(&c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 68;
Result rc = serviceIpcDispatch(&g_setsysSrv);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
ipcParse(&r);
struct {
u64 magic;
u64 result;
char serial[0x18];
} *resp = r.Raw;
rc = resp->result;
if (R_SUCCEEDED(rc) && serial)
memcpy(serial, resp->serial, 0x18);
}
return rc;
}