From 6900a0241cacbcec85acceee9513d2fac1aec485 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Fri, 6 Dec 2019 21:13:33 -0500 Subject: [PATCH] applet/time/set: Added TimeSteadyClockTimePoint. Updated appletSetDesirableKeyboardLayout/appletGetDesirableKeyboardLayout for using TimeSteadyClockTimePoint. * Added SetSysUserSelectorFlag, SetSysEulaVersionClockType, SetSysNotificationVolume, SetSysFriendPresenceOverlayPermission, SetSysPrimaryAlbumStorage, SetSysHandheldSleepPlan, SetSysConsoleSleepPlan, SetSysErrorReportSharePermission, SetKeyboardLayout, and SetChineseTraditionalInputMethod. * Added SetBatteryLot, SetSysUserSelectorSettings, SetSysAccountSettings, SetSysEulaVersion, SetSysNotificationTime, SetSysNotificationSettings, SetSysAccountNotificationSettings, SetSysTvSettings, SetSysDataDeletionSettings, SetSysSleepSettings, SetSysInitialLaunchSettings, and SetSysRebootlessSystemUpdateVersion. * Added setsysSetLanguageCode, setsysGetAccountSettings/setsysSetAccountSettings, setsysGetEulaVersions/setsysSetEulaVersions, setsysGetNotificationSettings/setsysSetNotificationSettings, setsysGetAccountNotificationSettings/setsysSetAccountNotificationSettings, setsysGetTvSettings/setsysSetTvSettings, setsysGetDataDeletionSettings/setsysSetDataDeletionSettings, setsysGetWirelessCertificationFileSize/setsysGetWirelessCertificationFile, setsysSetRegionCode, setsysGetPrimaryAlbumStorage/setsysSetPrimaryAlbumStorage, setsysGetBatteryLot, setsysGetSleepSettings/setsysSetSleepSettings, setsysGetInitialLaunchSettings/setsysSetInitialLaunchSettings, setsysGetProductModel, setsysGetMiiAuthorId, setsysGetErrorReportSharePermission/setsysSetErrorReportSharePermission, setsysGetAppletLaunchFlags/setsysSetAppletLaunchFlags, setsysGetKeyboardLayout/setsysSetKeyboardLayout, setsysGetRebootlessSystemUpdateVersion, and setsysGetChineseTraditionalInputMethod/setsysSetChineseTraditionalInputMethod. --- nx/include/switch/services/applet.h | 8 +- nx/include/switch/services/set.h | 393 ++++++++++++++++++++++++++++ nx/include/switch/services/time.h | 5 + nx/source/services/applet.c | 16 +- nx/source/services/set.c | 198 ++++++++++++++ 5 files changed, 614 insertions(+), 6 deletions(-) diff --git a/nx/include/switch/services/applet.h b/nx/include/switch/services/applet.h index e34086b1..bf1b2e6d 100644 --- a/nx/include/switch/services/applet.h +++ b/nx/include/switch/services/applet.h @@ -640,9 +640,9 @@ Result appletSetAlbumImageOrientation(AlbumImageOrientation orientation); /** * @brief Sets the DesirableKeyboardLayout. * @note Only available with [4.0.0+]. - * @param[in] layout Input layout. + * @param[in] layout Input \ref SetKeyboardLayout. */ -Result appletSetDesirableKeyboardLayout(u32 layout); +Result appletSetDesirableKeyboardLayout(SetKeyboardLayout layout); Result appletCreateManagedDisplayLayer(u64 *out); @@ -2030,9 +2030,9 @@ Result appletGetNextReturnDestinationAppletIdentityInfo(AppletIdentityInfo *info /** * @brief Gets the DesirableKeyboardLayout previously set by \ref appletSetDesirableKeyboardLayout. An error is returned when it's not set. * @note Only available with AppletType_LibraryApplet on [4.0.0+]. - * @param[out] layout Output layout. + * @param[out] layout Output \ref SetKeyboardLayout. */ -Result appletGetDesirableKeyboardLayout(u32 *layout); +Result appletGetDesirableKeyboardLayout(SetKeyboardLayout *layout); /** * @brief Pops a storage from current-LibraryApplet Extra input. diff --git a/nx/include/switch/services/set.h b/nx/include/switch/services/set.h index 000d51d8..2ca1df32 100644 --- a/nx/include/switch/services/set.h +++ b/nx/include/switch/services/set.h @@ -9,6 +9,8 @@ #pragma once #include "../types.h" #include "../kernel/event.h" +#include "../services/time.h" +#include "../services/acc.h" #include "../sf/service.h" #define SET_MAX_NAME_SIZE 0x48 @@ -53,6 +55,90 @@ typedef enum { SetRegion_TWN = 6, ///< Taiwan } SetRegion; +/// UserSelectorFlag +typedef enum { + SetSysUserSelectorFlag_SkipsIfSingleUser = BIT(0), +} SetSysUserSelectorFlag; + +/// EulaVersionClockType +typedef enum { + SetSysEulaVersionClockType_NetworkSystemClock = 0, + SetSysEulaVersionClockType_SteadyClock = 1, +} SetSysEulaVersionClockType; + +/// NotificationVolume +typedef enum { + SetSysNotificationVolume_Mute = 0, + SetSysNotificationVolume_Low = 1, + SetSysNotificationVolume_High = 2, +} SetSysNotificationVolume; + +/// FriendPresenceOverlayPermission +typedef enum { + SetSysFriendPresenceOverlayPermission_NotConfirmed = 0, + SetSysFriendPresenceOverlayPermission_NoDisplay = 1, + SetSysFriendPresenceOverlayPermission_FavoriteFriends = 2, + SetSysFriendPresenceOverlayPermission_Friends = 3, +} SetSysFriendPresenceOverlayPermission; + +/// PrimaryAlbumStorage +typedef enum { + SetSysPrimaryAlbumStorage_Nand = 0, + SetSysPrimaryAlbumStorage_SdCard = 1, +} SetSysPrimaryAlbumStorage; + +/// HandheldSleepPlan +typedef enum { + SetSysHandheldSleepPlan_1Min = 0, + SetSysHandheldSleepPlan_3Min = 1, + SetSysHandheldSleepPlan_5Min = 2, + SetSysHandheldSleepPlan_10Min = 3, + SetSysHandheldSleepPlan_30Min = 4, + SetSysHandheldSleepPlan_Never = 5, +} SetSysHandheldSleepPlan; + +/// ConsoleSleepPlan +typedef enum { + SetSysConsoleSleepPlan_1Hour = 0, + SetSysConsoleSleepPlan_2Hour = 1, + SetSysConsoleSleepPlan_3Hour = 2, + SetSysConsoleSleepPlan_6Hour = 3, + SetSysConsoleSleepPlan_12Hour = 4, + SetSysConsoleSleepPlan_Never = 5, +} SetSysConsoleSleepPlan; + +/// ErrorReportSharePermission +typedef enum { + SetSysErrorReportSharePermission_NotConfirmed = 0, + SetSysErrorReportSharePermission_Granted = 1, + SetSysErrorReportSharePermission_Denied = 2, +} SetSysErrorReportSharePermission; + +/// KeyboardLayout +typedef enum { + SetKeyboardLayout_Japanese = 0, + SetKeyboardLayout_EnglishUs = 1, + SetKeyboardLayout_EnglishUsInternational = 2, + SetKeyboardLayout_EnglishUk = 3, + SetKeyboardLayout_French = 4, + SetKeyboardLayout_FrenchCa = 5, + SetKeyboardLayout_Spanish = 6, + SetKeyboardLayout_SpanishLatin = 7, + SetKeyboardLayout_German = 8, + SetKeyboardLayout_Italian = 9, + SetKeyboardLayout_Portuguese = 10, + SetKeyboardLayout_Russian = 11, + SetKeyboardLayout_Korean = 12, + SetKeyboardLayout_ChineseSimplified = 13, + SetKeyboardLayout_ChineseTraditional = 14, +} SetKeyboardLayout; + +/// ChineseTraditionalInputMethod +typedef enum { + SetChineseTraditionalInputMethod_Unknown1 = 1, + SetChineseTraditionalInputMethod_Unknown2 = 2, +} SetChineseTraditionalInputMethod; + /// PlatformRegion. Other values not listed here should be handled as "Unknown". typedef enum { SetSysPlatformRegion_Global = 1, @@ -65,6 +151,11 @@ typedef enum { SetSysTouchScreenMode_Standard = 1, ///< Standard, the default. } SetSysTouchScreenMode; +/// BatteryLot +typedef struct { + char lot[0x18]; ///< BatteryLot string. +} SetBatteryLot; + /// Structure returned by \ref setsysGetFirmwareVersion. typedef struct { u8 major; @@ -81,6 +172,87 @@ typedef struct { char display_title[0x80]; } SetSysFirmwareVersion; +/// UserSelectorSettings +typedef struct { + u32 flags; ///< Bitmask with \ref SetSysUserSelectorFlag. +} SetSysUserSelectorSettings; + +/// AccountSettings +typedef struct { + SetSysUserSelectorSettings settings; +} SetSysAccountSettings; + +/// EulaVersion +typedef struct { + u32 version; + s32 region_code; + s32 clock_type; ///< \ref SetSysEulaVersionClockType + u32 pad; + u64 network_clock_time; ///< POSIX timestamp. + TimeSteadyClockTimePoint steady_clock_time; ///< \ref TimeSteadyClockTimePoint +} SetSysEulaVersion; + +/// NotificationTime +typedef struct { + s32 hour; + s32 minute; +} SetSysNotificationTime; + +/// NotificationSettings +typedef struct { + u32 flags; ///< Bitmask with NotificationFlag. + s32 volume; ///< \ref SetSysNotificationVolume + SetSysNotificationTime start_time; ///< \ref SetSysNotificationTime + SetSysNotificationTime end_time; ///< \ref SetSysNotificationTime +} SetSysNotificationSettings; + +/// AccountNotificationSettings +typedef struct { + AccountUid uid; ///< \ref AccountUid + u32 flags; ///< Bitmask with AccountNotificationFlag. + s8 friend_presence_overlay_permission; ///< \ref SetSysFriendPresenceOverlayPermission + u8 pad[3]; ///< Padding. +} SetSysAccountNotificationSettings; + +/// TvSettings +typedef struct { + u32 flags; ///< Bitmask with TvFlag. + s32 tv_resolution; ///< \ref SetSysTvResolution + s32 hdmi_content_type; ///< \ref SetSysHdmiContentType + s32 rgb_range; ///< \ref SetSysRgbRange + s32 cmu_mode; ///< \ref SetSysCmuMode + u32 underscan; ///< Underscan. + float gamma; ///< Gamma. + float contrast; ///< Contrast. +} SetSysTvSettings; + +/// DataDeletionSettings +typedef struct { + u32 flags; ///< Bitmask with DataDeletionFlag. + s32 use_count; ///< Use count. +} SetSysDataDeletionSettings; + +/// SleepSettings +typedef struct { + u32 flags; ///< Bitmask with SleepFlag. + s32 handheld_sleep_plan; ///< \ref SetSysHandheldSleepPlan + s32 console_sleep_plan; ///< \ref SetSysConsoleSleepPlan +} SetSysSleepSettings; + +/// InitialLaunchSettings +typedef struct { + u32 flags; ///< Bitmask with InitialLaunchFlag. + u32 pad; ///< Padding. + TimeSteadyClockTimePoint timestamp; ///< \ref TimeSteadyClockTimePoint timestamp. +} SetSysInitialLaunchSettings; + +/// RebootlessSystemUpdateVersion. This is the content of the RebootlessSystemUpdateVersion SystemData, in the "/version" file. +typedef struct { + u32 version; + u8 reserved[0x1c]; + char display_version[0x20]; +} SetSysRebootlessSystemUpdateVersion; + /// Output from \ref setsysGetHomeMenuScheme. This contains RGBA8 colors which correspond with the physical shell of the system. typedef struct { u32 main_color; ///< Main Color. @@ -133,6 +305,12 @@ void setsysExit(void); /// Gets the Service object for the actual setsys service session. Service* setsysGetServiceSession(void); +/** + * @brief SetLanguageCode + * @param[in] LanguageCode LanguageCode. + */ +Result setsysSetLanguageCode(u64 LanguageCode); + /** * @brief Gets the system firmware version. * @param[out] out Firmware version to populate. @@ -151,6 +329,33 @@ Result setsysGetLockScreenFlag(bool *out); */ Result setsysSetLockScreenFlag(bool flag); +/** + * @brief GetAccountSettings + * @param[out] out \ref SetSysAccountSettings + */ +Result setsysGetAccountSettings(SetSysAccountSettings *out); + +/** + * @brief SetAccountSettings + * @param[in] settings \ref SetSysAccountSettings + */ +Result setsysSetAccountSettings(SetSysAccountSettings settings); + +/** + * @brief GetEulaVersions + * @param[out] total_out Total output entries. + * @param[out] versions Output array of \ref SetSysEulaVersion. + * @param[in] count Size of the versions array in entries. + */ +Result setsysGetEulaVersions(s32 *total_out, SetSysEulaVersion *versions, s32 count); + +/** + * @brief SetEulaVersions + * @param[in] versions Input array of \ref SetSysEulaVersion. + * @param[in] count Size of the versions array in entries. + */ +Result setsysSetEulaVersions(const SetSysEulaVersion *versions, s32 count); + /// Gets the current system theme. Result setsysGetColorSetId(ColorSetId *out); @@ -181,6 +386,33 @@ Result setsysGetAutomaticApplicationDownloadFlag(bool *out); */ Result setsysSetAutomaticApplicationDownloadFlag(bool flag); +/** + * @brief GetNotificationSettings + * @param[out] out \ref SetSysNotificationSettings + */ +Result setsysGetNotificationSettings(SetSysNotificationSettings *out); + +/** + * @brief SetNotificationSettings + * @param[in] settings \ref SetSysNotificationSettings + */ +Result setsysSetNotificationSettings(const SetSysNotificationSettings *settings); + +/** + * @brief GetAccountNotificationSettings + * @param[out] total_out Total output entries. + * @param[out] settings Output array of \ref SetSysAccountNotificationSettings. + * @param[in] count Size of the settings array in entries. + */ +Result setsysGetAccountNotificationSettings(s32 *total_out, SetSysAccountNotificationSettings *settings, s32 count); + +/** + * @brief SetAccountNotificationSettings + * @param[in] settings Input array of \ref SetSysAccountNotificationSettings. + * @param[in] count Size of the settings array in entries. + */ +Result setsysSetAccountNotificationSettings(const SetSysAccountNotificationSettings *settings, s32 count); + /** * @brief Gets the size of a settings item value. * @param name Name string. @@ -199,6 +431,18 @@ Result setsysGetSettingsItemValueSize(const char *name, const char *item_key, u6 */ Result setsysGetSettingsItemValue(const char *name, const char *item_key, void *value_out, size_t value_out_size, u64 *size_out); +/** + * @brief GetTvSettings + * @param[out] out \ref SetSysTvSettings + */ +Result setsysGetTvSettings(SetSysTvSettings *out); + +/** + * @brief SetTvSettings + * @param[in] settings \ref SetSysTvSettings + */ +Result setsysSetTvSettings(const SetSysTvSettings *settings); + /** * @brief GetQuestFlag * @param[out] out Output flag. @@ -211,6 +455,38 @@ Result setsysGetQuestFlag(bool *out); */ Result setsysSetQuestFlag(bool flag); +/** + * @brief GetDataDeletionSettings + * @param[out] out \ref SetSysDataDeletionSettings + */ +Result setsysGetDataDeletionSettings(SetSysDataDeletionSettings *out); + +/** + * @brief SetDataDeletionSettings + * @param[in] settings \ref SetSysDataDeletionSettings + */ +Result setsysSetDataDeletionSettings(const SetSysDataDeletionSettings *settings); + +/** + * @brief GetWirelessCertificationFileSize + * @param[out] out_size Output size. + */ +Result setsysGetWirelessCertificationFileSize(u64 *out_size); + +/** + * @brief GetWirelessCertificationFile + * @param[out] buffer Output buffer. + * @param[in] size Output buffer size. + * @param[out] out_size Output size. + */ +Result setsysGetWirelessCertificationFile(void* buffer, size_t size, u64 *out_size); + +/** + * @brief SetRegionCode + * @param[in] region \ref SetRegion + */ +Result setsysSetRegionCode(SetRegion region); + /** * @brief IsUserSystemClockAutomaticCorrectionEnabled * @param[out] out Output flag. @@ -223,6 +499,18 @@ Result setsysIsUserSystemClockAutomaticCorrectionEnabled(bool *out); */ Result setsysSetUserSystemClockAutomaticCorrectionEnabled(bool flag); +/** + * @brief GetPrimaryAlbumStorage + * @param[out] out \ref GetPrimaryAlbumStorage + */ +Result setsysGetPrimaryAlbumStorage(SetSysPrimaryAlbumStorage *out); + +/** + * @brief SetPrimaryAlbumStorage + * @param[in] storage \ref SetSysPrimaryAlbumStorage + */ +Result setsysSetPrimaryAlbumStorage(SetSysPrimaryAlbumStorage storage); + /** * @brief GetUsb30EnableFlag * @param[out] out Output flag. @@ -235,6 +523,12 @@ Result setsysGetUsb30EnableFlag(bool *out); */ Result setsysSetUsb30EnableFlag(bool flag); +/** + * @brief Gets the \ref SetBatteryLot. + * @param[out] out \ref SetBatteryLot + */ +Result setsysGetBatteryLot(SetBatteryLot *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) @@ -253,6 +547,18 @@ Result setsysGetNfcEnableFlag(bool *out); */ Result setsysSetNfcEnableFlag(bool flag); +/** + * @brief GetSleepSettings + * @param[out] out \ref SetSysSleepSettings + */ +Result setsysGetSleepSettings(SetSysSleepSettings *out); + +/** + * @brief SetSleepSettings + * @param[in] settings \ref SetSysSleepSettings + */ +Result setsysSetSleepSettings(const SetSysSleepSettings *settings); + /** * @brief GetWirelessLanEnableFlag * @param[out] out Output flag. @@ -265,6 +571,18 @@ Result setsysGetWirelessLanEnableFlag(bool *out); */ Result setsysSetWirelessLanEnableFlag(bool flag); +/** + * @brief GetInitialLaunchSettings + * @param[out] out \ref SetSysInitialLaunchSettings + */ +Result setsysGetInitialLaunchSettings(SetSysInitialLaunchSettings *out); + +/** + * @brief SetInitialLaunchSettings + * @param[in] settings \ref SetSysInitialLaunchSettings + */ +Result setsysSetInitialLaunchSettings(const SetSysInitialLaunchSettings *settings); + /** * @brief Gets the system's nickname. * @param nickname Pointer to output the nickname to. (The buffer size needs to be at least 0x80 bytes) @@ -277,6 +595,12 @@ Result setsysGetDeviceNickname(char* nickname); */ Result setsysSetDeviceNickname(const char* nickname); +/** + * @brief GetProductModel + * @param[out] out Output ProductModel. + */ +Result setsysGetProductModel(s32 *out); + /** * @brief GetBluetoothEnableFlag * @param[out] out Output flag. @@ -289,6 +613,12 @@ Result setsysGetBluetoothEnableFlag(bool *out); */ Result setsysSetBluetoothEnableFlag(bool flag); +/** + * @brief GetMiiAuthorId + * @param[out] out Output MiiAuthorId. + */ +Result setsysGetMiiAuthorId(Uuid *out); + /** * @brief Gets an event that settings will signal on flag change. * @param out_event Event to bind. Output event will have autoclear=false. @@ -414,6 +744,48 @@ Result setsysGetHeadphoneVolumeUpdateFlag(bool *out); */ Result setsysSetHeadphoneVolumeUpdateFlag(bool flag); +/** + * @brief GetErrorReportSharePermission + * @note Only available on [4.0.0+]. + * @param[out] out \ref SetSysErrorReportSharePermission + */ +Result setsysGetErrorReportSharePermission(SetSysErrorReportSharePermission *out); + +/** + * @brief SetErrorReportSharePermission + * @note Only available on [4.0.0+]. + * @param[in] permission \ref SetSysErrorReportSharePermission + */ +Result setsysSetErrorReportSharePermission(SetSysErrorReportSharePermission permission); + +/** + * @brief GetAppletLaunchFlags + * @note Only available on [4.0.0+]. + * @param[out] out Output AppletLaunchFlags bitmask. + */ +Result setsysGetAppletLaunchFlags(u32 *out); + +/** + * @brief SetAppletLaunchFlags + * @note Only available on [4.0.0+]. + * @param[in] flags Input AppletLaunchFlags bitmask. + */ +Result setsysSetAppletLaunchFlags(u32 flags); + +/** + * @brief GetKeyboardLayout + * @note Only available on [4.0.0+]. + * @param[out] out \ref SetKeyboardLayout + */ +Result setsysGetKeyboardLayout(SetKeyboardLayout *out); + +/** + * @brief SetKeyboardLayout + * @note Only available on [4.0.0+]. + * @param[in] layout \ref SetKeyboardLayout + */ +Result setsysSetKeyboardLayout(SetKeyboardLayout layout); + /** * @brief GetRequiresRunRepairTimeReviser * @note Only available on [5.0.0+]. @@ -421,6 +793,13 @@ Result setsysSetHeadphoneVolumeUpdateFlag(bool flag); */ Result setsysGetRequiresRunRepairTimeReviser(bool *out); +/** + * @brief GetRebootlessSystemUpdateVersion + * @note Only available on [5.0.0+]. + * @param[out] out \ref SetSysRebootlessSystemUpdateVersion + */ +Result setsysGetRebootlessSystemUpdateVersion(SetSysRebootlessSystemUpdateVersion *out); + /** * @brief SetRequiresRunRepairTimeReviser * @note Only available on [5.0.0+]. @@ -442,6 +821,20 @@ Result setsysGetPctlReadyFlag(bool *out); */ Result setsysSetPctlReadyFlag(bool flag); +/** + * @brief GetChineseTraditionalInputMethod + * @note Only available on [7.0.0+]. + * @param[out] out \ref SetChineseTraditionalInputMethod + */ +Result setsysGetChineseTraditionalInputMethod(SetChineseTraditionalInputMethod *out); + +/** + * @brief SetChineseTraditionalInputMethod + * @note Only available on [7.0.0+]. + * @param[in] method \ref SetChineseTraditionalInputMethod + */ +Result setsysSetChineseTraditionalInputMethod(SetChineseTraditionalInputMethod method); + /** * @brief Gets the \ref SetSysHomeMenuScheme. * @note Only available on [9.0.0+]. diff --git a/nx/include/switch/services/time.h b/nx/include/switch/services/time.h index d2b3b895..756d2d68 100644 --- a/nx/include/switch/services/time.h +++ b/nx/include/switch/services/time.h @@ -52,6 +52,11 @@ typedef struct { char name[0x24]; } TimeLocationName; +typedef struct { + s64 time_point; ///< A point in time. + Uuid source_id; ///< An ID representing the clock source. +} TimeSteadyClockTimePoint; + /// Initialize time. Used automatically during app startup. Result timeInitialize(void); diff --git a/nx/source/services/applet.c b/nx/source/services/applet.c index 0536fc94..bbe93e7a 100644 --- a/nx/source/services/applet.c +++ b/nx/source/services/applet.c @@ -1056,7 +1056,7 @@ IPC_MAKE_CMD_IMPL(static Result _appletSetOutOfFocusSuspendingEnabled(bool flag) IPC_MAKE_CMD_IMPL_HOSVER(Result appletSetControllerFirmwareUpdateSection(bool flag), &g_appletISelfController, 17, _appletCmdInBoolNoOut, (3,0,0), flag) IPC_MAKE_CMD_IMPL_HOSVER(Result appletSetRequiresCaptureButtonShortPressedMessage(bool flag), &g_appletISelfController, 18, _appletCmdInBoolNoOut, (3,0,0), flag) IPC_MAKE_CMD_IMPL_HOSVER(Result appletSetAlbumImageOrientation(AlbumImageOrientation orientation), &g_appletISelfController, 19, _appletCmdInU32NoOut, (3,0,0), orientation) -IPC_MAKE_CMD_IMPL_HOSVER(Result appletSetDesirableKeyboardLayout(u32 layout), &g_appletISelfController, 20, _appletCmdInU32NoOut, (4,0,0), layout) +IPC_MAKE_CMD_IMPL_HOSVER(Result appletSetDesirableKeyboardLayout(SetKeyboardLayout layout), &g_appletISelfController, 20, _appletCmdInU32NoOut, (4,0,0), layout) IPC_MAKE_CMD_IMPL( Result appletCreateManagedDisplayLayer(u64 *out), &g_appletISelfController, 40, _appletCmdNoInOutU64, out) IPC_MAKE_CMD_IMPL_HOSVER(Result appletIsSystemBufferSharingEnabled(void), &g_appletISelfController, 41, _appletCmdNoIO, (4,0,0)) @@ -2593,7 +2593,19 @@ Result appletGetCallerAppletIdentityInfoStack(AppletIdentityInfo *stack, s32 cou } IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletGetNextReturnDestinationAppletIdentityInfo(AppletIdentityInfo *info), &g_appletILibraryAppletSelfAccessor, 18, _appletGetIdentityInfo, __nx_applet_type != AppletType_LibraryApplet, (4,0,0), info) -IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletGetDesirableKeyboardLayout(u32 *layout), &g_appletILibraryAppletSelfAccessor, 19, _appletCmdNoInOutU32, __nx_applet_type != AppletType_LibraryApplet, (4,0,0), layout) + +Result appletGetDesirableKeyboardLayout(SetKeyboardLayout *layout) { + if (__nx_applet_type != AppletType_LibraryApplet) + return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + if (hosversionBefore(4,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + u32 tmp=0; + Result rc = _appletCmdNoInOutU32(&g_appletILibraryAppletSelfAccessor, &tmp, 19); + if (R_SUCCEEDED(rc) && layout) *layout = tmp; + return rc; +} + IPC_MAKE_CMD_IMPL_INITEXPR( Result appletPopExtraStorage(AppletStorage *s), &g_appletILibraryAppletSelfAccessor, 20, _appletCmdNoInOutStorage, __nx_applet_type != AppletType_LibraryApplet, s) IPC_MAKE_CMD_IMPL_INITEXPR( Result appletGetPopExtraStorageEvent(Event *out_event), &g_appletILibraryAppletSelfAccessor, 25, _appletCmdGetEvent, __nx_applet_type != AppletType_LibraryApplet, out_event, false) IPC_MAKE_CMD_IMPL_INITEXPR( Result appletUnpopInData(AppletStorage *s), &g_appletILibraryAppletSelfAccessor, 30, _appletCmdInStorage, __nx_applet_type != AppletType_LibraryApplet, s) diff --git a/nx/source/services/set.c b/nx/source/services/set.c index 5d165a23..938b9c5f 100644 --- a/nx/source/services/set.c +++ b/nx/source/services/set.c @@ -79,6 +79,10 @@ static Result _setCmdNoInOutBool(Service* srv, bool *out, u32 cmd_id) { return rc; } +static Result _setCmdNoInOutUuid(Service* srv, Uuid *out, u32 cmd_id) { + return serviceDispatchOut(srv, cmd_id, *out); +} + static Result _setCmdInU8NoOut(Service* srv, u8 inval, u64 cmd_id) { return serviceDispatchIn(srv, cmd_id, inval); } @@ -91,6 +95,10 @@ static Result _setCmdInU32NoOut(Service* srv, u32 inval, u32 cmd_id) { return serviceDispatchIn(srv, cmd_id, inval); } +static Result _setCmdInU64NoOut(Service* srv, u64 inval, u32 cmd_id) { + return serviceDispatchIn(srv, cmd_id, inval); +} + static Result setInitializeLanguageCodesCache(void) { if (g_setLanguageCodesInitialized) return 0; Result rc = 0; @@ -186,6 +194,10 @@ Result setGetRegionCode(SetRegion *out) { return rc; } +Result setsysSetLanguageCode(u64 LanguageCode) { + return _setCmdInU64NoOut(&g_setsysSrv, LanguageCode, 0); +} + static Result _setsysGetFirmwareVersionImpl(SetSysFirmwareVersion *out, u32 cmd_id) { return serviceDispatch(&g_setsysSrv, cmd_id, .buffer_attrs = { SfBufferAttr_FixedSize | SfBufferAttr_HipcPointer | SfBufferAttr_Out }, @@ -210,6 +222,28 @@ Result setsysSetLockScreenFlag(bool flag) { return _setCmdInBoolNoOut(&g_setsysSrv, flag, 8); } +Result setsysGetAccountSettings(SetSysAccountSettings *out) { + return serviceDispatchOut(&g_setsysSrv, 17, *out); +} + +Result setsysSetAccountSettings(SetSysAccountSettings settings) { + return serviceDispatchIn(&g_setsysSrv, 18, settings); +} + +Result setsysGetEulaVersions(s32 *total_out, SetSysEulaVersion *versions, s32 count) { + return serviceDispatchOut(&g_setsysSrv, 21, *total_out, + .buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out }, + .buffers = { { versions, count*sizeof(SetSysEulaVersion) } }, + ); +} + +Result setsysSetEulaVersions(const SetSysEulaVersion *versions, s32 count) { + return serviceDispatch(&g_setsysSrv, 22, + .buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_In }, + .buffers = { { versions, count*sizeof(SetSysEulaVersion) } }, + ); +} + Result setsysGetColorSetId(ColorSetId *out) { u32 color_set=0; Result rc = _setCmdNoInOutU32(&g_setsysSrv, &color_set, 23); @@ -237,6 +271,28 @@ Result setsysSetAutomaticApplicationDownloadFlag(bool flag) { return _setCmdInBoolNoOut(&g_setsysSrv, flag, 28); } +Result setsysGetNotificationSettings(SetSysNotificationSettings *out) { + return serviceDispatchOut(&g_setsysSrv, 29, *out); +} + +Result setsysSetNotificationSettings(const SetSysNotificationSettings *settings) { + return serviceDispatchIn(&g_setsysSrv, 30, *settings); +} + +Result setsysGetAccountNotificationSettings(s32 *total_out, SetSysAccountNotificationSettings *settings, s32 count) { + return serviceDispatchOut(&g_setsysSrv, 31, *total_out, + .buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out }, + .buffers = { { settings, count*sizeof(SetSysAccountNotificationSettings) } }, + ); +} + +Result setsysSetAccountNotificationSettings(const SetSysAccountNotificationSettings *settings, s32 count) { + return serviceDispatch(&g_setsysSrv, 32, + .buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_In }, + .buffers = { { settings, count*sizeof(SetSysAccountNotificationSettings) } }, + ); +} + Result setsysGetSettingsItemValueSize(const char *name, const char *item_key, u64 *size_out) { char send_name[SET_MAX_NAME_SIZE]; char send_item_key[SET_MAX_NAME_SIZE]; @@ -281,6 +337,14 @@ Result setsysGetSettingsItemValue(const char *name, const char *item_key, void * ); } +Result setsysGetTvSettings(SetSysTvSettings *out) { + return serviceDispatchOut(&g_setsysSrv, 39, *out); +} + +Result setsysSetTvSettings(const SetSysTvSettings *settings) { + return serviceDispatchIn(&g_setsysSrv, 40, *settings); +} + Result setsysGetQuestFlag(bool *out) { return _setCmdNoInOutBool(&g_setsysSrv, out, 47); } @@ -289,6 +353,29 @@ Result setsysSetQuestFlag(bool flag) { return _setCmdInBoolNoOut(&g_setsysSrv, flag, 48); } +Result setsysGetDataDeletionSettings(SetSysDataDeletionSettings *out) { + return serviceDispatchOut(&g_setsysSrv, 49, *out); +} + +Result setsysSetDataDeletionSettings(const SetSysDataDeletionSettings *settings) { + return serviceDispatchIn(&g_setsysSrv, 50, *settings); +} + +Result setsysGetWirelessCertificationFileSize(u64 *out_size) { + return _setCmdNoInOut64(&g_setsysSrv, out_size, 55); +} + +Result setsysGetWirelessCertificationFile(void* buffer, size_t size, u64 *out_size) { + return serviceDispatchOut(&g_setsysSrv, 56, *out_size, + .buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out }, + .buffers = { { buffer, size } }, + ); +} + +Result setsysSetRegionCode(SetRegion region) { + return _setCmdInU32NoOut(&g_setsysSrv, region, 57); +} + Result setsysIsUserSystemClockAutomaticCorrectionEnabled(bool *out) { return _setCmdNoInOutBool(&g_setsysSrv, out, 60); } @@ -297,6 +384,17 @@ Result setsysSetUserSystemClockAutomaticCorrectionEnabled(bool flag) { return _setCmdInBoolNoOut(&g_setsysSrv, flag, 61); } +Result setsysGetPrimaryAlbumStorage(SetSysPrimaryAlbumStorage *out) { + u32 tmp=0; + Result rc = _setCmdNoInOutU32(&g_setsysSrv, &tmp, 63); + if (R_SUCCEEDED(rc) && out) *out = tmp; + return rc; +} + +Result setsysSetPrimaryAlbumStorage(SetSysPrimaryAlbumStorage storage) { + return _setCmdInU32NoOut(&g_setsysSrv, storage, 64); +} + Result setsysGetUsb30EnableFlag(bool *out) { return _setCmdNoInOutBool(&g_setsysSrv, out, 65); } @@ -305,6 +403,10 @@ Result setsysSetUsb30EnableFlag(bool flag) { return _setCmdInBoolNoOut(&g_setsysSrv, flag, 66); } +Result setsysGetBatteryLot(SetBatteryLot *out) { + return serviceDispatchOut(&g_setsysSrv, 67, *out); +} + Result setsysGetSerialNumber(char *serial) { char out[0x18]={0}; @@ -324,6 +426,14 @@ Result setsysSetNfcEnableFlag(bool flag) { return _setCmdInBoolNoOut(&g_setsysSrv, flag, 70); } +Result setsysGetSleepSettings(SetSysSleepSettings *out) { + return serviceDispatchOut(&g_setsysSrv, 71, *out); +} + +Result setsysSetSleepSettings(const SetSysSleepSettings *settings) { + return serviceDispatchIn(&g_setsysSrv, 72, *settings); +} + Result setsysGetWirelessLanEnableFlag(bool *out) { return _setCmdNoInOutBool(&g_setsysSrv, out, 73); } @@ -332,6 +442,14 @@ Result setsysSetWirelessLanEnableFlag(bool flag) { return _setCmdInBoolNoOut(&g_setsysSrv, flag, 74); } +Result setsysGetInitialLaunchSettings(SetSysInitialLaunchSettings *out) { + return serviceDispatchOut(&g_setsysSrv, 75, *out); +} + +Result setsysSetInitialLaunchSettings(const SetSysInitialLaunchSettings *settings) { + return serviceDispatchIn(&g_setsysSrv, 76, *settings); +} + Result setsysGetDeviceNickname(char* nickname) { return serviceDispatch(&g_setsysSrv, 77, .buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out }, @@ -349,6 +467,10 @@ Result setsysSetDeviceNickname(const char* nickname) { ); } +Result setsysGetProductModel(s32 *out) { + return _setCmdNoInOutU32(&g_setsysSrv, (u32*)out, 79); +} + Result setsysGetBluetoothEnableFlag(bool *out) { return _setCmdNoInOutBool(&g_setsysSrv, out, 88); } @@ -357,6 +479,10 @@ Result setsysSetBluetoothEnableFlag(bool flag) { return _setCmdInBoolNoOut(&g_setsysSrv, flag, 89); } +Result setsysGetMiiAuthorId(Uuid *out) { + return _setCmdNoInOutUuid(&g_setsysSrv, out, 90); +} + Result setsysBindFatalDirtyFlagEvent(Event *out_event) { return _setCmdGetEvent(&g_setsysSrv, out_event, false, 93); } @@ -485,6 +611,54 @@ Result setsysSetHeadphoneVolumeUpdateFlag(bool flag) { return _setCmdInBoolNoOut(&g_setsysSrv, flag, 118); } +Result setsysGetErrorReportSharePermission(SetSysErrorReportSharePermission *out) { + if (hosversionBefore(4,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + u32 tmp=0; + Result rc = _setCmdNoInOutU32(&g_setsysSrv, &tmp, 124); + if (R_SUCCEEDED(rc) && out) *out = tmp; + return rc; +} + +Result setsysSetErrorReportSharePermission(SetSysErrorReportSharePermission permission) { + if (hosversionBefore(4,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + return _setCmdInU32NoOut(&g_setsysSrv, permission, 125); +} + +Result setsysGetAppletLaunchFlags(u32 *out) { + if (hosversionBefore(4,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + return _setCmdNoInOutU32(&g_setsysSrv, out, 126); +} + +Result setsysSetAppletLaunchFlags(u32 flags) { + if (hosversionBefore(4,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + return _setCmdInU32NoOut(&g_setsysSrv, flags, 127); +} + +Result setsysGetKeyboardLayout(SetKeyboardLayout *out) { + if (hosversionBefore(4,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + u32 tmp=0; + Result rc = _setCmdNoInOutU32(&g_setsysSrv, &tmp, 136); + if (R_SUCCEEDED(rc) && out) *out = tmp; + return rc; +} + +Result setsysSetKeyboardLayout(SetKeyboardLayout layout) { + if (hosversionBefore(4,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + return _setCmdInU32NoOut(&g_setsysSrv, layout, 137); +} + Result setsysGetRequiresRunRepairTimeReviser(bool *out) { if (hosversionBefore(5,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); @@ -492,6 +666,13 @@ Result setsysGetRequiresRunRepairTimeReviser(bool *out) { return _setCmdNoInOutBool(&g_setsysSrv, out, 141); } +Result setsysGetRebootlessSystemUpdateVersion(SetSysRebootlessSystemUpdateVersion *out) { + if (hosversionBefore(5,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + return serviceDispatchOut(&g_setsysSrv, 149, *out); +} + Result setsysSetRequiresRunRepairTimeReviser(bool flag) { if (hosversionBefore(5,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); @@ -513,6 +694,23 @@ Result setsysSetPctlReadyFlag(bool flag) { return _setCmdInBoolNoOut(&g_setsysSrv, flag, 157); } +Result setsysGetChineseTraditionalInputMethod(SetChineseTraditionalInputMethod *out) { + if (hosversionBefore(7,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + u32 tmp=0; + Result rc = _setCmdNoInOutU32(&g_setsysSrv, &tmp, 170); + if (R_SUCCEEDED(rc) && out) *out = tmp; + return rc; +} + +Result setsysSetChineseTraditionalInputMethod(SetChineseTraditionalInputMethod method) { + if (hosversionBefore(7,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + return _setCmdInU32NoOut(&g_setsysSrv, method, 171); +} + Result setsysGetHomeMenuScheme(SetSysHomeMenuScheme *out) { if (hosversionBefore(9,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);