Compare commits

..

1 Commits

Author SHA1 Message Date
coah
5c45fddea5 cleanup(NWC24MsgObj): rename unk_0x1C to crc
Copied from/to mailbox entry->crc in MBoxCtrl.
2026-10-02 14:03:08 -05:00
10 changed files with 54 additions and 54 deletions

View File

@@ -89,10 +89,10 @@ namespace ipl {
int mIPLState; // 0x04
volatile BS2State mState; // 0x08
bool mbTickEnabled; // 0x0C
bool mbUpdateRequested; // 0x0D
bool mbAbortRequested; // 0x0E
bool mbRestartRequested; // 0x0F
bool unk_0x0C;
bool unk_0x0D;
bool unk_0x0E;
bool unk_0x0F;
bool mbIsDiagDisc; // 0x10
bool mbIncludesSeatTitles; // 0x11
u8* mpBannerBuffer; // 0x14

View File

@@ -265,7 +265,7 @@ struct __zi8_work_data_s {
ziPtr unk_0x11FC;
ziPtr userKeys[0x83]; // 0x1200
ziU8 unk_0x140C[4];
ziU32 formats; // 0x1410
ziU32 unk_0x1410;
ziU8 unk_0x1414[4];
ziU8 unk_0x1418;
ziU8 unk_0x1419;

View File

@@ -50,10 +50,10 @@ ziBool Zi8ZHsetZYfuzzyPairs(ziFuzzyZYPairs pairs ZI_NEED_WORK) {
ziBool Zi8SetLatinSearchOrder(ziU8* searchArray, ziU8 searchSize ZI_NEED_WORK) {
if (searchArray == 0 || *searchArray == 0) {
ZI_WORK->formats = (ziU32)Zi8SOdefaultArray;
ZI_WORK->unk_0x1410 = (ziU32)Zi8SOdefaultArray;
ZI_WORK->unk_0x1418 = 9;
} else {
ZI_WORK->formats = (ziU32)searchArray;
ZI_WORK->unk_0x1410 = (ziU32)searchArray;
ZI_WORK->unk_0x1418 = searchSize;
}
return 1;

View File

@@ -45,7 +45,7 @@ ziBool Zi8IsWordW(ziWChar* word, ziU8 language ZI_NEED_WORK) {
ziWChar* cursor;
ziU8* data;
ziU8 formats[8] = {1, 5, 0, 0, 0, 0, 0, 0};
ziU32 savedFormats = ZI_WORK->formats;
ziU32 savedFormats = ZI_WORK->unk_0x1410;
ziU8 savedCount = ZI_WORK->unk_0x1418;
ziSearchState search = {0};
Zi8LogError(100, __zi8_work_data);
@@ -73,7 +73,7 @@ ziBool Zi8IsWordW(ziWChar* word, ziU8 language ZI_NEED_WORK) {
request.candidates = ordinals;
request.maxCandidates = 1;
request.firstCandidate = 0;
ZI_WORK->formats = (ziU32)formats;
ZI_WORK->unk_0x1410 = (ziU32)formats;
if (ZI_WORK->unk_0x1C[0] == 2) {
ZI_WORK->unk_0x1418 = 0;
if (ZI_WORK->unk_0x09 & 1) formats[ZI_WORK->unk_0x1418++] = 1;
@@ -87,7 +87,7 @@ ziBool Zi8IsWordW(ziWChar* word, ziU8 language ZI_NEED_WORK) {
} else if (ZI_WORK->unk_0x1C[0] != 0) ZI_WORK->unk_0x1418 = 2;
else ZI_WORK->unk_0x1418 = 1;
count = Zi8GetCandidatesOrCount(&request, &search, __zi8_work_data);
ZI_WORK->formats = savedFormats;
ZI_WORK->unk_0x1410 = savedFormats;
ZI_WORK->unk_0x1418 = savedCount;
if (count != 0) return 1;
}

View File

@@ -31,7 +31,7 @@ typedef struct NWC24MsgObjPrivate {
u32 tag; // 0x14
u32 ledPattern; // 0x18
#if defined(NWC24_MBOX_CTRL) || defined(NWC24_MSG_COMMIT)
u32 unk_0x1C;
u32 crc; // 0x1C
#endif
#if defined(NWC24_MBOX_CTRL) || defined(NWC24_MSG_COMMIT)
union {
@@ -50,8 +50,8 @@ typedef struct NWC24MsgObjPrivate {
NWC24Data unk_0x38;
NWC24Data subject; // 0x40
NWC24Data text; // 0x48
NWC24Data charsetData; // 0x50
NWC24Data encodingData; // 0x58
NWC24Data unk_0x50;
NWC24Data unk_0x58;
NWC24Charset charset; // 0x60
NWC24Encoding encoding; // 0x64
NWC24Data attached[NWC24_MSG_ATTACHMENT_MAX]; // 0x68

View File

@@ -782,7 +782,7 @@ static NWC24Err DuplicationCheck(MBCHeader* header, const NWC24MsgObjPrivate* ms
duplicateOffset = offset;
continue;
}
if (msg->unk_0x1C != 0 && entry->crc == msg->unk_0x1C && entry->type == msg->type && entry->length == msg->length &&
if (msg->crc != 0 && entry->crc == msg->crc && entry->type == msg->type && entry->length == msg->length &&
entry->flags == msg->unk_0x10 && (s32)entry->date == (s32)msg->date) {
duplicateId = entry->msgId;
duplicateOffset = offset;
@@ -950,8 +950,8 @@ static NWC24Err CopyMsgObjToMBCFmt(const NWC24MsgObjPrivate* msg, MBCEntry* entr
u32 field1 = ((u32)msg->unk_0x30.ptr & 0xFFFFF) | (msg->unk_0x30.size << 20);
u32 field2 = ((u32)msg->unk_0x38.ptr & 0xFFFFF) | (msg->unk_0x38.size << 20);
u32 field3 = ((u32)msg->subject.ptr & 0xFFFFF) | (msg->subject.size << 20);
u32 field4 = ((u32)msg->charsetData.ptr & 0xFFFFF) | (msg->charsetData.size << 20);
u32 field5 = ((u32)msg->encodingData.ptr & 0xFFFFF) | (msg->encodingData.size << 20);
u32 field4 = ((u32)msg->unk_0x50.ptr & 0xFFFFF) | (msg->unk_0x50.size << 20);
u32 field5 = ((u32)msg->unk_0x58.ptr & 0xFFFFF) | (msg->unk_0x58.size << 20);
entry->msgId = msg->msgId;
entry->type = msg->type;
entry->length = msg->length;
@@ -959,7 +959,7 @@ static NWC24Err CopyMsgObjToMBCFmt(const NWC24MsgObjPrivate* msg, MBCEntry* entr
entry->flags = msg->unk_0x10;
entry->tag = msg->tag;
entry->ledPattern = msg->ledPattern;
entry->crc = msg->unk_0x1C;
entry->crc = msg->crc;
entry->fromIdHigh = msg->fromIdHigh;
entry->fromIdLow = msg->fromIdLow;
entry->date = msg->date;
@@ -1006,7 +1006,7 @@ static NWC24Err CopyMsgObjToPrvFmt(const MBCEntry* entry, NWC24MsgObjPrivate* ms
msg->unk_0x10 = entry->flags;
msg->tag = entry->tag;
msg->ledPattern = entry->ledPattern;
msg->unk_0x1C = entry->crc;
msg->crc = entry->crc;
msg->fromIdHigh = entry->fromIdHigh;
msg->fromIdLow = entry->fromIdLow;
msg->date = entry->date;
@@ -1025,10 +1025,10 @@ static NWC24Err CopyMsgObjToPrvFmt(const MBCEntry* entry, NWC24MsgObjPrivate* ms
msg->unk_0x38.size = size2;
msg->subject.ptr = (void*)offset3;
msg->subject.size = size3;
msg->charsetData.ptr = (void*)offset4;
msg->charsetData.size = size4;
msg->encodingData.ptr = (void*)offset5;
msg->encodingData.size = size5;
msg->unk_0x50.ptr = (void*)offset4;
msg->unk_0x50.size = size4;
msg->unk_0x58.ptr = (void*)offset5;
msg->unk_0x58.size = size5;
msg->attached[0].ptr = entry->attached[0].ptr;
msg->attached[0].size = entry->attached[0].size;
msg->attachedSize[0] = entry->attachedSize[0];

View File

@@ -811,16 +811,16 @@ static NWC24Err WriteContentTypeField(NWC24MsgObjPrivate* msg) {
name = NWC24GetCharsetStr(msg->charset);
if (name != NULL) {
Mail_sprintf(buffer, (char*)ContentTypeTP, name);
msg->charsetData.ptr = (const void*)(msg->length + 34);
msg->charsetData.size = Mail_strlen(name) + 1;
msg->unk_0x50.ptr = (const void*)(msg->length + 34);
msg->unk_0x50.size = Mail_strlen(name) + 1;
total = Mail_strlen(buffer);
buffer += total;
}
encoding = NWC24GetEncodingStr(msg->encoding);
if (encoding != NULL) {
Mail_sprintf(buffer, (char*)ContentTxEncT, encoding);
msg->encodingData.ptr = (const void*)(total + msg->length + 27);
msg->encodingData.size = Mail_strlen(encoding) + 1;
msg->unk_0x58.ptr = (const void*)(total + msg->length + 27);
msg->unk_0x58.size = Mail_strlen(encoding) + 1;
total += Mail_strlen(buffer);
}
if (total == 0)

View File

@@ -75,8 +75,8 @@ NWC24Err NWC24InitMsgObj(NWC24MsgObj* msg, NWC24MsgType type) {
NWC24Data_Init(&msgObj->unk_0x30);
NWC24Data_Init(&msgObj->unk_0x38);
NWC24Data_Init(&msgObj->charsetData);
NWC24Data_Init(&msgObj->encodingData);
NWC24Data_Init(&msgObj->unk_0x50);
NWC24Data_Init(&msgObj->unk_0x58);
NWC24Data_Init(&msgObj->unk_0xD0);
NWC24Data_Init(&msgObj->faceData);
NWC24Data_Init(&msgObj->altName);

View File

@@ -426,19 +426,19 @@ static NWC24Err ReadMsgTextInternal(const NWC24MsgObj* msg, char* text, u32 capa
return result;
}
Mail_memset(charset, 0, charsetCapacity);
if (privateMsg->charsetData.size >= charsetCapacity)
if (privateMsg->unk_0x50.size >= charsetCapacity)
result = NWC24_ERR_FORMAT;
else {
if (privateMsg->charsetData.size != 0) {
NWC24FSeek(&file, (u32)privateMsg->charsetData.ptr, NWC24_SEEK_BEG);
result = NWC24FRead(charset, privateMsg->charsetData.size, &file);
if (privateMsg->unk_0x50.size != 0) {
NWC24FSeek(&file, (u32)privateMsg->unk_0x50.ptr, NWC24_SEEK_BEG);
result = NWC24FRead(charset, privateMsg->unk_0x50.size, &file);
if (result != NWC24_OK)
goto close;
}
if (privateMsg->encodingData.size != 0 && privateMsg->encodingData.size < 32) {
if (privateMsg->unk_0x58.size != 0 && privateMsg->unk_0x58.size < 32) {
Mail_memset(buffer, 0, 32);
NWC24FSeek(&file, (u32)privateMsg->encodingData.ptr, NWC24_SEEK_BEG);
result = NWC24FRead(buffer, privateMsg->encodingData.size, &file);
NWC24FSeek(&file, (u32)privateMsg->unk_0x58.ptr, NWC24_SEEK_BEG);
result = NWC24FRead(buffer, privateMsg->unk_0x58.size, &file);
if (result != NWC24_OK)
goto close;
result = NWC24ParseEncodingStr(encoding, buffer);

View File

@@ -14,7 +14,7 @@
namespace ipl {
namespace bs2 {
Manager::Manager(EGG::Heap* pHeap)
: mIPLState(IPL_STATE_NO_DISK), mState(BS2_STT_NO_DISK), mbTickEnabled(true), mbUpdateRequested(false), mbAbortRequested(false), mbRestartRequested(false),
: mIPLState(IPL_STATE_NO_DISK), mState(BS2_STT_NO_DISK), unk_0x0C(true), unk_0x0D(false), unk_0x0E(false), unk_0x0F(false),
mbIsDiagDisc(false), mbIncludesSeatTitles(false), mbHasBanner(FALSE), mUnlockedState(BS2_STT_NO_DISK), mbStartUpdate(false),
mEntries(NULL), mEntrySize(1), mEntryOffset(0) {
mpBannerBuffer = new (pHeap, DEFAULT_ALIGN) u8[BS2_DEFAULT_BANNER_SIZE];
@@ -30,13 +30,13 @@ namespace ipl {
return mIPLState;
}
if (mbRestartRequested && !System::isNandFull()) {
if (unk_0x0F && !System::isNandFull()) {
BS2RestartStateMachine();
mbTickEnabled = true;
unk_0x0C = true;
mIPLState = IPL_STATE_NO_DISK;
mbRestartRequested = false;
} else if (mbTickEnabled) {
unk_0x0F = false;
} else if (unk_0x0C) {
BOOL old = OSDisableInterrupts();
mState = BS2Tick();
@@ -51,7 +51,7 @@ namespace ipl {
if (mbIsDiagDisc && System::isRsrcLoaded()) {
__WPADReconnect(TRUE);
mbTickEnabled = false;
unk_0x0C = false;
bootNewSystem();
}
}
@@ -65,7 +65,7 @@ namespace ipl {
}
void Manager::startUpdate() {
mbUpdateRequested = true;
unk_0x0D = true;
mbStartUpdate = true;
mPrevEntry = 0;
mPrevFound = 0;
@@ -88,11 +88,11 @@ namespace ipl {
}
void Manager::reserveRVLGame() {
mbTickEnabled = false;
unk_0x0C = false;
}
void Manager::reserveGCGame() {
mbTickEnabled = false;
unk_0x0C = false;
}
void Manager::startRVLGame() {
@@ -103,13 +103,13 @@ namespace ipl {
}
void Manager::abort() {
mbAbortRequested = true;
mbRestartRequested = false;
unk_0x0E = true;
unk_0x0F = false;
}
void Manager::restart() {
mbAbortRequested = false;
mbRestartRequested = true;
unk_0x0E = false;
unk_0x0F = true;
System::checkNandOverFlowFlagAsync();
}
@@ -195,7 +195,7 @@ namespace ipl {
break;
}
case BS2_STT_64: {
mbTickEnabled = false;
unk_0x0C = false;
mIPLState = IPL_STATE_8;
break;
}
@@ -216,25 +216,25 @@ namespace ipl {
}
void Manager::execTick(BS2State state) {
if (mbUpdateRequested) {
if (unk_0x0D) {
if (state == BS2_STT_UPDATE_DISK) {
BS2StartUpdate();
} else {
mbStartUpdate = false;
}
} else if (mbAbortRequested) {
} else if (unk_0x0E) {
if (state == BS2_STT_NO_DISK || state == BS2_STT_COVER_OPEN || state == BS2_STT_55 || state == BS2_STT_WRONG_DISK ||
state == BS2_STT_66 || state == BS2_STT_67 || state == BS2_STT_68 || state == BS2_STT_FATAL_ERROR ||
state == BS2_STT_UPDATE_FAILED || state == BS2_STT_DIRTY_DISK) {
mbTickEnabled = false;
unk_0x0C = false;
mIPLState = IPL_STATE_8;
} else {
BS2AbortStateMachine();
}
}
mbUpdateRequested = false;
mbAbortRequested = false;
unk_0x0D = false;
unk_0x0E = false;
}
void Manager::updateTick() {