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
2 changed files with 25 additions and 25 deletions

View File

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

View File

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