mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-22 21:02:39 +02:00
Add setGetSerialNumber (#95)
This commit is contained in:
parent
df203f0697
commit
c28cae95cd
@ -66,3 +66,9 @@ void setsysExit(void);
|
|||||||
|
|
||||||
/// Gets the current system theme.
|
/// Gets the current system theme.
|
||||||
Result setsysGetColorSetId(ColorSetId* out);
|
Result setsysGetColorSetId(ColorSetId* out);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the system's serial number.
|
||||||
|
* @param serial Pointer to output the serial to. (The buffer size needs to be at least 0x19 bytes)
|
||||||
|
*/
|
||||||
|
Result setsysGetSerialNumber(char *serial);
|
||||||
|
@ -346,3 +346,40 @@ Result setsysGetColorSetId(ColorSetId* out)
|
|||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result setsysGetSerialNumber(char *serial) {
|
||||||
|
IpcCommand c;
|
||||||
|
ipcInitialize(&c);
|
||||||
|
|
||||||
|
if (serial) memset(serial, 0, 0x19);
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user