Compare commits

...

1 Commits

Author SHA1 Message Date
coah
87a084da31 cleanup(iplSettingButton): rename Unk ring-buffer placeholders
Unk -> CmdEntry; unk_0x64 -> mCmdQueue; capacity/count/read/write
indices. Byte-identical (DOL sha1 unchanged).
2026-10-02 14:06:01 -05:00
2 changed files with 27 additions and 27 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 mQueueCapacity;
int unk_0x268; int mQueueCount;
int unk_0x26C; int mQueueRead;
int unk_0x270; int mQueueWrite;
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; mQueueCapacity = 64;
unk_0x268 = 0; mQueueCount = 0;
unk_0x26C = 0; mQueueRead = 0;
unk_0x270 = 0; mQueueWrite = 0;
mSettingArg = arg; mSettingArg = arg;
mpLayout = NULL; mpLayout = NULL;
mpLayoutFile = NULL; mpLayoutFile = NULL;
@@ -81,9 +81,9 @@ 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() && mQueueCount != 0) {
Unk unk = unk_0x64[unk_0x26C]; CmdEntry entry = mCmdQueue[mQueueRead];
switch (unk.command) { switch (entry.command) {
case CMD_SHOW_BTN: { case CMD_SHOW_BTN: {
showBtn(); showBtn();
break; break;
@@ -93,16 +93,16 @@ namespace ipl {
break; break;
} }
case CMD_SET_TEXT: { case CMD_SET_TEXT: {
setText(unk.msgID); setText(entry.msgID);
break; break;
} }
} }
if (unk_0x268 != 0) { if (mQueueCount != 0) {
if (++unk_0x26C >= unk_0x264) { if (++mQueueRead >= mQueueCapacity) {
unk_0x26C = 0; mQueueRead = 0;
} }
unk_0x268--; mQueueCount--;
} }
} }
@@ -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 (mQueueCapacity != mQueueCount) {
int unk = unk_0x270; int writeIdx = mQueueWrite;
unk_0x64[unk].command = command; mCmdQueue[writeIdx].command = command;
unk_0x64[unk].msgID = msgId; mCmdQueue[writeIdx].msgID = msgId;
unk_0x270++; mQueueWrite++;
if (unk_0x270 >= unk_0x264) { if (mQueueWrite >= mQueueCapacity) {
unk_0x270 = 0; mQueueWrite = 0;
} }
unk_0x268++; mQueueCount++;
} }
} }