diff --git a/nx/include/switch/applets/web.h b/nx/include/switch/applets/web.h index 6d6eb286..846cb178 100644 --- a/nx/include/switch/applets/web.h +++ b/nx/include/switch/applets/web.h @@ -98,6 +98,13 @@ void webPageCreate(WebCommonConfig* config, const char* url); */ void webConfigSetWhitelist(WebCommonConfig* config, const char* whitelist); +/** + * @brief Sets the DisplayUrlKind. + * @param config WebCommonConfig object. + * @param kind Kind + */ +void webConfigSetDisplayUrlKind(WebCommonConfig* config, bool kind); + /** * @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 4743e543..2c679d95 100644 --- a/nx/source/applets/web.c +++ b/nx/source/applets/web.c @@ -126,6 +126,18 @@ static void _webTLVSet(WebCommonTLVStorage *storage, u16 type, const void* argda _webTLVWrite(storage, type, argdata, argdata_size, argdata_size); } +static void _webConfigSetU8(WebCommonConfig* config, u16 type, u8 arg) { + _webTLVSet(&config->arg, type, &arg, sizeof(arg)); +} + +static void _webConfigSetFlag(WebCommonConfig* config, u16 type, bool arg) { + _webConfigSetU8(config, type, arg!=0); +} + +/*static void _webConfigSetU32(WebCommonConfig* config, u16 type, u32 arg) { + _webTLVSet(&config->arg, type, &arg, sizeof(arg)); +}*/ + static void _webConfigSetString(WebCommonConfig* config, u16 type, const char* str, u16 argdata_size_total) { u16 arglen = strlen(str); if (arglen >= argdata_size_total) arglen = argdata_size_total-1; //The string must be NUL-terminated. @@ -156,9 +168,8 @@ Result webWifiShow(WebWifiConfig* config, WebWifiReturnValue *out) { void webPageCreate(WebCommonConfig* config, const char* url) { _webArgInitialize(config, AppletId_web, WebShimKind_Web); - u8 tmpval=1; - _webTLVSet(&config->arg, 0xD, &tmpval, sizeof(tmpval)); - if (config->version < 0x30000) _webTLVSet(&config->arg, 0x12, &tmpval, sizeof(tmpval)); // Removed from user-process init with [3.0.0+]. + _webConfigSetU8(config, 0xD, 1); + if (config->version < 0x30000) _webConfigSetU8(config, 0x12, 1); // Removed from user-process init with [3.0.0+]. _webConfigSetUrl(config, url); } @@ -168,6 +179,10 @@ void webConfigSetWhitelist(WebCommonConfig* config, const char* whitelist) { _webConfigSetString(config, 0xA, whitelist, 0x1000); } +void webConfigSetDisplayUrlKind(WebCommonConfig* config, bool kind) { + _webConfigSetFlag(config, 0x1F, kind); +} + Result webConfigShow(WebCommonConfig* config, WebCommonReturnValue *out) { return _webShow(config->appletid, config->version, &config->arg, sizeof(config->arg), out, sizeof(*out)); }