diff --git a/include/vpad/input.h b/include/vpad/input.h new file mode 100644 index 0000000..d6cfb1a --- /dev/null +++ b/include/vpad/input.h @@ -0,0 +1,140 @@ +#pragma once +#include + +/** + * \defgroup vpad_input VPAD Input + * \ingroup vpad + * @{ + */ + +#define VPAD_BUTTON_A 0x8000 +#define VPAD_BUTTON_B 0x4000 +#define VPAD_BUTTON_X 0x2000 +#define VPAD_BUTTON_Y 0x1000 +#define VPAD_BUTTON_LEFT 0x0800 +#define VPAD_BUTTON_RIGHT 0x0400 +#define VPAD_BUTTON_UP 0x0200 +#define VPAD_BUTTON_DOWN 0x0100 +#define VPAD_BUTTON_ZL 0x0080 +#define VPAD_BUTTON_ZR 0x0040 +#define VPAD_BUTTON_L 0x0020 +#define VPAD_BUTTON_R 0x0010 +#define VPAD_BUTTON_PLUS 0x0008 +#define VPAD_BUTTON_MINUS 0x0004 +#define VPAD_BUTTON_HOME 0x0002 +#define VPAD_BUTTON_SYNC 0x0001 +#define VPAD_BUTTON_STICK_R 0x00020000 +#define VPAD_BUTTON_STICK_L 0x00040000 +#define VPAD_BUTTON_TV 0x00010000 + +#define VPAD_STICK_R_EMULATION_LEFT 0x04000000 +#define VPAD_STICK_R_EMULATION_RIGHT 0x02000000 +#define VPAD_STICK_R_EMULATION_UP 0x01000000 +#define VPAD_STICK_R_EMULATION_DOWN 0x00800000 + +#define VPAD_STICK_L_EMULATION_LEFT 0x40000000 +#define VPAD_STICK_L_EMULATION_RIGHT 0x20000000 +#define VPAD_STICK_L_EMULATION_UP 0x10000000 +#define VPAD_STICK_L_EMULATION_DOWN 0x08000000 + +#define VPAD_VALID 0x0 +#define VPAD_INVALID_X 0x1 +#define VPAD_INVALID_Y 0x2 + +#define VPAD_READ_SUCCESS 0x0 +#define VPAD_READ_FAIL -2 + +typedef uint32_t VPADReadError; + +typedef struct +{ + float x,y; +} VPADVec2D; + +typedef struct +{ + float x,y,z; +} VPADVec3D; + +typedef struct +{ + uint16_t x; + uint16_t y; + uint16_t down; + uint16_t unk1; +} VPADTouchData; + +typedef struct +{ + uint16_t x; + uint16_t y; + uint16_t touched; + uint16_t validity; +} VPADTouchPadStatus; + +typedef struct +{ + float unk1; + float unk2; + float unk3; + float unk4; + float unk5; + VPADVec2D vertical; +} VPADAccStatus; + +typedef struct +{ + float unk1; + float unk2; + float unk3; + float unk4; + float unk5; + float unk6; +} VPADGyroStatus; + +typedef struct +{ + uint32_t btn_hold; + uint32_t btn_trigger; + uint32_t btn_release; + VPADVec2D lstick; + VPADVec2D rstick; + VPADAccStatus accelorometer; + VPADGyroStatus gyro; + char unk1[0x2]; + VPADTouchPadStatus tpNormal; + VPADTouchPadStatus tpFiltered1; + VPADTouchPadStatus tpFiltered2; + char unk2[0x28]; + VPADVec3D mag; + uint8_t slideVolume; + uint8_t battery; + uint8_t micStatus; + uint8_t slideVolumeEx; + char unk3[0x7]; +} VPADStatus; + +#ifdef __cplusplus +"C" { +#endif + +// Depreciated +void +VPADInit(); + +int32_t +VPADRead(uint32_t chan, + VPADStatus *buffers, + uint32_t count, + VPADReadError *error); + +void +VPADGetTPCalibratedPoint(uint32_t chan, + VPADTouchData *calibratedData, + VPADTouchData *uncalibratedData); + +#ifdef __cplusplus +} +#endif + +/** @} */ diff --git a/rpl/Makefile b/rpl/Makefile index d3d1977..ad25b33 100644 --- a/rpl/Makefile +++ b/rpl/Makefile @@ -1,5 +1,5 @@ WUT_ROOT := $(CURDIR)/.. -TARGETS := libcoreinit libgx2 libnsysnet +TARGETS := libcoreinit libgx2 libnsysnet libvpad all: @for dir in $(TARGETS); do \ diff --git a/rpl/libvpad/Makefile b/rpl/libvpad/Makefile new file mode 100644 index 0000000..0db6a68 --- /dev/null +++ b/rpl/libvpad/Makefile @@ -0,0 +1,2 @@ +-include ../common/rules.mk +-include ../../common/rules.mk diff --git a/rpl/libvpad/config.h b/rpl/libvpad/config.h new file mode 100644 index 0000000..72607da --- /dev/null +++ b/rpl/libvpad/config.h @@ -0,0 +1 @@ +#define LIBRARY_NAME "vpad" diff --git a/rpl/libvpad/exports.h b/rpl/libvpad/exports.h new file mode 100644 index 0000000..b136d64 --- /dev/null +++ b/rpl/libvpad/exports.h @@ -0,0 +1,4 @@ +// vpad/input.h +EXPORT(VPADInit); +EXPORT(VPADRead); +EXPORT(VPADGetTPCalibratedPoint);