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
5 changed files with 30 additions and 30 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

@@ -63,7 +63,7 @@ typedef struct {
u8 mcuYRem; // 0x0F
u16 mcuYCount; // 0x10
u16 mcuXCount2; // 0x12
u32 mcuTotal; // 0x14
u32 unk_0x14;
u8 remX; // 0x18
u8 remY; // 0x19
u8 compCount; // 0x1A
@@ -142,7 +142,7 @@ struct TMCCJPEGDecWork_t {
u8 mcuYRem; // 0x17FF
u16 mcuYCount; // 0x1800
u16 mcuXCount2; // 0x1802
u32 mcuTotal; // 0x1804
u32 unk_0x1804;
u8 remX; // 0x1808
u8 remY; // 0x1809
u8 compCount; // 0x180A

View File

@@ -51,7 +51,7 @@ s32 TMCJPEGDEC_Setsize(TMCCJPEGDecWork* work) {
}
state->componentCount = work->componentCount;
state->result = work->mcuTotal;
state->result = work->unk_0x1804;
state->maxX = work->mcuYCount;
state->maxY = work->mcuXCount2;

View File

@@ -567,7 +567,7 @@ s32 TMCJPEGDEC_scan_varinit(TMCCJPEGDecWork* work) {
p->mcuYCount = p->mcuYCount + ((u8)remX != 0 ? 1 : 0);
p->mcuXCount2 = p->mcuXCount2 + ((u8)remY != 0 ? 1 : 0);
p->mcuTotal = (u32)p->mcuYCount * (u32)p->mcuXCount2;
p->unk_0x14 = (u32)p->mcuYCount * (u32)p->mcuXCount2;
for (idx = 0; idx < (s32)p->scanCompCount; idx++) {
u8 compId;
@@ -1929,7 +1929,7 @@ static s32 TMCJPEGDEC_parse_sof(TMCCJPEGDecWork* work) {
mcuCountY += yr;
frameInfo->mcuYCount = mcuCountX;
frameInfo->mcuXCount2 = mcuCountY;
work->mcuTotal = (u32)mcuCountX * (u32)mcuCountY;
work->unk_0x1804 = (u32)mcuCountX * (u32)mcuCountY;
}
compCount2 = frameInfo->compCount;

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++;
}
}