mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 20:42:44 +02:00
Eyeballin set:sys
This commit is contained in:
parent
954a48b8fe
commit
60876ef3f3
@ -42,6 +42,7 @@ extern "C" {
|
||||
#include "switch/services/vi.h"
|
||||
#include "switch/services/nv.h"
|
||||
#include "switch/services/pm.h"
|
||||
#include "switch/services/set.h"
|
||||
|
||||
#include "switch/gfx/gfx.h"
|
||||
#include "switch/gfx/binder.h"
|
||||
|
13
nx/include/switch/services/set.h
Normal file
13
nx/include/switch/services/set.h
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright 2018 plutoo
|
||||
#include "result.h"
|
||||
|
||||
typedef enum {
|
||||
ColorSetId_Light=0,
|
||||
ColorSetId_Dark=1
|
||||
} ColorSetId;
|
||||
|
||||
Result setsysInitialize(void);
|
||||
void setsysExit(void);
|
||||
|
||||
/// Gets the current system theme.
|
||||
Result setsysGetColorSetId(ColorSetId* out);
|
56
nx/source/services/set.c
Normal file
56
nx/source/services/set.c
Normal file
@ -0,0 +1,56 @@
|
||||
// Copyright 2018 plutoo
|
||||
#include "types.h"
|
||||
#include "result.h"
|
||||
#include "ipc.h"
|
||||
#include "services/set.h"
|
||||
#include "services/sm.h"
|
||||
|
||||
static Service g_setsysSrv;
|
||||
|
||||
Result setsysInitialize(void)
|
||||
{
|
||||
if (serviceIsActive(&g_setsysSrv))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_AlreadyInitialized);
|
||||
|
||||
return smGetService(&g_setsysSrv, "set:sys");
|
||||
}
|
||||
|
||||
void setsysExit(void)
|
||||
{
|
||||
serviceClose(&g_setsysSrv);
|
||||
}
|
||||
|
||||
Result setsysGetColorSetId(ColorSetId* out)
|
||||
{
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 cmd_id;
|
||||
} *raw;
|
||||
|
||||
raw = ipcPrepareHeader(&c, sizeof(*raw));
|
||||
|
||||
raw->magic = SFCI_MAGIC;
|
||||
raw->cmd_id = 23;
|
||||
|
||||
Result rc = serviceIpcDispatch(&g_setsysSrv);
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
IpcParsedCommand r;
|
||||
ipcParse(&r);
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 result;
|
||||
u32 color_set;
|
||||
} *resp = r.Raw;
|
||||
|
||||
*out = resp->color_set;
|
||||
rc = resp->result;
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user