d_pad_manager WIP

This commit is contained in:
robojumper
2025-07-30 21:44:01 +02:00
parent 899f86a571
commit 415873f7b3
15 changed files with 1056 additions and 90 deletions
+8 -2
View File
@@ -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;
};
+1
View File
@@ -28,6 +28,7 @@ public:
void fn_80052D50();
void fn_80052C90();
void fn_80052C60();
bool fn_80052D20();
s32 getField_0x24() const {
return field_0x24;
+5
View File
@@ -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; }
+7 -3
View File
@@ -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();
+108
View File
@@ -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
-23
View File
@@ -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
+4
View File
@@ -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;
+57
View File
@@ -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();
+1
View File
@@ -153,6 +153,7 @@ public:
bool clearSelectedFile();
private:
// TODO - Align with NSMBW ModeInit_ / ModeProc_ naming convention?
void initializeCheckForSave();
void initializeCheckForFreeSpace();
void initializeCreateFiles();