Updated swkbdInlineMakeAppearArg, this now just writes defaults and sets type to the input param. Added swkbdInlineAppearArgSetOkButtonText.

This commit is contained in:
yellows8 2019-01-28 16:54:38 -05:00
parent 131b92a8c8
commit 2ebac06061
2 changed files with 15 additions and 47 deletions

View File

@ -158,7 +158,7 @@ typedef struct {
u8 returnButtonFlag; ///< Controls whether the Return button is enabled, for newlines input. 0 = disabled, non-zero = enabled.
u16 unk_x29;
u8 unk_x2b;
u32 flags;
u32 flags; ///< Bitmask 0x4: unknown.
u8 unk_x30;
u8 unk_x31[0x17];
} PACKED SwkbdAppearArg;
@ -476,13 +476,19 @@ void swkbdInlineAppear(SwkbdInline* s, SwkbdAppearArg* arg);
void swkbdInlineDisappear(SwkbdInline* s);
/**
* @brief Creates a \ref SwkbdAppearArg which can then be passed to \ref swkbdInlineAppear.
* @brief Creates a \ref SwkbdAppearArg which can then be passed to \ref swkbdInlineAppear. arg is initialized with the defaults, with type being set to the input type.
* @param arg Output \ref SwkbdAppearArg.
* @param type Type. Must be 0..5, otherwise this will return.
* @param flag Unknown flag
* @param type \ref SwkbdType type
* @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);
void swkbdInlineMakeAppearArg(SwkbdAppearArg* arg, SwkbdType type);
/**
* @brief Sets okButtonText for the specified SwkbdAppearArg, which was previously initialized with \ref swkbdInlineMakeAppearArg.
* @param arg \ref SwkbdAppearArg
* @param str Input UTF-8 string for the Ok button text, this can be empty/NULL to use the default.
*/
void swkbdInlineAppearArgSetOkButtonText(SwkbdAppearArg* arg, const char* str);
/**
* @brief Sets the audio volume.

View File

@ -643,54 +643,16 @@ void swkbdInlineDisappear(SwkbdInline* s) {
s->calcArg.flags = (s->calcArg.flags & ~0x4) | 0x80;
}
void swkbdInlineMakeAppearArg(SwkbdAppearArg* arg, u32 type, bool flag, const char* str) {
void swkbdInlineMakeAppearArg(SwkbdAppearArg* arg, SwkbdType type) {
memset(arg, 0, sizeof(SwkbdAppearArg));
u32 tmpval=0;
u8 tmpval2[2]={0};
switch(type) {
case 0:
tmpval = SwkbdType_NumPad;
tmpval2[0] = tmpval;
break;
case 1:
tmpval = 0x101;
tmpval2[0] = 1;
tmpval2[1] = 1;
break;
case 2:
tmpval = 3;
tmpval2[0] = 1;
break;
case 3:
tmpval = SwkbdType_QWERTY;
break;
case 4:
tmpval = SwkbdType_NumPad;
break;
case 5:
tmpval = SwkbdType_Normal;
arg->keySetDisableBitmask = SwkbdKeyDisableBitmask_DownloadCode;
break;
default:
return;
}
arg->unk_x20 = -1;
arg->unk_x24 = -1;
arg->unk_x30 = 1;
arg->type = tmpval;
arg->dicFlag = tmpval2[0];
arg->returnButtonFlag = tmpval2[1];
if (flag) arg->flags = 0x4;
arg->type = type;
}
void swkbdInlineAppearArgSetOkButtonText(SwkbdAppearArg* arg, const char* str) {
_swkbdConvertToUTF16ByteSize(arg->okButtonText, str, sizeof(arg->okButtonText));
}