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

View File

@ -79,16 +79,18 @@ extern "C" {
#define WPAD_PRO_STICK_R_EMULATION_LEFT 0x00400000
#define WPAD_PRO_STICK_R_EMULATION_RIGHT 0x00800000
typedef struct {
f32 x,y;
} WPADVec2D;
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;
WPADVec2D leftStick;
WPADVec2D rightStick;
uint8_t unknown2[8];
uint8_t fmt;
}WPADReadData;