diff --git a/nx/include/switch/services/set.h b/nx/include/switch/services/set.h index 8516180f..2b40738e 100644 --- a/nx/include/switch/services/set.h +++ b/nx/include/switch/services/set.h @@ -35,6 +35,14 @@ typedef enum SetLanguage_Total, ///< Total languages supported by this enum. } SetLanguage; +/// Region codes. +typedef enum { + SetRegion_JPN = 0, ///< Japan + SetRegion_USA = 1, ///< The Americas + SetRegion_EUR = 2, ///< Europe + SetRegion_AUS = 3, ///< Australia/New Zealand +} SetRegion; + /// Command IDs for setsysGetFlag/setsysSetFlag. typedef enum { SetSysFlag_LockScreen = 7, @@ -81,13 +89,16 @@ Result setGetAvailableLanguageCodes(s32 *total_entries, u64 *LanguageCodes, size Result setGetAvailableLanguageCodeCount(s32 *total); /// Gets the RegionCode. -Result setGetRegionCode(s32 *RegionCode); +Result setGetRegionCode(SetRegion *out); Result setsysInitialize(void); void setsysExit(void); /// Gets the current system theme. -Result setsysGetColorSetId(ColorSetId* out); +Result setsysGetColorSetId(ColorSetId *out); + +/// Sets the current system theme. +Result setsysSetColorSetId(ColorSetId id); /** * @brief Gets the size of a settings item value. diff --git a/nx/source/services/set.c b/nx/source/services/set.c index 9e5f23da..1ff7296a 100644 --- a/nx/source/services/set.c +++ b/nx/source/services/set.c @@ -279,7 +279,7 @@ Result setGetAvailableLanguageCodeCount(s32 *total) { return rc; } -Result setGetRegionCode(s32 *RegionCode) { +Result setGetRegionCode(SetRegion *out) { IpcCommand c; ipcInitialize(&c); @@ -307,13 +307,13 @@ Result setGetRegionCode(s32 *RegionCode) { rc = resp->result; - if (R_SUCCEEDED(rc) && RegionCode) *RegionCode = resp->RegionCode; + if (R_SUCCEEDED(rc) && out) *out = resp->RegionCode; } return rc; } -Result setsysGetColorSetId(ColorSetId* out) +Result setsysGetColorSetId(ColorSetId *out) { IpcCommand c; ipcInitialize(&c); @@ -345,7 +345,40 @@ Result setsysGetColorSetId(ColorSetId* out) } return rc; +} +Result setsysSetColorSetId(ColorSetId id) +{ + IpcCommand c; + ipcInitialize(&c); + + struct { + u64 magic; + u64 cmd_id; + s32 id; + } *raw; + + raw = ipcPrepareHeader(&c, sizeof(*raw)); + + raw->magic = SFCI_MAGIC; + raw->cmd_id = 24; + raw->id = id; + + 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 setsysGetSettingsItemValue(const char *name, const char *item_key, void *value_out, size_t value_out_size) {