mirror of
https://github.com/zeldaret/ss
synced 2026-08-17 21:33:05 -04:00
Pad stuff
This commit is contained in:
+104
-12
@@ -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 void (*KPADConnectCallback)(s32, s32);
|
||||
// TODO: Create Proper Headers
|
||||
void KPADInitEx(void * /* UNKTYPE */, u32);
|
||||
typedef struct KPADUnifiedWpadStatus {
|
||||
union {
|
||||
WPADStatus core;
|
||||
WPADFSStatus fs;
|
||||
WPADCLStatus cl;
|
||||
WPADTRStatus tr;
|
||||
WPADBLStatus bl;
|
||||
} u; // at 0x0
|
||||
u8 fmt; // 0x36;
|
||||
u8 padding; // 0x37;
|
||||
|
||||
s32 KPADRead(s32 chan, UNKTYPE *status, s32);
|
||||
s32 KPADReadEx(s32 chan, UNKTYPE *status, s32, s32 *);
|
||||
} KPADUnifiedWpadStatus;
|
||||
|
||||
typedef void (*KPADConnectCallback)(s32, s32);
|
||||
|
||||
void KPADSetConnectCallback(u32, KPADConnectCallback);
|
||||
|
||||
void KPADSetPosParam(u32, f32, f32);
|
||||
void KPADSetHoriParam(u32, f32, f32);
|
||||
void KPADSetDistParam(u32, f32, f32);
|
||||
void KPADSetAccParam(u32, f32, f32);
|
||||
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 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);
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
+17
-13
@@ -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);
|
||||
|
||||
+18
-15
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user