Modifed the kpad and wpad struct to be more like the VPADStatus struct.

This commit is contained in:
Maschell 2018-06-17 20:18:51 +02:00 committed by James Benton
parent ea64525812
commit c3c8ce30fe
2 changed files with 28 additions and 24 deletions

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <wut.h> #include <wut.h>
#include <padscore/wpad.h>
/** /**
* \defgroup padscore_kpad KPAD * \defgroup padscore_kpad KPAD
@ -11,17 +12,23 @@
extern "C" { extern "C" {
#endif #endif
typedef WPADVec2D KPADVec2D;
typedef struct _KPADStatus typedef struct _KPADStatus
{ {
uint32_t btns_h; //! Indicates what KPADButtons are held down
uint32_t btns_d; uint32_t hold;
uint32_t btns_r;
//! Indicates what KPADButtons have been pressed since last sample
uint32_t trigger;
//! Indicates what KPADButtons have been released since last sample
uint32_t release;
uint32_t unused_1[5]; uint32_t unused_1[5];
float pos_x; KPADVec2D pos;
float pos_y;
uint32_t unused_2[3]; uint32_t unused_2[3];
float angle_x; KPADVec2D angle;
float angle_y;
uint32_t unused_3[8]; uint32_t unused_3[8];
uint8_t device_type; uint8_t device_type;
uint8_t wpad_error; uint8_t wpad_error;
@ -32,8 +39,7 @@ typedef struct _KPADStatus
{ {
struct struct
{ {
float stick_x; KPADVec2D stick;
float stick_y;
} nunchuck; } nunchuck;
struct struct
@ -41,12 +47,10 @@ typedef struct _KPADStatus
uint32_t btns_h; uint32_t btns_h;
uint32_t btns_d; uint32_t btns_d;
uint32_t btns_r; uint32_t btns_r;
float lstick_x; KPADVec2D leftStick;
float lstick_y; KPADVec2D rightStick;
float rstick_x; float leftTrigger;
float rstick_y; float rightTrigger;
float ltrigger;
float rtrigger;
} classic; } classic;
struct struct
@ -54,10 +58,8 @@ typedef struct _KPADStatus
uint32_t hold; uint32_t hold;
uint32_t trigger; uint32_t trigger;
uint32_t release; uint32_t release;
float lstick_x; KPADVec2D leftStick;
float lstick_y; KPADVec2D rightStick;
float rstick_x;
float rstick_y;
int32_t charging; int32_t charging;
int32_t wired; int32_t wired;
} pro; } pro;

View File

@ -79,16 +79,18 @@ extern "C" {
#define WPAD_PRO_STICK_R_EMULATION_LEFT 0x00400000 #define WPAD_PRO_STICK_R_EMULATION_LEFT 0x00400000
#define WPAD_PRO_STICK_R_EMULATION_RIGHT 0x00800000 #define WPAD_PRO_STICK_R_EMULATION_RIGHT 0x00800000
typedef struct {
f32 x,y;
} WPADVec2D;
typedef struct WPADReadData_ { typedef struct WPADReadData_ {
uint8_t unknown[40]; uint8_t unknown[40];
uint8_t dev; uint8_t dev;
uint8_t err; uint8_t err;
uint8_t unknown1[2]; uint8_t unknown1[2];
uint32_t buttons; uint32_t buttons;
int16_t l_stick_x; WPADVec2D leftStick;
int16_t l_stick_y; WPADVec2D rightStick;
int16_t r_stick_x;
int16_t r_stick_y;
uint8_t unknown2[8]; uint8_t unknown2[8];
uint8_t fmt; uint8_t fmt;
}WPADReadData; }WPADReadData;