diff --git a/nx/include/switch/applets/web.h b/nx/include/switch/applets/web.h index 9942d1a2..b6a2c57d 100644 --- a/nx/include/switch/applets/web.h +++ b/nx/include/switch/applets/web.h @@ -78,46 +78,49 @@ typedef enum { WebArgType_UnknownD = 0xD, ///< [1.0.0+] u8 WebArgType_UserID = 0xE, ///< [1.0.0+] u128 userID, controls which user-specific savedata to mount. WebArgType_AlbumEntry = 0xF, ///< [1.0.0+] Share-applet caps AlbumEntry - WebArgType_EcClientCertEnabled = 0x11, ///< [1.0.0+] u8 bool + WebArgType_EcClientCert = 0x11, ///< [1.0.0+] u8 bool WebArgType_Unknown12 = 0x12, ///< [1.0.0+] u8 - WebArgType_PlayReportEnabled = 0x13, ///< [1.0.0+] u8 bool + WebArgType_PlayReport = 0x13, ///< [1.0.0+] u8 bool WebArgType_Unknown14 = 0x14, ///< [1.0.0+] u8 WebArgType_Unknown15 = 0x15, ///< [1.0.0+] u8 WebArgType_BootDisplayKind = 0x17, ///< [1.0.0+] u32 enum *BootDisplayKind WebArgType_BackgroundKind = 0x18, ///< [1.0.0+] u32 enum *BackgroundKind - WebArgType_FooterEnabled = 0x19, ///< [1.0.0+] u8 bool - WebArgType_PointerEnabled = 0x1A, ///< [1.0.0+] u8 bool + WebArgType_Footer = 0x19, ///< [1.0.0+] u8 bool + WebArgType_Pointer = 0x1A, ///< [1.0.0+] u8 bool WebArgType_LeftStickMode = 0x1B, ///< [1.0.0+] u32 enum *LeftStickMode WebArgType_KeyRepeatFrame0 = 0x1C, ///< [1.0.0+] s32 KeyRepeatFrame, first param WebArgType_KeyRepeatFrame1 = 0x1D, ///< [1.0.0+] s32 KeyRepeatFrame, second param WebArgType_BootAsMediaPlayerInverted = 0x1E, ///< [1.0.0+] u8 bool, set after BootAsMediaPlayer with the value inverted. WebArgType_DisplayUrlKind = 0x1F, ///< [1.0.0+] u8 bool, DisplayUrlKind (value = (input_enumval==0x1)). WebArgType_BootAsMediaPlayer = 0x21, ///< [2.0.0+] u8 bool - WebArgType_ShopJumpEnabled = 0x22, ///< [2.0.0+] u8 bool - WebArgType_MediaPlayerUserGestureRestrictionEnabled = 0x23, ///< [2.0.0+] u8 bool + WebArgType_ShopJump = 0x22, ///< [2.0.0+] u8 bool + WebArgType_MediaPlayerUserGestureRestriction = 0x23, ///< [2.0.0+] u8 bool WebArgType_LobbyParameter = 0x24, ///< [2.0.0+] String, size 0x100. WebArgType_ApplicationAlbumEntry = 0x26, ///< [3.0.0+] Share-applet caps ApplicationAlbumEntry - WebArgType_JsExtensionEnabled = 0x27, ///< [3.0.0+] u8 bool + WebArgType_JsExtension = 0x27, ///< [3.0.0+] u8 bool WebArgType_AdditionalCommentText = 0x28, ///< [4.0.0+] String, size 0x100. Share-applet AdditionalCommentText. WebArgType_TouchEnabledOnContents = 0x29, ///< [4.0.0+] u8 bool WebArgType_UserAgentAdditionalString = 0x2A, ///< [4.0.0+] String, size 0x80. WebArgType_AdditionalMediaData = 0x2B, ///< [4.0.0+] Share-applet 0x10-byte u8 array, AdditionalMediaData. If the user-input size is less than 0x10, the remaining data used for the TLV is cleared. - WebArgType_MediaPlayerAutoCloseEnabled = 0x2C, ///< [4.0.0+] u8 bool - WebArgType_PageCacheEnabled = 0x2D, ///< [4.0.0+] u8 bool - WebArgType_WebAudioEnabled = 0x2E, ///< [4.0.0+] u8 bool + WebArgType_MediaPlayerAutoClose = 0x2C, ///< [4.0.0+] u8 bool + WebArgType_PageCache = 0x2D, ///< [4.0.0+] u8 bool + WebArgType_WebAudio = 0x2E, ///< [4.0.0+] u8 bool WebArgType_2F = 0x2F, ///< [5.0.0+] u8 WebArgType_YouTubeVideoFlag = 0x31, ///< [5.0.0+] u8 bool Indicates that the built-in whitelist for YouTubeVideo should be used. WebArgType_FooterFixedKind = 0x32, ///< [5.0.0+] u32 enum *WebFooterFixedKind - WebArgType_PageFadeEnabled = 0x33, ///< [5.0.0+] u8 bool + WebArgType_PageFade = 0x33, ///< [5.0.0+] u8 bool WebArgType_MediaCreatorApplicationRatingAge = 0x34, ///< [5.0.0+] Share-applet 0x20-byte s8 array, MediaCreatorApplicationRatingAge. - WebArgType_BootLoadingIconEnabled = 0x35, ///< [5.0.0+] u8 bool - WebArgType_PageScrollIndicatorEnabled = 0x36, ///< [5.0.0+] u8 bool + WebArgType_BootLoadingIcon = 0x35, ///< [5.0.0+] u8 bool + WebArgType_PageScrollIndicator = 0x36, ///< [5.0.0+] u8 bool } WebArgType; /// Kind values for \ref webConfigSetBootDisplayKind with Web applet. Controls the background color while displaying the loading screen during applet boot. typedef enum { - WebBootDisplayKind_White = 0, ///< Default white background. Value 1 seems to have same affect. - WebBootDisplayKind_Black = 2, ///< Black background, likewise with values >2 it seems. + WebBootDisplayKind_White = 0, ///< Default white background. + WebBootDisplayKind_Unknown1 = 1, + WebBootDisplayKind_Black = 2, ///< Black background. + WebBootDisplayKind_Unknown3 = 3, + WebBootDisplayKind_Unknown4 = 4, } WebBootDisplayKind; /** @@ -184,6 +187,14 @@ Result webConfigSetBootDisplayKind(WebCommonConfig* config, u32 kind); */ Result webConfigSetDisplayUrlKind(WebCommonConfig* config, bool kind); +/** + * @brief Sets the BootAsMediaPlayer flag. + * @note Only available with config created by \ref webPageCreate or with Offline-applet, on [2.0.0+]. + * @param config WebCommonConfig object. + * @param flag Flag. true = BootAsMediaPlayer, false = BootAsWebPage. + */ +Result webConfigSetBootAsMediaPlayer(WebCommonConfig* config, bool flag); + /** * @brief Sets the UserAgentAdditionalString. * @note Only available with config created by \ref webPageCreate on [4.0.0+]. @@ -192,6 +203,14 @@ Result webConfigSetDisplayUrlKind(WebCommonConfig* config, bool kind); */ Result webConfigSetUserAgentAdditionalString(WebCommonConfig* config, const char* str); +/** + * @brief Sets the MediaPlayerAutoClose flag. + * @note Only available with config created by \ref webPageCreate on [4.0.0+]. + * @param config WebCommonConfig object. + * @param flag Flag + */ +Result webConfigSetMediaPlayerAutoClose(WebCommonConfig* config, bool flag); + /** * @brief Launches the {web applet} with the specified config and waits for it to exit. * @param config WebCommonConfig object. diff --git a/nx/source/applets/web.c b/nx/source/applets/web.c index 0a84ba6e..cef47f87 100644 --- a/nx/source/applets/web.c +++ b/nx/source/applets/web.c @@ -212,6 +212,19 @@ Result webConfigSetUserAgentAdditionalString(WebCommonConfig* config, const char return _webConfigSetString(config, WebArgType_UserAgentAdditionalString, str, 0x80); } +Result webConfigSetMediaPlayerAutoClose(WebCommonConfig* config, bool flag) { + if (_webGetShimKind(config) != WebShimKind_Web) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + if (hosversionBefore(4,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + return _webConfigSetFlag(config, WebArgType_MediaPlayerAutoClose, flag); +} + +Result webConfigSetBootAsMediaPlayer(WebCommonConfig* config, bool flag) { + WebShimKind shim = _webGetShimKind(config); + if (shim != WebShimKind_Web && shim != WebShimKind_Offline) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + if (hosversionBefore(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + return _webConfigSetFlag(config, WebArgType_BootAsMediaPlayer, flag); +} + Result webConfigShow(WebCommonConfig* config, WebCommonReturnValue *out) { return _webShow(config->appletid, config->version, &config->arg, sizeof(config->arg), out, sizeof(*out)); }