In memory of Ben “bushing” Byer, who passed away on Monday, February 8th, 2016.

Nsyskbd.rpl

From WiiUBrew
Jump to navigation Jump to search

nsyskbd.rpl is the system library that allows applications to use USB keyboards plugged in the WiiU USB ports; it supports up to multiple keyboards and assign a channel to each keyboard connected.

Functions

Initialisation

Prototype Description
uint8_t KBDSetup((void*)connection_callback,(void*)disconnection_callback,(void*)key_callback) Initializes the USB keyboard library and set callbacks; return 0 if the library was successfully initialized. connection_callback is called when an USB keyboard is connected with an uint8_t* as argument that specify the channel that was assigned to the keyboard. disconnection_callback is called when an USB keyboard is disconnected with an uint8_t* as argument that specify the channel of the keyboared that was disconnected. key_callback is called when a key event happens (press/release) and has a pointer to a key_state structure as argument
uint8_t KBDTeardown() Deinitializes the USB keyboard library and return 0 if the deinitialization was successfull
uint8_t KBDInit((void*)unknown,(void*)connection_callback,(void*)disconnection_callback,(void*)key_callback); Pass arguments to KBDSetup (probably an old function left for compatibility); should returns 0 if successfull
uint8_t KBDExit(); Calls KBDTeardown() (probably an old function left for compatibility); should returns 0 if successfull

Structures

Prototype Description
typedef struct {
	uint8_t ch; //Key channel
	uint8_t scancode; //Key scancode
	uint32_t state; //1=pressed; 0=releases; 3=keeping pressed
	uint8_t unknown[4]; //?
	uint16_t UTF16; //key value as an UTF16 char
} key_state;
Used as argument of key_callback