wut v1.8.0
Wii U Toolchain
|
KPAD is a high-level library over WPAD. More...
Data Structures | |
struct | KPADVec2D |
2D vector. More... | |
struct | KPADVec3D |
3D vector. More... | |
struct | KPADStatus |
A structure containing the Wii Remote data. More... | |
struct | KPADUnifiedWpadStatus |
Storage type for the internal KPAD ring buffer. More... | |
union | KPADStatus.__unnamed46__ |
Extension data, check with extensionType to see what is valid to read. More... | |
struct | KPADStatus.__unnamed46__.nunchuk |
Structure to use when extensionType is set to WPAD_EXT_NUNCHUK. More... | |
struct | KPADStatus.__unnamed46__.classic |
Structure to use when extensionType is set to WPAD_EXT_CLASSIC. More... | |
struct | KPADStatus.__unnamed46__.pro |
Structure to use when extensionType is set to WPAD_EXT_PRO_CONTROLLER. More... | |
struct | KPADStatus.__unnamed46__.balance |
Structure to use when extensionType is set to WPAD_EXT_BALANCE_BOARD . More... | |
struct | KPADStatus.mplus |
Structure to use when MotionPlus is enabled. More... | |
union | KPADUnifiedWpadStatus.__unnamed53__ |
Typedefs | |
typedef enum WPADChan | KPADChan |
Wii Remote channel. | |
typedef enum WPADDataFormat | KPADDataFormat |
Data format. | |
typedef enum WPADExtensionType | KPADExtensionType |
Extension type. | |
typedef enum WPADMplsMode | KPADMplsMode |
MotionPlus Mode. | |
typedef struct KPADStatus | KPADStatus |
typedef struct KPADUnifiedWpadStatus | KPADUnifiedWpadStatus |
typedef struct KPADVec2D | KPADVec2D |
typedef struct KPADVec3D | KPADVec3D |
typedef enum KPADError | KPADError |
Error. | |
typedef enum KPADControlMplsStatus | KPADControlMplsStatus |
Status codes for KPADControlMplsCallback . | |
typedef WPADConnectCallback | KPADConnectCallback |
typedef WPADSamplingCallback | KPADSamplingCallback |
typedef void(* | KPADControlMplsCallback) (KPADChan chan, KPADControlMplsStatus status) |
Callback used for KPADSetControlMplsCallback() . | |
Enumerations | |
enum | KPADError { KPAD_ERROR_OK = 0 , KPAD_ERROR_NO_SAMPLES = -1 , KPAD_ERROR_INVALID_CONTROLLER = -2 , KPAD_ERROR_WPAD_UNINIT = -3 , KPAD_ERROR_BUSY = -4 , KPAD_ERROR_UNINITIALIZED = -5 } |
Error. More... | |
enum | KPADControlMplsStatus { KPAD_CONTROL_MPLS_STATUS_STARTED = 0 , KPAD_CONTROL_MPLS_STATUS_FINISHED = 1 , KPAD_CONTROL_MPLS_STATUS_FAILED_MPLS_ONLY = -1 , KPAD_CONTROL_MPLS_STATUS_FAILED_MPLS_NUNCHUK = -2 , KPAD_CONTROL_MPLS_STATUS_FAILED_MPLS_CLASSIC = -3 } |
Status codes for KPADControlMplsCallback . More... | |
Functions | |
void | KPADInit (void) |
Initialises the KPAD library for use. | |
void | KPADInitEx (KPADUnifiedWpadStatus *buffer, uint32_t count) |
Initializes the KPAD library with extra buffers. | |
void | KPADShutdown (void) |
Cleans up and frees the KPAD library. | |
uint32_t | KPADRead (KPADChan chan, KPADStatus *data, uint32_t size) |
Read data from the desired controller. | |
uint32_t | KPADReadEx (KPADChan chan, KPADStatus *data, uint32_t size, KPADError *error) |
Read data from the desired controller. | |
void | KPADGetUnifiedWpadStatus (KPADChan chan, KPADUnifiedWpadStatus *buffer, uint32_t count) |
Read a number of entries from the internal buffer. | |
int32_t | KPADSetMaxControllers (uint32_t maxControllers) |
Set the maximum amount of controllers which can be connected to the system. | |
uint32_t | KPADGetMaxControllers (void) |
Get the maximum amount of controllers which can be connected to the system. | |
uint32_t | KPADGetGameMaxControllers (void) |
Get the maximum amount of controllers which can be connected, as reported by IOS-PAD. | |
KPADConnectCallback | KPADSetConnectCallback (KPADChan chan, KPADConnectCallback callback) |
Set a callback for when a controller connection status changes. | |
KPADSamplingCallback | KPADSetSamplingCallback (KPADChan channel, KPADSamplingCallback callback) |
Same usage as , except compatible with other KPAD functions. | |
uint32_t | KPADGetMplsWorkSize (void) |
Returns the amount of memory needed for KPADSetMplsWorkarea() . | |
void | KPADSetMplsWorkarea (void *buf) |
Sets the extra memory KPAD will use to process MotionPlus data. | |
void | KPADSetControlMplsCallback (KPADChan chan, KPADControlMplsCallback callback) |
Set a callback for when the MotionPlus extension is configured. | |
void | KPADEnableMpls (KPADChan channel, KPADMplsMode mode) |
Sets MotionPlus for the controller in specified mode. | |
void | KPADDisableMpls (KPADChan channel) |
Disables MotionPlus for the controller. | |
KPADMplsMode | KPADGetMplsStatus (KPADChan chan) |
Get MotionPlus mode. | |
void | KPADResetMpls (KPADChan chan) |
Resets the MotionPlus state. | |
void | KPADEnableDPD (KPADChan chan) |
Enable IR pointing. | |
void | KPADDisableDPD (KPADChan chan) |
Disable IR pointing. | |
void | KPADResetWbcZeroPoint (void) |
Resets the Balance Board's zero. | |
void | KPADResetWbcTgcWeight (void) |
Recalculate the Balance Board's TGC coefficients and zero. | |
KPAD is a high-level library over WPAD.
struct KPADVec3D |
struct KPADStatus |
Data Fields | ||
---|---|---|
uint32_t | hold | Indicates what KPADButtons are held down. |
uint32_t | trigger | Indicates what KPADButtons have been pressed since last sample. |
uint32_t | release | Indicates what KPADButtons have been released since last sample. |
KPADVec3D | acc | Indicates the value of the acceleration sensor. |
float | accMagnitude | Indicates the magnitude of acceleration. |
float | accVariation | Indicates the variation in acceleration. |
KPADVec2D | pos | Indicates the position where the Wii Remote is pointing; positive for right and down. |
KPADVec2D | posDiff |
Difference from previous pos . |
float | posDiffMagnitude |
Magnitude of posDiff . |
KPADVec2D | angle | Angle: horizon vector (+x is right, +y is down.) |
KPADVec2D | angleDiff |
Difference from previous angle . |
float | angleDiffMagnitude |
Magnitude of angleDiff . |
float | dist | Distance to the sensor bar, in meters. |
float | distDiff |
Difference from previous dist . |
float | distDiffMagnitude |
Absolute value of distDiff . |
KPADVec2D | down |
The "down" vector from accelerometer: when down.y is negative, wiimote is facing down. |
uint8_t | extensionType | Value from KPADExtensionType. |
int8_t | error | Value from KPADError. |
int8_t | posValid |
Validity of the pos field. |
uint8_t | format | Value from KPADDataFormat. |
union KPADStatus.__unnamed46__ | __unnamed__ | Extension data, check with extensionType to see what is valid to read. |
struct KPADStatus.mplus | mplus | Structure to use when MotionPlus is enabled. |
struct KPADUnifiedWpadStatus |
Storage type for the internal KPAD ring buffer.
Data Fields | ||
---|---|---|
union KPADUnifiedWpadStatus.__unnamed53__ | __unnamed__ | |
uint8_t | format |
One of WPADDataFormat . |
union KPADStatus.__unnamed46__ |
Extension data, check with extensionType to see what is valid to read.
Data Fields | ||
---|---|---|
struct KPADStatus.__unnamed46__.nunchuk | nunchuk |
Structure to use when extensionType is set to WPAD_EXT_NUNCHUK. |
struct KPADStatus.__unnamed46__.classic | classic |
Structure to use when extensionType is set to WPAD_EXT_CLASSIC. |
struct KPADStatus.__unnamed46__.pro | pro |
Structure to use when extensionType is set to WPAD_EXT_PRO_CONTROLLER. |
struct KPADStatus.__unnamed46__.balance | balance |
Structure to use when extensionType is set to WPAD_EXT_BALANCE_BOARD . Note: Balance Board support in KPAD seems to be incomplete, only |
struct KPADStatus.__unnamed46__.nunchuk |
Structure to use when extensionType
is set to WPAD_EXT_NUNCHUK.
Data Fields | ||
---|---|---|
KPADVec2D | stick | Position of the analog stick. |
KPADVec3D | acc | Indicates the value of the acceleration sensor. |
float | accMagnitude | Indicates the magnitude of acceleration. |
float | accVariation | Indicates the variation in acceleration. |
uint32_t | hold | Indicates what buttons are held down. |
uint32_t | trigger | Indicates what buttons have been pressed since last sample. |
uint32_t | release | Indicates what buttons have been released since last sample. |
struct KPADStatus.__unnamed46__.classic |
Structure to use when extensionType
is set to WPAD_EXT_CLASSIC.
Data Fields | ||
---|---|---|
uint32_t | hold | Indicates what buttons are held down. |
uint32_t | trigger | Indicates what buttons have been pressed since last sample. |
uint32_t | release | Indicates what buttons have been released since last sample. |
KPADVec2D | leftStick | Position of left analog stick. |
KPADVec2D | rightStick | Position of right analog stick. |
float | leftTrigger | Left trigger. |
float | rightTrigger | Right trigger. |
struct KPADStatus.__unnamed46__.pro |
Structure to use when extensionType
is set to WPAD_EXT_PRO_CONTROLLER.
Data Fields | ||
---|---|---|
uint32_t | hold | Indicates what buttons are held down. |
uint32_t | trigger | Indicates what buttons have been pressed since last sample. |
uint32_t | release | Indicates what buttons have been released since last sample. |
KPADVec2D | leftStick | Position of left analog stick. |
KPADVec2D | rightStick | Position of right analog stick. |
int32_t | charging | Is charging flag. |
int32_t | wired | Is wired flag. |
struct KPADStatus.__unnamed46__.balance |
Structure to use when extensionType
is set to WPAD_EXT_BALANCE_BOARD
.
Note: Balance Board support in KPAD seems to be incomplete, only weights
and error
members seem to hold useful data.
Data Fields | ||
---|---|---|
double | avgTGCWeight | Averaged corrected (total) weight, but it's always zero because calibration never completes. |
double | weights[WPAD_MAX_PRESSURE_SENSORS] | Instantaneous uncorrected weights. |
double | avgWeights[WPAD_MAX_PRESSURE_SENSORS] | Time-smoothed uncorrected weights, very slow to stabilize. |
int32_t | error | Error generated from reading weights. |
int32_t | calibration | Status of calibration: negative is error, otherwise is [0, 3], but KPAD never reaches level 3. |
struct KPADStatus.mplus |
union KPADUnifiedWpadStatus.__unnamed53__ |
Data Fields | ||
---|---|---|
WPADStatus | core | |
WPADStatusNunchuk | nunchuk | |
WPADStatusClassic | classic | |
WPADStatusPro | pro | |
WPADStatusBalanceBoard | balance | |
WPADStatusTrain | train |
typedef enum WPADDataFormat KPADDataFormat |
typedef enum WPADExtensionType KPADExtensionType |
typedef enum WPADMplsMode KPADMplsMode |
typedef struct KPADStatus KPADStatus |
typedef struct KPADUnifiedWpadStatus KPADUnifiedWpadStatus |
typedef enum KPADControlMplsStatus KPADControlMplsStatus |
Status codes for KPADControlMplsCallback
.
typedef void(* KPADControlMplsCallback) (KPADChan chan, KPADControlMplsStatus status) |
Callback used for KPADSetControlMplsCallback()
.
enum KPADError |
Error.
Enumerator | |
---|---|
KPAD_ERROR_OK | No error occurred, and data was written to the buffers. |
KPAD_ERROR_NO_SAMPLES | There was no sample new data available to write. |
KPAD_ERROR_INVALID_CONTROLLER | The requested controller or channel was invalid. |
KPAD_ERROR_WPAD_UNINIT | WPAD is uninitialized, shouldn't happen unless WPADShutdown() is manually called. |
KPAD_ERROR_BUSY | KPAD channel is busy, perhaps being accessed by another thread. |
KPAD_ERROR_UNINITIALIZED | KPAD is uninitialized, need to call KPADInit() |
Status codes for KPADControlMplsCallback
.
Enumerator | |
---|---|
KPAD_CONTROL_MPLS_STATUS_STARTED | When |
KPAD_CONTROL_MPLS_STATUS_FINISHED | When MotionPlus mode was set correctly, or wiimote disconnected prematurely. |
KPAD_CONTROL_MPLS_STATUS_FAILED_MPLS_ONLY | When |
KPAD_CONTROL_MPLS_STATUS_FAILED_MPLS_NUNCHUK | When |
KPAD_CONTROL_MPLS_STATUS_FAILED_MPLS_CLASSIC | When |
void KPADInit | ( | void | ) |
Initialises the KPAD library for use.
Note: this calls KPADInitEx(NULL, 0)
.
void KPADInitEx | ( | KPADUnifiedWpadStatus * | buffer, |
uint32_t | count | ||
) |
Initializes the KPAD library with extra buffers.
void KPADShutdown | ( | void | ) |
Cleans up and frees the KPAD library.
uint32_t KPADRead | ( | KPADChan | chan, |
KPADStatus * | data, | ||
uint32_t | size | ||
) |
Read data from the desired controller.
chan | The channel of the controller to read from. |
data | The KPADStatus to fill. |
size | The maximum number of data to read. |
uint32_t KPADReadEx | ( | KPADChan | chan, |
KPADStatus * | data, | ||
uint32_t | size, | ||
KPADError * | error | ||
) |
Read data from the desired controller.
chan | The channel of the controller to read from. |
data | The KPADStatus to fill. |
size | The maximum number of data to read. |
error | A pointer to an error code. |
void KPADGetUnifiedWpadStatus | ( | KPADChan | chan, |
KPADUnifiedWpadStatus * | buffer, | ||
uint32_t | count | ||
) |
Read a number of entries from the internal buffer.
int32_t KPADSetMaxControllers | ( | uint32_t | maxControllers | ) |
Set the maximum amount of controllers which can be connected to the system.
maxControllers | The maximum amount of controllers. Must be 4 or 7 . |
uint32_t KPADGetMaxControllers | ( | void | ) |
Get the maximum amount of controllers which can be connected to the system.
uint32_t KPADGetGameMaxControllers | ( | void | ) |
Get the maximum amount of controllers which can be connected, as reported by IOS-PAD.
KPADConnectCallback KPADSetConnectCallback | ( | KPADChan | chan, |
KPADConnectCallback | callback | ||
) |
Set a callback for when a controller connection status changes.
chan | The channel of the controller to set a callback for. |
callback | Pointer to a callback function. |
KPADSamplingCallback KPADSetSamplingCallback | ( | KPADChan | channel, |
KPADSamplingCallback | callback | ||
) |
Same usage as , except compatible with other KPAD functions.
uint32_t KPADGetMplsWorkSize | ( | void | ) |
Returns the amount of memory needed for KPADSetMplsWorkarea()
.
void KPADSetMplsWorkarea | ( | void * | buf | ) |
Sets the extra memory KPAD will use to process MotionPlus data.
Without this work area, the mplus
field in KPADStatus
will be filled with zeros.
buf | A memory buffer with size obtained from KPADGetMplsWorkSize() . |
void KPADSetControlMplsCallback | ( | KPADChan | chan, |
KPADControlMplsCallback | callback | ||
) |
Set a callback for when the MotionPlus extension is configured.
chan | Controller channel to set the callback for. |
callback | Pointer to callback functio that will be invoked. |
void KPADEnableMpls | ( | KPADChan | channel, |
KPADMplsMode | mode | ||
) |
Sets MotionPlus for the controller in specified mode.
mode | The MotionPlus mode which should be used, the mode may be ignored and a different mode used, usually because the required extension is not connected. Make sure to check result with KPADGetMplsStatus |
void KPADDisableMpls | ( | KPADChan | channel | ) |
Disables MotionPlus for the controller.
KPADMplsMode KPADGetMplsStatus | ( | KPADChan | chan | ) |
Get MotionPlus mode.
identical to WPADiGetMplsStatus
void KPADResetMpls | ( | KPADChan | chan | ) |
Resets the MotionPlus state.
void KPADEnableDPD | ( | KPADChan | chan | ) |
Enable IR pointing.
void KPADDisableDPD | ( | KPADChan | chan | ) |
Disable IR pointing.
void KPADResetWbcZeroPoint | ( | void | ) |
Resets the Balance Board's zero.
void KPADResetWbcTgcWeight | ( | void | ) |
Recalculate the Balance Board's TGC coefficients and zero.