diff --git a/include/functions.h b/include/functions.h index 49770b6a..ba2d1180 100644 --- a/include/functions.h +++ b/include/functions.h @@ -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); diff --git a/include/game/pad.h b/include/game/pad.h new file mode 100644 index 00000000..a771d2c2 --- /dev/null +++ b/include/game/pad.h @@ -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 \ No newline at end of file diff --git a/include/variables.h b/include/variables.h index 9dbeef8b..4bd9c0ca 100644 --- a/include/variables.h +++ b/include/variables.h @@ -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]; diff --git a/src/REL/subchrselDll/subchrselDll.c b/src/REL/subchrselDll/subchrselDll.c index aa5c4c37..e945bf6f 100644 --- a/src/REL/subchrselDll/subchrselDll.c +++ b/src/REL/subchrselDll/subchrselDll.c @@ -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" diff --git a/src/REL/w10Dll/w10Dll4.c b/src/REL/w10Dll/w10Dll4.c index bcd62892..a2ba9f60 100644 --- a/src/REL/w10Dll/w10Dll4.c +++ b/src/REL/w10Dll/w10Dll4.c @@ -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] = { diff --git a/src/game/objmain.c b/src/game/objmain.c index ab6f414d..6935918b 100644 --- a/src/game/objmain.c +++ b/src/game/objmain.c @@ -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 diff --git a/src/game/pad.c b/src/game/pad.c index 2f97cb42..38b3e0c1 100644 --- a/src/game/pad.c +++ b/src/game/pad.c @@ -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]; } diff --git a/src/game/window.c b/src/game/window.c index 46b8776e..3f842a10 100644 --- a/src/game/window.c +++ b/src/game/window.c @@ -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];