Added webConfigSetBootDisplayKind and enum WebBootDisplayKind. Added enum WebShimKind_Offline. Minor other web adjustments.

This commit is contained in:
yellows8 2019-02-26 19:40:20 -05:00
parent 9e11dd1bd7
commit a48f7c3502
2 changed files with 31 additions and 10 deletions

View File

@ -10,11 +10,12 @@
/// This indicates the type of web-applet.
typedef enum {
WebShimKind_Login = 2,
WebShimKind_Share = 4,
WebShimKind_Web = 5,
WebShimKind_Wifi = 6,
WebShimKind_Lobby = 7,
WebShimKind_Login = 2,
WebShimKind_Offline = 3,
WebShimKind_Share = 4,
WebShimKind_Web = 5,
WebShimKind_Wifi = 6,
WebShimKind_Lobby = 7,
} WebShimKind;
typedef struct {
@ -82,8 +83,8 @@ typedef enum {
WebArgType_PlayReportEnabled = 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 enum WebBootDisplayKind
WebArgType_BackgroundKind = 0x18, ///< [1.0.0+] u32 enum u32 enum *BackgroundKind
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_LeftStickMode = 0x1B, ///< [1.0.0+] u32 enum *LeftStickMode
@ -113,6 +114,12 @@ typedef enum {
WebArgType_PageScrollIndicatorEnabled = 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;
/**
* @brief Creates the config for WifiWebAuthApplet.
* @param config WebWifiConfig object.
@ -162,6 +169,14 @@ Result webConfigSetCallbackableUrl(WebCommonConfig* config, const char* url);
*/
Result webConfigSetWhitelist(WebCommonConfig* config, const char* whitelist);
/**
* @brief Sets the BootDisplayKind.
* @note Only available with config created by \ref webPageCreate or with Offline-applet.
* @param config WebCommonConfig object.
* @param kind Kind, different enums for Web (\ref WebBootDisplayKind) and Offline.
*/
Result webConfigSetBootDisplayKind(WebCommonConfig* config, u32 kind);
/**
* @brief Sets the DisplayUrlKind.
* @param config WebCommonConfig object.

View File

@ -153,9 +153,9 @@ static Result _webConfigSetFlag(WebCommonConfig* config, u16 type, bool arg) {
return _webConfigSetU8(config, type, arg!=0);
}
/*static Result _webConfigSetU32(WebCommonConfig* config, u16 type, u32 arg) {
static Result _webConfigSetU32(WebCommonConfig* config, u16 type, u32 arg) {
return _webTLVSet(&config->arg, type, &arg, sizeof(arg));
}*/
}
static Result _webConfigSetString(WebCommonConfig* config, u16 type, const char* str, u16 argdata_size_total) {
u16 arglen = strlen(str);
@ -182,7 +182,7 @@ Result webPageCreate(WebCommonConfig* config, const char* url) {
Result webConfigSetCallbackUrl(WebCommonConfig* config, const char* url) {
WebShimKind shim = _webGetShimKind(config);
if (shim != WebShimKind_Web && shim != WebShimKind_Share) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
if (shim != WebShimKind_Share && shim != WebShimKind_Web) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return _webConfigSetString(config, WebArgType_CallbackUrl, url, 0x400);
}
@ -196,6 +196,12 @@ Result webConfigSetWhitelist(WebCommonConfig* config, const char* whitelist) {
return _webConfigSetString(config, WebArgType_Whitelist, whitelist, 0x1000);
}
Result webConfigSetBootDisplayKind(WebCommonConfig* config, u32 kind) {
WebShimKind shim = _webGetShimKind(config);
if (shim != WebShimKind_Web && shim != WebShimKind_Offline) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return _webConfigSetU32(config, WebArgType_BootDisplayKind, kind);
}
Result webConfigSetDisplayUrlKind(WebCommonConfig* config, bool kind) {
return _webConfigSetFlag(config, WebArgType_DisplayUrlKind, kind);
}