From c3c8ce30fe729f563e2b03286732449213fc9baa Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 17 Jun 2018 20:18:51 +0200 Subject: [PATCH] Modifed the kpad and wpad struct to be more like the VPADStatus struct. --- include/padscore/kpad.h | 42 +++++++++++++++++++++-------------------- include/padscore/wpad.h | 10 ++++++---- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/include/padscore/kpad.h b/include/padscore/kpad.h index d27c4bd..c157677 100644 --- a/include/padscore/kpad.h +++ b/include/padscore/kpad.h @@ -1,5 +1,6 @@ #pragma once #include +#include /** * \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; diff --git a/include/padscore/wpad.h b/include/padscore/wpad.h index 3efe541..122cce2 100644 --- a/include/padscore/wpad.h +++ b/include/padscore/wpad.h @@ -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;