wut v1.9.1
Wii U Toolchain
Loading...
Searching...
No Matches
swkbd_cpp.h
Go to the documentation of this file.
1#pragma once
2#include <wut.h>
4#include <nn/result.h>
5#include <padscore/kpad.h>
6#include <string.h>
7#include <vpad/input.h>
8
17#ifdef __cplusplus
18
19namespace nn
20{
21
35namespace swkbd
36{
37
39{
40 WiiRemote0 = 0,
41 WiiRemote1 = 1,
42 WiiRemote2 = 2,
43 WiiRemote3 = 3,
44 DrcGamepad = 4,
45};
46
48enum class LanguageType
49{
51 Japanese = 0,
53 English = 1,
55 French = 2,
57 German = 3,
59 Italian = 4,
61 Spanish = 5,
65 Korean = 7,
67 Dutch = 8,
69 Portuguese = 9,
71 Russian = 10,
74 Invalid = 12,
75};
76
77enum class RegionType
78{
79 Japan = 0,
80 USA = 1,
81 Europe = 2,
82 China = 3,
83 Korea = 4,
84 Taiwan = 5,
85};
86
87enum class State
88{
90 Hidden = 0,
92 FadeIn = 1,
94 Visible = 2,
96 FadeOut = 3,
97};
98
99enum class InputFormType
100{
102 InputForm0 = 0,
104 Default = 1,
105};
106
108{
109 JPN_JP_QWERTY = 0,
110 USA_EN_QWERTY = 1,
111 USA_FR_QWERTY = 2,
112 USA_ES_QWERTY = 3,
113 USA_PT_QWERTY = 4,
114 EUR_EN_QWERTY = 5,
115 EUR_FR_AZERTY = 6,
116 EUR_DE_QWERTZ = 7,
117 EUR_IT_QWERTY = 8,
118 EUR_ES_QWERTY = 9,
119 EUR_NL_QWERTY = 10,
120 EUR_PT_QWERTY = 11,
121 EUR_RU_JCUKEN = 12,
122 JPN_JP_Kana = 13,
123 JPN_JP_Phone = 14,
125 JPN_JP_Symbols = 16,
126 USA_Special = 17,
127 EUR_Special = 17,
128 USA_Symbols = 18,
129 EUR_Symbols = 18,
130 LanguageDefault = 19,
131};
132
133enum class KeyboardMode
134{
136 Full = 0,
138 Numpad = 1,
140 Utf8 = 2,
142 NNID = 3,
143};
144
145enum class PasswordMode
146{
148 Clear = 0,
150 Hide = 1,
152 Fade = 2,
153};
154
157{
159 {
160 memset(this, 0, sizeof(*this));
164 accessFlags = 0x7FFFF;
166 keyboardTab = -1;
167 unk_0x9C = 1;
168 unk_0xA4 = -1;
169 }
170
176 uint32_t accessFlags; // Bitmasked!
178 int32_t keyboardTab;
181 const char16_t *okString;
188 WUT_PADDING_BYTES(3);
189 uint8_t unk_0x28;
190 uint8_t unk_0x29;
191 uint8_t unk_0x2A;
194 WUT_UNKNOWN_BYTES(0x9C - 0x2C);
195 uint32_t unk_0x9C;
198 int32_t unk_0xA4;
199};
200WUT_CHECK_OFFSET(ConfigArg, 0x00, languageType);
201WUT_CHECK_OFFSET(ConfigArg, 0x04, controllerType);
202WUT_CHECK_OFFSET(ConfigArg, 0x08, keyboardMode);
203WUT_CHECK_OFFSET(ConfigArg, 0x0C, accessFlags);
204WUT_CHECK_OFFSET(ConfigArg, 0x10, keyboardLayout);
205WUT_CHECK_OFFSET(ConfigArg, 0x14, keyboardTab);
206WUT_CHECK_OFFSET(ConfigArg, 0x18, unk_0x18);
207WUT_CHECK_OFFSET(ConfigArg, 0x1C, okString);
208WUT_CHECK_OFFSET(ConfigArg, 0x20, numpadCharLeft);
209WUT_CHECK_OFFSET(ConfigArg, 0x22, numpadCharRight);
210WUT_CHECK_OFFSET(ConfigArg, 0x24, showWordSuggestions);
211WUT_CHECK_OFFSET(ConfigArg, 0x28, unk_0x28);
212WUT_CHECK_OFFSET(ConfigArg, 0x29, unk_0x29);
213WUT_CHECK_OFFSET(ConfigArg, 0x2A, unk_0x2A);
214WUT_CHECK_OFFSET(ConfigArg, 0x2B, disableNewLine);
215WUT_CHECK_OFFSET(ConfigArg, 0x9C, unk_0x9C);
216WUT_CHECK_OFFSET(ConfigArg, 0xA0, drawSysWiiPointer);
217WUT_CHECK_OFFSET(ConfigArg, 0xA4, unk_0xA4);
218WUT_CHECK_SIZE(ConfigArg, 0xA8);
219
221{
222 uint32_t unk_0x00 = 0;
223 uint32_t unk_0x04 = 0;
224 uint32_t unk_0x08 = 0;
225 int32_t unk_0x0C = -1;
226 uint32_t unk_0x10 = 0;
227 int32_t unk_0x14 = -1;
228};
229WUT_CHECK_OFFSET(ReceiverArg, 0x00, unk_0x00);
230WUT_CHECK_OFFSET(ReceiverArg, 0x04, unk_0x04);
231WUT_CHECK_OFFSET(ReceiverArg, 0x08, unk_0x08);
232WUT_CHECK_OFFSET(ReceiverArg, 0x0C, unk_0x0C);
233WUT_CHECK_OFFSET(ReceiverArg, 0x10, unk_0x10);
234WUT_CHECK_OFFSET(ReceiverArg, 0x14, unk_0x14);
235WUT_CHECK_SIZE(ReceiverArg, 0x18);
236
244WUT_CHECK_SIZE(KeyboardArg, 0xC0);
245
248{
251 int32_t unk_0x04 = -1;
253 const char16_t *initialText = nullptr;
255 const char16_t *hintText = nullptr;
257 int32_t maxTextLength = -1;
260 uint32_t unk_0x18 = 0;
262 bool drawInput0Cursor = false;
267 WUT_PADDING_BYTES(1);
268};
269WUT_CHECK_OFFSET(InputFormArg, 0x00, type);
270WUT_CHECK_OFFSET(InputFormArg, 0x04, unk_0x04);
271WUT_CHECK_OFFSET(InputFormArg, 0x08, initialText);
272WUT_CHECK_OFFSET(InputFormArg, 0x0C, hintText);
273WUT_CHECK_OFFSET(InputFormArg, 0x10, maxTextLength);
274WUT_CHECK_OFFSET(InputFormArg, 0x14, passwordMode);
275WUT_CHECK_OFFSET(InputFormArg, 0x18, unk_0x18);
276WUT_CHECK_OFFSET(InputFormArg, 0x1C, drawInput0Cursor);
277WUT_CHECK_OFFSET(InputFormArg, 0x1D, higlightInitialText);
278WUT_CHECK_OFFSET(InputFormArg, 0x1E, showCopyPasteButtons);
279WUT_CHECK_SIZE(InputFormArg, 0x20);
280
289WUT_CHECK_SIZE(AppearArg, 0xE0);
290
293{
295 void *workMemory = nullptr;
298 uint32_t unk_0x08 = 0;
300 FSClient *fsClient = nullptr;
301};
302WUT_CHECK_OFFSET(CreateArg, 0x00, workMemory);
303WUT_CHECK_OFFSET(CreateArg, 0x04, regionType);
304WUT_CHECK_OFFSET(CreateArg, 0x08, unk_0x08);
305WUT_CHECK_OFFSET(CreateArg, 0x0C, fsClient);
306WUT_CHECK_SIZE(CreateArg, 0x10);
307
310{
312 VPADStatus *vpad = nullptr;
314 KPADStatus *kpad[4] = {nullptr, nullptr, nullptr, nullptr};
315};
316WUT_CHECK_OFFSET(ControllerInfo, 0x00, vpad);
317WUT_CHECK_OFFSET(ControllerInfo, 0x04, kpad);
318WUT_CHECK_SIZE(ControllerInfo, 0x14);
319
321{
323 {
324 memset(this, 0, sizeof(*this));
325 }
326
327 WUT_UNKNOWN_BYTES(0x1C);
328};
329WUT_CHECK_SIZE(DrawStringInfo, 0x1C);
330
332{
334 uint32_t unk_0x00 = 0;
336 uint32_t unk_0x04 = 0;
337};
338WUT_CHECK_OFFSET(KeyboardCondition, 0x00, unk_0x00);
339WUT_CHECK_OFFSET(KeyboardCondition, 0x04, unk_0x04);
340WUT_CHECK_SIZE(KeyboardCondition, 0x8);
341
342struct IEventReceiver;
343struct IControllerEventObj;
344struct ISoundObj;
345
362bool
364
380bool
382
391void
393
402void
404
418void
419Calc(const ControllerInfo &controllerInfo);
420
421void
423
439bool
440Create(const CreateArg &args);
441
453void
455
466bool
468
478bool
480
486void
488
494void
496
497void
499
509const char16_t *
511
512void
514
521State
523
524State
526
540uint32_t
541GetWorkMemorySize(uint32_t unk);
542
543void
545
546bool
547InitLearnDic(void *dictionary);
548
549bool
551
565bool
566IsDecideCancelButton(bool *outIsSelected);
567
581bool
582IsDecideOkButton(bool *outIsSelected);
583
584bool
585IsKeyboardTarget(IEventReceiver *eventReceiver);
586
597bool
599
610bool
612
619bool
621
629void
630MuteAllSound(bool muted);
631
632void
634
647void
649
657void
658SetEnableOkButton(bool enable);
659
669void
670SetInputFormString(const char16_t *str);
671
672void
673SetReceiver(const ReceiverArg &receiver);
674
675void
677
678void
679SetUserControllerEventObj(IControllerEventObj *controllerEventObj);
680
681void
682SetUserSoundObj(ISoundObj *soundObj);
683
684} // namespace swkbd
685} // namespace nn
686
687#endif // ifdef __cplusplus
688
A structure containing the Wii Remote data.
Definition kpad.h:92
VPADStatus * vpad
DRC input information, see VPADRead.
Definition swkbd_cpp.h:312
void InactivateSelectCursor()
@ InputForm0
Input form seen when adding an NNID on Friends List or creating a folder on the System Menu....
@ Default
The default input layout that is usually used (Page design)
const char16_t * hintText
Hint string.
Definition swkbd_cpp.h:255
InputFormType type
The type of input form.
Definition swkbd_cpp.h:250
bool IsNeedCalcSubThreadPredict()
Determines whether the prediction data needs calculating.
void DrawTV()
Draw the keyboard to the TV.
void CalcSubThreadFont()
Calculate font data.
void SetUserSoundObj(ISoundObj *soundObj)
bool InitLearnDic(void *dictionary)
bool AppearInputForm(const AppearArg &args)
Show an input form (keyboard with text area) with the given configuration.
const char16_t * GetInputFormString()
Get the string the user typed into the input form.
bool AppearKeyboard(const KeyboardArg &args)
Show a keyboard with the given configuration.
bool IsDecideOkButton(bool *outIsSelected)
Gets the current status of the OK button on the keyboard.
void SetSelectFrom(int)
@ FadeIn
The input form / keyboard is drawing the fade in animation.
@ Hidden
The input form / keyboard is completely hidden.
@ Visible
The input form / keyboard is done drawing the fade in animation and completely visible.
@ FadeOut
The input form / keyboard is drawing the fade out animation.
nn::swkbd::PasswordMode passwordMode
Which password inputting preset to use.
Definition swkbd_cpp.h:259
RegionType regionType
The swkbd region to use.
Definition swkbd_cpp.h:297
void Calc(const ControllerInfo &controllerInfo)
Respond to user inputs and calculate the state of input buffers and graphics.
const char16_t * initialText
Initial string to open the keyboard with.
Definition swkbd_cpp.h:253
void GetDrawStringInfo(DrawStringInfo *drawStringInfo)
void CalcSubThreadPredict()
Calculate word prediction data.
void SetReceiver(const ReceiverArg &receiver)
void SetEnableOkButton(bool enable)
Enables and disables the OK button on the keyboard.
bool showCopyPasteButtons
Whether or not to show a copy and a paste button.
Definition swkbd_cpp.h:266
bool drawInput0Cursor
Whether or not to draw a cursor. Exclusive to the inputform0 input form type.
Definition swkbd_cpp.h:262
ConfigArg configArg
Configuration for the keyboard itself.
Definition swkbd_cpp.h:241
FSClient * fsClient
An FSClient for swkbd to use while loading resources.
Definition swkbd_cpp.h:300
void SetUserControllerEventObj(IControllerEventObj *controllerEventObj)
uint32_t GetWorkMemorySize(uint32_t unk)
Get the required size for swkbd's work memory buffer.
void DrawDRC()
Draw the keyboard to the DRC.
KeyboardArg keyboardArg
Arguments for the virtual keyboard.
Definition swkbd_cpp.h:285
void * workMemory
A pointer to a work memory buffer; see GetWorkMemorySize.
Definition swkbd_cpp.h:295
bool higlightInitialText
Whether or not to highlight the initial string. Exclusive to the Default input form type.
Definition swkbd_cpp.h:264
void SetInputFormString(const char16_t *str)
Sets the text in the input form.
bool DisappearKeyboard()
Hide a previously shown keyboard.
bool IsDecideCancelButton(bool *outIsSelected)
Gets the current status of the Cancel button on the keyboard.
void GetKeyboardCondition(KeyboardCondition *keyboardCondition)
InputFormArg inputFormArg
Arguments for the input form (text area)
Definition swkbd_cpp.h:287
KPADStatus * kpad[4]
Wiimote and extension controller inputs, see KPADRead.
Definition swkbd_cpp.h:314
@ Fade
Hides the charater after a few seconds.
@ Hide
Hides the text.
@ Clear
Show clear text.
void MuteAllSound(bool muted)
Mutes or unmutes the sounds generated by the keyboard.
void Destroy()
Clean up and shut down the swkbd library.
@ Numpad
Numpad used for entering for example a DNS address.
@ Utf8
ascii, possibly used for passwords ?
@ Full
The one that fully allows utf-16LE(char16_t) charaters.
@ NNID
the one thats used for registering an nnid full alphabet, numbers, '_' and '-'
bool IsCoveredWithSubWindow()
State GetStateInputForm()
Get the current state of the input form.
void SetCursorPos(int pos)
Set the character at which the cursor is positioned.
void ConfirmUnfixAll()
LanguageType
If the LanguageType and RegionType are not compatible, the LanguageType will be set to English,...
Definition swkbd_cpp.h:49
@ TraditionalChinese
Must be used in combination with RegionType::Taiwan.
@ Portuguese
Must be used in combination with RegionType::USA or RegionType::Europe.
@ Italian
Must be used in combination with RegionType::Europe.
@ Dutch
Must be used in combination with RegionType::Europe.
@ English
Must be used in combination with RegionType::USA or RegionType::Europe.
@ German
Must be used in combination with RegionType::Europe.
@ French
Must be used in combination with RegionType::USA or RegionType::Europe.
@ Spanish
Must be used in combination with RegionType::USA or RegionType::Europe.
@ SimplifiedChinese
Must be used in combination with RegionType::China.
@ Korean
Must be used in combination with RegionType::Korea.
@ Russian
Must be used in combination with RegionType::Europe.
@ Japanese
Must be used in combination with RegionType::Japan.
int32_t maxTextLength
The maximum number of characters that can be entered, -1 for unlimited.
Definition swkbd_cpp.h:257
bool IsSelectCursorActive()
Determines whether the selection cursor is active.
bool IsNeedCalcSubThreadFont()
Determines whether the font data needs calculating.
bool IsKeyboardTarget(IEventReceiver *eventReceiver)
State GetStateKeyboard()
bool Create(const CreateArg &args)
Initialise the swkbd library and create the keyboard and input form.
void SetControllerRemo(ControllerType type)
ReceiverArg receiverArg
Definition swkbd_cpp.h:242
bool DisappearInputForm()
Hide a previously shown input form.
Arguments for the swkbd input form and keyboard.
Definition swkbd_cpp.h:283
Input and controller information for swkbd.
Definition swkbd_cpp.h:310
The arguments used to initialise swkbd and pass in its required resources.
Definition swkbd_cpp.h:293
Arguments for swkbd the input form (text area).
Definition swkbd_cpp.h:248
Arguments for the swkbd keyboard.
Definition swkbd_cpp.h:239
Definition ac_cpp.h:16
Configuration options for the virtual keyboard.
Definition swkbd_cpp.h:157
KeyboardLayout keyboardLayout
Definition swkbd_cpp.h:177
char16_t numpadCharLeft
The left side button exclusive to the numpad keyboard mode.
Definition swkbd_cpp.h:183
bool showWordSuggestions
Bool to either enable or disable word suggestions.
Definition swkbd_cpp.h:187
const char16_t * okString
Text that's displayed on the "OK" button.
Definition swkbd_cpp.h:181
ControllerType controllerType
Definition swkbd_cpp.h:173
uint32_t accessFlags
TODO: find all bit flags.
Definition swkbd_cpp.h:176
KeyboardMode keyboardMode
Definition swkbd_cpp.h:174
bool drawSysWiiPointer
Draws the system Wii remote pointer.
Definition swkbd_cpp.h:197
char16_t numpadCharRight
The right side button exclusive to the numpad keyboard mode.
Definition swkbd_cpp.h:185
bool disableNewLine
If true it'll disable the new Line character on the keyboard.
Definition swkbd_cpp.h:193
LanguageType languageType
The language to use for input.
Definition swkbd_cpp.h:172