Introduce pad header

This commit is contained in:
gamemasterplc 2023-12-23 11:55:51 -06:00
parent c97fa8c5ee
commit 9b9438ca3a
8 changed files with 45 additions and 17 deletions

View file

@ -38,8 +38,6 @@ void HuWinMesSpeedSet(s16, s16);
void HuWinMesMaxSizeGet(s16, f32*, ...);
s16 HuWinCreate(float x, float y, s16 w, s16 h, s16 frame);
void HuPadRumbleAllStop(void);
void HuAudFXListnerKill(void);
void HuAudDllSndGrpSet(u16 ovl);
void HuAudVoiceInit(s16 ovl);

35
include/game/pad.h Normal file
View file

@ -0,0 +1,35 @@
#ifndef _GAME_PAD_H
#define _GAME_PAD_H
#include "dolphin.h"
#define PAD_BUTTON_DIR (PAD_BUTTON_LEFT | PAD_BUTTON_RIGHT | PAD_BUTTON_UP | PAD_BUTTON_DOWN)
#define PAD_BUTTON_TRIGGER_L 0x4000
#define PAD_BUTTON_TRIGGER_R 0x2000
extern u16 HuPadBtn[4];
extern u16 HuPadBtnDown[4];
extern u16 HuPadBtnRep[4];
extern s8 HuPadStkX[4];
extern s8 HuPadStkY[4];
extern s8 HuPadSubStkX[4];
extern s8 HuPadSubStkY[4];
extern u8 HuPadTrigL[4];
extern u8 HuPadTrigR[4];
extern u8 HuPadDStk[4];
extern u8 HuPadDStkRep[4];
extern s8 HuPadErr[4];
extern u16 _PadBtn[4];
extern u16 _PadBtnDown[4];
extern u32 VCounter;
void HuPadInit(void);
void HuPadRead(void);
void HuPadRumbleSet(s16 pad, s16 duration, s16 off, s16 on);
void HuPadRumbleStop(s16 pad);
void HuPadRumbleAllStop(void);
s16 HuPadStatGet(s16 pad);
u32 HuPadRumbleGet(void);
#endif

View file

@ -4,9 +4,6 @@
#include "dolphin.h"
#include "common_structs.h"
extern u16 HuPadBtnDown[4];
extern u8 HuPadDStk[4];
extern WipeState wipeData;
extern PlayerConfig GWPlayerCfg[4];

View file

@ -1,7 +1,7 @@
#include "common.h"
#include "game/object.h"
#include "game/printfunc.h"
#include "dolphin/pad.h"
#include "game/pad.h"
#include "math.h"

View file

@ -1,8 +1,7 @@
#include "REL/w10Dll.h"
#include "game/pad.h"
#include "game/data.h"
s16 HuPadStatGet(s16 i); //TODO: Move to some other header file since gamework.c relies on an implicit declaration of it
char lbl_1_data_98[] = "@@@@@@@@@@@@@@ Tutorial Exit @@@@@@@@@@@@@@\n\000";
w10DllUnk03 lbl_1_data_C6[11] = {

View file

@ -1,6 +1,7 @@
#include "common.h"
#include "game/printfunc.h"
#include "game/object.h"
#include "game/pad.h"
#define OM_OVL_HIS_MAX 16
#define OM_MAX_GROUPS 10

View file

@ -1,6 +1,8 @@
#include "common.h"
#include "dolphin.h"
#include "game/msm.h"
#include "game/pad.h"
typedef struct pad_rumble {
s16 duration;
@ -9,7 +11,6 @@ typedef struct pad_rumble {
s16 time;
} PadRumble;
void HuPadRead(void);
static void PadReadVSync(u32 retraceCount);
static void PadADConv(s16 pad, PADStatus *status);
@ -45,7 +46,7 @@ static s8 _PadErr[4];
static u32 RumbleBit;
u32 VCounter;
u32 chanTbl[4] = { PAD_CHAN0_BIT, PAD_CHAN1_BIT, PAD_CHAN2_BIT, PAD_CHAN3_BIT };
static u32 chanTbl[4] = { PAD_CHAN0_BIT, PAD_CHAN1_BIT, PAD_CHAN2_BIT, PAD_CHAN3_BIT };
extern int HuDvdErrWait;
@ -119,10 +120,10 @@ static void PadReadVSync(u32 retraceCount)
} else {
u16 button = curr_status->button;
if(curr_status->triggerL & 0xC0) {
button |= 0x4000;
button |= PAD_BUTTON_TRIGGER_L;
}
if(curr_status->triggerR & 0xC0) {
button |= 0x2000;
button |= PAD_BUTTON_TRIGGER_R;
}
if(button && _PadBtn[i] == button) {
if(_PadRepCnt[i] > 20) {
@ -246,7 +247,7 @@ void HuPadRumbleAllStop(void)
}
}
int HuPadStatGet(s16 pad)
s16 HuPadStatGet(s16 pad)
{
return _PadErr[pad];
}

View file

@ -6,6 +6,7 @@
#include "game/dvd.h"
#include "game/memory.h"
#include "game/process.h"
#include "game/pad.h"
#include "math.h"
#include "stdarg.h"
@ -45,10 +46,6 @@ void HuAR_ARAMtoMRAM(void*);
void mtxTransCat(Mtx, float, float, float);
void *MessData_MesPtrGet(void*, u32);
extern u16 HuPadBtn[4];
extern u8 HuPadDStkRep[4];
WindowData ATTRIBUTE_ALIGN(32) winData[32];
u32 winKey[4];
keyBufData winComKeyBuf[256];