summaryrefslogtreecommitdiff
path: root/include/rvl
diff options
context:
space:
mode:
authorelijah-thomas774 <elijahthomas774@gmail.com>2025-06-15 14:40:59 -0400
committerelijah-thomas774 <elijahthomas774@gmail.com>2025-06-15 14:40:59 -0400
commite4b1c30f472e7a4fdbce657aba7b9b5fb0dd2d59 (patch)
treecd267c29d69e4996ff1d120ebb3613744ca69f1b /include/rvl
parent2707f74d70f2783f8e70889f48e95b3ec8c00635 (diff)
Pad stuff
Diffstat (limited to 'include/rvl')
-rw-r--r--include/rvl/KPAD/KPAD.h114
-rw-r--r--include/rvl/MTX/mtx.h30
-rw-r--r--include/rvl/WPAD/WPAD.h33
3 files changed, 138 insertions, 39 deletions
diff --git a/include/rvl/KPAD/KPAD.h b/include/rvl/KPAD/KPAD.h
index 1efeeb3e..849e7730 100644
--- a/include/rvl/KPAD/KPAD.h
+++ b/include/rvl/KPAD/KPAD.h
@@ -1,27 +1,119 @@
#ifndef REVOSDK_KPAD_H
#define REVOSDK_KPAD_H
-#ifdef __cplusplus
+
#include "common.h"
+#include "rvl/WPAD/WPAD.h"
+
+#include "rvl/MTX.h"
+
+#ifdef __cplusplus
extern "C" {
#endif
-typedef struct {
- // TODO
+#define KPAD_MAX_SAMPLES 16
+
+typedef union KPADEXStatus {
+ struct {
+ Vec2 stick; // at 0x0
+ Vec acc; // at 0x8
+ f32 acc_value; // at 0x14
+ f32 acc_speed; // at 0x18
+ } fs; // at 0x0
+
+ struct {
+ u32 hold; // at 0x0
+ u32 trig; // at 0x4
+ u32 release; // at 0x8
+ Vec2 lstick; // at 0xC
+ Vec2 rstick; // at 0x14
+ f32 ltrigger; // at 0x1C
+ f32 rtrigger; // at 0x20
+ } cl; // at 0x0
+
+ struct {
+ f64 tgc_weight; // at 0x0
+ f64 weight[4]; // at 0x8
+ f64 weight_ave[4]; // at 0x28
+ s32 weight_err; // at 0x48
+ s32 tgc_weight_err; // at 0x4C
+ } bl; // at 0x0
+} KPADEXStatus;
+
+typedef struct KPADStatus {
+ u32 hold; // at 0x0
+ u32 trig; // at 0x4
+ u32 release; // at 0x8
+ Vec acc; // at 0xC
+ f32 acc_value; // at 0x18
+ f32 acc_speed; // at 0x1C
+ Vec2 pos; // at 0x20
+ Vec2 vec; // at 0x28
+ f32 speed; // at 0x30
+ Vec2 horizon; // at 0x34
+ Vec2 hori_vec; // at 0x3C
+ f32 hori_speed; // at 0x44
+ f32 dist; // at 0x48
+ f32 dist_vec; // at 0x4C
+ f32 dist_speed; // at 0x50
+ Vec2 acc_vertical; // at 0x54
+ u8 dev_type; // at 0x5C
+ s8 wpad_err; // at 0x5D
+ s8 dpd_valid_fg; // at 0x5E
+ u8 data_format; // at 0x5F
+ KPADEXStatus ex_status; // at 0x60
+ u8 _0xB0[0xF0 - 0xB0]; // at 0xB0
} KPADStatus;
+typedef struct KPADUnifiedWpadStatus {
+ union {
+ WPADStatus core;
+ WPADFSStatus fs;
+ WPADCLStatus cl;
+ WPADTRStatus tr;
+ WPADBLStatus bl;
+ } u; // at 0x0
+ u8 fmt; // 0x36;
+ u8 padding; // 0x37;
+
+} KPADUnifiedWpadStatus;
+
typedef void (*KPADConnectCallback)(s32, s32);
-// TODO: Create Proper Headers
-void KPADInitEx(void * /* UNKTYPE */, u32);
-s32 KPADRead(s32 chan, UNKTYPE *status, s32);
+void KPADSetConnectCallback(u32, KPADConnectCallback);
+
+void KPADSetPosParam(s32 chan, f32 playRadius, f32 sensitivity);
+void KPADSetHoriParam(s32 chan, f32 playRadius, f32 sensitivity);
+void KPADSetDistParam(s32 chan, f32 playRadius, f32 sensitivity);
+void KPADSetAccParam(s32 chan, f32 playRadius, f32 sensitivity);
+
+s32 KPADRead(s32 chan, KPADStatus *pSamples, s32 numSamples);
s32 KPADReadEx(s32 chan, UNKTYPE *status, s32, s32 *);
-void KPADSetConnectCallback(u32, KPADConnectCallback);
+void KPADGetUnifiedWpadStatus(s32 chan, KPADUnifiedWpadStatus *pStatus, int);
+
+void KPADInit(void);
+void KPADInitEx(void * /* UNKTYPE */, u32);
+
+void KPADSetBtnRepeat(s32 chan, f32, f32);
+void KPADSetReviseMode(s32 chan, s32);
+
+void KPADEnableMpls(s32 chan, s32);
+void KPADDisableMpls(s32 chan);
-void KPADSetPosParam(u32, f32, f32);
-void KPADSetHoriParam(u32, f32, f32);
-void KPADSetDistParam(u32, f32, f32);
-void KPADSetAccParam(u32, f32, f32);
+s32 KPADGetMplsWorkSize();
+void KPADSetMplsWorkarea(void *);
+void KPADSetControlMplsCallback(s32 chan, KPADConnectCallback cb);
+void KPADResetMpls(s32 chan);
+void KPADDisableMplsZeroPlay(s32 chan);
+void KPADSetMplsZeroPlayParam(s32 chan, f32);
+void KPADSetMplsZeroDriftMode(s32 chan, s32);
+void KPADEnableMplsDirRevise(s32 chan);
+void KPADDisableMplsDirRevise(s32 chan);
+void KPADSetMplsDirReviseParam(s32 chan, f32);
+void KPADEnableMplsAccRevise(s32 chan);
+void KPADSetMplsAccReviseParam(s32 chan, f32, f32);
+void KPADEnableMplsDpdRevise(s32 chan);
+void KPADSetMplsDpdReviseParam(s32 chan, f32);
#ifdef __cplusplus
}
diff --git a/include/rvl/MTX/mtx.h b/include/rvl/MTX/mtx.h
index 2581d7a3..de5a32f4 100644
--- a/include/rvl/MTX/mtx.h
+++ b/include/rvl/MTX/mtx.h
@@ -20,26 +20,30 @@ typedef struct Vec {
f32 x, y, z;
} Vec;
+typedef struct Vec2 {
+ f32 x, y;
+} Vec2;
+
typedef struct Quaternion {
f32 x, y, z, w;
} Quaternion;
-#define MTXIdentity PSMTXIdentity
-#define MTXCopy PSMTXCopy
-#define MTXConcat PSMTXConcat
-#define MTXInverse PSMTXInverse
-#define MTXTranspose PSMTXTranspose
-#define MTXInverse PSMTXInverse
-#define MTXInvXpose PSMTXInvXpose
-#define MTXRotRad PSMTXRotRad
-#define MTXRotTrig PSMTXRotTrig
+#define MTXIdentity PSMTXIdentity
+#define MTXCopy PSMTXCopy
+#define MTXConcat PSMTXConcat
+#define MTXInverse PSMTXInverse
+#define MTXTranspose PSMTXTranspose
+#define MTXInverse PSMTXInverse
+#define MTXInvXpose PSMTXInvXpose
+#define MTXRotRad PSMTXRotRad
+#define MTXRotTrig PSMTXRotTrig
#define MTXRotAxisRad PSMTXRotAxisRad
-#define MTXTrans PSMTXTrans
+#define MTXTrans PSMTXTrans
#define MTXTransApply PSMTXTransApply
-#define MTXScale PSMTXScale
+#define MTXScale PSMTXScale
#define MTXScaleApply PSMTXScaleApply
-#define MTXQuat PSMTXQuat
-#define MTXReflect PSMTXReflect
+#define MTXQuat PSMTXQuat
+#define MTXReflect PSMTXReflect
void PSMTXIdentity(Mtx);
void PSMTXCopy(const Mtx, Mtx);
diff --git a/include/rvl/WPAD/WPAD.h b/include/rvl/WPAD/WPAD.h
index d62c7d45..c26e7700 100644
--- a/include/rvl/WPAD/WPAD.h
+++ b/include/rvl/WPAD/WPAD.h
@@ -8,7 +8,6 @@
#include "rvl/SC/scsystem.h"
#include "rvl/WPAD/WUD.h"
-
/*******************************************************************************
* macros
*/
@@ -31,13 +30,13 @@ typedef s32 WPADResult;
enum WPADResult_et {
WPAD_ERR_OK = 0,
- WPAD_ERR_NO_CONTROLLER = -1, /* name known from asserts */
- WPAD_ERR_BUSY = -2, // [RT3P54] has this as WPAD_ERR_BUSY
- WPAD_ERR_TRANSFER = -3, // [RT3P54] has this as WPAD_ERR_TRANSFER
- WPAD_ERR_INVALID = -4, /* name comes from [R89JEL] */
- // WPAD_ERR_5 = -5, /* unknown */
- // WPAD_ERR_6 = -6, /* unknown */
- WPAD_ERR_CORRUPTED = -7, /* name comes from [R89JEL] */
+ WPAD_ERR_NO_CONTROLLER = -1, /* name known from asserts */
+ WPAD_ERR_BUSY = -2, // [RT3P54] has this as WPAD_ERR_BUSY
+ WPAD_ERR_TRANSFER = -3, // [RT3P54] has this as WPAD_ERR_TRANSFER
+ WPAD_ERR_INVALID = -4, /* name comes from [R89JEL] */
+ // WPAD_ERR_5 = -5, /* unknown */
+ // WPAD_ERR_6 = -6, /* unknown */
+ WPAD_ERR_CORRUPTED = -7, /* name comes from [R89JEL] */
#define WPAD_ESUCCESS WPAD_ERR_OK
#define WPAD_ENODEV WPAD_ERR_NO_CONTROLLER
@@ -86,7 +85,7 @@ enum WPADChannel_et {
typedef s32 WPADDeviceType;
enum WPADDeviceType_et {
WPAD_DEV_CORE = 0,
- WPAD_DEV_FS = 1,
+ WPAD_DEV_FREESTYLE = 1,
WPAD_DEV_CLASSIC = 2, /* name known from asserts, but not value */
WPAD_DEV_BALANCE_CHECKER = 3,
WPAD_DEV_VSM = 4,
@@ -114,12 +113,11 @@ enum WPADDeviceType_et {
WPAD_DEV_MPLS_PT_UNKNOWN = 250,
- WPAD_DEV_251 = 251,
- WPAD_DEV_252 = 252, // invalid device mode?
- WPAD_DEV_NONE =
- 253, // sort of like WPAD_ENODEV (see __wpadAbortInitExtension in WPADHIDParser.c)
- // WPAD_DEV_254 = 254, /* unknown, doesn't seem to be used anywhere */
- WPAD_DEV_INITIALIZING = 255, // see __a1_20_status_report
+ WPAD_DEV_FUTURE = 251,
+ WPAD_DEV_NOT_SUPPORTED = 252,
+ WPAD_DEV_NOT_FOUND = 253, // sort of like WPAD_ENODEV (see __wpadAbortInitExtension in WPADHIDParser.c)
+ WPAD_DEV_NULL = 254, /* unknown, doesn't seem to be used anywhere */
+ WPAD_DEV_UNKNOWN = 255, // see __a1_20_status_report
};
typedef u32 WPADDataFormat;
@@ -621,6 +619,11 @@ void WPADRecalibrate(WPADChannel chan);
BOOL WPADIsUsedCallbackByKPAD(void);
void WPADSetCallbackByKPAD(BOOL isKPAD);
+void WPADSetAutoSleepTime(int min);
+void WPADSetControllerLastDataUpdateTime(int min);
+
+void WPADSetAcceptConnection(int);
+
#ifdef __cplusplus
}
#endif