Add header files for some kpad and wpad functions

This commit is contained in:
Maschell 2018-06-17 19:13:21 +02:00 committed by James Benton
parent da21125e15
commit 53c1a5f6c4
2 changed files with 191 additions and 1 deletions

View File

@ -11,7 +11,76 @@
extern "C" {
#endif
typedef struct KPADStatus KPADStatus;
typedef struct _KPADStatus
{
uint32_t btns_h;
uint32_t btns_d;
uint32_t btns_r;
uint32_t unused_1[5];
float pos_x;
float pos_y;
uint32_t unused_2[3];
float angle_x;
float angle_y;
uint32_t unused_3[8];
uint8_t device_type;
uint8_t wpad_error;
uint8_t pos_valid;
uint8_t format;
union
{
struct
{
float stick_x;
float stick_y;
} nunchuck;
struct
{
uint32_t btns_h;
uint32_t btns_d;
uint32_t btns_r;
float lstick_x;
float lstick_y;
float rstick_x;
float rstick_y;
float ltrigger;
float rtrigger;
} classic;
struct
{
uint32_t hold;
uint32_t trigger;
uint32_t release;
float lstick_x;
float lstick_y;
float rstick_x;
float rstick_y;
int32_t charging;
int32_t wired;
} pro;
uint32_t unused_6[20];
};
uint32_t unused_7[16];
} KPADStatus;
void
KPADInit (void);
int32_t
KPADRead(int32_t chan,
void * data,
uint32_t size);
int32_t
KPADReadEx(int32_t chan,
KPADStatus * data,
uint32_t size,
int32_t *error);
#ifdef __cplusplus
}

121
include/padscore/wpad.h Normal file
View File

@ -0,0 +1,121 @@
#pragma once
#include <wut.h>
/**
* \defgroup padscore_wpad WPAD
* \ingroup padscore
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
#define WPAD_EXT_CORE 0
#define WPAD_EXT_NUNCHUK 1
#define WPAD_EXT_CLASSIC 2
#define WPAD_EXT_MPLUS 5
#define WPAD_EXT_MPLUS_NUNCHUK 6
#define WPAD_EXT_MPLUS_CLASSIC 7
#define WPAD_EXT_PRO_CONTROLLER 31
#define WPAD_FMT_PRO_CONTROLLER 22
#define WPAD_BUTTON_LEFT 0x0001
#define WPAD_BUTTON_RIGHT 0x0002
#define WPAD_BUTTON_DOWN 0x0004
#define WPAD_BUTTON_UP 0x0008
#define WPAD_BUTTON_PLUS 0x0010
#define WPAD_BUTTON_2 0x0100
#define WPAD_BUTTON_1 0x0200
#define WPAD_BUTTON_B 0x0400
#define WPAD_BUTTON_A 0x0800
#define WPAD_BUTTON_MINUS 0x1000
#define WPAD_BUTTON_Z 0x2000
#define WPAD_BUTTON_C 0x4000
#define WPAD_BUTTON_HOME 0x8000
#define WPAD_CLASSIC_BUTTON_UP 0x0001
#define WPAD_CLASSIC_BUTTON_LEFT 0x0002
#define WPAD_CLASSIC_BUTTON_ZR 0x0004
#define WPAD_CLASSIC_BUTTON_X 0x0008
#define WPAD_CLASSIC_BUTTON_A 0x0010
#define WPAD_CLASSIC_BUTTON_Y 0x0020
#define WPAD_CLASSIC_BUTTON_B 0x0040
#define WPAD_CLASSIC_BUTTON_ZL 0x0080
#define WPAD_CLASSIC_BUTTON_R 0x0200
#define WPAD_CLASSIC_BUTTON_PLUS 0x0400
#define WPAD_CLASSIC_BUTTON_HOME 0x0800
#define WPAD_CLASSIC_BUTTON_MINUS 0x1000
#define WPAD_CLASSIC_BUTTON_L 0x2000
#define WPAD_CLASSIC_BUTTON_DOWN 0x4000
#define WPAD_CLASSIC_BUTTON_RIGHT 0x8000
#define WPAD_PRO_BUTTON_UP 0x00000001
#define WPAD_PRO_BUTTON_LEFT 0x00000002
#define WPAD_PRO_TRIGGER_ZR 0x00000004
#define WPAD_PRO_BUTTON_X 0x00000008
#define WPAD_PRO_BUTTON_A 0x00000010
#define WPAD_PRO_BUTTON_Y 0x00000020
#define WPAD_PRO_BUTTON_B 0x00000040
#define WPAD_PRO_TRIGGER_ZL 0x00000080
#define WPAD_PRO_RESERVED 0x00000100
#define WPAD_PRO_TRIGGER_R 0x00000200
#define WPAD_PRO_BUTTON_PLUS 0x00000400
#define WPAD_PRO_BUTTON_HOME 0x00000800
#define WPAD_PRO_BUTTON_MINUS 0x00001000
#define WPAD_PRO_TRIGGER_L 0x00002000
#define WPAD_PRO_BUTTON_DOWN 0x00004000
#define WPAD_PRO_BUTTON_RIGHT 0x00008000
#define WPAD_PRO_BUTTON_STICK_R 0x00010000
#define WPAD_PRO_BUTTON_STICK_L 0x00020000
#define WPAD_PRO_STICK_L_EMULATION_UP 0x00200000
#define WPAD_PRO_STICK_L_EMULATION_DOWN 0x00100000
#define WPAD_PRO_STICK_L_EMULATION_LEFT 0x00040000
#define WPAD_PRO_STICK_L_EMULATION_RIGHT 0x00080000
#define WPAD_PRO_STICK_R_EMULATION_UP 0x02000000
#define WPAD_PRO_STICK_R_EMULATION_DOWN 0x01000000
#define WPAD_PRO_STICK_R_EMULATION_LEFT 0x00400000
#define WPAD_PRO_STICK_R_EMULATION_RIGHT 0x00800000
typedef struct WPADReadData_ {
uint8_t unknown[40];
uint8_t dev;
uint8_t err;
uint8_t unknown1[2];
uint32_t buttons;
int16_t l_stick_x;
int16_t l_stick_y;
int16_t r_stick_x;
int16_t r_stick_y;
uint8_t unknown2[8];
uint8_t fmt;
}WPADReadData;
typedef void (* wpad_sampling_callback_t)(int32_t chan);
typedef void (* wpad_extension_callback_t)(int32_t chan, int32_t status);
typedef void (* wpad_connect_callback_t)(int32_t chan, int32_t status);
int32_t
WPADProbe (int32_t chan,
uint32_t * pad_type);
int32_t
WPADSetDataFormat(int32_t chan,
int32_t format);
void
WPADEnableURCC(int32_t enable);
void
WPADEnableWiiRemote(int32_t enable);
void
WPADRead(int32_t chan, void * data);
#ifdef __cplusplus
}
#endif
/** @} */