wut  1.0.0-beta9
Wii U Toolchain
swkbd_cpp.h
Go to the documentation of this file.
1 #pragma once
2 #include <wut.h>
3 #include <coreinit/filesystem.h>
4 #include <nn/result.h>
5 #include <padscore/kpad.h>
6 #include <vpad/input.h>
7 #include <string.h>
8 
17 #ifdef __cplusplus
18 
19 namespace nn
20 {
21 
35 namespace swkbd
36 {
37 
38 enum class ControllerType
39 {
40  Unknown0 = 0,
41 };
42 
43 enum class LanguageType
44 {
45  Japanese = 0,
46  English = 1,
47 };
48 
49 enum class RegionType
50 {
51  Japan = 0,
52  USA = 1,
53  Europe = 2,
54 };
55 
56 enum class State
57 {
58  Unknown0 = 0,
59 };
60 
62 struct ConfigArg
63 {
65  {
66  memset(this, 0, sizeof(*this));
68  unk_0x04 = 4;
69  unk_0x0C = 0x7FFFF;
70  unk_0x10 = 19;
71  unk_0x14 = -1;
72  unk_0x9C = 1;
73  unk_0xA4 = -1;
74  }
75 
78  uint32_t unk_0x04;
79  uint32_t unk_0x08;
80  uint32_t unk_0x0C;
81  uint32_t unk_0x10;
82  int32_t unk_0x14;
83  WUT_UNKNOWN_BYTES(0x9C - 0x18);
84  uint32_t unk_0x9C;
85  WUT_UNKNOWN_BYTES(4);
86  int32_t unk_0xA4;
87 };
88 WUT_CHECK_OFFSET(ConfigArg, 0x00, languageType);
89 WUT_CHECK_OFFSET(ConfigArg, 0x04, unk_0x04);
90 WUT_CHECK_OFFSET(ConfigArg, 0x08, unk_0x08);
91 WUT_CHECK_OFFSET(ConfigArg, 0x0C, unk_0x0C);
92 WUT_CHECK_OFFSET(ConfigArg, 0x10, unk_0x10);
93 WUT_CHECK_OFFSET(ConfigArg, 0x14, unk_0x14);
94 WUT_CHECK_OFFSET(ConfigArg, 0x9C, unk_0x9C);
95 WUT_CHECK_OFFSET(ConfigArg, 0xA4, unk_0xA4);
96 WUT_CHECK_SIZE(ConfigArg, 0xA8);
97 
99 {
100  uint32_t unk_0x00 = 0;
101  uint32_t unk_0x04 = 0;
102  uint32_t unk_0x08 = 0;
103  int32_t unk_0x0C = -1;
104  uint32_t unk_0x10 = 0;
105  int32_t unk_0x14 = -1;
106 };
107 WUT_CHECK_OFFSET(ReceiverArg, 0x00, unk_0x00);
108 WUT_CHECK_OFFSET(ReceiverArg, 0x04, unk_0x04);
109 WUT_CHECK_OFFSET(ReceiverArg, 0x08, unk_0x08);
110 WUT_CHECK_OFFSET(ReceiverArg, 0x0C, unk_0x0C);
111 WUT_CHECK_OFFSET(ReceiverArg, 0x10, unk_0x10);
112 WUT_CHECK_OFFSET(ReceiverArg, 0x14, unk_0x14);
113 WUT_CHECK_SIZE(ReceiverArg, 0x18);
114 
117 {
121 };
122 WUT_CHECK_SIZE(KeyboardArg, 0xC0);
123 
126 {
127  uint32_t unk_0x00 = 1;
128  int32_t unk_0x04 = -1;
129  uint32_t unk_0x08 = 0;
130  uint32_t unk_0x0C = 0;
132  int32_t maxTextLength = -1;
133  uint32_t unk_0x14 = 0;
134  uint32_t unk_0x18 = 0;
135  bool unk_0x1C = false;
136  bool unk_0x1D = false;
137  bool unk_0x1E = false;
138  WUT_PADDING_BYTES(1);
139 };
140 WUT_CHECK_OFFSET(InputFormArg, 0x00, unk_0x00);
141 WUT_CHECK_OFFSET(InputFormArg, 0x04, unk_0x04);
142 WUT_CHECK_OFFSET(InputFormArg, 0x08, unk_0x08);
143 WUT_CHECK_OFFSET(InputFormArg, 0x0C, unk_0x0C);
144 WUT_CHECK_OFFSET(InputFormArg, 0x10, maxTextLength);
145 WUT_CHECK_OFFSET(InputFormArg, 0x14, unk_0x14);
146 WUT_CHECK_OFFSET(InputFormArg, 0x18, unk_0x18);
147 WUT_CHECK_OFFSET(InputFormArg, 0x1C, unk_0x1C);
148 WUT_CHECK_OFFSET(InputFormArg, 0x1D, unk_0x1D);
149 WUT_CHECK_OFFSET(InputFormArg, 0x1E, unk_0x1E);
150 WUT_CHECK_SIZE(InputFormArg, 0x20);
151 
153 struct AppearArg
154 {
159 };
160 WUT_CHECK_SIZE(AppearArg, 0xE0);
161 
163 struct CreateArg
164 {
166  void *workMemory = nullptr;
169  uint32_t unk_0x08 = 0;
171  FSClient *fsClient = nullptr;
172 };
173 WUT_CHECK_OFFSET(CreateArg, 0x00, workMemory);
174 WUT_CHECK_OFFSET(CreateArg, 0x04, regionType);
175 WUT_CHECK_OFFSET(CreateArg, 0x08, unk_0x08);
176 WUT_CHECK_OFFSET(CreateArg, 0x0C, fsClient);
177 WUT_CHECK_SIZE(CreateArg, 0x10);
178 
181 {
183  VPADStatus *vpad = nullptr;
185  KPADStatus *kpad[4] = { nullptr, nullptr, nullptr, nullptr };
186 };
187 WUT_CHECK_OFFSET(ControllerInfo, 0x00, vpad);
188 WUT_CHECK_OFFSET(ControllerInfo, 0x04, kpad);
189 WUT_CHECK_SIZE(ControllerInfo, 0x14);
190 
192 {
194  {
195  memset(this, 0, sizeof(*this));
196  }
197 
198  WUT_UNKNOWN_BYTES(0x1C);
199 };
200 WUT_CHECK_SIZE(DrawStringInfo, 0x1C);
201 
203 {
204  uint32_t unk_0x00 = 0;
205  uint32_t unk_0x04 = 0;
206 };
207 WUT_CHECK_OFFSET(KeyboardCondition, 0x00, unk_0x00);
208 WUT_CHECK_OFFSET(KeyboardCondition, 0x04, unk_0x04);
209 WUT_CHECK_SIZE(KeyboardCondition, 0x8);
210 
211 struct IEventReceiver;
212 struct IControllerEventObj;
213 struct ISoundObj;
214 
231 bool
232 AppearInputForm(const AppearArg& args);
233 
249 bool
250 AppearKeyboard(const KeyboardArg& args);
251 
260 void
262 
271 void
273 
287 void
288 Calc(const ControllerInfo &controllerInfo);
289 
290 void
292 
308 bool
309 Create(const CreateArg &args);
310 
322 void
323 Destroy();
324 
335 bool
337 
347 bool
349 
355 void
356 DrawDRC();
357 
363 void
364 DrawTV();
365 
366 void
367 GetDrawStringInfo(DrawStringInfo *drawStringInfo);
368 
378 const char16_t *
380 
381 void
382 GetKeyboardCondition(KeyboardCondition *keyboardCondition);
383 
384 State
386 
387 State
389 
403 uint32_t
404 GetWorkMemorySize(uint32_t unk);
405 
406 void
408 
409 bool
410 InitLearnDic(void *dictionary);
411 
412 bool
414 
428 bool
429 IsDecideCancelButton(bool *outIsSelected);
430 
444 bool
445 IsDecideOkButton(bool *outIsSelected);
446 
447 bool
448 IsKeyboardTarget(IEventReceiver *eventReceiver);
449 
460 bool
462 
473 bool
475 
482 bool
484 
491 void
492 MuteAllSound(bool muted);
493 
494 void
496 
509 void
510 SetCursorPos(int pos);
511 
519 void
520 SetEnableOkButton(bool enable);
521 
531 void
532 SetInputFormString(const char16_t *str);
533 
534 void
535 SetReceiver(const ReceiverArg &receiver);
536 
537 void
538 SetSelectFrom(int);
539 
540 void
541 SetUserControllerEventObj(IControllerEventObj *controllerEventObj);
542 
543 void
544 SetUserSoundObj(ISoundObj *soundObj);
545 
546 } // namespace swkbd
547 } // namespace nn
548 
549 #endif // ifdef __cplusplus
550 
nn::swkbd::ConfigArg::unk_0xA4
int32_t unk_0xA4
Definition: swkbd_cpp.h:86
nn::swkbd::IsNeedCalcSubThreadFont
bool IsNeedCalcSubThreadFont()
Determines whether the font data needs calculating.
filesystem.h
nn::swkbd::ConfigArg::languageType
LanguageType languageType
The language to use for input.
Definition: swkbd_cpp.h:77
nn::swkbd::IsDecideOkButton
bool IsDecideOkButton(bool *outIsSelected)
Gets the current status of the OK button on the keyboard.
nn::swkbd::AppearArg::keyboardArg
KeyboardArg keyboardArg
Arguments for the virtual keyboard.
Definition: swkbd_cpp.h:156
nn::swkbd::SetSelectFrom
void SetSelectFrom(int)
nn::swkbd::DrawStringInfo::DrawStringInfo
DrawStringInfo()
Definition: swkbd_cpp.h:193
nn::swkbd::AppearKeyboard
bool AppearKeyboard(const KeyboardArg &args)
Show a keyboard with the given configuration.
nn::swkbd::ConfigArg::ConfigArg
ConfigArg()
Definition: swkbd_cpp.h:64
nn::swkbd::State::Unknown0
@ Unknown0
nn::swkbd::InputFormArg::unk_0x1E
bool unk_0x1E
Definition: swkbd_cpp.h:137
nn::swkbd::State
State
Definition: swkbd_cpp.h:56
nn::swkbd::ConfigArg::unk_0x08
uint32_t unk_0x08
Definition: swkbd_cpp.h:79
nn::swkbd::InputFormArg::unk_0x1C
bool unk_0x1C
Definition: swkbd_cpp.h:135
nn::swkbd::DrawStringInfo
Definition: swkbd_cpp.h:191
nn::swkbd::InputFormArg::maxTextLength
int32_t maxTextLength
The maximum number of characters that can be entered, -1 for unlimited.
Definition: swkbd_cpp.h:132
nn::swkbd::LanguageType::English
@ English
nn::swkbd::ReceiverArg::unk_0x14
int32_t unk_0x14
Definition: swkbd_cpp.h:105
KPADStatus
Definition: kpad.h:35
nn::swkbd::ControllerType
ControllerType
Definition: swkbd_cpp.h:38
nn::swkbd::DrawDRC
void DrawDRC()
Draw the keyboard to the DRC.
nn::swkbd::SetUserSoundObj
void SetUserSoundObj(ISoundObj *soundObj)
nn::swkbd::ConfigArg::unk_0x04
uint32_t unk_0x04
Definition: swkbd_cpp.h:78
nn::swkbd::KeyboardCondition
Definition: swkbd_cpp.h:202
nn::swkbd::Calc
void Calc(const ControllerInfo &controllerInfo)
Respond to user inputs and calculate the state of input buffers and graphics.
nn::swkbd::ReceiverArg
Definition: swkbd_cpp.h:98
VPADStatus
Definition: input.h:153
nn::swkbd::RegionType
RegionType
Definition: swkbd_cpp.h:49
nn::swkbd::CreateArg::workMemory
void * workMemory
A pointer to a work memory buffer; see GetWorkMemorySize.
Definition: swkbd_cpp.h:166
nn::swkbd::GetStateKeyboard
State GetStateKeyboard()
nn::swkbd::Create
bool Create(const CreateArg &args)
Initialise the swkbd library and create the keyboard and input form.
nn::swkbd::ControllerInfo::vpad
VPADStatus * vpad
DRC input information, see VPADRead.
Definition: swkbd_cpp.h:183
nn::swkbd::ConfigArg::unk_0x9C
uint32_t unk_0x9C
Definition: swkbd_cpp.h:84
nn::swkbd::AppearArg::inputFormArg
InputFormArg inputFormArg
Arguments for the input form (text area)
Definition: swkbd_cpp.h:158
nn::swkbd::ControllerType::Unknown0
@ Unknown0
nn::swkbd::ConfigArg
Configuration options for the virtual keyboard.
Definition: swkbd_cpp.h:62
nn::swkbd::KeyboardArg::configArg
ConfigArg configArg
Configuration for the keyboard itself.
Definition: swkbd_cpp.h:119
nn::swkbd::InputFormArg::unk_0x18
uint32_t unk_0x18
Definition: swkbd_cpp.h:134
wut.h
nn::swkbd::InputFormArg::unk_0x0C
uint32_t unk_0x0C
Definition: swkbd_cpp.h:130
nn::swkbd::SetInputFormString
void SetInputFormString(const char16_t *str)
Sets the text in the input form.
nn::swkbd::IsNeedCalcSubThreadPredict
bool IsNeedCalcSubThreadPredict()
Determines whether the prediction data needs calculating.
nn::swkbd::InputFormArg
Arguments for swkbd the input form (text area).
Definition: swkbd_cpp.h:125
nn::swkbd::AppearArg
Arguments for the swkbd input form and keyboard.
Definition: swkbd_cpp.h:153
nn::swkbd::SetUserControllerEventObj
void SetUserControllerEventObj(IControllerEventObj *controllerEventObj)
nn::swkbd::ReceiverArg::unk_0x0C
int32_t unk_0x0C
Definition: swkbd_cpp.h:103
nn::swkbd::ConfigArg::unk_0x14
int32_t unk_0x14
Definition: swkbd_cpp.h:82
nn::swkbd::ConfirmUnfixAll
void ConfirmUnfixAll()
nn::swkbd::ReceiverArg::unk_0x00
uint32_t unk_0x00
Definition: swkbd_cpp.h:100
nn::swkbd::CreateArg::regionType
RegionType regionType
The swkbd region to use.
Definition: swkbd_cpp.h:168
nn::swkbd::GetKeyboardCondition
void GetKeyboardCondition(KeyboardCondition *keyboardCondition)
nn::swkbd::InputFormArg::unk_0x14
uint32_t unk_0x14
Definition: swkbd_cpp.h:133
nn::swkbd::LanguageType
LanguageType
Definition: swkbd_cpp.h:43
nn::swkbd::SetReceiver
void SetReceiver(const ReceiverArg &receiver)
nn::swkbd::CalcSubThreadFont
void CalcSubThreadFont()
Calculate font data.
nn::swkbd::InitLearnDic
bool InitLearnDic(void *dictionary)
nn::swkbd::SetCursorPos
void SetCursorPos(int pos)
Set the character at which the cursor is positioned.
nn::swkbd::ReceiverArg::unk_0x04
uint32_t unk_0x04
Definition: swkbd_cpp.h:101
nn::swkbd::GetStateInputForm
State GetStateInputForm()
nn::swkbd::IsDecideCancelButton
bool IsDecideCancelButton(bool *outIsSelected)
Gets the current status of the Cancel button on the keyboard.
nn::swkbd::ConfigArg::unk_0x10
uint32_t unk_0x10
Definition: swkbd_cpp.h:81
nn::swkbd::GetWorkMemorySize
uint32_t GetWorkMemorySize(uint32_t unk)
Get the required size for swkbd's work memory buffer.
nn::swkbd::RegionType::USA
@ USA
nn::swkbd::SetControllerRemo
void SetControllerRemo(ControllerType type)
nn::swkbd::IsSelectCursorActive
bool IsSelectCursorActive()
Determines whether the selection cursor is active.
nn::swkbd::IsCoveredWithSubWindow
bool IsCoveredWithSubWindow()
nn::swkbd::CalcSubThreadPredict
void CalcSubThreadPredict()
Calculate word prediction data.
nn::swkbd::GetInputFormString
const char16_t * GetInputFormString()
Get the string the user typed into the input form.
nn::swkbd::CreateArg::fsClient
FSClient * fsClient
An FSClient for swkbd to use while loading resources.
Definition: swkbd_cpp.h:171
nn::swkbd::GetDrawStringInfo
void GetDrawStringInfo(DrawStringInfo *drawStringInfo)
nn::swkbd::ReceiverArg::unk_0x08
uint32_t unk_0x08
Definition: swkbd_cpp.h:102
nn::swkbd::IsKeyboardTarget
bool IsKeyboardTarget(IEventReceiver *eventReceiver)
nn::swkbd::Destroy
void Destroy()
Clean up and shut down the swkbd library.
nn::swkbd::CreateArg
The arguments used to initialise swkbd and pass in its required resources.
Definition: swkbd_cpp.h:163
nn::swkbd::DisappearKeyboard
bool DisappearKeyboard()
Hide a previously shown keyboard.
nn::swkbd::ControllerInfo::kpad
KPADStatus * kpad[4]
Wiimote and extension controller inputs, see KPADRead.
Definition: swkbd_cpp.h:185
nn
Definition: ac_cpp.h:14
kpad.h
nn::swkbd::ControllerInfo
Input and controller information for swkbd.
Definition: swkbd_cpp.h:180
result.h
nn::swkbd::InputFormArg::unk_0x04
int32_t unk_0x04
Definition: swkbd_cpp.h:128
nn::swkbd::AppearInputForm
bool AppearInputForm(const AppearArg &args)
Show an input form (keyboard with text area) with the given configuration.
nn::swkbd::RegionType::Japan
@ Japan
nn::swkbd::InactivateSelectCursor
void InactivateSelectCursor()
nn::swkbd::ReceiverArg::unk_0x10
uint32_t unk_0x10
Definition: swkbd_cpp.h:104
nn::swkbd::InputFormArg::unk_0x1D
bool unk_0x1D
Definition: swkbd_cpp.h:136
nn::swkbd::ConfigArg::unk_0x0C
uint32_t unk_0x0C
Definition: swkbd_cpp.h:80
nn::swkbd::DrawTV
void DrawTV()
Draw the keyboard to the TV.
input.h
nn::swkbd::KeyboardArg
Arguments for the swkbd keyboard.
Definition: swkbd_cpp.h:116
nn::swkbd::LanguageType::Japanese
@ Japanese
nn::swkbd::MuteAllSound
void MuteAllSound(bool muted)
Mutes or unmutes the sounds generated by the keyboard.
FSClient
Definition: filesystem.h:146
nn::swkbd::DisappearInputForm
bool DisappearInputForm()
Hide a previously shown input form.
nn::swkbd::KeyboardArg::receiverArg
ReceiverArg receiverArg
Definition: swkbd_cpp.h:120
nn::swkbd::SetEnableOkButton
void SetEnableOkButton(bool enable)
Enables and disables the OK button on the keyboard.
nn::swkbd::RegionType::Europe
@ Europe