wut  v1.5.0
Wii U Toolchain
Data Structures | Enumerations | Functions
nn::swkbd Namespace Reference

Graphical software keyboard, supporting several languages and configurations. More...

Data Structures

struct  ConfigArg
 Configuration options for the virtual keyboard. More...
 
struct  ReceiverArg
 
struct  KeyboardArg
 Arguments for the swkbd keyboard. More...
 
struct  InputFormArg
 Arguments for swkbd the input form (text area). More...
 
struct  AppearArg
 Arguments for the swkbd input form and keyboard. More...
 
struct  CreateArg
 The arguments used to initialise swkbd and pass in its required resources. More...
 
struct  ControllerInfo
 Input and controller information for swkbd. More...
 
struct  DrawStringInfo
 
struct  KeyboardCondition
 

Enumerations

enum class  ControllerType {
  WiiRemote0 = 0 ,
  WiiRemote1 = 1 ,
  WiiRemote2 = 2 ,
  WiiRemote3 = 3 ,
  DrcGamepad = 4
}
 
enum class  LanguageType {
  Japanese = 0 ,
  English = 1 ,
  French = 2 ,
  German = 3 ,
  Italian = 4 ,
  Spanish = 5 ,
  SimplifiedChinese = 6 ,
  Korean = 7 ,
  Dutch = 8 ,
  Portuguese = 9 ,
  Russian = 10 ,
  TraditionalChinese = 11 ,
  Invalid = 12
}
 If the LanguageType and RegionType are not compatible, the LanguageType will be set to English, unless the RegionType is set to "Japan," in which case the LanguageType will be set to Japanese. More...
 
enum class  RegionType {
  Japan = 0 ,
  USA = 1 ,
  Europe = 2 ,
  China = 3 ,
  Korea = 4 ,
  Taiwan = 5
}
 
enum class  State {
  Hidden = 0 ,
  FadeIn = 1 ,
  Visible = 2 ,
  FadeOut = 3
}
 
enum class  InputFormType {
  InputForm0 = 0 ,
  Default = 1
}
 
enum class  KeyboardMode {
  Full = 0 ,
  Numpad = 1 ,
  Utf8 = 2 ,
  NNID = 3
}
 
enum class  PasswordMode {
  Clear = 0 ,
  Hide = 1 ,
  Fade = 2
}
 

Functions

bool AppearInputForm (const AppearArg &args)
 Show an input form (keyboard with text area) with the given configuration. More...
 
bool AppearKeyboard (const KeyboardArg &args)
 Show a keyboard with the given configuration. More...
 
void CalcSubThreadFont ()
 Calculate font data. More...
 
void CalcSubThreadPredict ()
 Calculate word prediction data. More...
 
void Calc (const ControllerInfo &controllerInfo)
 Respond to user inputs and calculate the state of input buffers and graphics. More...
 
void ConfirmUnfixAll ()
 
bool Create (const CreateArg &args)
 Initialise the swkbd library and create the keyboard and input form. More...
 
void Destroy ()
 Clean up and shut down the swkbd library. More...
 
bool DisappearInputForm ()
 Hide a previously shown input form. More...
 
bool DisappearKeyboard ()
 Hide a previously shown keyboard. More...
 
void DrawDRC ()
 Draw the keyboard to the DRC. More...
 
void DrawTV ()
 Draw the keyboard to the TV. More...
 
void GetDrawStringInfo (DrawStringInfo *drawStringInfo)
 
const char16_t * GetInputFormString ()
 Get the string the user typed into the input form. More...
 
void GetKeyboardCondition (KeyboardCondition *keyboardCondition)
 
State GetStateInputForm ()
 Get the current state of the input form. More...
 
State GetStateKeyboard ()
 
uint32_t GetWorkMemorySize (uint32_t unk)
 Get the required size for swkbd's work memory buffer. More...
 
void InactivateSelectCursor ()
 
bool InitLearnDic (void *dictionary)
 
bool IsCoveredWithSubWindow ()
 
bool IsDecideCancelButton (bool *outIsSelected)
 Gets the current status of the Cancel button on the keyboard. More...
 
bool IsDecideOkButton (bool *outIsSelected)
 Gets the current status of the OK button on the keyboard. More...
 
bool IsKeyboardTarget (IEventReceiver *eventReceiver)
 
bool IsNeedCalcSubThreadFont ()
 Determines whether the font data needs calculating. More...
 
bool IsNeedCalcSubThreadPredict ()
 Determines whether the prediction data needs calculating. More...
 
bool IsSelectCursorActive ()
 Determines whether the selection cursor is active. More...
 
void MuteAllSound (bool muted)
 Mutes or unmutes the sounds generated by the keyboard. More...
 
void SetControllerRemo (ControllerType type)
 
void SetCursorPos (int pos)
 Set the character at which the cursor is positioned. More...
 
void SetEnableOkButton (bool enable)
 Enables and disables the OK button on the keyboard. More...
 
void SetInputFormString (const char16_t *str)
 Sets the text in the input form. More...
 
void SetReceiver (const ReceiverArg &receiver)
 
void SetSelectFrom (int)
 
void SetUserControllerEventObj (IControllerEventObj *controllerEventObj)
 
void SetUserSoundObj (ISoundObj *soundObj)
 

Detailed Description

Graphical software keyboard, supporting several languages and configurations.

Applications should first call Create to initialise the library, followed by AppearInputForm to show a text area and virtual keyboard. Input should be forwarded to the keyboard via Calc, along with calls to CalcSubThreadFont and CalcSubThreadPredict. Finally, the keyboard can be rendered with DrawTV and DrawDRC. The user's interaction with the keyboard can be tracked with GetInputFormString, IsDecideOkButton and IsDecideCancelButton; and once satisfied the application can dismiss the keyboard with DisappearInputForm. Don't forget Destroy!


Data Structure Documentation

◆ nn::swkbd::ReceiverArg

struct nn::swkbd::ReceiverArg

Definition at line 194 of file swkbd_cpp.h.

Data Fields
uint32_t unk_0x00
uint32_t unk_0x04
uint32_t unk_0x08
int32_t unk_0x0C
uint32_t unk_0x10
int32_t unk_0x14

◆ nn::swkbd::KeyboardArg

struct nn::swkbd::KeyboardArg

Arguments for the swkbd keyboard.

Definition at line 212 of file swkbd_cpp.h.

Data Fields
ConfigArg configArg Configuration for the keyboard itself.
ReceiverArg receiverArg

◆ nn::swkbd::InputFormArg

struct nn::swkbd::InputFormArg

Arguments for swkbd the input form (text area).

Definition at line 221 of file swkbd_cpp.h.

Data Fields
InputFormType type The type of input form.
int32_t unk_0x04
const char16_t * initialText Initial string to open the keyboard with.
const char16_t * hintText Hint string.
int32_t maxTextLength The maximum number of characters that can be entered, -1 for unlimited.
PasswordMode passwordMode Which password inputting preset to use.
uint32_t unk_0x18
bool drawInput0Cursor Whether or not to draw a cursor. Exclusive to the inputform0 input form type.
bool higlightInitialText Whether or not to highlight the initial string. Exclusive to the Default input form type.
bool showCopyPasteButtons Whether or not to show a copy and a paste button.

◆ nn::swkbd::AppearArg

struct nn::swkbd::AppearArg

Arguments for the swkbd input form and keyboard.

Definition at line 256 of file swkbd_cpp.h.

Data Fields
KeyboardArg keyboardArg Arguments for the virtual keyboard.
InputFormArg inputFormArg Arguments for the input form (text area)

◆ nn::swkbd::CreateArg

struct nn::swkbd::CreateArg

The arguments used to initialise swkbd and pass in its required resources.

Definition at line 266 of file swkbd_cpp.h.

Data Fields
void * workMemory A pointer to a work memory buffer; see GetWorkMemorySize.
RegionType regionType The swkbd region to use.
uint32_t unk_0x08
FSClient * fsClient An FSClient for swkbd to use while loading resources.

◆ nn::swkbd::ControllerInfo

struct nn::swkbd::ControllerInfo

Input and controller information for swkbd.

Definition at line 283 of file swkbd_cpp.h.

Data Fields
VPADStatus * vpad DRC input information, see VPADRead.
KPADStatus * kpad[4] Wiimote and extension controller inputs, see KPADRead.

◆ nn::swkbd::KeyboardCondition

struct nn::swkbd::KeyboardCondition

Definition at line 305 of file swkbd_cpp.h.

Data Fields
uint32_t unk_0x00 Selected Language.
uint32_t unk_0x04 Selected Character menu.

Enumeration Type Documentation

◆ ControllerType

enum ControllerType
strong
Enumerator
WiiRemote0 
WiiRemote1 
WiiRemote2 
WiiRemote3 
DrcGamepad 

Definition at line 38 of file swkbd_cpp.h.

◆ LanguageType

enum LanguageType
strong

If the LanguageType and RegionType are not compatible, the LanguageType will be set to English, unless the RegionType is set to "Japan," in which case the LanguageType will be set to Japanese.

Enumerator
Japanese 

Must be used in combination with RegionType::Japan.

English 

Must be used in combination with RegionType::USA or RegionType::Europe.

French 

Must be used in combination with RegionType::USA or RegionType::Europe.

German 

Must be used in combination with RegionType::Europe.

Italian 

Must be used in combination with 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.

Dutch 

Must be used in combination with RegionType::Europe.

Portuguese 

Must be used in combination with RegionType::USA or RegionType::Europe.

Russian 

Must be used in combination with RegionType::Europe.

TraditionalChinese 

Must be used in combination with RegionType::Taiwan.

Invalid 

Definition at line 48 of file swkbd_cpp.h.

◆ RegionType

enum RegionType
strong
Enumerator
Japan 
USA 
Europe 
China 
Korea 
Taiwan 

Definition at line 77 of file swkbd_cpp.h.

◆ State

enum State
strong
Enumerator
Hidden 

The input form / keyboard is completely hidden.

FadeIn 

The input form / keyboard is drawing the fade in animation.

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.

Definition at line 87 of file swkbd_cpp.h.

◆ InputFormType

enum InputFormType
strong
Enumerator
InputForm0 

Input form seen when adding an NNID on Friends List or creating a folder on the System Menu. (Individual square design with up to 40 characters)

Default 

The default input layout that is usually used (Page design)

Definition at line 99 of file swkbd_cpp.h.

◆ KeyboardMode

enum KeyboardMode
strong
Enumerator
Full 

The one that fully allows utf-16LE(char16_t) charaters.

Numpad 

Numpad used for entering for example a DNS address.

Utf8 

ascii, possibly used for passwords ?

NNID 

the one thats used for registering an nnid full alphabet, numbers, '_' and '-'

Definition at line 107 of file swkbd_cpp.h.

◆ PasswordMode

enum PasswordMode
strong
Enumerator
Clear 

Show clear text.

Hide 

Hides the text.

Fade 

Hides the charater after a few seconds.

Definition at line 119 of file swkbd_cpp.h.

Function Documentation

◆ AppearInputForm()

bool nn::swkbd::AppearInputForm ( const AppearArg args)

Show an input form (keyboard with text area) with the given configuration.

Parameters
argsAn AppearArg struct with the desired configuration for the keyboard and input form.
Returns
true on success, or false on error.
See also

◆ AppearKeyboard()

bool nn::swkbd::AppearKeyboard ( const KeyboardArg args)

Show a keyboard with the given configuration.

Parameters
argsAn KeyboardArg struct with the desired configuration for the keyboard.
Returns
true on success, or false on error.
See also

◆ CalcSubThreadFont()

void nn::swkbd::CalcSubThreadFont ( )

Calculate font data.

Call in response to IsNeedCalcSubThreadFont.

See also

◆ CalcSubThreadPredict()

void nn::swkbd::CalcSubThreadPredict ( )

Calculate word prediction data.

Call in response to IsNeedCalcSubThreadPredict.

See also

◆ Calc()

void nn::swkbd::Calc ( const ControllerInfo controllerInfo)

Respond to user inputs and calculate the state of input buffers and graphics.

Parameters
controllerInfoA ControllerInfo structure containing fresh data from the controllers (see VPADRead and KPADRead). Each controller can also be nullptr if data is not available.
See also

◆ ConfirmUnfixAll()

void nn::swkbd::ConfirmUnfixAll ( )

◆ Create()

bool nn::swkbd::Create ( const CreateArg args)

Initialise the swkbd library and create the keyboard and input form.

Parameters
argsA CreateArg structure containing the desired keyboard region, a pointer to work memory, and an FSClient. See CreateArg.
Returns
true on success, false otherwise.
See also

◆ Destroy()

void nn::swkbd::Destroy ( )

Clean up and shut down the swkbd library.

Note
Resources passed into Create (work memory, filesystem client) must be manually freed by the application after calling this function.
See also

◆ DisappearInputForm()

bool nn::swkbd::DisappearInputForm ( )

Hide a previously shown input form.

Returns
true on success, false otherwise.
See also

◆ DisappearKeyboard()

bool nn::swkbd::DisappearKeyboard ( )

Hide a previously shown keyboard.

Returns
true on success, false otherwise.
See also

◆ DrawDRC()

void nn::swkbd::DrawDRC ( )

Draw the keyboard to the DRC.

Must be called inside a valid GX2 rendering context, after rendering all other DRC graphics (to appear under the keyboard)

◆ DrawTV()

void nn::swkbd::DrawTV ( )

Draw the keyboard to the TV.

Must be called inside a valid GX2 rendering context, after rendering all other TV graphics (to appear under the keyboard)

◆ GetDrawStringInfo()

void nn::swkbd::GetDrawStringInfo ( DrawStringInfo drawStringInfo)

◆ GetInputFormString()

const char16_t* nn::swkbd::GetInputFormString ( )

Get the string the user typed into the input form.

Returns
The user's text, as a null-terminated UTF-16 string.
See also

◆ GetKeyboardCondition()

void nn::swkbd::GetKeyboardCondition ( KeyboardCondition keyboardCondition)

◆ GetStateInputForm()

State nn::swkbd::GetStateInputForm ( )

Get the current state of the input form.

Returns
The current State of the input form.

◆ GetStateKeyboard()

State nn::swkbd::GetStateKeyboard ( )

◆ GetWorkMemorySize()

uint32_t nn::swkbd::GetWorkMemorySize ( uint32_t  unk)

Get the required size for swkbd's work memory buffer.

The application must allocate a buffer of this size and pass it into Create.

Parameters
unkUnknown. A value of 0 seems to work.
Returns
The required size of the work buffer, in bytes.
See also

◆ InactivateSelectCursor()

void nn::swkbd::InactivateSelectCursor ( )

◆ InitLearnDic()

bool nn::swkbd::InitLearnDic ( void *  dictionary)

◆ IsCoveredWithSubWindow()

bool nn::swkbd::IsCoveredWithSubWindow ( )

◆ IsDecideCancelButton()

bool nn::swkbd::IsDecideCancelButton ( bool *  outIsSelected)

Gets the current status of the Cancel button on the keyboard.

Parameters
outIsSelectedPointer to a boolean to write the button status to, or nullptr if the return value is enough.
Returns
true if the Cancel button has been pressed, or false otherwise.
See also

◆ IsDecideOkButton()

bool nn::swkbd::IsDecideOkButton ( bool *  outIsSelected)

Gets the current status of the OK button on the keyboard.

Parameters
outIsSelectedPointer to a boolean to write the button status to, or nullptr if the return value is enough.
Returns
true if the OK button has been pressed, or false otherwise.
See also

◆ IsKeyboardTarget()

bool nn::swkbd::IsKeyboardTarget ( IEventReceiver *  eventReceiver)

◆ IsNeedCalcSubThreadFont()

bool nn::swkbd::IsNeedCalcSubThreadFont ( )

Determines whether the font data needs calculating.

If it does, a call to CalcSubThreadFont is required.

Returns
true if the font data needs calculating, false otherwise.
See also

◆ IsNeedCalcSubThreadPredict()

bool nn::swkbd::IsNeedCalcSubThreadPredict ( )

Determines whether the prediction data needs calculating.

If it does, a call to CalcSubThreadPredict is required.

Returns
true if the prediction data needs calculating, false otherwise.
See also

◆ IsSelectCursorActive()

bool nn::swkbd::IsSelectCursorActive ( )

Determines whether the selection cursor is active.

Returns
true if the selection cursor is active, false otherwise.

◆ MuteAllSound()

void nn::swkbd::MuteAllSound ( bool  muted)

Mutes or unmutes the sounds generated by the keyboard.

Must be called inside a valid AX sound context, after AXInit and before AXQuit.

Parameters
mutedtrue to disable all sounds, or false to enable them.

◆ SetControllerRemo()

void nn::swkbd::SetControllerRemo ( ControllerType  type)

◆ SetCursorPos()

void nn::swkbd::SetCursorPos ( int  pos)

Set the character at which the cursor is positioned.

Parameters
posThe position at which to move the cursor, with 0 corresponding to the start of the string (before the first character).

◆ SetEnableOkButton()

void nn::swkbd::SetEnableOkButton ( bool  enable)

Enables and disables the OK button on the keyboard.

When disabled, the button cannot be pressed.

Parameters
enabletrue to enable the button, or false to disable it.

◆ SetInputFormString()

void nn::swkbd::SetInputFormString ( const char16_t *  str)

Sets the text in the input form.

Parameters
strThe UTF-16 string to set the input form to.
See also

◆ SetReceiver()

void nn::swkbd::SetReceiver ( const ReceiverArg receiver)

◆ SetSelectFrom()

void nn::swkbd::SetSelectFrom ( int  )

◆ SetUserControllerEventObj()

void nn::swkbd::SetUserControllerEventObj ( IControllerEventObj *  controllerEventObj)

◆ SetUserSoundObj()

void nn::swkbd::SetUserSoundObj ( ISoundObj *  soundObj)