mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
Added support for web Lobby applet. Added webConfigSetBackgroundKind, webConfigSetPointer, and webConfigSetLeftStickMode. Fixed order of web funcs. Minor other web adjustments.
This commit is contained in:
parent
6736053ae1
commit
344d87a3e4
@ -166,6 +166,15 @@ Result webNewsCreate(WebCommonConfig* config, const char* url);
|
||||
*/
|
||||
Result webYouTubeVideoCreate(WebCommonConfig* config, const char* url);
|
||||
|
||||
/**
|
||||
* @brief Creates the config for LobbyApplet.
|
||||
* @note Only available on [2.0.0+].
|
||||
* @note If a non-zero userID isn't set with \ref webConfigSetUserID prior to using \ref webConfigShow, the applet will launch the profile-selector applet to select an account.
|
||||
* @note Uses \ref webConfigSetLeftStickMode with mode=1, \ref webConfigSetPointer with flag=false on [3.0.0+], \ref webConfigSetUserID with userID=0, and sets WebArgType_Unknown14/WebArgType_Unknown15 to value 1. Uses \ref webConfigSetBootDisplayKind with WebBootDisplayKind_Unknown4, \ref webConfigSetBackgroundKind with kind=2, and sets WebArgType_BootAsMediaPlayerInverted to false.
|
||||
* @param config WebCommonConfig object.
|
||||
*/
|
||||
Result webLobbyCreate(WebCommonConfig* config);
|
||||
|
||||
/**
|
||||
* @brief Sets the CallbackUrl.
|
||||
* @note Only available with config created by \ref webPageCreate or with Share-applet.
|
||||
@ -193,7 +202,8 @@ Result webConfigSetWhitelist(WebCommonConfig* config, const char* whitelist);
|
||||
|
||||
/**
|
||||
* @brief Sets the account UserID. Controls which user-specific savedata to mount.
|
||||
* @note Only available with config created by \ref webPageCreate, or with Share-applet/Lobby-applet.
|
||||
* @note Only available with config created by \ref webPageCreate, \ref webLobbyCreate, or with Share-applet.
|
||||
* @note Used automatically by \ref webLobbyCreate with userID=0.
|
||||
* @param config WebCommonConfig object.
|
||||
* @param userID Account userID
|
||||
*/
|
||||
@ -210,12 +220,40 @@ Result webConfigSetEcClientCert(WebCommonConfig* config, bool flag);
|
||||
|
||||
/**
|
||||
* @brief Sets the BootDisplayKind.
|
||||
* @note Only available with config created by \ref webPageCreate or with Offline-applet.
|
||||
* @note Only available with config created by \ref webPageCreate, \ref webLobbyCreate, or with Offline-applet.
|
||||
* @note Used automatically by \ref webLobbyCreate with kind=WebBootDisplayKind_Unknown4.
|
||||
* @param config WebCommonConfig object.
|
||||
* @param kind Kind, different enums for Web (\ref WebBootDisplayKind) and Offline.
|
||||
*/
|
||||
Result webConfigSetBootDisplayKind(WebCommonConfig* config, u32 kind);
|
||||
|
||||
/**
|
||||
* @brief Sets the BackgroundKind.
|
||||
* @note Only available with config created by \ref webPageCreate, \ref webLobbyCreate, or with Offline-applet.
|
||||
* @note Used automatically by \ref webLobbyCreate with kind=2.
|
||||
* @param config WebCommonConfig object.
|
||||
* @param kind Kind, different enums for Web and Offline.
|
||||
*/
|
||||
Result webConfigSetBackgroundKind(WebCommonConfig* config, u32 kind);
|
||||
|
||||
/**
|
||||
* @brief Sets the whether the Pointer is enabled.
|
||||
* @note Only available with config created by \ref webPageCreate, \ref webLobbyCreate, or with Offline-applet.
|
||||
* @note Used automatically by \ref webLobbyCreate with flag=false on [3.0.0+].
|
||||
* @param config WebCommonConfig object.
|
||||
* @param flag Flag
|
||||
*/
|
||||
Result webConfigSetPointer(WebCommonConfig* config, bool flag);
|
||||
|
||||
/**
|
||||
* @brief Sets the LeftStickMode.
|
||||
* @note Only available with config created by \ref webPageCreate, \ref webLobbyCreate, or with Offline-applet.
|
||||
* @note Used automatically by \ref webLobbyCreate with mode=1.
|
||||
* @param config WebCommonConfig object.
|
||||
* @param mode Mode, different enums for Web and Offline.
|
||||
*/
|
||||
Result webConfigSetLeftStickMode(WebCommonConfig* config, u32 mode);
|
||||
|
||||
/**
|
||||
* @brief Sets the DisplayUrlKind.
|
||||
* @param config WebCommonConfig object.
|
||||
@ -240,6 +278,14 @@ Result webConfigSetBootAsMediaPlayer(WebCommonConfig* config, bool flag);
|
||||
*/
|
||||
Result webConfigSetShopJump(WebCommonConfig* config, bool flag);
|
||||
|
||||
/**
|
||||
* @brief Sets the LobbyParameter.
|
||||
* @note Only available with config created by \ref webLobbyCreate.
|
||||
* @param config WebCommonConfig object.
|
||||
* @param str String
|
||||
*/
|
||||
Result webConfigSetLobbyParameter(WebCommonConfig* config, const char* str);
|
||||
|
||||
/**
|
||||
* @brief Sets the UserAgentAdditionalString.
|
||||
* @note Only available with config created by \ref webPageCreate on [4.0.0+].
|
||||
|
@ -209,6 +209,26 @@ Result webYouTubeVideoCreate(WebCommonConfig* config, const char* url) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result webLobbyCreate(WebCommonConfig* config) {
|
||||
Result rc=0;
|
||||
if (hosversionBefore(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
_webArgInitialize(config, AppletId_loginShare, WebShimKind_Lobby);
|
||||
|
||||
rc = webConfigSetLeftStickMode(config, 1);
|
||||
if (R_SUCCEEDED(rc) && config->version >= 0x30000) rc = webConfigSetPointer(config, false); // Added to user-process init with [3.0.0+].
|
||||
|
||||
if (R_SUCCEEDED(rc)) rc = webConfigSetUserID(config, 0);
|
||||
|
||||
if (R_SUCCEEDED(rc)) rc = _webConfigSetU8(config, WebArgType_Unknown14, 1);
|
||||
if (R_SUCCEEDED(rc)) rc = _webConfigSetU8(config, WebArgType_Unknown15, 1);
|
||||
if (R_SUCCEEDED(rc)) rc = webConfigSetBootDisplayKind(config, WebBootDisplayKind_Unknown4);
|
||||
if (R_SUCCEEDED(rc)) rc = webConfigSetBackgroundKind(config, 2);
|
||||
if (R_SUCCEEDED(rc)) rc = _webConfigSetFlag(config, WebArgType_BootAsMediaPlayerInverted, false);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result webConfigSetCallbackUrl(WebCommonConfig* config, const char* url) {
|
||||
WebShimKind shim = _webGetShimKind(config);
|
||||
if (shim != WebShimKind_Share && shim != WebShimKind_Web) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
@ -233,20 +253,56 @@ Result webConfigSetUserID(WebCommonConfig* config, u128 userID) {
|
||||
|
||||
Result webConfigSetEcClientCert(WebCommonConfig* config, bool flag) {
|
||||
WebShimKind shim = _webGetShimKind(config);
|
||||
if (shim != WebShimKind_Web && shim != WebShimKind_Offline) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
if (shim != WebShimKind_Offline && shim != WebShimKind_Web) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
return _webConfigSetU8(config, WebArgType_EcClientCert, flag);
|
||||
}
|
||||
|
||||
Result webConfigSetBootDisplayKind(WebCommonConfig* config, u32 kind) {
|
||||
WebShimKind shim = _webGetShimKind(config);
|
||||
if (shim != WebShimKind_Web && shim != WebShimKind_Offline) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
if (shim != WebShimKind_Offline && shim != WebShimKind_Web && shim != WebShimKind_Lobby) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
return _webConfigSetU32(config, WebArgType_BootDisplayKind, kind);
|
||||
}
|
||||
|
||||
Result webConfigSetBackgroundKind(WebCommonConfig* config, u32 kind) {
|
||||
WebShimKind shim = _webGetShimKind(config);
|
||||
if (shim != WebShimKind_Offline && shim != WebShimKind_Web && shim != WebShimKind_Lobby) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
return _webConfigSetU32(config, WebArgType_BackgroundKind, kind);
|
||||
}
|
||||
|
||||
Result webConfigSetPointer(WebCommonConfig* config, bool flag) {
|
||||
WebShimKind shim = _webGetShimKind(config);
|
||||
if (shim != WebShimKind_Offline && shim != WebShimKind_Web && shim != WebShimKind_Lobby) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
return _webConfigSetFlag(config, WebArgType_Pointer, flag);
|
||||
}
|
||||
|
||||
Result webConfigSetLeftStickMode(WebCommonConfig* config, u32 mode) {
|
||||
WebShimKind shim = _webGetShimKind(config);
|
||||
if (shim != WebShimKind_Offline && shim != WebShimKind_Web && shim != WebShimKind_Lobby) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
return _webConfigSetU32(config, WebArgType_LeftStickMode, mode);
|
||||
}
|
||||
|
||||
Result webConfigSetDisplayUrlKind(WebCommonConfig* config, bool kind) {
|
||||
return _webConfigSetFlag(config, WebArgType_DisplayUrlKind, kind);
|
||||
}
|
||||
|
||||
Result webConfigSetBootAsMediaPlayer(WebCommonConfig* config, bool flag) {
|
||||
WebShimKind shim = _webGetShimKind(config);
|
||||
if (shim != WebShimKind_Offline && shim != WebShimKind_Web) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
if (hosversionBefore(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
return _webConfigSetFlag(config, WebArgType_BootAsMediaPlayer, flag);
|
||||
}
|
||||
|
||||
Result webConfigSetShopJump(WebCommonConfig* config, bool flag) {
|
||||
if (_webGetShimKind(config) != WebShimKind_Web) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
if (hosversionBefore(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
return _webConfigSetFlag(config, WebArgType_ShopJump, flag);
|
||||
}
|
||||
|
||||
Result webConfigSetLobbyParameter(WebCommonConfig* config, const char* str) {
|
||||
if (_webGetShimKind(config) != WebShimKind_Lobby) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
return _webConfigSetString(config, WebArgType_LobbyParameter, str, 0x100);
|
||||
}
|
||||
|
||||
Result webConfigSetUserAgentAdditionalString(WebCommonConfig* config, const char* str) {
|
||||
if (_webGetShimKind(config) != WebShimKind_Web) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
if (hosversionBefore(4,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
@ -259,19 +315,6 @@ Result webConfigSetMediaPlayerAutoClose(WebCommonConfig* config, bool flag) {
|
||||
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 webConfigSetShopJump(WebCommonConfig* config, bool flag) {
|
||||
if (_webGetShimKind(config) != WebShimKind_Web) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
if (hosversionBefore(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
return _webConfigSetFlag(config, WebArgType_ShopJump, flag);
|
||||
}
|
||||
|
||||
Result webConfigShow(WebCommonConfig* config, WebCommonReturnValue *out) {
|
||||
return _webShow(config->appletid, config->version, &config->arg, sizeof(config->arg), out, sizeof(*out));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user