mirror of
https://github.com/SeekyCt/spm-decomp.git
synced 2024-11-23 21:39:52 +00:00
A bit more wpadmgr
This commit is contained in:
parent
4ade461b8a
commit
1e93d6820b
@ -7,6 +7,19 @@
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#define WPAD_BTN_LEFT 0x1
|
||||
#define WPAD_BTN_RIGHT 0x2
|
||||
#define WPAD_BTN_DOWN 0x4
|
||||
#define WPAD_BTN_UP 0x8
|
||||
#define WPAD_BTN_PLUS 0x10
|
||||
#define WPAD_BTN_2 0x100
|
||||
#define WPAD_BTN_1 0x200
|
||||
#define WPAD_BTN_B 0x400
|
||||
#define WPAD_BTN_A 0x800
|
||||
#define WPAD_BTN_MINUS 0x1000
|
||||
#define WPAD_BTN_HOME 0x8000
|
||||
#define WPAD_BTN_REPEAT 0x80000000
|
||||
|
||||
typedef void * (WPADAlloc)(u32 size);
|
||||
typedef bool (WPADFree)(void * ptr);
|
||||
|
||||
|
@ -18,7 +18,12 @@ typedef struct {
|
||||
Vec2 pointingPos[4]; // wii remote pointer positions
|
||||
KPADStatus statuses[4][WPAD_STATUS_COUNT];
|
||||
s32 kpadReadRet[4];
|
||||
u8 unknown_0x217c[0x9dc8 - 0x217c];
|
||||
u8 unknown_0x217c[0x9d3c - 0x217c];
|
||||
u32 unknown_0x9d3c[4];
|
||||
s32 unknown_0x9d4c[4];
|
||||
u8 unknown_0x9d5c[0x9d60 - 0x9d5c];
|
||||
s64 unknown_0x9d60[4];
|
||||
u8 unknown_0x9d80[0x9dc8 - 0x9d80];
|
||||
} WpadWork;
|
||||
|
||||
WpadWork * wpadGetWork(); // 8023697c
|
||||
@ -34,9 +39,9 @@ bool wpadGetRumbleStatus(s32 controller); // 80237678
|
||||
u32 wpadGetButtonsHeld(s32 controller); // 80237688
|
||||
u32 wpadGetButtonsReleased(s32 controller); // 8023769c
|
||||
u32 wpadGetButtonsPressed(s32 controller); // 802376b0
|
||||
u32 wpadGetButtonsHeldConditional(s32 controller); // 802376c4
|
||||
// 802376e4
|
||||
// 80237710
|
||||
u32 wpadGetButtonsHeldRepeat(s32 controller); // 802376c4
|
||||
u32 unknown_802376e4(s32 controller); // 802376e4
|
||||
void unknown_80237710(s32 controller); // 80237710
|
||||
// 80237750
|
||||
|
||||
#endif
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <string.h>
|
||||
#include <wpad.h>
|
||||
#include <wpadmgr.h>
|
||||
#include <spmario.h>
|
||||
|
||||
static WpadWork wpadWork; // 80528f48
|
||||
static WpadWork * wp = &wpadWork; // 805ae198
|
||||
@ -87,11 +88,20 @@ u32 wpadGetButtonsPressed(s32 controller) {
|
||||
return wp->statuses[controller]->buttonsPressed;
|
||||
}
|
||||
|
||||
u32 wpadGetButtonsHeldConditional(s32 controller) {
|
||||
u32 wpadGetButtonsHeldRepeat(s32 controller) {
|
||||
u32 held = wp->statuses[controller][0].buttonsHeld;
|
||||
return held & 0x80000000 ? held : 0;
|
||||
return held & WPAD_BTN_REPEAT ? held : 0;
|
||||
}
|
||||
|
||||
// 802376e4
|
||||
// 80237710
|
||||
u32 unknown_802376e4(s32 controller) {
|
||||
if (wp->unknown_0x9d4c[controller] > 50)
|
||||
return wp->unknown_0x9d3c[controller];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void unknown_80237710(s32 controller) {
|
||||
wp->unknown_0x9d4c[controller] = 0;
|
||||
wp->unknown_0x9d60[controller] = gp->time;
|
||||
}
|
||||
// 80237750
|
||||
|
Loading…
Reference in New Issue
Block a user