Skip to content

Commit

Permalink
Yoink most of Pad.c
Browse files Browse the repository at this point in the history
ty prime decomp - couple functions need to not auto-inline and part of SPEC2_MakeStatus needs tweaking
  • Loading branch information
HeartPiece44 committed Sep 27, 2023
1 parent f63e314 commit 0fdb658
Show file tree
Hide file tree
Showing 5 changed files with 717 additions and 1,623 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"thpaudio.h": "c",
"ai.h": "c",
"gx.h": "c",
"gxenum.h": "c"
"gxenum.h": "c",
"pad.h": "c"
}
}
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@
{
"lib": "pad",
"mw_version": "1.2.5n",
"cflags": "$cflags_base -fp_contract off ",
"cflags": "$cflags_base -fp_contract off -str noreadonly",
"host": False,
"objects": [
["Dolphin/pad/Padclamp", True],
Expand Down
1 change: 1 addition & 0 deletions include/Dolphin/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ void __OSSystemCallVectorEnd();
void OSFillFPUContext(OSContext*);
extern u32 __OSFpscrEnableBits; /** TODO: find a wrapper for this. Symbol is defined in OSError.c. */

u16 __OSWirelessPadFixMode AT_ADDRESS(OS_BASE_CACHED | 0x30E0);
u8 GameChoice AT_ADDRESS(OS_BASE_CACHED | 0x30E3);

volatile int __OSTVMode AT_ADDRESS(OS_BASE_CACHED | 0xCC);
Expand Down
31 changes: 21 additions & 10 deletions include/Dolphin/pad.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ extern "C" {
#include "Dolphin/os.h"

typedef struct PADStatus {
u16 button; // Or-ed PAD_BUTTON_* bits
s8 stickX; // -128 <= stickX <= 127
s8 stickY; // -128 <= stickY <= 127
s8 substickX; // -128 <= substickX <= 127
s8 substickY; // -128 <= substickY <= 127
u8 triggerLeft; // 0 <= triggerLeft <= 255
u8 triggerRight; // 0 <= triggerRight <= 255
u8 analogA; // 0 <= analogA <= 255
u8 analogB; // 0 <= analogB <= 255
s8 err; // one of PAD_ERR_* number
u16 button; // _00, Or-ed PAD_BUTTON_* bits
s8 stickX; // _02, -128 <= stickX <= 127
s8 stickY; // _03, -128 <= stickY <= 127
s8 substickX; // _04, -128 <= substickX <= 127
s8 substickY; // _05, -128 <= substickY <= 127
u8 triggerLeft; // _06, 0 <= triggerLeft <= 255
u8 triggerRight; // _07, 0 <= triggerRight <= 255
u8 analogA; // _08, 0 <= analogA <= 255
u8 analogB; // _09, 0 <= analogB <= 255
s8 err; // _0A, one of PAD_ERR_* number
} PADStatus;

#define PAD_MAX_CONTROLLERS 4
Expand All @@ -37,6 +37,17 @@ typedef struct PADStatus {
#define PAD_BUTTON_MENU 0x1000
#define PAD_BUTTON_START 0x1000

#define PAD_ALL \
(PAD_BUTTON_LEFT | PAD_BUTTON_RIGHT | PAD_BUTTON_DOWN | PAD_BUTTON_UP | PAD_TRIGGER_Z | PAD_TRIGGER_R | PAD_TRIGGER_L | PAD_BUTTON_A \
| PAD_BUTTON_B | PAD_BUTTON_X | PAD_BUTTON_Y | PAD_BUTTON_MENU | 0x2000 | 0x0080)

#define PAD_SPEC_0 0
#define PAD_SPEC_1 1
#define PAD_SPEC_2 2
#define PAD_SPEC_3 3
#define PAD_SPEC_4 4
#define PAD_SPEC_5 5

#define PAD_CHAN0 0
#define PAD_CHAN1 1
#define PAD_CHAN2 2
Expand Down
Loading

0 comments on commit 0fdb658

Please sign in to comment.