diff options
| author | robojumper <robojumper@gmail.com> | 2025-07-30 21:44:01 +0200 |
|---|---|---|
| committer | robojumper <robojumper@gmail.com> | 2025-08-02 09:20:02 +0200 |
| commit | 415873f7b34faa42ead43e620c591842dadee68e (patch) | |
| tree | 391a12cbafd49168260f8bd98b8133b6d7a631bf /include | |
| parent | 899f86a57111df7545e5ab031e92d8564faa112a (diff) | |
d_pad_manager WIP
Diffstat (limited to 'include')
| -rw-r--r-- | include/d/d_cs_base.h | 10 | ||||
| -rw-r--r-- | include/d/d_dvd_unk.h | 1 | ||||
| -rw-r--r-- | include/d/d_gfx.h | 5 | ||||
| -rw-r--r-- | include/d/d_pad.h | 10 | ||||
| -rw-r--r-- | include/d/d_pad_manager.h | 108 | ||||
| -rw-r--r-- | include/d/d_pause.h | 23 | ||||
| -rw-r--r-- | include/d/lyt/d_lyt_battery.h | 4 | ||||
| -rw-r--r-- | include/d/lyt/d_lyt_system_window.h | 57 | ||||
| -rw-r--r-- | include/toBeSorted/save_manager.h | 1 |
9 files changed, 191 insertions, 28 deletions
diff --git a/include/d/d_cs_base.h b/include/d/d_cs_base.h index 361175cf..50786801 100644 --- a/include/d/d_cs_base.h +++ b/include/d/d_cs_base.h @@ -25,10 +25,12 @@ public: void setField703(bool val) { field_0x703 = val; } - void setField704(bool val) { field_0x704 = val; } + bool getField704() const { + return field_0x704; + } void setField705(bool val) { field_0x705 = val; } @@ -41,6 +43,10 @@ public: return sInstance; } + void setCursorStickVisible(bool visible) { + mCursorStick.setShouldBeOn(visible); + } + private: static dCsBase_c *sInstance; void setCurrentLyt(int lyt); @@ -55,7 +61,7 @@ private: /* 0x700 */ mAng field_0x700; /* 0x702 */ u8 mAlpha; /* 0x703 */ u8 field_0x703; - /* 0x704 */ u8 field_0x704; + /* 0x704 */ bool field_0x704; /* 0x705 */ u8 field_0x705; }; diff --git a/include/d/d_dvd_unk.h b/include/d/d_dvd_unk.h index 2b93fd22..90cd7175 100644 --- a/include/d/d_dvd_unk.h +++ b/include/d/d_dvd_unk.h @@ -28,6 +28,7 @@ public: void fn_80052D50(); void fn_80052C90(); void fn_80052C60(); + bool fn_80052D20(); s32 getField_0x24() const { return field_0x24; diff --git a/include/d/d_gfx.h b/include/d/d_gfx.h index 337d3d57..826e8d33 100644 --- a/include/d/d_gfx.h +++ b/include/d/d_gfx.h @@ -36,6 +36,11 @@ public: return sInstance; } + static void doDrawCapTexture() { + nw4r::ut::Color c(0xFFFFFFFF); + sInstance->drawCapTexture(sInstance->mpTextureBuffer, &c); + } + public: // clang-format off static s32 getCurrentScreenWidth() { return g_CurrentScreenWidth_s32; } diff --git a/include/d/d_pad.h b/include/d/d_pad.h index fa95a003..9c20a6c9 100644 --- a/include/d/d_pad.h +++ b/include/d/d_pad.h @@ -137,10 +137,10 @@ public: static void setInfo(s32 chan, const WPADInfo *pInfo); static f32 fn_80058F50(); - static bool fn_80058F60(); + static bool startCurrentMplsCalibration(); static f32 getCurrentCalibrationWork(); - static void fn_80058FF0(); - static void fn_80059000(); + static void stopCurrentMplsCalibration(); + static void centerCurrentCursor(); static bool needMplsCalibration(); static void setCalibrateMpls(); static bool fn_800590B0(); @@ -168,6 +168,10 @@ public: void getUnifiedWpadStatus(s32 chan); void calcFSStickDirMask(); + void setNoCalibrationNeeded() { + mNeedMplsCalibration = false; + } + static void setNoSleep(); static void setAutoSleepTime(); diff --git a/include/d/d_pad_manager.h b/include/d/d_pad_manager.h new file mode 100644 index 00000000..a27fb945 --- /dev/null +++ b/include/d/d_pad_manager.h @@ -0,0 +1,108 @@ +#ifndef D_PAD_MANAGER_H +#define D_PAD_MANAGER_H + +#include "common.h" +#include "d/lyt/d_lyt_system_window.h" +#include "egg/core/eggHeap.h" + +class dPadManager_c { +public: + dPadManager_c(); + virtual ~dPadManager_c(); + + static bool create(EGG::Heap *pHeap); + void init(); + bool execute(); + bool draw(); + + static void buildWindow(); + + static dPadManager_c *GetInstance() { + return sInstance; + } + bool getField_0x25() const { + return field_0x25; + } + + void requestMplsCalibration(); + +private: + typedef void (dPadManager_c::*ModeFunc)(); + + void executeProc(); + static s32 get30SecondsInTicks(); + static s32 get3Point3SecondsInTicks(); + /* static */ s32 get1Point5SecondsInTicks(); + + enum Mode_e { + Normal = 0, + ReconnectPad = 1, + AttachMplsAndNunchuk = 2, + AttachNunchuk = 3, + Calibrating = 4, + LowBattery = 5, + PointCenter = 6, + CalibrationFail = 7, + }; + + enum PadStatus_e { + PAD_DISCONNECTED = 0, + PAD_NO_MPLS = 1, + PAD_NO_NUNCHUK = 2, + PAD_NEED_CALIBRATION = 3, + PAD_CONFIGURING_MPLS = 4, + PAD_NEED_POINT_CENTER = 5, + PAD_NORMAL = 6, + }; + + void ModeRequestNormal(); + void ModeProc_Normal(); + + void ModeRequestReconnectPad(); + void ModeProc_ReconnectPad(); + + void ModeRequestAttachMplsAndNunchuk(); + void ModeProc_AttachMplsAndNunchuk(); + + void ModeRequestAttachNunchuk(); + void ModeProc_AttachNunchuk(); + + void ModeRequestCalibrating(); + void ModeProc_Calibrating(); + + void ModeRequestLowBattery(); + void ModeProc_LowBattery(); + + void ModeRequestPointCenter(); + void ModeProc_PointCenter(); + + void ModeRequestCalibrationFail(); + void ModeProc_CalibrationFail(); + + void ModeRequest(Mode_e mode); + void ModeRequestNext(PadStatus_e status); + + PadStatus_e getPadStatus(); + bool isOutOfBattery(); + + /* 0x04 */ dLytSystemWindowMain_c *mpWindow; + /* 0x08 */ PadStatus_e mPadStatus; + /* 0x0C */ Mode_e mMode; + /* 0x10 */ s32 mStep; + /* 0x14 */ s32 mCalibrationTimer; + /* 0x18 */ s32 mStepTimer; + /* 0x1C */ bool field_0x1C; + /* 0x1D */ bool field_0x1D; + /* 0x1E */ bool field_0x1E; + /* 0x1F */ bool field_0x1F; + /* 0x20 */ bool field_0x20; + /* 0x21 */ bool mCalibrationFinished; + /* 0x22 */ bool field_0x22; + /* 0x23 */ bool field_0x23; + /* 0x24 */ bool field_0x24; + /* 0x25 */ bool field_0x25; + + static dPadManager_c *sInstance; +}; + +#endif diff --git a/include/d/d_pause.h b/include/d/d_pause.h deleted file mode 100644 index a42c5a87..00000000 --- a/include/d/d_pause.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef D_PAUSE_H -#define D_PAUSE_H - -#include "common.h" - -// reference to NSMBW PauseManage_c (im adding back the d) -class dPauseManager_c { -public: - static dPauseManager_c *GetInstance() { - return sInstance; - } - bool getField_0x25() const { - return field_0x25; - } - -private: - /* 0x00 */ u8 _00[0x25 - 0x00]; - /* 0x25 */ bool field_0x25; - - static dPauseManager_c *sInstance; -}; - -#endif diff --git a/include/d/lyt/d_lyt_battery.h b/include/d/lyt/d_lyt_battery.h index 1d7c52aa..06abee5f 100644 --- a/include/d/lyt/d_lyt_battery.h +++ b/include/d/lyt/d_lyt_battery.h @@ -11,6 +11,10 @@ public: static bool draw(); bool dismissManually(); + static dLytBattery_c *GetInstance() { + return sInstance; + } + private: dLytBattery_c() : mStateMgr(*this, sStateID::null) { sInstance = this; diff --git a/include/d/lyt/d_lyt_system_window.h b/include/d/lyt/d_lyt_system_window.h index ff1959a0..6e1b1ab1 100644 --- a/include/d/lyt/d_lyt_system_window.h +++ b/include/d/lyt/d_lyt_system_window.h @@ -3,6 +3,63 @@ #include "common.h" +// TODO - the Main vs not-main split may not make sense here, +// but I don't know what the second class here does + +class dLytSystemWindowMain_c { +public: + dLytSystemWindowMain_c(); + virtual ~dLytSystemWindowMain_c(); + + bool draw(); + bool build(); + bool calc(); + + void init(); + + bool setProperties(const char *label, bool, const wchar_t *); + void fn_80150F30(s32 arg); + bool requestABtnOut(); + + bool fn_80150EB0(); + bool fn_80150EE0(); + bool fn_80150FB0(); + void fn_80150FE0(); + void fn_80150FF0(); + void fn_80151000(); + bool isPointerWithinWindow(); + + s32 getField_0xDDC() const { + return field_0xDDC; + } + + bool getField_0xDF7() const { + return field_0xDF7; + } + + bool getField_0xDF8() const { + return field_0xDF8; + } + + void setField_0xE03(bool val) { + field_0xE03 = val; + } + + void setField_0xE04(bool val) { + field_0xE04 = val; + } + +private: + /* 0x004 */ u8 _0x004[0xDDC - 0x004]; + /* 0xDDC */ s32 field_0xDDC; + /* 0xDF0 */ u8 _0xDF0[0xDF7 - 0xDE0]; + /* 0xDF7 */ bool field_0xDF7; + /* 0xDF8 */ bool field_0xDF8; + /* 0xDF9 */ u8 _0xDF9[0xE03 - 0xDF9]; + /* 0xE03 */ bool field_0xE03; + /* 0xE04 */ bool field_0xE04; +}; + class dLytSystemWindow_c { public: virtual ~dLytSystemWindow_c(); diff --git a/include/toBeSorted/save_manager.h b/include/toBeSorted/save_manager.h index d1e74677..fc58e410 100644 --- a/include/toBeSorted/save_manager.h +++ b/include/toBeSorted/save_manager.h @@ -153,6 +153,7 @@ public: bool clearSelectedFile(); private: + // TODO - Align with NSMBW ModeInit_ / ModeProc_ naming convention? void initializeCheckForSave(); void initializeCheckForFreeSpace(); void initializeCreateFiles(); |
