webConfigShow now uses new struct WebCommonReply as the output, for supporting WebCommonTLVStorage reply data.

This commit is contained in:
yellows8 2019-03-02 11:11:39 -05:00
parent e55dfd69c7
commit 2ed160624a
2 changed files with 25 additions and 3 deletions

View File

@ -68,6 +68,12 @@ typedef struct {
u32 version; u32 version;
} WebCommonConfig; } WebCommonConfig;
typedef struct {
bool type; ///< false = ret, true = storage.
WebCommonReturnValue ret;
WebCommonTLVStorage storage;
} WebCommonReply;
/// Types for \ref WebArgTLV. /// Types for \ref WebArgTLV.
typedef enum { typedef enum {
WebArgType_Url = 0x1, ///< [1.0.0+] String, size 0xC00. Initial URL. WebArgType_Url = 0x1, ///< [1.0.0+] String, size 0xC00. Initial URL.
@ -466,5 +472,5 @@ Result webConfigSetPageScrollIndicator(WebCommonConfig* config, bool flag);
* @param config WebCommonConfig object. * @param config WebCommonConfig object.
* @param out Optional output applet reply data, can be NULL. * @param out Optional output applet reply data, can be NULL.
*/ */
Result webConfigShow(WebCommonConfig* config, WebCommonReturnValue *out); Result webConfigShow(WebCommonConfig* config, WebCommonReply *out);

View File

@ -506,7 +506,23 @@ Result webConfigSetPageScrollIndicator(WebCommonConfig* config, bool flag) {
return _webConfigSetFlag(config, WebArgType_PageScrollIndicator, flag); return _webConfigSetFlag(config, WebArgType_PageScrollIndicator, flag);
} }
Result webConfigShow(WebCommonConfig* config, WebCommonReturnValue *out) { Result webConfigShow(WebCommonConfig* config, WebCommonReply *out) {
return _webShow(config->appletid, config->version, &config->arg, sizeof(config->arg), out, sizeof(*out)); void* reply;
size_t size;
// ShareApplet on [3.0.0+] uses TLV storage for the reply, while older versions + everything else uses *ReturnValue.
memset(out, 0, sizeof(*out));
if (config->version >= 0x30000 && _webGetShimKind(config) == WebShimKind_Share) out->type = true;
if (!out->type) {
reply = &out->ret;
size = sizeof(out->ret);
}
else {
reply = &out->storage;
size = sizeof(out->storage);
}
return _webShow(config->appletid, config->version, &config->arg, sizeof(config->arg), reply, size);
} }