Added SwkbdReplyType. Added initial impl for _swkbdProcessReply.

This commit is contained in:
yellows8 2019-01-17 21:31:18 -05:00
parent 4250fb3752
commit 40d5fb8587
2 changed files with 30 additions and 5 deletions

View File

@ -47,6 +47,21 @@ typedef enum {
SwkbdRequestCommand_Calc = 0xA,
} SwkbdRequestCommand;
/// SwkbdInline Interactive output storage reply ID.
typedef enum {
SwkbdReplyType_FinishedInitialize = 0x0,
SwkbdReplyType_ChangedString = 0x2,
SwkbdReplyType_MovedCursor = 0x3,
SwkbdReplyType_MovedTab = 0x4,
SwkbdReplyType_DecidedEnter = 0x5,
SwkbdReplyType_DecidedCancel = 0x6,
SwkbdReplyType_ChangedStringUtf8 = 0x7,
SwkbdReplyType_MovedCursorUtf8 = 0x8,
SwkbdReplyType_DecidedEnterUtf8 = 0x9,
SwkbdReplyType_UnsetCustomizeDic = 0xA,
SwkbdReplyType_ReleasedUserWordInfo = 0xB,
} SwkbdReplyType;
/// Value for \ref SwkbdInitializeArg mode. Controls the LibAppletMode when launching the applet.
typedef enum {
SwkbdInlineMode_UserDisplay = 0, ///< LibAppletMode_Unknown3. This is the default. The user-process must handle displaying the swkbd gfx on the screen. Attempting to get the swkbd gfx data for this currently throws an error (unknown why), SwkbdInlineMode_AppletDisplay should be used instead.

View File

@ -445,10 +445,20 @@ Result swkbdInlineLaunch(SwkbdInline* s) {
return rc;
}
static void _swkbdProcessReply(SwkbdInline* s, u32 State, SwkbdReplyType ReplyType, size_t size) {
switch(ReplyType) {
default:
break;
//TODO: Process storage content.
}
}
Result swkbdInlineUpdate(SwkbdInline* s) {
Result rc=0;
AppletStorage storage;
u32 tmp0=0, tmp1=0;
u32 State=0;
SwkbdReplyType ReplyType=0;
u8 fadetype=0;
if (s->calcArg.footerScalable) {
@ -474,20 +484,20 @@ Result swkbdInlineUpdate(SwkbdInline* s) {
}
while(R_SUCCEEDED(appletHolderPopInteractiveOutData(&s->holder, &storage))) {
//TODO: Process storage content.
s64 tmpsize=0;
rc = appletStorageGetSize(&storage, &tmpsize);
memset(s->interactive_tmpbuf, 0, s->interactive_tmpbuf_size);
if (R_SUCCEEDED(rc) && (tmpsize < 8 || tmpsize-8 > s->interactive_tmpbuf_size)) rc = MAKERESULT(Module_Libnx, LibnxError_BadInput);
if (R_SUCCEEDED(rc)) rc = appletStorageRead(&storage, 0x0, &tmp0, sizeof(u32));
if (R_SUCCEEDED(rc)) rc = appletStorageRead(&storage, 0x4, &tmp1, sizeof(u32));
if (R_SUCCEEDED(rc)) rc = appletStorageRead(&storage, 0x0, &State, sizeof(u32));
if (R_SUCCEEDED(rc)) rc = appletStorageRead(&storage, 0x4, &ReplyType, sizeof(u32));
if (R_SUCCEEDED(rc) && tmpsize >= 8) rc = appletStorageRead(&storage, 0x8, s->interactive_tmpbuf, tmpsize-8);
appletStorageClose(&storage);
if (R_FAILED(rc)) break;
_swkbdProcessReply(s, State, ReplyType, tmpsize-8);
}
return rc;