mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-22 21:02:39 +02:00
Moved web common AppletHolder into WebCommonConfig, _webShow now takes AppletHolder as a param. Added webConfigRequestExit. Renamed WebExitReason_Unknown2 to WebExitReason_Requested.
This commit is contained in:
parent
d353213d72
commit
a897b9a836
@ -23,7 +23,7 @@ typedef enum {
|
||||
typedef enum {
|
||||
WebExitReason_ExitButton = 0x0, ///< User pressed the X button to exit.
|
||||
WebExitReason_BackButton = 0x1, ///< User pressed the B button to exit, on the initial page.
|
||||
WebExitReason_Unknown2 = 0x2,
|
||||
WebExitReason_Requested = 0x2, ///< The applet exited since \ref webConfigRequestExit was used.
|
||||
WebExitReason_LastUrl = 0x3, ///< The applet exited due to LastUrl handling, see \ref webReplyGetLastUrl.
|
||||
} WebExitReason;
|
||||
|
||||
@ -79,6 +79,7 @@ typedef struct {
|
||||
WebCommonTLVStorage arg; ///< TLV storage.
|
||||
AppletId appletid; ///< AppletId
|
||||
u32 version; ///< CommonArgs applet version.
|
||||
AppletHolder holder; ///< AppletHolder
|
||||
} WebCommonConfig;
|
||||
|
||||
/// Common container struct for applets' reply data, from the output storage.
|
||||
@ -545,6 +546,12 @@ Result webConfigSetPageScrollIndicator(WebCommonConfig* config, bool flag);
|
||||
*/
|
||||
Result webConfigShow(WebCommonConfig* config, WebCommonReply *out);
|
||||
|
||||
/**
|
||||
* @brief Request the applet to exit after \ref webConfigShow was used, while the applet is still running. This is for use from another thread.
|
||||
* @param config WebCommonConfig object.
|
||||
*/
|
||||
Result webConfigRequestExit(WebCommonConfig* config);
|
||||
|
||||
/**
|
||||
* @brief Gets the ExitReason from the specified reply.
|
||||
* @param reply WebCommonReply object.
|
||||
|
@ -44,15 +44,14 @@ static Result _webHandleExit(AppletHolder* holder, void* reply_buffer, size_t re
|
||||
return rc;
|
||||
}
|
||||
|
||||
static Result _webShow(AppletId id, u32 version, void* arg, size_t arg_size, void* reply_buffer, size_t reply_size) {
|
||||
static Result _webShow(AppletHolder *holder, AppletId id, u32 version, void* arg, size_t arg_size, void* reply_buffer, size_t reply_size) {
|
||||
Result rc = 0;
|
||||
AppletHolder holder;
|
||||
|
||||
rc = _webLaunch(&holder, id, version, arg, arg_size);
|
||||
rc = _webLaunch(holder, id, version, arg, arg_size);
|
||||
|
||||
if (R_SUCCEEDED(rc)) rc = _webHandleExit(&holder, reply_buffer, reply_size);
|
||||
if (R_SUCCEEDED(rc)) rc = _webHandleExit(holder, reply_buffer, reply_size);
|
||||
|
||||
appletHolderClose(&holder);
|
||||
appletHolderClose(holder);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@ -70,7 +69,8 @@ void webWifiCreate(WebWifiConfig* config, const char* conntest_url, const char*
|
||||
}
|
||||
|
||||
Result webWifiShow(WebWifiConfig* config, WebWifiReturnValue *out) {
|
||||
return _webShow(AppletId_wifiWebAuth, 0, &config->arg, sizeof(config->arg), out, sizeof(*out));
|
||||
AppletHolder holder;
|
||||
return _webShow(&holder, AppletId_wifiWebAuth, 0, &config->arg, sizeof(config->arg), out, sizeof(*out));
|
||||
}
|
||||
|
||||
static void _webArgInitialize(WebCommonConfig* config, AppletId appletid, WebShimKind shimKind) {
|
||||
@ -609,7 +609,11 @@ Result webConfigShow(WebCommonConfig* config, WebCommonReply *out) {
|
||||
size = sizeof(out->storage);
|
||||
}
|
||||
|
||||
return _webShow(config->appletid, config->version, &config->arg, sizeof(config->arg), reply, size);
|
||||
return _webShow(&config->holder, config->appletid, config->version, &config->arg, sizeof(config->arg), reply, size);
|
||||
}
|
||||
|
||||
Result webConfigRequestExit(WebCommonConfig* config) {
|
||||
return appletHolderRequestExit(&config->holder);
|
||||
}
|
||||
|
||||
// For strings only available via TLVs.
|
||||
|
Loading…
Reference in New Issue
Block a user