summaryrefslogtreecommitdiff
path: root/include/d
diff options
context:
space:
mode:
authorelijah-thomas774 <elijahthomas774@gmail.com>2025-06-15 14:40:59 -0400
committerelijah-thomas774 <elijahthomas774@gmail.com>2025-06-15 14:40:59 -0400
commite4b1c30f472e7a4fdbce657aba7b9b5fb0dd2d59 (patch)
treecd267c29d69e4996ff1d120ebb3613744ca69f1b /include/d
parent2707f74d70f2783f8e70889f48e95b3ec8c00635 (diff)
Pad stuff
Diffstat (limited to 'include/d')
-rw-r--r--include/d/a/obj/d_a_obj_boomerang.h46
-rw-r--r--include/d/d_gfx.h93
-rw-r--r--include/d/d_pad.h251
-rw-r--r--include/d/snd/d_snd_player_mgr.h3
4 files changed, 357 insertions, 36 deletions
diff --git a/include/d/a/obj/d_a_obj_boomerang.h b/include/d/a/obj/d_a_obj_boomerang.h
index 20dd7c9b..00fa98d0 100644
--- a/include/d/a/obj/d_a_obj_boomerang.h
+++ b/include/d/a/obj/d_a_obj_boomerang.h
@@ -106,24 +106,34 @@ public: // TYPES
RB_FLY_MAX = 2,
};
static const char *sFlyChrAnims[RB_FLY_MAX];
-// Macros until enum is solidified (0x8CC)
-#define FLAG_BOOMERANG_CANCEL (0x3)
-#define FLAG_BOOMERANG_RELEASE_ITEM (0x4)
-#define FLAG_BOOMERANG_0x8 (0x8)
-#define FLAG_BOOMERANG_0x10 (0x10)
-#define FLAG_BOOMERANG_0x20 (0x20)
-#define FLAG_BOOMERANG_0x40 (0x40)
-#define FLAG_BOOMERANG_0x80 (0x80)
-#define FLAG_BOOMERANG_STOP_TIMER_ACTIVE (0x100)
-#define FLAG_BOOMERANG_DROP_ITEM (0x200) // related to 0x400
-#define FLAG_BOOMERANG_REQUEST_0x400 (0x400) // related to 0x200
-#define FLAG_BOOMERANG_REQUEST_MOVE (0x800)
-#define FLAG_BOOMERANG_CONTROLLABLE (0x1000)
-#define FLAG_BOOMERANG_0x2000 (0x2000)
-#define FLAG_BOOMERANG_RUMBLE_ACTIVE (0x4000)
-#define FLAG_BOOMERANG_WING_EFFECT_ACTIVE (0x8000)
-#define FLAG_BOOMERANG_0x10000 (0x10000)
-#define FLAG_BOOMERANG_0x40000 (0x40000)
+
+ enum Flags_e {
+ /* 0x00000001 */ FLAG_CANCEL_1 = 1 << 0,
+ /* 0x00000002 */ FLAG_CANCEL_2 = 1 << 1,
+ /* 0x00000003 */ FLAG_CANCEL = FLAG_CANCEL_1 | FLAG_CANCEL_2,
+
+ /* 0x00000004 */ FLAG_RELEASE_ITEM = 1 << 2,
+ /* 0x00000008 */ FLAG_0x8 = (0x8),
+ /* 0x00000010 */ FLAG_0x10 = (0x10),
+ /* 0x00000020 */ FLAG_0x20 = (0x20),
+ /* 0x00000040 */ FLAG_0x40 = (0x40),
+ /* 0x00000080 */ FLAG_0x80 = (0x80),
+ /* 0x00000100 */ FLAG_STOP_TIMER_ACTIVE = (0x100),
+ /* 0x00000200 */ FLAG_DROP_ITEM = (0x200), // related to 0x400
+ /* 0x00000400 */ FLAG_REQUEST_0x400 = (0x400), // related to 0x200
+ /* 0x00000800 */ FLAG_REQUEST_MOVE = (0x800),
+ /* 0x00001000 */ FLAG_CONTROLLABLE = (0x1000),
+ /* 0x00002000 */ FLAG_0x2000 = (0x2000),
+ /* 0x00004000 */ FLAG_RUMBLE_ACTIVE = (0x4000),
+ /* 0x00008000 */ FLAG_WING_EFFECT_ACTIVE = (0x8000),
+ /* 0x00010000 */ FLAG_0x10000 = (0x10000),
+ /* 0x00020000 */ FLAG_0x20000 = (0x40000),
+ /* 0x00040000 */ FLAG_0x40000 = (0x40000),
+ /* 0x00080000 */ FLAG_0x80000 = (0x80000),
+
+ /* 0x0001A117 */ FLAG_COMMON_INIT = FLAG_0x10000 | FLAG_WING_EFFECT_ACTIVE | FLAG_0x2000 |
+ FLAG_STOP_TIMER_ACTIVE | FLAG_0x10 | FLAG_RELEASE_ITEM | FLAG_CANCEL,
+ };
public: // INLINES
bool checkField_0x8CC(u32 mask) const {
diff --git a/include/d/d_gfx.h b/include/d/d_gfx.h
index 18e63957..4a80203c 100644
--- a/include/d/d_gfx.h
+++ b/include/d/d_gfx.h
@@ -20,9 +20,100 @@ public:
return sInstance;
}
-private:
+public:
+ // clang-format off
+ static s32 getCurrentScreenWidth() { return g_CurrentScreenWidth_s32; }
+ static s32 getCurrentScreenHeight() { return g_CurrentScreenHeight_s32; }
+ static s32 getCurrentScreenWidthLimit() { return g_CurrentScreenWidthLimit_s32; }
+ static s32 getCurrentScreenHeightLimit() { return g_CurrentScreenHeightLimit_s32; }
+ static s32 getCurrentScreenLeft() { return g_CurrentScreenLeft_s32; }
+ static s32 getCurrentScreenRight() { return g_CurrentScreenRight_s32; }
+ static s32 getCurrentScreenTop() { return g_CurrentScreenTop_s32; }
+ static s32 getCurrentScreenBottom() { return g_CurrentScreenBottom_s32; }
+
+ static s32 getEFBHeight() { return g_CurrentEFBHeight_s32; }
+ static s32 getEFBHeightLimit() { return g_CurrentEFBHeightLimit_s32; }
+ static s32 getLetterboxAmount() { return g_CurrentLetterBoxAmount_s32; }
+
+ static f32 getCurrentScreenWidthF() { return g_CurrentScreenWidth_f32; }
+ static f32 getCurrentScreenHeightF() { return g_CurrentScreenHeight_f32; }
+ static f32 getCurrentScreenWidthLimitF() { return g_CurrentScreenWidthLimit_f32; }
+ static f32 getCurrentScreenHeightLimitF() { return g_CurrentScreenHeightLimit_f32; }
+ static f32 getCurrentScreenLeftF() { return g_CurrentScreenLeft_f32; }
+ static f32 getCurrentScreenRightF() { return g_CurrentScreenRight_f32; }
+ static f32 getCurrentScreenTopF() { return g_CurrentScreenTop_f32; }
+ static f32 getCurrentScreenBottomF() { return g_CurrentScreenBottom_f32; }
+
+ static f32 getScreenAspectF() { return g_CurrentScreenAspect; }
+
+ static f32 getEFBHeightF() { return g_CurrentEFBHeight_f32; }
+ static f32 getEFBHeightLimitF() { return g_CurrentEFBHeightLimit_f32; }
+ static f32 getLetterboxAmountF() { return g_CurrentEFBHeightDifference_f32; }
+ static f32 getHeightScaledF() { return g_CurrentHeightScaled_f32; }
+ static f32 getEFBHeightDifferenceF() { return g_CurrentEFBHeightDifference2_f32; }
+
+ static s32 getWidth4x3() { return g_Width4x3_s32; }
+ static s32 getWidth4x3Limit() { return g_Width4x3Limit_s32; }
+ static s32 getWidth16x9() { return g_Width16x9_s32; }
+ static s32 getWidth4x3Left() { return g_Width4x3Left_s32; }
+ static s32 getWidth4x3Right() { return g_Width4x3Right_s32; }
+
+ static f32 getWidth4x3F() { return g_Width4x3_f32; }
+ static f32 getWidth4x3LimitF() { return g_Width4x3Limit_f32; }
+ static f32 getWidth16x9F() { return g_Width16x9_f32; }
+ static f32 getWidth4x3LeftF() { return g_Width4x3Left_f32; }
+ static f32 getWidth4x3RightF() { return g_Width4x3Right_f32; }
+
+ static f32 get16x9to4x3WidthScaleF() { return g_16x9to4x3WidthScale; }
+ // clang-format on
+
+public:
static dGfx_c *sInstance;
+ static s32 g_CurrentScreenWidth_s32;
+ static s32 g_CurrentScreenHeight_s32;
+ static s32 g_CurrentScreenWidthLimit_s32;
+ static s32 g_CurrentScreenHeightLimit_s32;
+ static s32 g_CurrentScreenLeft_s32;
+ static s32 g_CurrentScreenRight_s32;
+ static s32 g_CurrentScreenTop_s32;
+ static s32 g_CurrentScreenBottom_s32;
+
+ static s32 g_CurrentEFBHeight_s32;
+ static s32 g_CurrentEFBHeightLimit_s32;
+ static s32 g_CurrentLetterBoxAmount_s32;
+
+ static f32 g_CurrentScreenWidth_f32;
+ static f32 g_CurrentScreenHeight_f32;
+ static f32 g_CurrentScreenWidthLimit_f32;
+ static f32 g_CurrentScreenHeightLimit_f32;
+ static f32 g_CurrentScreenLeft_f32;
+ static f32 g_CurrentScreenRight_f32;
+ static f32 g_CurrentScreenTop_f32;
+ static f32 g_CurrentScreenBottom_f32;
+
+ static f32 g_CurrentScreenAspect;
+
+ static f32 g_CurrentEFBHeight_f32;
+ static f32 g_CurrentEFBHeightLimit_f32;
+ static f32 g_CurrentEFBHeightDifference_f32;
+ static f32 g_CurrentHeightScaled_f32;
+ static f32 g_CurrentEFBHeightDifference2_f32;
+
+ static s32 g_Width4x3_s32;
+ static s32 g_Width4x3Limit_s32;
+ static s32 g_Width16x9_s32;
+ static s32 g_Width4x3Left_s32;
+ static s32 g_Width4x3Right_s32;
+
+ static f32 g_Width4x3_f32;
+ static f32 g_Width4x3Limit_f32;
+ static f32 g_Width16x9_f32;
+ static f32 g_Width4x3Left_f32;
+ static f32 g_Width4x3Right_f32;
+
+ static f32 g_16x9to4x3WidthScale;
+
/* 0x00 */ u8 _0x00[0x04 - 0x00];
/* 0x04 */ DrawCallback mDrawCallback;
/* 0x08 */ u8 field_0x08;
diff --git a/include/d/d_pad.h b/include/d/d_pad.h
index 53a9955a..7b5f4f0c 100644
--- a/include/d/d_pad.h
+++ b/include/d/d_pad.h
@@ -1,24 +1,241 @@
#ifndef D_PAD_H
#define D_PAD_H
-class dPad {
+#include "common.h"
+#include "egg/core/eggController.h"
+#include "m/m_mtx.h"
+#include "m/m_vec.h"
+#include "rvl/KPAD/KPAD.h"
+#include "rvl/WPAD/WPAD.h"
+
+namespace dPad {
+class ex_c {
+ // Complete Made up name
+ struct motion_c {
+ void init();
+
+ /* 0x0000 */ mVec3_c field_0x000[120];
+ /* 0x05A0 */ mVec3_c field_0x5A0[120];
+ /* 0x0B40 */ f32 field_0xB40[120];
+ /* 0x0D20 */ mVec3_c field_0xD20[39];
+ /* 0x0EF4 */ mVec3_c field_0xEF4[33];
+ /* 0x1080 */ mVec3_c field_0x1080;
+ /* 0x108C */ mVec3_c field_0x108C;
+ /* 0x1098 */ mMtx_c field_0x1098;
+ /* 0x10C8 */ u32 field_0x10C8;
+ /* 0x10CC */ u32 field_0x10CC;
+ /* 0x10D0 */ u32 field_0x10D0;
+ /* 0x10D4 */ f32 field_0x10D4;
+ /* 0x10D8 */ u32 field_0x10D8;
+ };
+
+public:
+ void fn_80056AF0(s32 chan);
+ void fn_80056B90(s32 chan);
+ void fn_80056CE0(s32 chan);
+ void fn_80056DA0(s32 chan); // Deals with Mpls Calibration Start
+ void fn_80056DF0(s32 chan); // Deals with Mpls Calibration Work
+ f32 fn_80056E50();
+ void fn_80056E60(s32 chan); // Deals with Mpls Calibration Stop
+ void resetState(s32 chan);
+
+ void fn_800572A0();
+
+ static bool isLowBattery();
+ static bool isOutOfBattery();
+
+ static void resetInfo();
+ static void clearInfo(s32 chan);
+ static s32 getInfo(s32 chan);
+ static s32 getBatteryLevel();
+ static s32 getBatteryLevel(s32 chan);
+ static void setInfo(s32 chan, const WPADInfo *pInfo);
+
+ static void on_0x54(s32 chan);
+ static void on_0x55(s32 chan);
+ static void on_0x56(s32 chan);
+ static void on_0x57(s32 chan);
+
+ static void fn_800592D0(s32 chan);
+
+ void fn_80059300(s32 chan);
+ void getUnifiedWpadStatus(s32 chan);
+ void fn_800593D0();
+
+ static ex_c *getInstance() {
+ return m_current_ex;
+ }
+
public:
- static bool checkButtonAPressed();
- static bool checkButtonBPressed();
- static bool checkButtonZPressed();
- static bool checkButtonCPressed();
- static bool checkButtonMinusPressed();
- static bool checkButtonPlusPressed();
- static bool checkButton1Pressed();
- static bool checkButton2Pressed();
-
- static bool checkButtonDpadUpPressed();
- static bool checkButtonDpadDownPressed();
- static bool checkButtonDpadLeftPressed();
- static bool checkButtonDpadRightPressed();
-
- static bool checkButtonAHeld();
- static bool checkButtonZHeld();
+ /* 0x0000 */ mVec2_c mDpdPos;
+ /* 0x0008 */ mVec2_c field_0x8;
+ /* 0x0010 */ mVec2_c mFSStick;
+ /* 0x0018 */ f32 mFSStickDistance;
+ /* 0x001C */ mAng mFSStickAngle;
+ /* 0x0020 */ WPADResult mWPADProbeResult;
+ /* 0x0024 */ WPADResult mWPADProbeResultStable;
+ /* 0x0028 */ s32 mWPADProbeStableTimer;
+ /* 0x002C */ WPADDeviceType mWPADDeviceType;
+ /* 0x0030 */ u32 mWPADDeviceTypeStable;
+ /* 0x0034 */ s32 mWPADDeviceTypeStableTimer;
+ /* 0x0038 */ s32 field_0x38;
+ /* 0x003C */ s32 field_0x3C;
+ /* 0x0040 */ f32 field_0x40;
+ /* 0x0044 */ bool field_0x44;
+ /* 0x0045 */ bool field_0x45;
+ /* 0x0046 */ bool field_0x46;
+ /* 0x0047 */ bool field_0x47;
+ /* 0x0048 */ bool field_0x48;
+ /* 0x0049 */ bool field_0x49;
+ /* 0x004A */ bool field_0x4A;
+ /* 0x004B */ bool field_0x4B;
+ /* 0x004C */ bool mSpeakerSetup;
+ /* 0x004D */ bool mSpeakerShutdown;
+ /* 0x004E */ bool mIncorrectDeviceType;
+ /* 0x004F */ bool field_0x4F;
+ /* 0x0050 */ bool field_0x50;
+ /* 0x0051 */ bool field_0x51;
+ /* 0x0052 */ bool mMplsEnabled;
+ /* 0x0053 */ bool field_0x53;
+ /* 0x0054 */ bool field_0x54[4];
+ /* 0x0058 */ bool field_0x58[4];
+ /* 0x005C */ mVec2_c field_0x5C;
+ /* 0x0064 */ mVec2_c field_0x64;
+ /* 0x006C */ s32 field_0x6C;
+ /* 0x0070 */ mAng field_0x70;
+ /* 0x0074 */ mVec3_c field_0x74;
+ /* 0x0080 */ mVec3_c field_0x80;
+ /* 0x008C */ mVec3_c field_0x8C;
+ /* 0x0098 */ motion_c mMotion;
+ /* 0x1174 */ motion_c mFSMotion;
+ /* 0x2250 */ u8 _0x2250[0x2268 - 0x2250];
+ /* 0x2268 */ mVec3_c field_0x2268;
+ /* 0x2274 */ mVec3_c field_0x2274;
+ /* 0x2280 */ s32 mState;
+ /* 0x2284 */ s32 field_0x2284;
+ /* 0x2288 */ s32 field_0x2288;
+ /* 0x228C */ KPADUnifiedWpadStatus mStatus;
+ /* 0x22C0 */ u8 _0x22C0[0x22D0 - 0x22C4];
+ /* 0x22D0 */ u8 field_0x22D0;
+ /* 0x22D1 */ u8 field_0x22D1;
+ /* 0x22D4 */ s32 field_0x22D4;
+ /* 0x22D8 */ u8 field_0x22D8;
+
+ static WPADInfo m_info[2][4];
+ static bool m_connected[4];
+ static ex_c m_ex[4];
+ static ex_c *m_current_ex;
};
+void initMpls(s32 chan);
+void create();
+void setMpls(bool enable, s32 chan);
+void beginPad_BR();
+void endPad_BR();
+
+void setConnectCallback();
+void enableMplsDirRevise(s32 chan);
+void disableMplsDirRevise(s32 chan);
+
+void setNoSleep();
+void setAutoSleepTime();
+
+// the next 4 funcs do nothing
+void fn_80059620();
+void fn_80059630();
+void fn_80059640();
+void fn_80059650();
+
+bool getDownTrig(u32 btns);
+bool getDownTrigA();
+bool getDownTrigB();
+bool getDownTrigC();
+bool getDownTrigZ();
+bool getDownTrigUp();
+bool getDownTrigDown();
+bool getDownTrigLeft();
+bool getDownTrigRight();
+bool getDownTrig1();
+bool getDownTrig2();
+bool getDownTrigMinus();
+bool getDownTrigPlus();
+
+bool getDown(u32 btns);
+bool getDownAll(u32 btns);
+bool getDownA();
+bool getDownB();
+bool getDownC();
+bool getDownZ();
+bool getDownUp();
+bool getDownDown();
+bool getDownLeft();
+bool getDownRight();
+bool getDown1();
+bool getDown2();
+bool getDownMinus();
+bool getDownPlus();
+
+bool getUpTrig(u32 btns);
+bool getUpTrigA();
+bool getUpTrigB();
+bool getUpTrigC();
+bool getUpTrigZ();
+bool getUpTrigUp();
+bool getUpTrigDown();
+bool getUpTrigLeft();
+bool getUpTrigRight();
+bool getUpTrig1();
+bool getUpTrig2();
+bool getUpTrigMinus();
+bool getUpTrigPlus();
+
+bool getUp(u32 btns);
+bool getUpAll(u32 btns);
+bool getUpA();
+bool getUpB();
+bool getUpC();
+bool getUpZ();
+bool getUpUp();
+bool getUpDown();
+bool getUpLeft();
+bool getUpRight();
+bool getUp1();
+bool getUp2();
+bool getUpMinus();
+bool getUpPlus();
+
+mVec2_c &getDpdPos();
+mVec2_c &getDpdStableMaybe();
+mVec2_c &getFSStick();
+f32 getFSStickX();
+f32 getFSStickY();
+f32 getFSStickDistance();
+mAng getFSStickAngle();
+mVec3_c getAcc();
+
+/** returns m_current_ex->field_0x1160 >> 0 & 1 */
+u32 fn_80059B750();
+
+/** returns m_current_ex->field_0x1160 >> 1 & 1 */
+u32 fn_80059B760();
+
+/** returns m_current_ex->field_0x1160 >> 2 & 1 */
+u32 fn_80059B70();
+
+/** returns m_current_ex->field_0x1160 >> 3 & 1 */
+u32 fn_80059B80();
+
+/** returns m_current_ex->field_0x1160 >> 5 & 1 */
+u32 fn_80059B90();
+
+mVec3_c getFSAcc();
+
+/** returns m_current_ex->field_0x223C >> 4 & 1 */
+u32 fn_80059CC0();
+
+/** returns m_current_ex->field_0x223C >> 5 & 1 */
+u32 fn_80059CD0();
+
+}; // namespace dPad
+
#endif
diff --git a/include/d/snd/d_snd_player_mgr.h b/include/d/snd/d_snd_player_mgr.h
index 7808092d..95886ba8 100644
--- a/include/d/snd/d_snd_player_mgr.h
+++ b/include/d/snd/d_snd_player_mgr.h
@@ -23,6 +23,9 @@ public:
public:
dSndPlayerMgr_c();
+ void setup(s32 channel);
+ void shutdown(s32 channel);
+
void shutdown();
void calc();