mirror of
https://github.com/wiiu-env/wut.git
synced 2024-12-05 02:44:19 +01:00
Add Nunchuk/CC emulated sticks, KPAD accelerometer data, WPAD/KPAD documentation (#114)
* Add emulated stick values for Nunchuk and Classic Controller * Add acceleration sensor data to KPADStatus I have also changed the posValid type from uint8_t to int8_t because the value can be negative. A negative value means that the result validity is not really good. * Set version to beta in the doc * Added mask for button C and button Z on the Nunchuk The same mask applies to WPADButton and WPADNunchukButton. * Add doxygen comments and fix typos Most of the comments are pretty obvious but at least it's a start. * Fix a copy-paste error in my last commit I have also added comments for VPADGetTPCalibrationParam and VPADSetTPCalibrationParam. * Add documentation for all buttons
This commit is contained in:
parent
d39e7cad4a
commit
78ee1c51bc
@ -6,7 +6,7 @@ if(DOXYGEN_FOUND)
|
|||||||
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
|
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
|
||||||
|
|
||||||
set(DOXYGEN_PROJECT_NAME "wut")
|
set(DOXYGEN_PROJECT_NAME "wut")
|
||||||
set(DOXYGEN_PROJECT_NUMBER "1.0.0-alpha")
|
set(DOXYGEN_PROJECT_NUMBER "1.0.0-beta")
|
||||||
set(DOXYGEN_PROJECT_BRIEF "Wii U Toolchain")
|
set(DOXYGEN_PROJECT_BRIEF "Wii U Toolchain")
|
||||||
|
|
||||||
set(DOXYGEN_GENERATE_HTML YES)
|
set(DOXYGEN_GENERATE_HTML YES)
|
||||||
|
@ -227,7 +227,7 @@ NSSLCreateContext(int32_t unk);
|
|||||||
* The NSSL context to destroy.
|
* The NSSL context to destroy.
|
||||||
*
|
*
|
||||||
* \returns
|
* \returns
|
||||||
* 0 on success, or a negative value if an error occured.
|
* 0 on success, or a negative value if an error occurred.
|
||||||
*/
|
*/
|
||||||
int32_t
|
int32_t
|
||||||
NSSLDestroyContext(NSSLContextHandle context);
|
NSSLDestroyContext(NSSLContextHandle context);
|
||||||
|
@ -5,95 +5,160 @@
|
|||||||
/**
|
/**
|
||||||
* \defgroup padscore_kpad KPAD
|
* \defgroup padscore_kpad KPAD
|
||||||
* \ingroup padscore
|
* \ingroup padscore
|
||||||
|
*
|
||||||
|
* KPAD is a high-level library over WPAD.
|
||||||
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//! Wii Remote channel.
|
||||||
typedef enum WPADChan KPADChan;
|
typedef enum WPADChan KPADChan;
|
||||||
|
//! Data format.
|
||||||
typedef enum WPADDataFormat KPADDataFormat;
|
typedef enum WPADDataFormat KPADDataFormat;
|
||||||
|
//! Extension type.
|
||||||
typedef enum WPADExtensionType KPADExtensionType;
|
typedef enum WPADExtensionType KPADExtensionType;
|
||||||
|
|
||||||
typedef struct KPADStatus KPADStatus;
|
typedef struct KPADStatus KPADStatus;
|
||||||
typedef struct KPADVec2D KPADVec2D;
|
typedef struct KPADVec2D KPADVec2D;
|
||||||
|
typedef struct KPADVec3D KPADVec3D;
|
||||||
|
|
||||||
|
//! Error.
|
||||||
typedef enum KPADError
|
typedef enum KPADError
|
||||||
{
|
{
|
||||||
|
//! No errors.
|
||||||
KPAD_ERROR_OK = 0,
|
KPAD_ERROR_OK = 0,
|
||||||
} KPADError;
|
} KPADError;
|
||||||
|
|
||||||
|
//! 2D vector.
|
||||||
struct KPADVec2D
|
struct KPADVec2D
|
||||||
{
|
{
|
||||||
|
//! x.
|
||||||
float x;
|
float x;
|
||||||
|
//! y.
|
||||||
float y;
|
float y;
|
||||||
};
|
};
|
||||||
WUT_CHECK_OFFSET(KPADVec2D, 0x00, x);
|
WUT_CHECK_OFFSET(KPADVec2D, 0x00, x);
|
||||||
WUT_CHECK_OFFSET(KPADVec2D, 0x04, y);
|
WUT_CHECK_OFFSET(KPADVec2D, 0x04, y);
|
||||||
WUT_CHECK_SIZE(KPADVec2D, 0x08);
|
WUT_CHECK_SIZE(KPADVec2D, 0x08);
|
||||||
|
|
||||||
|
//! 3D vector.
|
||||||
|
struct KPADVec3D
|
||||||
|
{
|
||||||
|
//! x.
|
||||||
|
float x;
|
||||||
|
//! y.
|
||||||
|
float y;
|
||||||
|
//! z.
|
||||||
|
float z;
|
||||||
|
};
|
||||||
|
WUT_CHECK_OFFSET(KPADVec3D, 0x00, x);
|
||||||
|
WUT_CHECK_OFFSET(KPADVec3D, 0x04, y);
|
||||||
|
WUT_CHECK_OFFSET(KPADVec3D, 0x08, z);
|
||||||
|
WUT_CHECK_SIZE(KPADVec3D, 0x0C);
|
||||||
|
|
||||||
|
//! A structure conataining the Wii Remote data.
|
||||||
struct KPADStatus
|
struct KPADStatus
|
||||||
{
|
{
|
||||||
//! Indicates what KPADButtons are held down
|
//! Indicates what KPADButtons are held down.
|
||||||
uint32_t hold;
|
uint32_t hold;
|
||||||
|
|
||||||
//! Indicates what KPADButtons have been pressed since last sample
|
//! Indicates what KPADButtons have been pressed since last sample.
|
||||||
uint32_t trigger;
|
uint32_t trigger;
|
||||||
|
|
||||||
//! Indicates what KPADButtons have been released since last sample
|
//! Indicates what KPADButtons have been released since last sample.
|
||||||
uint32_t release;
|
uint32_t release;
|
||||||
|
|
||||||
WUT_UNKNOWN_BYTES(5 * 4);
|
//! Indicates the value of the acceleration sensor.
|
||||||
|
KPADVec3D acc;
|
||||||
|
|
||||||
|
//! Indicates the magnitude of acceleration.
|
||||||
|
float accMagnitude;
|
||||||
|
|
||||||
|
//! Indicates the variation in acceleration.
|
||||||
|
float accVariation;
|
||||||
|
|
||||||
|
//! Indicates the position where the Wii Remote is pointing.
|
||||||
KPADVec2D pos;
|
KPADVec2D pos;
|
||||||
|
|
||||||
WUT_UNKNOWN_BYTES(3 * 4);
|
WUT_UNKNOWN_BYTES(3 * 4);
|
||||||
|
|
||||||
|
//! Angle.
|
||||||
KPADVec2D angle;
|
KPADVec2D angle;
|
||||||
|
|
||||||
WUT_UNKNOWN_BYTES(8 * 4);
|
WUT_UNKNOWN_BYTES(8 * 4);
|
||||||
|
|
||||||
//! Value from KPADExtensionType
|
//! Value from KPADExtensionType.
|
||||||
uint8_t extensionType;
|
uint8_t extensionType;
|
||||||
|
|
||||||
//! Value from KPADError
|
//! Value from KPADError.
|
||||||
int8_t error;
|
int8_t error;
|
||||||
|
|
||||||
uint8_t posValid;
|
//! Validity of the result.
|
||||||
|
int8_t posValid;
|
||||||
|
|
||||||
//! Value from KPADDataFormat
|
//! Value from KPADDataFormat.
|
||||||
uint8_t format;
|
uint8_t format;
|
||||||
|
|
||||||
// Extension data, check with extensionType to see what is valid to read
|
//! Extension data, check with extensionType to see what is valid to read.
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
// For WPAD_EXT_NUNCHUK
|
//! Structure to use when extension type is set to \link WPAD_EXT_NUNCHUK \endlink.
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
//! Position of the analog stick.
|
||||||
KPADVec2D stick;
|
KPADVec2D stick;
|
||||||
|
//! Indicates the value of the acceleration sensor.
|
||||||
|
KPADVec3D acc;
|
||||||
|
//! Indicates the magnitude of acceleration.
|
||||||
|
float accMagnitude;
|
||||||
|
//! Indicates the variation in acceleration.
|
||||||
|
float accVariation;
|
||||||
|
//! Indicates what buttons are held down.
|
||||||
|
uint32_t hold;
|
||||||
|
//! Indicates what buttons have been pressed since last sample.
|
||||||
|
uint32_t trigger;
|
||||||
|
//! Indicates what buttons have been released since last sample.
|
||||||
|
uint32_t release;
|
||||||
} nunchuck;
|
} nunchuck;
|
||||||
|
|
||||||
// For WPAD_EXT_CLASSIC
|
//! Structure to use when extension type is set to \link WPAD_EXT_CLASSIC \endlink.
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
//! Indicates what buttons are held down.
|
||||||
uint32_t hold;
|
uint32_t hold;
|
||||||
|
//! Indicates what buttons have been pressed since last sample.
|
||||||
uint32_t trigger;
|
uint32_t trigger;
|
||||||
|
//! Indicates what buttons have been released since last sample.
|
||||||
uint32_t release;
|
uint32_t release;
|
||||||
|
//! Position of left analog stick.
|
||||||
KPADVec2D leftStick;
|
KPADVec2D leftStick;
|
||||||
|
//! Position of right analog stick.
|
||||||
KPADVec2D rightStick;
|
KPADVec2D rightStick;
|
||||||
|
//! Left trigger.
|
||||||
float leftTrigger;
|
float leftTrigger;
|
||||||
|
//! Right trigger.
|
||||||
float rightTrigger;
|
float rightTrigger;
|
||||||
} classic;
|
} classic;
|
||||||
|
|
||||||
// For WPAD_EXT_PRO_CONTROLLER
|
//! Structure to use when extension type is set to \link WPAD_EXT_PRO_CONTROLLER \endlink.
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
//! Indicates what buttons are held down.
|
||||||
uint32_t hold;
|
uint32_t hold;
|
||||||
|
//! Indicates what buttons have been pressed since last sample.
|
||||||
uint32_t trigger;
|
uint32_t trigger;
|
||||||
|
//! Indicates what buttons have been released since last sample.
|
||||||
uint32_t release;
|
uint32_t release;
|
||||||
|
//! Position of left analog stick.
|
||||||
KPADVec2D leftStick;
|
KPADVec2D leftStick;
|
||||||
|
//! Position of right analog stick.
|
||||||
KPADVec2D rightStick;
|
KPADVec2D rightStick;
|
||||||
|
//! Is charging flag.
|
||||||
int32_t charging;
|
int32_t charging;
|
||||||
|
//! Is wired flag.
|
||||||
int32_t wired;
|
int32_t wired;
|
||||||
} pro;
|
} pro;
|
||||||
|
|
||||||
@ -105,6 +170,9 @@ struct KPADStatus
|
|||||||
WUT_CHECK_OFFSET(KPADStatus, 0x00, hold);
|
WUT_CHECK_OFFSET(KPADStatus, 0x00, hold);
|
||||||
WUT_CHECK_OFFSET(KPADStatus, 0x04, trigger);
|
WUT_CHECK_OFFSET(KPADStatus, 0x04, trigger);
|
||||||
WUT_CHECK_OFFSET(KPADStatus, 0x08, release);
|
WUT_CHECK_OFFSET(KPADStatus, 0x08, release);
|
||||||
|
WUT_CHECK_OFFSET(KPADStatus, 0x0C, acc);
|
||||||
|
WUT_CHECK_OFFSET(KPADStatus, 0x18, accMagnitude);
|
||||||
|
WUT_CHECK_OFFSET(KPADStatus, 0x1C, accVariation);
|
||||||
WUT_CHECK_OFFSET(KPADStatus, 0x20, pos);
|
WUT_CHECK_OFFSET(KPADStatus, 0x20, pos);
|
||||||
WUT_CHECK_OFFSET(KPADStatus, 0x34, angle);
|
WUT_CHECK_OFFSET(KPADStatus, 0x34, angle);
|
||||||
WUT_CHECK_OFFSET(KPADStatus, 0x5C, extensionType);
|
WUT_CHECK_OFFSET(KPADStatus, 0x5C, extensionType);
|
||||||
@ -113,6 +181,12 @@ WUT_CHECK_OFFSET(KPADStatus, 0x5E, posValid);
|
|||||||
WUT_CHECK_OFFSET(KPADStatus, 0x5F, format);
|
WUT_CHECK_OFFSET(KPADStatus, 0x5F, format);
|
||||||
// For WPAD_EXT_NUNCHUK
|
// For WPAD_EXT_NUNCHUK
|
||||||
WUT_CHECK_OFFSET(KPADStatus, 0x60, nunchuck.stick);
|
WUT_CHECK_OFFSET(KPADStatus, 0x60, nunchuck.stick);
|
||||||
|
WUT_CHECK_OFFSET(KPADStatus, 0x68, nunchuck.acc);
|
||||||
|
WUT_CHECK_OFFSET(KPADStatus, 0x74, nunchuck.accMagnitude);
|
||||||
|
WUT_CHECK_OFFSET(KPADStatus, 0x78, nunchuck.accVariation);
|
||||||
|
WUT_CHECK_OFFSET(KPADStatus, 0x7C, nunchuck.hold);
|
||||||
|
WUT_CHECK_OFFSET(KPADStatus, 0x80, nunchuck.trigger);
|
||||||
|
WUT_CHECK_OFFSET(KPADStatus, 0x84, nunchuck.release);
|
||||||
// For WPAD_EXT_CLASSIC
|
// For WPAD_EXT_CLASSIC
|
||||||
WUT_CHECK_OFFSET(KPADStatus, 0x60, classic.hold);
|
WUT_CHECK_OFFSET(KPADStatus, 0x60, classic.hold);
|
||||||
WUT_CHECK_OFFSET(KPADStatus, 0x64, classic.trigger);
|
WUT_CHECK_OFFSET(KPADStatus, 0x64, classic.trigger);
|
||||||
@ -131,14 +205,50 @@ WUT_CHECK_OFFSET(KPADStatus, 0x7C, pro.charging);
|
|||||||
WUT_CHECK_OFFSET(KPADStatus, 0x80, pro.wired);
|
WUT_CHECK_OFFSET(KPADStatus, 0x80, pro.wired);
|
||||||
WUT_CHECK_SIZE(KPADStatus, 0xF0);
|
WUT_CHECK_SIZE(KPADStatus, 0xF0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialises the KPAD library for use.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
KPADInit();
|
KPADInit();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read data from the desired Wii Remote.
|
||||||
|
*
|
||||||
|
* \param chan
|
||||||
|
* The channel of the controller to read from.
|
||||||
|
*
|
||||||
|
* \param data
|
||||||
|
* The KPADStatus to fill.
|
||||||
|
*
|
||||||
|
* \param size
|
||||||
|
* The maximum number of data to read.
|
||||||
|
*
|
||||||
|
* \return
|
||||||
|
* The number of data read.
|
||||||
|
*/
|
||||||
int32_t
|
int32_t
|
||||||
KPADRead(KPADChan chan,
|
KPADRead(KPADChan chan,
|
||||||
KPADStatus *data,
|
KPADStatus *data,
|
||||||
uint32_t size);
|
uint32_t size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read data from the desired Wii Remote.
|
||||||
|
*
|
||||||
|
* \param chan
|
||||||
|
* The channel of the controller to read from.
|
||||||
|
*
|
||||||
|
* \param data
|
||||||
|
* The KPADStatus to fill.
|
||||||
|
*
|
||||||
|
* \param size
|
||||||
|
* The maximum number of data to read.
|
||||||
|
*
|
||||||
|
* \param error
|
||||||
|
* A pointer to an error code.
|
||||||
|
*
|
||||||
|
* \return
|
||||||
|
* The number of data read.
|
||||||
|
*/
|
||||||
int32_t
|
int32_t
|
||||||
KPADReadEx(KPADChan chan,
|
KPADReadEx(KPADChan chan,
|
||||||
KPADStatus *data,
|
KPADStatus *data,
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
/**
|
/**
|
||||||
* \defgroup padscore_wpad WPAD
|
* \defgroup padscore_wpad WPAD
|
||||||
* \ingroup padscore
|
* \ingroup padscore
|
||||||
|
*
|
||||||
|
* WPAD is a low-level library under KPAD.
|
||||||
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -13,99 +16,206 @@ extern "C" {
|
|||||||
typedef struct WPADStatusProController WPADStatusProController;
|
typedef struct WPADStatusProController WPADStatusProController;
|
||||||
typedef struct WPADVec2D WPADVec2D;
|
typedef struct WPADVec2D WPADVec2D;
|
||||||
|
|
||||||
|
//! Wii Remote channel.
|
||||||
typedef enum WPADChan
|
typedef enum WPADChan
|
||||||
{
|
{
|
||||||
|
//! Channel 0.
|
||||||
WPAD_CHAN_0 = 0,
|
WPAD_CHAN_0 = 0,
|
||||||
|
//! Channel 1.
|
||||||
WPAD_CHAN_1 = 1,
|
WPAD_CHAN_1 = 1,
|
||||||
|
//! Channel 2.
|
||||||
WPAD_CHAN_2 = 2,
|
WPAD_CHAN_2 = 2,
|
||||||
|
//! Channel 3.
|
||||||
WPAD_CHAN_3 = 3,
|
WPAD_CHAN_3 = 3,
|
||||||
} WPADChan;
|
} WPADChan;
|
||||||
|
|
||||||
|
//! Data format.
|
||||||
typedef enum WPADDataFormat
|
typedef enum WPADDataFormat
|
||||||
{
|
{
|
||||||
WPAD_FMT_PRO_CONTROLLER = 22,
|
WPAD_FMT_PRO_CONTROLLER = 22,
|
||||||
} WPADDataFormat;
|
} WPADDataFormat;
|
||||||
|
|
||||||
|
//! Extension type.
|
||||||
typedef enum WPADExtensionType
|
typedef enum WPADExtensionType
|
||||||
{
|
{
|
||||||
|
//! Wii Remote with no extension.
|
||||||
WPAD_EXT_CORE = 0,
|
WPAD_EXT_CORE = 0,
|
||||||
|
//! Nunchuk.
|
||||||
WPAD_EXT_NUNCHUK = 1,
|
WPAD_EXT_NUNCHUK = 1,
|
||||||
|
//! Classic Controller.
|
||||||
WPAD_EXT_CLASSIC = 2,
|
WPAD_EXT_CLASSIC = 2,
|
||||||
|
//! Motion Plus.
|
||||||
WPAD_EXT_MPLUS = 5,
|
WPAD_EXT_MPLUS = 5,
|
||||||
|
//! Motion Plus with Nunchuk.
|
||||||
WPAD_EXT_MPLUS_NUNCHUK = 6,
|
WPAD_EXT_MPLUS_NUNCHUK = 6,
|
||||||
|
//! Motion Plus with Classic Controller.
|
||||||
WPAD_EXT_MPLUS_CLASSIC = 7,
|
WPAD_EXT_MPLUS_CLASSIC = 7,
|
||||||
|
//! Pro Controller.
|
||||||
WPAD_EXT_PRO_CONTROLLER = 31,
|
WPAD_EXT_PRO_CONTROLLER = 31,
|
||||||
} WPADExtensionType;
|
} WPADExtensionType;
|
||||||
|
|
||||||
|
//! Wii Remote buttons.
|
||||||
typedef enum WPADButton
|
typedef enum WPADButton
|
||||||
{
|
{
|
||||||
|
//! The left button of the D-pad.
|
||||||
WPAD_BUTTON_LEFT = 0x0001,
|
WPAD_BUTTON_LEFT = 0x0001,
|
||||||
|
//! The right button of the D-pad.
|
||||||
WPAD_BUTTON_RIGHT = 0x0002,
|
WPAD_BUTTON_RIGHT = 0x0002,
|
||||||
|
//! The down button of the D-pad.
|
||||||
WPAD_BUTTON_DOWN = 0x0004,
|
WPAD_BUTTON_DOWN = 0x0004,
|
||||||
|
//! The up button of the D-pad.
|
||||||
WPAD_BUTTON_UP = 0x0008,
|
WPAD_BUTTON_UP = 0x0008,
|
||||||
|
//! The + button.
|
||||||
WPAD_BUTTON_PLUS = 0x0010,
|
WPAD_BUTTON_PLUS = 0x0010,
|
||||||
|
//! The 2 button.
|
||||||
WPAD_BUTTON_2 = 0x0100,
|
WPAD_BUTTON_2 = 0x0100,
|
||||||
|
//! The 1 button.
|
||||||
WPAD_BUTTON_1 = 0x0200,
|
WPAD_BUTTON_1 = 0x0200,
|
||||||
|
//! The B button.
|
||||||
WPAD_BUTTON_B = 0x0400,
|
WPAD_BUTTON_B = 0x0400,
|
||||||
|
//! The A button.
|
||||||
WPAD_BUTTON_A = 0x0800,
|
WPAD_BUTTON_A = 0x0800,
|
||||||
|
//! The - button.
|
||||||
WPAD_BUTTON_MINUS = 0x1000,
|
WPAD_BUTTON_MINUS = 0x1000,
|
||||||
|
//! The Z button on the Nunchuk extension.
|
||||||
WPAD_BUTTON_Z = 0x2000,
|
WPAD_BUTTON_Z = 0x2000,
|
||||||
|
//! The C button on the Nunchuk extension.
|
||||||
WPAD_BUTTON_C = 0x4000,
|
WPAD_BUTTON_C = 0x4000,
|
||||||
|
//! The HOME button.
|
||||||
WPAD_BUTTON_HOME = 0x8000,
|
WPAD_BUTTON_HOME = 0x8000,
|
||||||
} WPADButton;
|
} WPADButton;
|
||||||
|
|
||||||
|
//! Nunchuk buttons.
|
||||||
|
typedef enum WPADNunchukButton
|
||||||
|
{
|
||||||
|
//! The emulated left button on the Nunchuk stick or the left button of the D-pad on the Wii Remote.
|
||||||
|
WPAD_NUNCHUK_STICK_EMULATION_LEFT = 0x0001,
|
||||||
|
//! The emulated right button on the Nunchuk stick or the right button of the D-pad on the Wii Remote.
|
||||||
|
WPAD_NUNCHUK_STICK_EMULATION_RIGHT = 0x0002,
|
||||||
|
//! The emulated down button on the Nunchuk stick or the down button of the D-pad on the Wii Remote.
|
||||||
|
WPAD_NUNCHUK_STICK_EMULATION_DOWN = 0x0004,
|
||||||
|
//! The emulated up button on the Nunchuk stick or the up button of the D-pad on the Wii Remote.
|
||||||
|
WPAD_NUNCHUK_STICK_EMULATION_UP = 0x0008,
|
||||||
|
//! The Z button.
|
||||||
|
WPAD_NUNCHUK_BUTTON_Z = 0x2000,
|
||||||
|
//! The C button.
|
||||||
|
WPAD_NUNCHUK_BUTTON_C = 0x4000,
|
||||||
|
} WPADNunchukButton;
|
||||||
|
|
||||||
|
//! Classic Controller buttons.
|
||||||
typedef enum WPADClassicButton
|
typedef enum WPADClassicButton
|
||||||
{
|
{
|
||||||
WPAD_CLASSIC_BUTTON_UP = 0x0001,
|
//! The up button of the D-pad.
|
||||||
WPAD_CLASSIC_BUTTON_LEFT = 0x0002,
|
WPAD_CLASSIC_BUTTON_UP = 0x00000001,
|
||||||
WPAD_CLASSIC_BUTTON_ZR = 0x0004,
|
//! The left button of the D-pad.
|
||||||
WPAD_CLASSIC_BUTTON_X = 0x0008,
|
WPAD_CLASSIC_BUTTON_LEFT = 0x00000002,
|
||||||
WPAD_CLASSIC_BUTTON_A = 0x0010,
|
//! The ZR button.
|
||||||
WPAD_CLASSIC_BUTTON_Y = 0x0020,
|
WPAD_CLASSIC_BUTTON_ZR = 0x00000004,
|
||||||
WPAD_CLASSIC_BUTTON_B = 0x0040,
|
//! The X button.
|
||||||
WPAD_CLASSIC_BUTTON_ZL = 0x0080,
|
WPAD_CLASSIC_BUTTON_X = 0x00000008,
|
||||||
WPAD_CLASSIC_BUTTON_R = 0x0200,
|
//! The A button.
|
||||||
WPAD_CLASSIC_BUTTON_PLUS = 0x0400,
|
WPAD_CLASSIC_BUTTON_A = 0x00000010,
|
||||||
WPAD_CLASSIC_BUTTON_HOME = 0x0800,
|
//! The Y button.
|
||||||
WPAD_CLASSIC_BUTTON_MINUS = 0x1000,
|
WPAD_CLASSIC_BUTTON_Y = 0x00000020,
|
||||||
WPAD_CLASSIC_BUTTON_L = 0x2000,
|
//! The B button.
|
||||||
WPAD_CLASSIC_BUTTON_DOWN = 0x4000,
|
WPAD_CLASSIC_BUTTON_B = 0x00000040,
|
||||||
WPAD_CLASSIC_BUTTON_RIGHT = 0x8000,
|
//! The ZL button.
|
||||||
|
WPAD_CLASSIC_BUTTON_ZL = 0x00000080,
|
||||||
|
//! The R button.
|
||||||
|
WPAD_CLASSIC_BUTTON_R = 0x00000200,
|
||||||
|
//! The + button.
|
||||||
|
WPAD_CLASSIC_BUTTON_PLUS = 0x00000400,
|
||||||
|
//! The HOME button.
|
||||||
|
WPAD_CLASSIC_BUTTON_HOME = 0x00000800,
|
||||||
|
//! The - button.
|
||||||
|
WPAD_CLASSIC_BUTTON_MINUS = 0x00001000,
|
||||||
|
//! The L button.
|
||||||
|
WPAD_CLASSIC_BUTTON_L = 0x00002000,
|
||||||
|
//! The down button of the D-pad.
|
||||||
|
WPAD_CLASSIC_BUTTON_DOWN = 0x00004000,
|
||||||
|
//! The right button of the D-pad.
|
||||||
|
WPAD_CLASSIC_BUTTON_RIGHT = 0x00008000,
|
||||||
|
//! The emulated left button on the left stick.
|
||||||
|
WPAD_CLASSIC_STICK_L_EMULATION_LEFT = 0x00010000,
|
||||||
|
//! The emulated right button on the left stick.
|
||||||
|
WPAD_CLASSIC_STICK_L_EMULATION_RIGHT = 0x00020000,
|
||||||
|
//! The emulated down button on the left stick.
|
||||||
|
WPAD_CLASSIC_STICK_L_EMULATION_DOWN = 0x00040000,
|
||||||
|
//! The emulated up button on the left stick.
|
||||||
|
WPAD_CLASSIC_STICK_L_EMULATION_UP = 0x00080000,
|
||||||
|
//! The emulated left button on the right stick.
|
||||||
|
WPAD_CLASSIC_STICK_R_EMULATION_LEFT = 0x00100000,
|
||||||
|
//! The emulated right button on the right stick.
|
||||||
|
WPAD_CLASSIC_STICK_R_EMULATION_RIGHT = 0x00200000,
|
||||||
|
//! The emulated down button on the right stick.
|
||||||
|
WPAD_CLASSIC_STICK_R_EMULATION_DOWN = 0x00400000,
|
||||||
|
//! The emulated up button on the right stick.
|
||||||
|
WPAD_CLASSIC_STICK_R_EMULATION_UP = 0x00800000,
|
||||||
} WPADClassicButton;
|
} WPADClassicButton;
|
||||||
|
|
||||||
|
//! Pro Controller buttons.
|
||||||
typedef enum WPADProButton
|
typedef enum WPADProButton
|
||||||
{
|
{
|
||||||
|
//! The up button of the D-pad.
|
||||||
WPAD_PRO_BUTTON_UP = 0x00000001,
|
WPAD_PRO_BUTTON_UP = 0x00000001,
|
||||||
|
//! The left button of the D-pad.
|
||||||
WPAD_PRO_BUTTON_LEFT = 0x00000002,
|
WPAD_PRO_BUTTON_LEFT = 0x00000002,
|
||||||
|
//! The ZR button.
|
||||||
WPAD_PRO_TRIGGER_ZR = 0x00000004,
|
WPAD_PRO_TRIGGER_ZR = 0x00000004,
|
||||||
|
//! The X button.
|
||||||
WPAD_PRO_BUTTON_X = 0x00000008,
|
WPAD_PRO_BUTTON_X = 0x00000008,
|
||||||
|
//! The A button.
|
||||||
WPAD_PRO_BUTTON_A = 0x00000010,
|
WPAD_PRO_BUTTON_A = 0x00000010,
|
||||||
|
//! The Y button.
|
||||||
WPAD_PRO_BUTTON_Y = 0x00000020,
|
WPAD_PRO_BUTTON_Y = 0x00000020,
|
||||||
|
//! The B button.
|
||||||
WPAD_PRO_BUTTON_B = 0x00000040,
|
WPAD_PRO_BUTTON_B = 0x00000040,
|
||||||
|
//! The ZL button.
|
||||||
WPAD_PRO_TRIGGER_ZL = 0x00000080,
|
WPAD_PRO_TRIGGER_ZL = 0x00000080,
|
||||||
|
//! Reserved.
|
||||||
WPAD_PRO_RESERVED = 0x00000100,
|
WPAD_PRO_RESERVED = 0x00000100,
|
||||||
|
//! The right trigger button.
|
||||||
WPAD_PRO_TRIGGER_R = 0x00000200,
|
WPAD_PRO_TRIGGER_R = 0x00000200,
|
||||||
|
//! The + button.
|
||||||
WPAD_PRO_BUTTON_PLUS = 0x00000400,
|
WPAD_PRO_BUTTON_PLUS = 0x00000400,
|
||||||
|
//! The HOME button.
|
||||||
WPAD_PRO_BUTTON_HOME = 0x00000800,
|
WPAD_PRO_BUTTON_HOME = 0x00000800,
|
||||||
|
//! The - button.
|
||||||
WPAD_PRO_BUTTON_MINUS = 0x00001000,
|
WPAD_PRO_BUTTON_MINUS = 0x00001000,
|
||||||
|
//! The left trigger button.
|
||||||
WPAD_PRO_TRIGGER_L = 0x00002000,
|
WPAD_PRO_TRIGGER_L = 0x00002000,
|
||||||
|
//! The down button of the D-pad.
|
||||||
WPAD_PRO_BUTTON_DOWN = 0x00004000,
|
WPAD_PRO_BUTTON_DOWN = 0x00004000,
|
||||||
|
//! The right button of the D-pad.
|
||||||
WPAD_PRO_BUTTON_RIGHT = 0x00008000,
|
WPAD_PRO_BUTTON_RIGHT = 0x00008000,
|
||||||
|
//! The right stick button.
|
||||||
WPAD_PRO_BUTTON_STICK_R = 0x00010000,
|
WPAD_PRO_BUTTON_STICK_R = 0x00010000,
|
||||||
|
//! The left stick button.
|
||||||
WPAD_PRO_BUTTON_STICK_L = 0x00020000,
|
WPAD_PRO_BUTTON_STICK_L = 0x00020000,
|
||||||
|
//! The emulated up button on the left stick.
|
||||||
WPAD_PRO_STICK_L_EMULATION_UP = 0x00200000,
|
WPAD_PRO_STICK_L_EMULATION_UP = 0x00200000,
|
||||||
|
//! The emulated down button on the left stick.
|
||||||
WPAD_PRO_STICK_L_EMULATION_DOWN = 0x00100000,
|
WPAD_PRO_STICK_L_EMULATION_DOWN = 0x00100000,
|
||||||
|
//! The emulated left button on the left stick.
|
||||||
WPAD_PRO_STICK_L_EMULATION_LEFT = 0x00040000,
|
WPAD_PRO_STICK_L_EMULATION_LEFT = 0x00040000,
|
||||||
|
//! The emulated right button on the left stick.
|
||||||
WPAD_PRO_STICK_L_EMULATION_RIGHT = 0x00080000,
|
WPAD_PRO_STICK_L_EMULATION_RIGHT = 0x00080000,
|
||||||
|
//! The emulated up button on the right stick.
|
||||||
WPAD_PRO_STICK_R_EMULATION_UP = 0x02000000,
|
WPAD_PRO_STICK_R_EMULATION_UP = 0x02000000,
|
||||||
|
//! The emulated down button on the right stick.
|
||||||
WPAD_PRO_STICK_R_EMULATION_DOWN = 0x01000000,
|
WPAD_PRO_STICK_R_EMULATION_DOWN = 0x01000000,
|
||||||
|
//! The emulated left button on the right stick.
|
||||||
WPAD_PRO_STICK_R_EMULATION_LEFT = 0x00400000,
|
WPAD_PRO_STICK_R_EMULATION_LEFT = 0x00400000,
|
||||||
|
//! The emulated right button on the right stick.
|
||||||
WPAD_PRO_STICK_R_EMULATION_RIGHT = 0x00800000,
|
WPAD_PRO_STICK_R_EMULATION_RIGHT = 0x00800000,
|
||||||
} WPADProButton;
|
} WPADProButton;
|
||||||
|
|
||||||
|
//! 2D vector.
|
||||||
struct WPADVec2D
|
struct WPADVec2D
|
||||||
{
|
{
|
||||||
|
//! x.
|
||||||
int16_t x;
|
int16_t x;
|
||||||
|
//! y.
|
||||||
int16_t y;
|
int16_t y;
|
||||||
};
|
};
|
||||||
WUT_CHECK_OFFSET(WPADVec2D, 0x00, x);
|
WUT_CHECK_OFFSET(WPADVec2D, 0x00, x);
|
||||||
@ -116,7 +226,7 @@ struct WPADStatusProController
|
|||||||
{
|
{
|
||||||
WUT_UNKNOWN_BYTES(0x28);
|
WUT_UNKNOWN_BYTES(0x28);
|
||||||
|
|
||||||
//! A value from WPADExtensionType
|
//! A value from WPADExtensionType.
|
||||||
uint8_t extensionType;
|
uint8_t extensionType;
|
||||||
|
|
||||||
uint8_t err;
|
uint8_t err;
|
||||||
@ -139,9 +249,15 @@ typedef void (*WPADSamplingCallback)(WPADChan chan);
|
|||||||
typedef void (*WPADExtensionCallback)(WPADChan chan, int32_t status);
|
typedef void (*WPADExtensionCallback)(WPADChan chan, int32_t status);
|
||||||
typedef void (*WPADConnectCallback)(WPADChan chan, int32_t status);
|
typedef void (*WPADConnectCallback)(WPADChan chan, int32_t status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialises the WPAD library for use.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
WPADInit();
|
WPADInit();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleans up and frees the WPAD library.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
WPADShutdown();
|
WPADShutdown();
|
||||||
|
|
||||||
|
@ -20,54 +20,86 @@ typedef struct VPADTouchData VPADTouchData;
|
|||||||
typedef struct VPADVec2D VPADVec2D;
|
typedef struct VPADVec2D VPADVec2D;
|
||||||
typedef struct VPADVec3D VPADVec3D;
|
typedef struct VPADVec3D VPADVec3D;
|
||||||
|
|
||||||
|
//! Wii U GamePad buttons.
|
||||||
typedef enum VPADButtons
|
typedef enum VPADButtons
|
||||||
{
|
{
|
||||||
|
//! The A button.
|
||||||
VPAD_BUTTON_A = 0x8000,
|
VPAD_BUTTON_A = 0x8000,
|
||||||
|
//! The B button.
|
||||||
VPAD_BUTTON_B = 0x4000,
|
VPAD_BUTTON_B = 0x4000,
|
||||||
|
//! The X button.
|
||||||
VPAD_BUTTON_X = 0x2000,
|
VPAD_BUTTON_X = 0x2000,
|
||||||
|
//! The Y button.
|
||||||
VPAD_BUTTON_Y = 0x1000,
|
VPAD_BUTTON_Y = 0x1000,
|
||||||
|
//! The left button of the D-pad.
|
||||||
VPAD_BUTTON_LEFT = 0x0800,
|
VPAD_BUTTON_LEFT = 0x0800,
|
||||||
|
//! The right button of the D-pad.
|
||||||
VPAD_BUTTON_RIGHT = 0x0400,
|
VPAD_BUTTON_RIGHT = 0x0400,
|
||||||
|
//! The up button of the D-pad.
|
||||||
VPAD_BUTTON_UP = 0x0200,
|
VPAD_BUTTON_UP = 0x0200,
|
||||||
|
//! The down button of the D-pad.
|
||||||
VPAD_BUTTON_DOWN = 0x0100,
|
VPAD_BUTTON_DOWN = 0x0100,
|
||||||
|
//! The ZL button.
|
||||||
VPAD_BUTTON_ZL = 0x0080,
|
VPAD_BUTTON_ZL = 0x0080,
|
||||||
|
//! The ZR button.
|
||||||
VPAD_BUTTON_ZR = 0x0040,
|
VPAD_BUTTON_ZR = 0x0040,
|
||||||
|
//! The L button.
|
||||||
VPAD_BUTTON_L = 0x0020,
|
VPAD_BUTTON_L = 0x0020,
|
||||||
|
//! The R button.
|
||||||
VPAD_BUTTON_R = 0x0010,
|
VPAD_BUTTON_R = 0x0010,
|
||||||
|
//! The + button.
|
||||||
VPAD_BUTTON_PLUS = 0x0008,
|
VPAD_BUTTON_PLUS = 0x0008,
|
||||||
|
//! The - button.
|
||||||
VPAD_BUTTON_MINUS = 0x0004,
|
VPAD_BUTTON_MINUS = 0x0004,
|
||||||
|
//! The HOME button.
|
||||||
VPAD_BUTTON_HOME = 0x0002,
|
VPAD_BUTTON_HOME = 0x0002,
|
||||||
|
//! The SYNC button.
|
||||||
VPAD_BUTTON_SYNC = 0x0001,
|
VPAD_BUTTON_SYNC = 0x0001,
|
||||||
|
//! The right stick button.
|
||||||
VPAD_BUTTON_STICK_R = 0x00020000,
|
VPAD_BUTTON_STICK_R = 0x00020000,
|
||||||
|
//! The left stick button.
|
||||||
VPAD_BUTTON_STICK_L = 0x00040000,
|
VPAD_BUTTON_STICK_L = 0x00040000,
|
||||||
|
//! The TV button.
|
||||||
VPAD_BUTTON_TV = 0x00010000,
|
VPAD_BUTTON_TV = 0x00010000,
|
||||||
|
//! The emulated left button on the right stick.
|
||||||
VPAD_STICK_R_EMULATION_LEFT = 0x04000000,
|
VPAD_STICK_R_EMULATION_LEFT = 0x04000000,
|
||||||
|
//! The emulated right button on the right stick.
|
||||||
VPAD_STICK_R_EMULATION_RIGHT = 0x02000000,
|
VPAD_STICK_R_EMULATION_RIGHT = 0x02000000,
|
||||||
|
//! The emulated up button on the right stick.
|
||||||
VPAD_STICK_R_EMULATION_UP = 0x01000000,
|
VPAD_STICK_R_EMULATION_UP = 0x01000000,
|
||||||
|
//! The emulated down button on the right stick.
|
||||||
VPAD_STICK_R_EMULATION_DOWN = 0x00800000,
|
VPAD_STICK_R_EMULATION_DOWN = 0x00800000,
|
||||||
|
//! The emulated left button on the left stick.
|
||||||
VPAD_STICK_L_EMULATION_LEFT = 0x40000000,
|
VPAD_STICK_L_EMULATION_LEFT = 0x40000000,
|
||||||
|
//! The emulated right button on the left stick.
|
||||||
VPAD_STICK_L_EMULATION_RIGHT = 0x20000000,
|
VPAD_STICK_L_EMULATION_RIGHT = 0x20000000,
|
||||||
|
//! The emulated up button on the left stick.
|
||||||
VPAD_STICK_L_EMULATION_UP = 0x10000000,
|
VPAD_STICK_L_EMULATION_UP = 0x10000000,
|
||||||
|
//! The emulated down button on the left stick.
|
||||||
VPAD_STICK_L_EMULATION_DOWN = 0x08000000,
|
VPAD_STICK_L_EMULATION_DOWN = 0x08000000,
|
||||||
} VPADButtons;
|
} VPADButtons;
|
||||||
|
|
||||||
|
//! Wii U GamePad channel.
|
||||||
typedef enum VPADChan
|
typedef enum VPADChan
|
||||||
{
|
{
|
||||||
|
//! Channel 0.
|
||||||
VPAD_CHAN_0 = 0,
|
VPAD_CHAN_0 = 0,
|
||||||
} VPADChan;
|
} VPADChan;
|
||||||
|
|
||||||
|
//! Touch pad validity.
|
||||||
typedef enum VPADTouchPadValidity
|
typedef enum VPADTouchPadValidity
|
||||||
{
|
{
|
||||||
//! Both X and Y touchpad positions are accurate
|
//! Both X and Y touchpad positions are accurate.
|
||||||
VPAD_VALID = 0x0,
|
VPAD_VALID = 0x0,
|
||||||
|
|
||||||
//! X position is inaccurate
|
//! X position is inaccurate.
|
||||||
VPAD_INVALID_X = 0x1,
|
VPAD_INVALID_X = 0x1,
|
||||||
|
|
||||||
//! Y position is inaccurate
|
//! Y position is inaccurate.
|
||||||
VPAD_INVALID_Y = 0x2,
|
VPAD_INVALID_Y = 0x2,
|
||||||
} VPADTouchPadValidity;
|
} VPADTouchPadValidity;
|
||||||
|
|
||||||
|
//! Touch pad resolution.
|
||||||
typedef enum VPADTouchPadResolution
|
typedef enum VPADTouchPadResolution
|
||||||
{
|
{
|
||||||
//! 1920 x 1080 resolution.
|
//! 1920 x 1080 resolution.
|
||||||
@ -78,9 +110,10 @@ typedef enum VPADTouchPadResolution
|
|||||||
VPAD_TP_854X480 = 2,
|
VPAD_TP_854X480 = 2,
|
||||||
} VPADTouchPadResolution;
|
} VPADTouchPadResolution;
|
||||||
|
|
||||||
|
//! Read error.
|
||||||
typedef enum VPADReadError
|
typedef enum VPADReadError
|
||||||
{
|
{
|
||||||
//! No error occured, and data was written to the buffers.
|
//! No error occurred, and data was written to the buffers.
|
||||||
VPAD_READ_SUCCESS = 0,
|
VPAD_READ_SUCCESS = 0,
|
||||||
//! There was no sample new data available to write.
|
//! There was no sample new data available to write.
|
||||||
VPAD_READ_NO_SAMPLES = -1,
|
VPAD_READ_NO_SAMPLES = -1,
|
||||||
@ -88,6 +121,7 @@ typedef enum VPADReadError
|
|||||||
VPAD_READ_INVALID_CONTROLLER = -2,
|
VPAD_READ_INVALID_CONTROLLER = -2,
|
||||||
} VPADReadError;
|
} VPADReadError;
|
||||||
|
|
||||||
|
//! LCD mode.
|
||||||
typedef enum VPADLcdMode
|
typedef enum VPADLcdMode
|
||||||
{
|
{
|
||||||
//! Display is in standby and will turn back on if any buttons are pressed.
|
//! Display is in standby and will turn back on if any buttons are pressed.
|
||||||
@ -98,19 +132,26 @@ typedef enum VPADLcdMode
|
|||||||
VPAD_LCD_ON = 0xFF,
|
VPAD_LCD_ON = 0xFF,
|
||||||
} VPADLcdMode;
|
} VPADLcdMode;
|
||||||
|
|
||||||
|
//! 2D vector.
|
||||||
struct VPADVec2D
|
struct VPADVec2D
|
||||||
{
|
{
|
||||||
|
//! x.
|
||||||
float x;
|
float x;
|
||||||
|
//! y.
|
||||||
float y;
|
float y;
|
||||||
};
|
};
|
||||||
WUT_CHECK_OFFSET(VPADVec2D, 0x00, x);
|
WUT_CHECK_OFFSET(VPADVec2D, 0x00, x);
|
||||||
WUT_CHECK_OFFSET(VPADVec2D, 0x04, y);
|
WUT_CHECK_OFFSET(VPADVec2D, 0x04, y);
|
||||||
WUT_CHECK_SIZE(VPADVec2D, 0x08);
|
WUT_CHECK_SIZE(VPADVec2D, 0x08);
|
||||||
|
|
||||||
|
//! 3D vector.
|
||||||
struct VPADVec3D
|
struct VPADVec3D
|
||||||
{
|
{
|
||||||
|
//! x.
|
||||||
float x;
|
float x;
|
||||||
|
//! y.
|
||||||
float y;
|
float y;
|
||||||
|
//! z.
|
||||||
float z;
|
float z;
|
||||||
};
|
};
|
||||||
WUT_CHECK_OFFSET(VPADVec3D, 0x00, x);
|
WUT_CHECK_OFFSET(VPADVec3D, 0x00, x);
|
||||||
@ -118,10 +159,14 @@ WUT_CHECK_OFFSET(VPADVec3D, 0x04, y);
|
|||||||
WUT_CHECK_OFFSET(VPADVec3D, 0x08, z);
|
WUT_CHECK_OFFSET(VPADVec3D, 0x08, z);
|
||||||
WUT_CHECK_SIZE(VPADVec3D, 0x0C);
|
WUT_CHECK_SIZE(VPADVec3D, 0x0C);
|
||||||
|
|
||||||
|
//! Direction.
|
||||||
struct VPADDirection
|
struct VPADDirection
|
||||||
{
|
{
|
||||||
|
//! x.
|
||||||
VPADVec3D x;
|
VPADVec3D x;
|
||||||
|
//! y.
|
||||||
VPADVec3D y;
|
VPADVec3D y;
|
||||||
|
//! z.
|
||||||
VPADVec3D z;
|
VPADVec3D z;
|
||||||
};
|
};
|
||||||
WUT_CHECK_OFFSET(VPADDirection, 0x00, x);
|
WUT_CHECK_OFFSET(VPADDirection, 0x00, x);
|
||||||
@ -129,11 +174,16 @@ WUT_CHECK_OFFSET(VPADDirection, 0x0C, y);
|
|||||||
WUT_CHECK_OFFSET(VPADDirection, 0x18, z);
|
WUT_CHECK_OFFSET(VPADDirection, 0x18, z);
|
||||||
WUT_CHECK_SIZE(VPADDirection, 0x24);
|
WUT_CHECK_SIZE(VPADDirection, 0x24);
|
||||||
|
|
||||||
|
//! Touch calibration parameter.
|
||||||
struct VPADTouchCalibrationParam
|
struct VPADTouchCalibrationParam
|
||||||
{
|
{
|
||||||
|
//! X offset.
|
||||||
uint16_t adjustX;
|
uint16_t adjustX;
|
||||||
|
//! Y offset.
|
||||||
uint16_t adjustY;
|
uint16_t adjustY;
|
||||||
|
//! X scale.
|
||||||
float scaleX;
|
float scaleX;
|
||||||
|
//! Y scale.
|
||||||
float scaleY;
|
float scaleY;
|
||||||
};
|
};
|
||||||
WUT_CHECK_OFFSET(VPADTouchCalibrationParam, 0x00, adjustX);
|
WUT_CHECK_OFFSET(VPADTouchCalibrationParam, 0x00, adjustX);
|
||||||
@ -142,6 +192,7 @@ WUT_CHECK_OFFSET(VPADTouchCalibrationParam, 0x04, scaleX);
|
|||||||
WUT_CHECK_OFFSET(VPADTouchCalibrationParam, 0x08, scaleY);
|
WUT_CHECK_OFFSET(VPADTouchCalibrationParam, 0x08, scaleY);
|
||||||
WUT_CHECK_SIZE(VPADTouchCalibrationParam, 0x0C);
|
WUT_CHECK_SIZE(VPADTouchCalibrationParam, 0x0C);
|
||||||
|
|
||||||
|
//! Touch data.
|
||||||
struct VPADTouchData
|
struct VPADTouchData
|
||||||
{
|
{
|
||||||
//! The x-coordinate of a touched point.
|
//! The x-coordinate of a touched point.
|
||||||
@ -149,10 +200,10 @@ struct VPADTouchData
|
|||||||
//! The y-coordinate of a touched point.
|
//! The y-coordinate of a touched point.
|
||||||
uint16_t y;
|
uint16_t y;
|
||||||
|
|
||||||
//! 0 if screen is not currently being touched
|
//! 0 if screen is not currently being touched.
|
||||||
uint16_t touched;
|
uint16_t touched;
|
||||||
|
|
||||||
//! Bitfield of #VPADTouchPadValidity to indicate how touch sample accuracy
|
//! Bitfield of #VPADTouchPadValidity to indicate how touch sample accuracy.
|
||||||
uint16_t validity;
|
uint16_t validity;
|
||||||
};
|
};
|
||||||
WUT_CHECK_OFFSET(VPADTouchData, 0x00, x);
|
WUT_CHECK_OFFSET(VPADTouchData, 0x00, x);
|
||||||
@ -176,63 +227,63 @@ WUT_CHECK_SIZE(VPADAccStatus, 0x1c);
|
|||||||
|
|
||||||
struct WUT_PACKED VPADStatus
|
struct WUT_PACKED VPADStatus
|
||||||
{
|
{
|
||||||
//! Indicates what VPADButtons are held down
|
//! Indicates what VPADButtons are held down.
|
||||||
uint32_t hold;
|
uint32_t hold;
|
||||||
|
|
||||||
//! Indicates what VPADButtons have been pressed since last sample
|
//! Indicates what VPADButtons have been pressed since last sample.
|
||||||
uint32_t trigger;
|
uint32_t trigger;
|
||||||
|
|
||||||
//! Indicates what VPADButtons have been released since last sample
|
//! Indicates what VPADButtons have been released since last sample.
|
||||||
uint32_t release;
|
uint32_t release;
|
||||||
|
|
||||||
//! Position of left analog stick
|
//! Position of left analog stick.
|
||||||
VPADVec2D leftStick;
|
VPADVec2D leftStick;
|
||||||
|
|
||||||
//! Position of right analog stick
|
//! Position of right analog stick.
|
||||||
VPADVec2D rightStick;
|
VPADVec2D rightStick;
|
||||||
|
|
||||||
//! Status of DRC accelorometer
|
//! Status of DRC accelorometer.
|
||||||
VPADAccStatus accelorometer;
|
VPADAccStatus accelorometer;
|
||||||
|
|
||||||
//! Status of DRC gyro
|
//! Status of DRC gyro.
|
||||||
VPADVec3D gyro;
|
VPADVec3D gyro;
|
||||||
|
|
||||||
//! Status of DRC angle
|
//! Status of DRC angle.
|
||||||
VPADVec3D angle;
|
VPADVec3D angle;
|
||||||
|
|
||||||
uint8_t error;
|
uint8_t error;
|
||||||
|
|
||||||
WUT_UNKNOWN_BYTES(0x01);
|
WUT_UNKNOWN_BYTES(0x01);
|
||||||
|
|
||||||
//! Current touch position on DRC
|
//! Current touch position on DRC.
|
||||||
VPADTouchData tpNormal;
|
VPADTouchData tpNormal;
|
||||||
|
|
||||||
//! Filtered touch position, first level of smoothing
|
//! Filtered touch position, first level of smoothing.
|
||||||
VPADTouchData tpFiltered1;
|
VPADTouchData tpFiltered1;
|
||||||
|
|
||||||
//! Filtered touch position, second level of smoothing
|
//! Filtered touch position, second level of smoothing.
|
||||||
VPADTouchData tpFiltered2;
|
VPADTouchData tpFiltered2;
|
||||||
|
|
||||||
WUT_UNKNOWN_BYTES(0x02);
|
WUT_UNKNOWN_BYTES(0x02);
|
||||||
|
|
||||||
VPADDirection direction;
|
VPADDirection direction;
|
||||||
|
|
||||||
//! Set to 1 if headphones are plugged in, 0 otherwise
|
//! Set to 1 if headphones are plugged in, 0 otherwise.
|
||||||
BOOL usingHeadphones;
|
BOOL usingHeadphones;
|
||||||
|
|
||||||
//! Status of DRC magnetometer
|
//! Status of DRC magnetometer.
|
||||||
VPADVec3D mag;
|
VPADVec3D mag;
|
||||||
|
|
||||||
//! Current volume set by the slide control
|
//! Current volume set by the slide control.
|
||||||
uint8_t slideVolume;
|
uint8_t slideVolume;
|
||||||
|
|
||||||
//! Battery level of controller
|
//! Battery level of controller.
|
||||||
uint8_t battery;
|
uint8_t battery;
|
||||||
|
|
||||||
//! Status of DRC microphone
|
//! Status of DRC microphone.
|
||||||
uint8_t micStatus;
|
uint8_t micStatus;
|
||||||
|
|
||||||
//! Unknown volume related value
|
//! Unknown volume related value.
|
||||||
uint8_t slideVolumeEx;
|
uint8_t slideVolumeEx;
|
||||||
|
|
||||||
WUT_UNKNOWN_BYTES(0x8);
|
WUT_UNKNOWN_BYTES(0x8);
|
||||||
@ -305,7 +356,7 @@ VPADShutdown();
|
|||||||
*
|
*
|
||||||
* \warning
|
* \warning
|
||||||
* You must check outError - the VPADStatus buffers may be filled with random
|
* You must check outError - the VPADStatus buffers may be filled with random
|
||||||
* or invalid data on error, not neccesarily zeroes.
|
* or invalid data on error, not necessarily zeroes.
|
||||||
*
|
*
|
||||||
* \return
|
* \return
|
||||||
* 0 on success or 1 on failure. Check outError for reason.
|
* 0 on success or 1 on failure. Check outError for reason.
|
||||||
@ -319,10 +370,36 @@ VPADRead(VPADChan chan,
|
|||||||
uint32_t count,
|
uint32_t count,
|
||||||
VPADReadError *outError);
|
VPADReadError *outError);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get touch pad calibration parameters.
|
||||||
|
*
|
||||||
|
* \note
|
||||||
|
* Retail Wii U systems have a single Gamepad on \link VPADChan::VPAD_CHAN_0
|
||||||
|
* VPAD_CHAN_0. \endlink
|
||||||
|
*
|
||||||
|
* \param chan
|
||||||
|
* Denotes which channel to get the calibration parameter from.
|
||||||
|
*
|
||||||
|
* \param outParam
|
||||||
|
* Pointer to the calibration to get.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
VPADGetTPCalibrationParam(VPADChan chan,
|
VPADGetTPCalibrationParam(VPADChan chan,
|
||||||
VPADTouchCalibrationParam *outParam);
|
VPADTouchCalibrationParam *outParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set touch pad calibration parameters.
|
||||||
|
*
|
||||||
|
* \note
|
||||||
|
* Retail Wii U systems have a single Gamepad on \link VPADChan::VPAD_CHAN_0
|
||||||
|
* VPAD_CHAN_0. \endlink
|
||||||
|
*
|
||||||
|
* \param chan
|
||||||
|
* Denotes which channel to set the calibration parameter to.
|
||||||
|
*
|
||||||
|
* \param param
|
||||||
|
* Pointer to the calibration to set.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
VPADSetTPCalibrationParam(VPADChan chan,
|
VPADSetTPCalibrationParam(VPADChan chan,
|
||||||
const VPADTouchCalibrationParam *param);
|
const VPADTouchCalibrationParam *param);
|
||||||
|
Loading…
Reference in New Issue
Block a user