Compare commits

..

1 Commits

Author SHA1 Message Date
coah
c403d9edcc cleanup(SettingButton): name deferred command ring buffer
Rename Unk/unk_* queue fields from usage as a circular command buffer:
- Unk → CmdEntry
- unk_0x64 → mCmdQueue
- unk_0x264 → mCmdCapacity
- unk_0x268 → mCmdCount
- unk_0x26C → mCmdReadIdx
- unk_0x270 → mCmdWriteIdx

Verified: SettingButton 100%/100%, build/43U/ok, DOL sha1
26116613f624061ba99c8d1a299aaa6efa85670d
2026-10-02 14:03:03 -05:00
4 changed files with 29 additions and 29 deletions

View File

@@ -62,17 +62,17 @@ namespace ipl {
void start_left_event(const char* paneName);
void start_trig_event(const char* paneName);
typedef struct Unk {
typedef struct CmdEntry {
int command; // 0x00
u32 msgID; // 0x04
} Unk;
} CmdEntry;
Unk unk_0x64[64];
CmdEntry mCmdQueue[64];
int unk_0x264;
int unk_0x268;
int unk_0x26C;
int unk_0x270;
int mCmdCapacity;
int mCmdCount;
int mCmdReadIdx;
int mCmdWriteIdx;
int mSettingArg; // 0x274

View File

@@ -24,7 +24,7 @@ typedef struct WPADMemBlock {
int unk_0x04; // 0x04
s16 unk_0x08; // 0x08
int unk_0x0C; // 0x0C
WPADCallback callback; // 0x10
WPADCallback unk_0x10; // 0x10
} WPADMemBlock;
typedef struct WPADGameInfo {

View File

@@ -1315,7 +1315,7 @@ static void __ClearControlBlock(s32 chan) {
_wmb[chan].unk_0x04 = 0;
_wmb[chan].unk_0x08 = 0;
_wmb[chan].unk_0x0C = 0;
_wmb[chan].callback = NULL;
_wmb[chan].unk_0x10 = NULL;
_rumbleCnt[chan] = 0;
}
@@ -1643,8 +1643,8 @@ static void WPADiConnCallback(WUDDevInfo* devInfo, u8 open) {
if (p->cmdBlkCB != NULL) {
p->cmdBlkCB(chan, WPAD_ERR_NO_CONTROLLER);
} else if (_wmb[chan].callback != NULL) {
_wmb[chan].callback(chan, WPAD_ERR_NO_CONTROLLER);
} else if (_wmb[chan].unk_0x10 != NULL) {
_wmb[chan].unk_0x10(chan, WPAD_ERR_NO_CONTROLLER);
}
do {

View File

@@ -15,10 +15,10 @@ namespace ipl {
// clang-format on
SettingButton::SettingButton(EGG::Heap* heap, int arg) : FaderSceneBase(heap), ::gui::EventHandler() {
unk_0x264 = 64;
unk_0x268 = 0;
unk_0x26C = 0;
unk_0x270 = 0;
mCmdCapacity = 64;
mCmdCount = 0;
mCmdReadIdx = 0;
mCmdWriteIdx = 0;
mSettingArg = arg;
mpLayout = NULL;
mpLayoutFile = NULL;
@@ -81,8 +81,8 @@ namespace ipl {
FaderSceneCommand SettingButton::calcNormal() {
if (!mpLayout->getAnim(ANIM_ALPHA_IN)->isPlaying() && !mpLayout->getAnim(ANIM_ALPHA_OUT)->isPlaying() &&
!mpLayout->getAnim(ANIM_BTN_FLASH)->isPlaying() && unk_0x268 != 0) {
Unk unk = unk_0x64[unk_0x26C];
!mpLayout->getAnim(ANIM_BTN_FLASH)->isPlaying() && mCmdCount != 0) {
CmdEntry unk = mCmdQueue[mCmdReadIdx];
switch (unk.command) {
case CMD_SHOW_BTN: {
showBtn();
@@ -98,11 +98,11 @@ namespace ipl {
}
}
if (unk_0x268 != 0) {
if (++unk_0x26C >= unk_0x264) {
unk_0x26C = 0;
if (mCmdCount != 0) {
if (++mCmdReadIdx >= mCmdCapacity) {
mCmdReadIdx = 0;
}
unk_0x268--;
mCmdCount--;
}
}
@@ -225,16 +225,16 @@ namespace ipl {
}
void SettingButton::reserve(int command, u32 msgId) {
if (unk_0x264 != unk_0x268) {
int unk = unk_0x270;
unk_0x64[unk].command = command;
unk_0x64[unk].msgID = msgId;
unk_0x270++;
if (mCmdCapacity != mCmdCount) {
int unk = mCmdWriteIdx;
mCmdQueue[unk].command = command;
mCmdQueue[unk].msgID = msgId;
mCmdWriteIdx++;
if (unk_0x270 >= unk_0x264) {
unk_0x270 = 0;
if (mCmdWriteIdx >= mCmdCapacity) {
mCmdWriteIdx = 0;
}
unk_0x268++;
mCmdCount++;
}
}