Difference between revisions of "Software Keyboard"
(→Library Applet Versions)
|Line 1:||Line 1:|
The software keyboard expects to be passed three [[AM_services#IStorage|IStorage]]s,
The software keyboard expects to be passed three [[AM_services#IStorage|IStorage]]s
== Library Applet Versions ==
== Library Applet Versions ==
Revision as of 03:25, 12 December 2018
The below is for normal swkbd usage. There's also InlineKeyboard, which doesn't run in the foreground and has completely different input/output IStorages.
Library Applet Versions
The second IStorage passed to this applet should contain the configuration for the keyboard.
|0x4||18||0||UTF-16 text displayed in the submit button|
|0x16||2||0||UTF-16 "left optional symbol key"|
|0x18||2||0||UTF-16 "right optional symbol key"|
|0x1C||4||0||Key set disable bitmask|
|0x20||4||1||Initial cursor position (0 = start of string, 1 = end of string)|
|0x24||130||u""||UTF-16 header text|
|0xA6||258||u""||UTF-16 sub text|
|0x1A8||514||u""||UTF-16 guide text|
|0x3AC||4||0||String length limit (defaults to 500?)|
|0x3B4||4||0||Password flag (0 = not password, 1 = password)|
|0x3BE||1||1||Draw background (0 = no, 1 = yes)|
|0x3C0||4||20||Offset of initial string in work buffer (or 0)|
|0x3C4||4||0||Size of initial string in work buffer (bytes)|
|0x3C8||4||2024||Offset of user dictionary in work buffer (or 0)|
|0x3CC||4||0||Length of user dictionary (number of entries)|
|0x3D0||1||0||#Text check enable|
|0x3D8||8||0||#Text check callback function address. Not sure why this is included here|
This struct is 0x3E0-bytes with version 0x5. Starting with version 0x30007 this struct is 0x400-bytes.
The 0x20-bytes at offset 0x3E0 is -1 normally, except for DownloadCodes. This is presumably an extension to #Key Set Disable Bitmask?(The field at 0x1C is still set to 0x80 here)
If the length limit is <= 32, the text entry box will be a single row and show the header/sub text. Otherwise, it will use multiple rows and the header/sub text will not be shown.
Each entry in the user dictionary is 100 bytes long.
Key Set Disable Bitmask
Various bits in this field disable certain keys on the keyboard. This list is incomplete.
0x02: disable ' ' 0x04: disable '@' 0x08: disable '%' 0x10: disable '\' and '/' 0x40: disable numbers 0x80: used for download codes
This is the third IStorage passed to this applet. It is a transfer memory storage. The transfer memory should have size 0x1000 (0xd000 in certain cases) and permissions 0.
The layout of the work buffer doesn't seem to matter as long as the offsets in the #KeyboardConfig are adjusted, but official code lays it out like this.
|20 (decimal)||Unknown||UTF-16 initial string|
|2024 (decimal)||Unknown||User dictionary|
If text checking is enabled in #KeyboardConfig, text will be checked when the submit button is pressed. First, swkbd sends the text via PushInteractiveOutData. This storage is 0x7D4-bytes.
The application then has an opportunity to validate or reject the text. It creates a new IStorage, writes the response to it, and sends it via PushInteractiveInData. This storage is 0x7D4-bytes.
|0x0||0x4||Status (0 = OK, 1 = bad)|
|0x4||Variable||UTF-16 error message (shown in a dialog box)|
When either the submit button is pressed and input has been validated, or the user cancels the text entry, swkbd will push its response and exit. The response IStorage has the following format. This storage is 0xDd8-bytes.
|0x0||0x4||Result code (0 = OK, 1 = Cancel)|