From a812587a319f348dd78ecd9f442005b9c080c810 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Sun, 13 Jan 2019 19:51:01 -0500 Subject: [PATCH] Updated SwkbdAppearArg. Updated comments. --- nx/include/switch/applets/swkbd.h | 17 +++++++++-------- nx/source/applets/swkbd.c | 22 +++++++++++----------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/nx/include/switch/applets/swkbd.h b/nx/include/switch/applets/swkbd.h index 3b0946f9..65098e29 100644 --- a/nx/include/switch/applets/swkbd.h +++ b/nx/include/switch/applets/swkbd.h @@ -109,15 +109,16 @@ typedef struct { } SwkbdInitializeArg; typedef struct { - u32 unk_x0; - u16 str[9]; - u8 unk_x16[0x4]; - u8 unk_x1a; + SwkbdType type; ///< See \ref SwkbdType. + u16 okButtonText[9]; + u16 leftButtonText; + u16 rightButtonText; + u8 dicFlag; ///< Enables dictionary usage when non-zero (including the system dictionary). u8 unk_x1b; - u32 unk_x1c; + u32 keySetDisableBitmask; ///< See SwkbdKeyDisableBitmask_*. s32 unk_x20; s32 unk_x24; - u8 unk_x28; + u8 returnButtonFlag; ///< Controls whether the Return button is enabled, for newlines input. 0 = disabled, non-zero = enabled. u16 unk_x29; u8 unk_x2b; u32 unk_x2c; @@ -317,7 +318,7 @@ Result swkbdInlineLaunch(SwkbdInline* s); Result swkbdInlineUpdate(SwkbdInline* s); /** - * @brief Appear the kbd and set \ref SwkbdAppearArg. The applet will not start displaying on the screen with this. + * @brief Appear the kbd and set \ref SwkbdAppearArg. * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect. * @param s SwkbdInline object. * @param arg Input SwkbdAppearArg. @@ -336,7 +337,7 @@ void swkbdInlineDisappear(SwkbdInline* s); * @param arg Output \ref SwkbdAppearArg. * @param type Type. Must be 0..5, otherwise this will return. * @param flag Unknown flag - * @param str Input UTF-8 string. + * @param str Input UTF-8 string for the Ok button text, this can be empty/NULL to use the default. */ void swkbdInlineMakeAppearArg(SwkbdAppearArg* arg, u32 type, bool flag, const char* str); diff --git a/nx/source/applets/swkbd.c b/nx/source/applets/swkbd.c index c3d00500..b7709171 100644 --- a/nx/source/applets/swkbd.c +++ b/nx/source/applets/swkbd.c @@ -342,7 +342,7 @@ Result swkbdInlineCreate(SwkbdInline* s) { //if (s->version >= 0x50009) s->calcArg.initArg.unk_x5 = 0x1;//Set in a separate init func by official sw on 5.0.0+. s->calcArg.volume = 1.0f; - s->calcArg.appearArg.unk_x0 = 0x2; + s->calcArg.appearArg.type = SwkbdType_QWERTY; s->calcArg.unk_x6 = 1; s->calcArg.unk_x7 = 1; s->calcArg.appearArg.unk_x20 = -1; @@ -449,7 +449,7 @@ void swkbdInlineMakeAppearArg(SwkbdAppearArg* arg, u32 type, bool flag, const ch switch(type) { case 0: - tmpval = 1; + tmpval = SwkbdType_NumPad; tmpval2[0] = tmpval; break; @@ -465,16 +465,16 @@ void swkbdInlineMakeAppearArg(SwkbdAppearArg* arg, u32 type, bool flag, const ch break; case 3: - tmpval = 2; + tmpval = SwkbdType_QWERTY; break; case 4: - tmpval = 1; + tmpval = SwkbdType_NumPad; break; case 5: - tmpval = 0; - tmpval3 = 0x80; + tmpval = SwkbdType_Normal; + tmpval3 = SwkbdKeyDisableBitmask_DownloadCode; break; default: @@ -484,12 +484,12 @@ void swkbdInlineMakeAppearArg(SwkbdAppearArg* arg, u32 type, bool flag, const ch arg->unk_x20 = -1; arg->unk_x24 = -1; arg->unk_x30 = 1; - arg->unk_x0 = tmpval; - arg->unk_x1a = tmpval2[0]; - arg->unk_x28 = tmpval2[1]; - arg->unk_x1c = tmpval3; + arg->type = tmpval; + arg->dicFlag = tmpval2[0]; + arg->returnButtonFlag = tmpval2[1]; + arg->keySetDisableBitmask = tmpval3; if (flag) arg->unk_x2c = 0x4; - _swkbdConvertToUTF16ByteSize(arg->str, str, sizeof(arg->str)); + _swkbdConvertToUTF16ByteSize(arg->okButtonText, str, sizeof(arg->okButtonText)); }