Eyeballin set:sys

This commit is contained in:
plutoo 2018-02-22 08:43:56 +01:00
parent 954a48b8fe
commit 60876ef3f3
3 changed files with 70 additions and 0 deletions

View File

@ -42,6 +42,7 @@ extern "C" {
#include "switch/services/vi.h" #include "switch/services/vi.h"
#include "switch/services/nv.h" #include "switch/services/nv.h"
#include "switch/services/pm.h" #include "switch/services/pm.h"
#include "switch/services/set.h"
#include "switch/gfx/gfx.h" #include "switch/gfx/gfx.h"
#include "switch/gfx/binder.h" #include "switch/gfx/binder.h"

View 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
View 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;
}