mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-04 18:42:15 +02:00
Implement setsys(Get/Set)DeviceNickname.
Thanks to @shchmue & @thog for tips on the send/recv buffers!
This commit is contained in:
parent
8cf419802a
commit
fd858d5923
@ -175,3 +175,15 @@ Result setsysBindFatalDirtyFlagEvent(Event *out);
|
|||||||
* @param flags_1 Pointer to populate with second 64 flags.
|
* @param flags_1 Pointer to populate with second 64 flags.
|
||||||
*/
|
*/
|
||||||
Result setsysGetFatalDirtyFlags(u64 *flags_0, u64 *flags_1);
|
Result setsysGetFatalDirtyFlags(u64 *flags_0, u64 *flags_1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the system's nickname.
|
||||||
|
* @param buffer Pointer to output the nickname to. (The buffer size needs to be at least 0x80 bytes)
|
||||||
|
*/
|
||||||
|
Result setsysGetDeviceNickname(char* buffer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the system's nickname.
|
||||||
|
* @param buffer Pointer to read the nickname from.
|
||||||
|
*/
|
||||||
|
Result setsysSetDeviceNickname(char* buffer);
|
||||||
|
@ -686,3 +686,69 @@ Result setsysGetFatalDirtyFlags(u64 *flags_0, u64 *flags_1) {
|
|||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result setsysGetDeviceNickname(char* buffer) {
|
||||||
|
IpcCommand c;
|
||||||
|
ipcInitialize(&c);
|
||||||
|
|
||||||
|
ipcAddRecvBuffer(&c, buffer, 0x80, BufferType_Normal);
|
||||||
|
|
||||||
|
struct {
|
||||||
|
u64 magic;
|
||||||
|
u64 cmd_id;
|
||||||
|
} *raw;
|
||||||
|
|
||||||
|
raw = ipcPrepareHeader(&c, sizeof(*raw));
|
||||||
|
|
||||||
|
raw->magic = SFCI_MAGIC;
|
||||||
|
raw->cmd_id = 77;
|
||||||
|
|
||||||
|
Result rc = serviceIpcDispatch(&g_setsysSrv);
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(rc)) {
|
||||||
|
IpcParsedCommand r;
|
||||||
|
ipcParse(&r);
|
||||||
|
|
||||||
|
struct {
|
||||||
|
u64 magic;
|
||||||
|
u64 result;
|
||||||
|
} *resp = r.Raw;
|
||||||
|
|
||||||
|
rc = resp->result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result setsysSetDeviceNickname(char* buffer) {
|
||||||
|
IpcCommand c;
|
||||||
|
ipcInitialize(&c);
|
||||||
|
|
||||||
|
ipcAddSendBuffer(&c, buffer, 0x80, BufferType_Normal);
|
||||||
|
|
||||||
|
struct {
|
||||||
|
u64 magic;
|
||||||
|
u64 cmd_id;
|
||||||
|
} *raw;
|
||||||
|
|
||||||
|
raw = ipcPrepareHeader(&c, sizeof(*raw));
|
||||||
|
|
||||||
|
raw->magic = SFCI_MAGIC;
|
||||||
|
raw->cmd_id = 78;
|
||||||
|
|
||||||
|
Result rc = serviceIpcDispatch(&g_setsysSrv);
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(rc)) {
|
||||||
|
IpcParsedCommand r;
|
||||||
|
ipcParse(&r);
|
||||||
|
|
||||||
|
struct {
|
||||||
|
u64 magic;
|
||||||
|
u64 result;
|
||||||
|
} *resp = r.Raw;
|
||||||
|
|
||||||
|
rc = resp->result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user