diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 60662f7..0a7a43f 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -6,7 +6,7 @@ if(DOXYGEN_FOUND) set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) 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_GENERATE_HTML YES) diff --git a/include/nsysnet/nssl.h b/include/nsysnet/nssl.h index 7d1d8a9..b2e32ee 100644 --- a/include/nsysnet/nssl.h +++ b/include/nsysnet/nssl.h @@ -227,7 +227,7 @@ NSSLCreateContext(int32_t unk); * The NSSL context to destroy. * * \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 NSSLDestroyContext(NSSLContextHandle context); diff --git a/include/padscore/kpad.h b/include/padscore/kpad.h index 5f0c587..2b34242 100644 --- a/include/padscore/kpad.h +++ b/include/padscore/kpad.h @@ -5,95 +5,160 @@ /** * \defgroup padscore_kpad KPAD * \ingroup padscore + * + * KPAD is a high-level library over WPAD. + * * @{ */ #ifdef __cplusplus extern "C" { #endif +//! Wii Remote channel. typedef enum WPADChan KPADChan; +//! Data format. typedef enum WPADDataFormat KPADDataFormat; +//! Extension type. typedef enum WPADExtensionType KPADExtensionType; typedef struct KPADStatus KPADStatus; typedef struct KPADVec2D KPADVec2D; +typedef struct KPADVec3D KPADVec3D; +//! Error. typedef enum KPADError { + //! No errors. KPAD_ERROR_OK = 0, } KPADError; +//! 2D vector. struct KPADVec2D { - float x; - float y; + //! x. + float x; + //! y. + float y; }; WUT_CHECK_OFFSET(KPADVec2D, 0x00, x); WUT_CHECK_OFFSET(KPADVec2D, 0x04, y); 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 { - //! Indicates what KPADButtons are held down + //! Indicates what KPADButtons are held down. uint32_t hold; - //! Indicates what KPADButtons have been pressed since last sample + //! Indicates what KPADButtons have been pressed since last sample. uint32_t trigger; - //! Indicates what KPADButtons have been released since last sample + //! Indicates what KPADButtons have been released since last sample. 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; WUT_UNKNOWN_BYTES(3 * 4); + //! Angle. KPADVec2D angle; WUT_UNKNOWN_BYTES(8 * 4); - //! Value from KPADExtensionType + //! Value from KPADExtensionType. uint8_t extensionType; - //! Value from KPADError + //! Value from KPADError. int8_t error; - uint8_t posValid; + //! Validity of the result. + int8_t posValid; - //! Value from KPADDataFormat + //! Value from KPADDataFormat. 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 { - // For WPAD_EXT_NUNCHUK + //! Structure to use when extension type is set to \link WPAD_EXT_NUNCHUK \endlink. struct { + //! Position of the analog 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; - // For WPAD_EXT_CLASSIC + //! Structure to use when extension type is set to \link WPAD_EXT_CLASSIC \endlink. struct { + //! 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; + //! Position of left analog stick. KPADVec2D leftStick; + //! Position of right analog stick. KPADVec2D rightStick; + //! Left trigger. float leftTrigger; + //! Right trigger. float rightTrigger; } classic; - // For WPAD_EXT_PRO_CONTROLLER + //! Structure to use when extension type is set to \link WPAD_EXT_PRO_CONTROLLER \endlink. struct { + //! 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; + //! Position of left analog stick. KPADVec2D leftStick; + //! Position of right analog stick. KPADVec2D rightStick; + //! Is charging flag. int32_t charging; + //! Is wired flag. int32_t wired; } pro; @@ -105,6 +170,9 @@ struct KPADStatus WUT_CHECK_OFFSET(KPADStatus, 0x00, hold); WUT_CHECK_OFFSET(KPADStatus, 0x04, trigger); 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, 0x34, angle); WUT_CHECK_OFFSET(KPADStatus, 0x5C, extensionType); @@ -113,6 +181,12 @@ WUT_CHECK_OFFSET(KPADStatus, 0x5E, posValid); WUT_CHECK_OFFSET(KPADStatus, 0x5F, format); // For WPAD_EXT_NUNCHUK 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 WUT_CHECK_OFFSET(KPADStatus, 0x60, classic.hold); 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_SIZE(KPADStatus, 0xF0); +/** + * Initialises the KPAD library for use. + */ void 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 KPADRead(KPADChan chan, KPADStatus *data, 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 KPADReadEx(KPADChan chan, KPADStatus *data, diff --git a/include/padscore/wpad.h b/include/padscore/wpad.h index e5e7e6d..03c2b4c 100644 --- a/include/padscore/wpad.h +++ b/include/padscore/wpad.h @@ -4,6 +4,9 @@ /** * \defgroup padscore_wpad WPAD * \ingroup padscore + * + * WPAD is a low-level library under KPAD. + * * @{ */ #ifdef __cplusplus @@ -13,99 +16,206 @@ extern "C" { typedef struct WPADStatusProController WPADStatusProController; typedef struct WPADVec2D WPADVec2D; +//! Wii Remote channel. typedef enum WPADChan { + //! Channel 0. WPAD_CHAN_0 = 0, + //! Channel 1. WPAD_CHAN_1 = 1, + //! Channel 2. WPAD_CHAN_2 = 2, + //! Channel 3. WPAD_CHAN_3 = 3, } WPADChan; +//! Data format. typedef enum WPADDataFormat { WPAD_FMT_PRO_CONTROLLER = 22, } WPADDataFormat; +//! Extension type. typedef enum WPADExtensionType { + //! Wii Remote with no extension. WPAD_EXT_CORE = 0, + //! Nunchuk. WPAD_EXT_NUNCHUK = 1, + //! Classic Controller. WPAD_EXT_CLASSIC = 2, + //! Motion Plus. WPAD_EXT_MPLUS = 5, + //! Motion Plus with Nunchuk. WPAD_EXT_MPLUS_NUNCHUK = 6, + //! Motion Plus with Classic Controller. WPAD_EXT_MPLUS_CLASSIC = 7, + //! Pro Controller. WPAD_EXT_PRO_CONTROLLER = 31, } WPADExtensionType; +//! Wii Remote buttons. typedef enum WPADButton { + //! The left button of the D-pad. WPAD_BUTTON_LEFT = 0x0001, + //! The right button of the D-pad. WPAD_BUTTON_RIGHT = 0x0002, + //! The down button of the D-pad. WPAD_BUTTON_DOWN = 0x0004, + //! The up button of the D-pad. WPAD_BUTTON_UP = 0x0008, + //! The + button. WPAD_BUTTON_PLUS = 0x0010, + //! The 2 button. WPAD_BUTTON_2 = 0x0100, + //! The 1 button. WPAD_BUTTON_1 = 0x0200, + //! The B button. WPAD_BUTTON_B = 0x0400, + //! The A button. WPAD_BUTTON_A = 0x0800, + //! The - button. WPAD_BUTTON_MINUS = 0x1000, + //! The Z button on the Nunchuk extension. WPAD_BUTTON_Z = 0x2000, + //! The C button on the Nunchuk extension. WPAD_BUTTON_C = 0x4000, + //! The HOME button. WPAD_BUTTON_HOME = 0x8000, } 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 { - WPAD_CLASSIC_BUTTON_UP = 0x0001, - WPAD_CLASSIC_BUTTON_LEFT = 0x0002, - WPAD_CLASSIC_BUTTON_ZR = 0x0004, - WPAD_CLASSIC_BUTTON_X = 0x0008, - WPAD_CLASSIC_BUTTON_A = 0x0010, - WPAD_CLASSIC_BUTTON_Y = 0x0020, - WPAD_CLASSIC_BUTTON_B = 0x0040, - WPAD_CLASSIC_BUTTON_ZL = 0x0080, - WPAD_CLASSIC_BUTTON_R = 0x0200, - WPAD_CLASSIC_BUTTON_PLUS = 0x0400, - WPAD_CLASSIC_BUTTON_HOME = 0x0800, - WPAD_CLASSIC_BUTTON_MINUS = 0x1000, - WPAD_CLASSIC_BUTTON_L = 0x2000, - WPAD_CLASSIC_BUTTON_DOWN = 0x4000, - WPAD_CLASSIC_BUTTON_RIGHT = 0x8000, + //! The up button of the D-pad. + WPAD_CLASSIC_BUTTON_UP = 0x00000001, + //! The left button of the D-pad. + WPAD_CLASSIC_BUTTON_LEFT = 0x00000002, + //! The ZR button. + WPAD_CLASSIC_BUTTON_ZR = 0x00000004, + //! The X button. + WPAD_CLASSIC_BUTTON_X = 0x00000008, + //! The A button. + WPAD_CLASSIC_BUTTON_A = 0x00000010, + //! The Y button. + WPAD_CLASSIC_BUTTON_Y = 0x00000020, + //! The B button. + WPAD_CLASSIC_BUTTON_B = 0x00000040, + //! 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; +//! Pro Controller buttons. typedef enum WPADProButton { + //! The up button of the D-pad. WPAD_PRO_BUTTON_UP = 0x00000001, + //! The left button of the D-pad. WPAD_PRO_BUTTON_LEFT = 0x00000002, + //! The ZR button. WPAD_PRO_TRIGGER_ZR = 0x00000004, + //! The X button. WPAD_PRO_BUTTON_X = 0x00000008, + //! The A button. WPAD_PRO_BUTTON_A = 0x00000010, + //! The Y button. WPAD_PRO_BUTTON_Y = 0x00000020, + //! The B button. WPAD_PRO_BUTTON_B = 0x00000040, + //! The ZL button. WPAD_PRO_TRIGGER_ZL = 0x00000080, + //! Reserved. WPAD_PRO_RESERVED = 0x00000100, + //! The right trigger button. WPAD_PRO_TRIGGER_R = 0x00000200, + //! The + button. WPAD_PRO_BUTTON_PLUS = 0x00000400, + //! The HOME button. WPAD_PRO_BUTTON_HOME = 0x00000800, + //! The - button. WPAD_PRO_BUTTON_MINUS = 0x00001000, + //! The left trigger button. WPAD_PRO_TRIGGER_L = 0x00002000, + //! The down button of the D-pad. WPAD_PRO_BUTTON_DOWN = 0x00004000, + //! The right button of the D-pad. WPAD_PRO_BUTTON_RIGHT = 0x00008000, + //! The right stick button. WPAD_PRO_BUTTON_STICK_R = 0x00010000, + //! The left stick button. WPAD_PRO_BUTTON_STICK_L = 0x00020000, + //! The emulated up button on the left stick. WPAD_PRO_STICK_L_EMULATION_UP = 0x00200000, + //! The emulated down button on the left stick. WPAD_PRO_STICK_L_EMULATION_DOWN = 0x00100000, + //! The emulated left button on the left stick. WPAD_PRO_STICK_L_EMULATION_LEFT = 0x00040000, + //! The emulated right button on the left stick. WPAD_PRO_STICK_L_EMULATION_RIGHT = 0x00080000, + //! The emulated up button on the right stick. WPAD_PRO_STICK_R_EMULATION_UP = 0x02000000, + //! The emulated down button on the right stick. WPAD_PRO_STICK_R_EMULATION_DOWN = 0x01000000, + //! The emulated left button on the right stick. WPAD_PRO_STICK_R_EMULATION_LEFT = 0x00400000, + //! The emulated right button on the right stick. WPAD_PRO_STICK_R_EMULATION_RIGHT = 0x00800000, } WPADProButton; +//! 2D vector. struct WPADVec2D { + //! x. int16_t x; + //! y. int16_t y; }; WUT_CHECK_OFFSET(WPADVec2D, 0x00, x); @@ -116,7 +226,7 @@ struct WPADStatusProController { WUT_UNKNOWN_BYTES(0x28); - //! A value from WPADExtensionType + //! A value from WPADExtensionType. uint8_t extensionType; uint8_t err; @@ -139,9 +249,15 @@ typedef void (*WPADSamplingCallback)(WPADChan chan); typedef void (*WPADExtensionCallback)(WPADChan chan, int32_t status); typedef void (*WPADConnectCallback)(WPADChan chan, int32_t status); +/** + * Initialises the WPAD library for use. + */ void WPADInit(); +/** + * Cleans up and frees the WPAD library. + */ void WPADShutdown(); diff --git a/include/vpad/input.h b/include/vpad/input.h index d6593eb..b867e8d 100644 --- a/include/vpad/input.h +++ b/include/vpad/input.h @@ -20,54 +20,86 @@ typedef struct VPADTouchData VPADTouchData; typedef struct VPADVec2D VPADVec2D; typedef struct VPADVec3D VPADVec3D; +//! Wii U GamePad buttons. typedef enum VPADButtons { + //! The A button. VPAD_BUTTON_A = 0x8000, + //! The B button. VPAD_BUTTON_B = 0x4000, + //! The X button. VPAD_BUTTON_X = 0x2000, + //! The Y button. VPAD_BUTTON_Y = 0x1000, + //! The left button of the D-pad. VPAD_BUTTON_LEFT = 0x0800, + //! The right button of the D-pad. VPAD_BUTTON_RIGHT = 0x0400, + //! The up button of the D-pad. VPAD_BUTTON_UP = 0x0200, + //! The down button of the D-pad. VPAD_BUTTON_DOWN = 0x0100, + //! The ZL button. VPAD_BUTTON_ZL = 0x0080, + //! The ZR button. VPAD_BUTTON_ZR = 0x0040, + //! The L button. VPAD_BUTTON_L = 0x0020, + //! The R button. VPAD_BUTTON_R = 0x0010, + //! The + button. VPAD_BUTTON_PLUS = 0x0008, + //! The - button. VPAD_BUTTON_MINUS = 0x0004, + //! The HOME button. VPAD_BUTTON_HOME = 0x0002, + //! The SYNC button. VPAD_BUTTON_SYNC = 0x0001, + //! The right stick button. VPAD_BUTTON_STICK_R = 0x00020000, + //! The left stick button. VPAD_BUTTON_STICK_L = 0x00040000, + //! The TV button. VPAD_BUTTON_TV = 0x00010000, + //! The emulated left button on the right stick. VPAD_STICK_R_EMULATION_LEFT = 0x04000000, + //! The emulated right button on the right stick. VPAD_STICK_R_EMULATION_RIGHT = 0x02000000, + //! The emulated up button on the right stick. VPAD_STICK_R_EMULATION_UP = 0x01000000, + //! The emulated down button on the right stick. VPAD_STICK_R_EMULATION_DOWN = 0x00800000, + //! The emulated left button on the left stick. VPAD_STICK_L_EMULATION_LEFT = 0x40000000, + //! The emulated right button on the left stick. VPAD_STICK_L_EMULATION_RIGHT = 0x20000000, + //! The emulated up button on the left stick. VPAD_STICK_L_EMULATION_UP = 0x10000000, + //! The emulated down button on the left stick. VPAD_STICK_L_EMULATION_DOWN = 0x08000000, } VPADButtons; +//! Wii U GamePad channel. typedef enum VPADChan { + //! Channel 0. VPAD_CHAN_0 = 0, } VPADChan; +//! Touch pad validity. typedef enum VPADTouchPadValidity { - //! Both X and Y touchpad positions are accurate + //! Both X and Y touchpad positions are accurate. VPAD_VALID = 0x0, - //! X position is inaccurate + //! X position is inaccurate. VPAD_INVALID_X = 0x1, - //! Y position is inaccurate + //! Y position is inaccurate. VPAD_INVALID_Y = 0x2, } VPADTouchPadValidity; +//! Touch pad resolution. typedef enum VPADTouchPadResolution { //! 1920 x 1080 resolution. @@ -78,9 +110,10 @@ typedef enum VPADTouchPadResolution VPAD_TP_854X480 = 2, } VPADTouchPadResolution; +//! Read error. 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, //! There was no sample new data available to write. VPAD_READ_NO_SAMPLES = -1, @@ -88,6 +121,7 @@ typedef enum VPADReadError VPAD_READ_INVALID_CONTROLLER = -2, } VPADReadError; +//! LCD mode. typedef enum VPADLcdMode { //! 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, } VPADLcdMode; +//! 2D vector. struct VPADVec2D { + //! x. float x; + //! y. float y; }; WUT_CHECK_OFFSET(VPADVec2D, 0x00, x); WUT_CHECK_OFFSET(VPADVec2D, 0x04, y); WUT_CHECK_SIZE(VPADVec2D, 0x08); +//! 3D vector. struct VPADVec3D { + //! x. float x; + //! y. float y; + //! z. float z; }; WUT_CHECK_OFFSET(VPADVec3D, 0x00, x); @@ -118,10 +159,14 @@ WUT_CHECK_OFFSET(VPADVec3D, 0x04, y); WUT_CHECK_OFFSET(VPADVec3D, 0x08, z); WUT_CHECK_SIZE(VPADVec3D, 0x0C); +//! Direction. struct VPADDirection { + //! x. VPADVec3D x; + //! y. VPADVec3D y; + //! z. VPADVec3D z; }; WUT_CHECK_OFFSET(VPADDirection, 0x00, x); @@ -129,11 +174,16 @@ WUT_CHECK_OFFSET(VPADDirection, 0x0C, y); WUT_CHECK_OFFSET(VPADDirection, 0x18, z); WUT_CHECK_SIZE(VPADDirection, 0x24); +//! Touch calibration parameter. struct VPADTouchCalibrationParam { + //! X offset. uint16_t adjustX; + //! Y offset. uint16_t adjustY; + //! X scale. float scaleX; + //! Y scale. float scaleY; }; WUT_CHECK_OFFSET(VPADTouchCalibrationParam, 0x00, adjustX); @@ -142,6 +192,7 @@ WUT_CHECK_OFFSET(VPADTouchCalibrationParam, 0x04, scaleX); WUT_CHECK_OFFSET(VPADTouchCalibrationParam, 0x08, scaleY); WUT_CHECK_SIZE(VPADTouchCalibrationParam, 0x0C); +//! Touch data. struct VPADTouchData { //! The x-coordinate of a touched point. @@ -149,10 +200,10 @@ struct VPADTouchData //! The y-coordinate of a touched point. uint16_t y; - //! 0 if screen is not currently being touched + //! 0 if screen is not currently being 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; }; WUT_CHECK_OFFSET(VPADTouchData, 0x00, x); @@ -176,63 +227,63 @@ WUT_CHECK_SIZE(VPADAccStatus, 0x1c); struct WUT_PACKED VPADStatus { - //! Indicates what VPADButtons are held down + //! Indicates what VPADButtons are held down. uint32_t hold; - //! Indicates what VPADButtons have been pressed since last sample + //! Indicates what VPADButtons have been pressed since last sample. uint32_t trigger; - //! Indicates what VPADButtons have been released since last sample + //! Indicates what VPADButtons have been released since last sample. uint32_t release; - //! Position of left analog stick + //! Position of left analog stick. VPADVec2D leftStick; - //! Position of right analog stick + //! Position of right analog stick. VPADVec2D rightStick; - //! Status of DRC accelorometer + //! Status of DRC accelorometer. VPADAccStatus accelorometer; - //! Status of DRC gyro + //! Status of DRC gyro. VPADVec3D gyro; - //! Status of DRC angle + //! Status of DRC angle. VPADVec3D angle; uint8_t error; WUT_UNKNOWN_BYTES(0x01); - //! Current touch position on DRC + //! Current touch position on DRC. VPADTouchData tpNormal; - //! Filtered touch position, first level of smoothing + //! Filtered touch position, first level of smoothing. VPADTouchData tpFiltered1; - //! Filtered touch position, second level of smoothing + //! Filtered touch position, second level of smoothing. VPADTouchData tpFiltered2; WUT_UNKNOWN_BYTES(0x02); VPADDirection direction; - //! Set to 1 if headphones are plugged in, 0 otherwise + //! Set to 1 if headphones are plugged in, 0 otherwise. BOOL usingHeadphones; - //! Status of DRC magnetometer + //! Status of DRC magnetometer. VPADVec3D mag; - //! Current volume set by the slide control + //! Current volume set by the slide control. uint8_t slideVolume; - //! Battery level of controller + //! Battery level of controller. uint8_t battery; - //! Status of DRC microphone + //! Status of DRC microphone. uint8_t micStatus; - //! Unknown volume related value + //! Unknown volume related value. uint8_t slideVolumeEx; WUT_UNKNOWN_BYTES(0x8); @@ -305,7 +356,7 @@ VPADShutdown(); * * \warning * 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 * 0 on success or 1 on failure. Check outError for reason. @@ -319,10 +370,36 @@ VPADRead(VPADChan chan, uint32_t count, 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 VPADGetTPCalibrationParam(VPADChan chan, 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 VPADSetTPCalibrationParam(VPADChan chan, const VPADTouchCalibrationParam *param);