Compare commits

...

4 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
coah
2d9e3ee14a cleanup(eZiText): rename work unk_0x1A to separator (#854)
Init to space (0x20); Matching zi8space emits it; zi8cgetc saves as separator.
2026-10-02 14:00:30 -05:00
coah
23db5e05e1 cleanup(CDBCryptBuf): rename unk_0x3EC00/04 to size/offset (#853)
Decrypt fills size; Matching CDBRecordFile uses offset for seek/tell/read.
2026-10-02 14:00:24 -05:00
coah
741c9263e3 cleanup(iplSDButton): rename unk_0x54 to mAnimWait (#852)
Same pattern as Button: wait flag while help-button click anim plays.
2026-10-02 14:00:18 -05:00
11 changed files with 54 additions and 54 deletions

View File

@@ -145,7 +145,7 @@ namespace ipl {
ANIM_MAX, ANIM_MAX,
}; };
int unk_0x54; int mAnimWait;
layout::Object* mpLayout; // 0x58 layout::Object* mpLayout; // 0x58
nand::LayoutFile* mpLayoutFile; // 0x5C nand::LayoutFile* mpLayoutFile; // 0x5C

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

@@ -219,7 +219,7 @@ struct __zi8_work_data_s {
ziU8 unk_0x17; ziU8 unk_0x17;
ziU8 subLanguage; // 0x18 ziU8 subLanguage; // 0x18
ziU8 unk_0x19; ziU8 unk_0x19;
ziU16 unk_0x1A; ziU16 separator; // 0x1A
ziU8 unk_0x1C[3]; ziU8 unk_0x1C[3];
ziU8 unk_0x1F; ziU8 unk_0x1F;
ziU16 unk_0x20[0x40]; ziU16 unk_0x20[0x40];

View File

@@ -18,7 +18,7 @@ static Zi8UInt Zi8SetFindCand(ziU8* foundCandidates, Zi8UInt ordinal, ziPtr work
} }
ziWChar* ZiGetNextPhonetic(ziWChar* spelling, ziWChar* end ZI_NEED_WORK) { ziWChar* ZiGetNextPhonetic(ziWChar* spelling, ziWChar* end ZI_NEED_WORK) {
while (*spelling && *spelling != ZI_WORK->unk_0x1A && *spelling != 0xF360 && spelling < end) { while (*spelling && *spelling != ZI_WORK->separator && *spelling != 0xF360 && spelling < end) {
++spelling; ++spelling;
} }
if (!*spelling || spelling == end) { if (!*spelling || spelling == end) {
@@ -37,8 +37,8 @@ int ZiPartialMatch(ziWChar* spelling, ziWChar* spellingEnd,
if (spelling == spellingEnd || candidate == candidateEnd || !*spelling || !*candidate) { if (spelling == spellingEnd || candidate == candidateEnd || !*spelling || !*candidate) {
return 1; return 1;
} }
while (*spelling != ZI_WORK->unk_0x1A && *spelling != 0xF360) { while (*spelling != ZI_WORK->separator && *spelling != 0xF360) {
if (*candidate == ZI_WORK->unk_0x1A || *candidate == 0xF360) { if (*candidate == ZI_WORK->separator || *candidate == 0xF360) {
break; break;
} }
if (*spelling != *candidate) { if (*spelling != *candidate) {
@@ -2868,7 +2868,7 @@ ziU8 Zi8GetElementCount(ziWChar* elements, ziU8 elementCount, ziU8 charCount ZI_
ziU8 count; ziU8 count;
ziWChar spacedElements[256]; ziWChar spacedElements[256];
struct { ziWChar separator; } savedState; struct { ziWChar separator; } savedState;
savedState.separator = ZI_WORK->unk_0x1A; savedState.separator = ZI_WORK->separator;
if (elementCount <= 1 || !charCount) { if (elementCount <= 1 || !charCount) {
return elementCount; return elementCount;
} }
@@ -2881,9 +2881,9 @@ ziU8 Zi8GetElementCount(ziWChar* elements, ziU8 elementCount, ziU8 charCount ZI_
if (spacedIndex == elementCount) { if (spacedIndex == elementCount) {
return elementCount; return elementCount;
} }
ZI_WORK->unk_0x1A = 0xF360; ZI_WORK->separator = 0xF360;
Zi8ZHaddSpace(elements, elementCount, spacedElements, 256, __zi8_work_data); Zi8ZHaddSpace(elements, elementCount, spacedElements, 256, __zi8_work_data);
ZI_WORK->unk_0x1A = savedState.separator; ZI_WORK->separator = savedState.separator;
spacedIndex = elementIndex = count = 0; spacedIndex = elementIndex = count = 0;
while (charCount && elementIndex < elementCount) { while (charCount && elementIndex < elementCount) {
if (spacedElements[spacedIndex] == 0xF360) { if (spacedElements[spacedIndex] == 0xF360) {

View File

@@ -21,7 +21,7 @@ ziU8 Zi8InitializeDynamic(ziLanguageEntry* langEntries ZI_NEED_WORK) {
ZI_WORK->unk_0x0A = 0xFF; ZI_WORK->unk_0x0A = 0xFF;
ZI_WORK->unk_0x10 = 0x64; ZI_WORK->unk_0x10 = 0x64;
*(ziU16*)&ZI_WORK->unk_0x0C = 0xFFFF; *(ziU16*)&ZI_WORK->unk_0x0C = 0xFFFF;
ZI_WORK->unk_0x1A = 0x20; ZI_WORK->separator = 0x20;
ZI_WORK->unk_0x1C[2] = 0; ZI_WORK->unk_0x1C[2] = 0;
ZI_WORK->unk_0x1B30 = 0; ZI_WORK->unk_0x1B30 = 0;
ZI_WORK->unk_0x1B3A = 0; ZI_WORK->unk_0x1B3A = 0;

View File

@@ -68,7 +68,7 @@ ziU8 Zi8ZHaddSpace(ziWChar* src, ziU8 count, ziWChar* dst,
} }
if (pdst[k - 1] != 0xF360 && if (pdst[k - 1] != 0xF360 &&
(pdst[k - 1] < 0xF331 || pdst[k - 1] > 0xF335)) { (pdst[k - 1] < 0xF331 || pdst[k - 1] > 0xF335)) {
pdst[k++] = ZI_WORK->unk_0x1A; pdst[k++] = ZI_WORK->separator;
} }
psrc += i; psrc += i;
n -= i; n -= i;

View File

@@ -13,8 +13,8 @@ typedef struct _CDBCryptBuf {
u32 buffer32[0xFB00]; u32 buffer32[0xFB00];
}; // 0x00 }; // 0x00
u32 unk_0x3EC00; u32 size; // 0x3EC00
u32 unk_0x3EC04; u32 offset; // 0x3EC04
BOOL allocated; // 0x3EC08 BOOL allocated; // 0x3EC08
u8 unk_0x3EC0C[0x34]; u8 unk_0x3EC0C[0x34];
} CDBCryptBuf; } CDBCryptBuf;

View File

@@ -164,7 +164,7 @@ CDBErr CDBRecordOpen_(CDBRecord* record) {
goto open_result_ready; goto open_result_ready;
open_location_ok: open_location_ok:
if (CDBFSSDIsMounted()) { if (CDBFSSDIsMounted()) {
err = CDBRecordDecrypt(record, cryptBuf, 0x3EC00, &cryptBuf->unk_0x3EC00, NULL); err = CDBRecordDecrypt(record, cryptBuf, 0x3EC00, &cryptBuf->size, NULL);
} else { } else {
err = CDB_ERROR_SD_IS_NOT_MOUNTED; err = CDB_ERROR_SD_IS_NOT_MOUNTED;
} }
@@ -174,7 +174,7 @@ CDBErr CDBRecordOpen_(CDBRecord* record) {
CDBCryptBufFree((CDBCryptBuf**)&record->cryptBuf); CDBCryptBufFree((CDBCryptBuf**)&record->cryptBuf);
return err; return err;
} }
cryptBuf->unk_0x3EC04 = sizeof(CDBAttrBuf); cryptBuf->offset = sizeof(CDBAttrBuf);
} }
return CDB_ERROR_OK; return CDB_ERROR_OK;
} }
@@ -223,7 +223,7 @@ CDBErr CDBRecordOpenReadOnly_(CDBRecord* record) {
goto result_ready; goto result_ready;
location_ok: location_ok:
if (CDBFSSDIsMounted()) { if (CDBFSSDIsMounted()) {
result = CDBRecordDecrypt(record, cryptBuf, 0x3EC00, &cryptBuf->unk_0x3EC00, NULL); result = CDBRecordDecrypt(record, cryptBuf, 0x3EC00, &cryptBuf->size, NULL);
} else { } else {
result = CDB_ERROR_SD_IS_NOT_MOUNTED; result = CDB_ERROR_SD_IS_NOT_MOUNTED;
} }
@@ -233,7 +233,7 @@ CDBErr CDBRecordOpenReadOnly_(CDBRecord* record) {
CDBCryptBufFree((CDBCryptBuf**)&record->cryptBuf); CDBCryptBufFree((CDBCryptBuf**)&record->cryptBuf);
return result; return result;
} }
cryptBuf->unk_0x3EC04 = sizeof(CDBAttrBuf); cryptBuf->offset = sizeof(CDBAttrBuf);
} }
return CDB_ERROR_OK; return CDB_ERROR_OK;
} }

View File

@@ -264,8 +264,8 @@ CDBErr CDBRecordFileReadData(CDBRecord* record, void* buffer, u32 size, u32* rea
CDBCryptBuf* cryptBuf = record->cryptBuf; CDBCryptBuf* cryptBuf = record->cryptBuf;
if (cryptBuf != NULL) { if (cryptBuf != NULL) {
u32 unk = cryptBuf->unk_0x3EC00 - cryptBuf->unk_0x3EC04; u32 unk = cryptBuf->size - cryptBuf->offset;
if (cryptBuf->unk_0x3EC00 < unk) { if (cryptBuf->size < unk) {
unk = 0; unk = 0;
} }
@@ -274,8 +274,8 @@ CDBErr CDBRecordFileReadData(CDBRecord* record, void* buffer, u32 size, u32* rea
} }
if (unk != 0) { if (unk != 0) {
memcpy(buffer, (u8*)&cryptBuf->buffer[cryptBuf->unk_0x3EC04], unk); memcpy(buffer, (u8*)&cryptBuf->buffer[cryptBuf->offset], unk);
cryptBuf->unk_0x3EC04 += unk; cryptBuf->offset += unk;
} }
if (readSize != NULL) { if (readSize != NULL) {
@@ -300,16 +300,16 @@ CDBErr CDBRecordFileSeekData(CDBRecord* record, u32 offset, CDBSeek seek) {
if (cryptBuf != NULL) { if (cryptBuf != NULL) {
switch (seek) { switch (seek) {
case CDB_SEEK_BEGIN: { case CDB_SEEK_BEGIN: {
cryptBuf->unk_0x3EC04 = sizeof(CDBAttrBuf); cryptBuf->offset = sizeof(CDBAttrBuf);
cryptBuf->unk_0x3EC04 += offset; cryptBuf->offset += offset;
break; break;
} }
case CDB_SEEK_END: { case CDB_SEEK_END: {
cryptBuf->unk_0x3EC04 = (cryptBuf->unk_0x3EC00 - 1) - offset; cryptBuf->offset = (cryptBuf->size - 1) - offset;
break; break;
} }
case CDB_SEEK_CUR: { case CDB_SEEK_CUR: {
cryptBuf->unk_0x3EC04 += offset; cryptBuf->offset += offset;
break; break;
} }
} }
@@ -329,7 +329,7 @@ int CDBRecordFileTellData(CDBRecord* record) {
CDBCryptBuf* cryptBuf = record->cryptBuf; CDBCryptBuf* cryptBuf = record->cryptBuf;
if (cryptBuf != NULL) { if (cryptBuf != NULL) {
return cryptBuf->unk_0x3EC04 - sizeof(CDBAttrBuf); return cryptBuf->offset - sizeof(CDBAttrBuf);
} }
return CDBFTellData(&recordFile->bridgeFile, record->key.location); return CDBFTellData(&recordFile->bridgeFile, record->key.location);
} }

View File

@@ -31,7 +31,7 @@ namespace ipl {
}; };
// clang-format on // clang-format on
SDButton::SDButton(EGG::Heap* heap) : Base(heap), unk_0x54(0) { SDButton::SDButton(EGG::Heap* heap) : Base(heap), mAnimWait(0) {
setSceneParentFlags(SCN_PARENTFLAG_CALC | SCN_PARENTFLAG_DRAW); setSceneParentFlags(SCN_PARENTFLAG_CALC | SCN_PARENTFLAG_DRAW);
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
@@ -114,10 +114,10 @@ namespace ipl {
} }
void SDButton::calc() { void SDButton::calc() {
if (unk_0x54 == 1) { if (mAnimWait == 1) {
if (!mpLayout->isPlaying(ANIM_HELP_BTN_ROLL_ON)) { if (!mpLayout->isPlaying(ANIM_HELP_BTN_ROLL_ON)) {
reset_gui(); reset_gui();
unk_0x54 = 0; mAnimWait = 0;
} }
} }
@@ -347,7 +347,7 @@ namespace ipl {
switch (animNo) { switch (animNo) {
case IDANIM_HELP_BTN_CLICK: { case IDANIM_HELP_BTN_CLICK: {
anim = mpLayout->getAnim(ANIM_HELP_BTN_ROLL_ON); anim = mpLayout->getAnim(ANIM_HELP_BTN_ROLL_ON);
unk_0x54 = 1; mAnimWait = 1;
break; break;
} }
case IDANIM_ARROW_RIGHT_CLICK: { case IDANIM_ARROW_RIGHT_CLICK: {

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