Compare commits

..

1 Commits

Author SHA1 Message Date
coah
26090e7222 cleanup(NWC24MsgObj): rename unk_0x50/58 to charsetData/encodingData
Content-Type charset and Content-Transfer-Encoding string spans.
2026-10-02 14:03:52 -05:00
13 changed files with 39 additions and 39 deletions

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

@@ -273,7 +273,7 @@ struct __zi8_work_data_s {
ziU8 unk_0x141C;
ziU8 unk_0x141D;
ziU8 unk_0x141E;
ziU8 maxCnt; // 0x141F
ziU8 unk_0x141F;
ziU8 unk_0x1420[4];
zi8DawgCtx dawgCtx; // 0x1424
ziU8 unk_0x1760[4]; // 0x1760

View File

@@ -136,7 +136,7 @@ descend:
records[context->cnt].node = ZiDAWGGetChild(records[context->cnt - 1].node);
if (records[context->cnt].node == (ziU8*)0) goto next_sibling;
context->cnt++;
if (ZI_WORK->maxCnt < context->cnt) ZI_WORK->maxCnt = context->cnt;
if (ZI_WORK->unk_0x141F < context->cnt) ZI_WORK->unk_0x141F = context->cnt;
goto update_current;
next_sibling:
while (context->cnt != 0) {
@@ -238,7 +238,7 @@ unsigned int Zi8MatchROMdata2(ziWChar* elements, ziU8 count, ziU8 language,
}
}
search_segment:
ZI_WORK->maxCnt = 1;
ZI_WORK->unk_0x141F = 1;
result = Zi8MatchROMdata1(elements + ZI_WORK->unk_0x17EA,
count - ZI_WORK->unk_0x17EA, language,
&ZI_WORK->unk_0x17F4[ZI_WORK->unk_0x17EA], capacity,
@@ -262,8 +262,8 @@ search_segment:
if (elements[index] == 0xeff1) goto finish_segments;
}
}
if (ZI_WORK->maxCnt > capacity) goto finish_segments;
for (index = ZI_WORK->maxCnt; index != 0; index--) {
if (ZI_WORK->unk_0x141F > capacity) goto finish_segments;
for (index = ZI_WORK->unk_0x141F; index != 0; index--) {
result = Zi8MatchROMdata1(elements + ZI_WORK->unk_0x17EA, index, language,
&ZI_WORK->unk_0x17F4[ZI_WORK->unk_0x17EA], capacity,
1, 0, ZI_WORK->unk_0x1768, (char*)group,

View File

@@ -19,7 +19,7 @@ typedef struct _CDBRecordFile {
#else
u8 unk_0x00[0x1C - 0x00];
#endif
int allocFlag; // 0x1C
int unk_0x1C;
CDBAttr attr; // 0x20
CDBBridgeFile bridgeFile; // 0x42C
u8 unk_0x434[0x438 - 0x434];

View File

@@ -50,8 +50,8 @@ typedef struct NWC24MsgObjPrivate {
NWC24Data unk_0x38;
NWC24Data subject; // 0x40
NWC24Data text; // 0x48
NWC24Data unk_0x50;
NWC24Data unk_0x58;
NWC24Data charsetData; // 0x50
NWC24Data encodingData; // 0x58
NWC24Charset charset; // 0x60
NWC24Encoding encoding; // 0x64
NWC24Data attached[NWC24_MSG_ATTACHMENT_MAX]; // 0x68

View File

@@ -57,7 +57,7 @@ void CDBRecordInstanceInit(CDBRecordFile* recordFile, CDBRecord* record, int typ
OSLockMutex((OSMutex*)recordFile);
recordFile->used = 1;
OSUnlockMutex((OSMutex*)recordFile);
recordFile->allocFlag = type;
recordFile->unk_0x1C = type;
recordFile->database = record->unk_0x00;
CDBAttrInit(&recordFile->attr);
CDBRecordKeyCopy(&recordFile->key, &record->key);
@@ -310,7 +310,7 @@ CDBErr CDBRecordWrite_(CDBRecord* record, void* buffer, u32 size) {
CDBReportError("can't write data in the record; the record is closed\n");
return CDB_ERROR_27;
}
if ((recordFile->allocFlag & 2) == 0) {
if ((recordFile->unk_0x1C & 2) == 0) {
CDBReportError("can't write data in the record; the record is opened as READONLY\n");
return CDB_ERROR_27;
}
@@ -687,7 +687,7 @@ CDBErr CDBRecordEncrypt(CDBRecord* record, void* buffer, CDBRecordKey* key, u32
if ((s32)recordFile == 0) {
return CDB_ERROR_27;
}
if (recordFile->allocFlag == 1) {
if (recordFile->unk_0x1C == 1) {
return CDB_ERROR_26;
}
if ((s32)buffer == 0) {
@@ -699,7 +699,7 @@ CDBErr CDBRecordEncrypt(CDBRecord* record, void* buffer, CDBRecordKey* key, u32
tempFile = record->file;
if ((s32)tempFile == 0) {
result = CDB_ERROR_27;
} else if (tempFile->allocFlag == 1) {
} else if (tempFile->unk_0x1C == 1) {
result = CDB_ERROR_26;
} else {
CDBAttrSetWiiId(&tempFile->attr, CDBGetWiiId());
@@ -713,7 +713,7 @@ CDBErr CDBRecordEncrypt(CDBRecord* record, void* buffer, CDBRecordKey* key, u32
CDBErr result;
if ((s32)record->file == 0) {
result = CDB_ERROR_27;
} else if (((CDBRecordFile*)record->file)->allocFlag == 1) {
} else if (((CDBRecordFile*)record->file)->unk_0x1C == 1) {
result = CDB_ERROR_26;
} else {
CDBAttrInitIV(&((CDBRecordFile*)record->file)->attr);
@@ -727,7 +727,7 @@ CDBErr CDBRecordEncrypt(CDBRecord* record, void* buffer, CDBRecordKey* key, u32
CDBErr result;
if ((s32)record->file == 0) {
result = CDB_ERROR_27;
} else if (((CDBRecordFile*)record->file)->allocFlag == 1) {
} else if (((CDBRecordFile*)record->file)->unk_0x1C == 1) {
result = CDB_ERROR_26;
} else {
CDBAttrSetKeyStr(&((CDBRecordFile*)record->file)->attr, key);

View File

@@ -265,7 +265,7 @@ CDBErr CDBRecordFree(CDBRecord* record) {
OSLockMutex((OSMutex*)recordFile);
*(u32*)&recordFile->unk_0x00[0x18] = 0;
OSUnlockMutex((OSMutex*)recordFile);
recordFile->allocFlag = 0;
recordFile->unk_0x1C = 0;
record->file = NULL;
OSUnlockMutex(&s_mutex);
}

View File

@@ -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->unk_0x50.ptr & 0xFFFFF) | (msg->unk_0x50.size << 20);
u32 field5 = ((u32)msg->unk_0x58.ptr & 0xFFFFF) | (msg->unk_0x58.size << 20);
u32 field4 = ((u32)msg->charsetData.ptr & 0xFFFFF) | (msg->charsetData.size << 20);
u32 field5 = ((u32)msg->encodingData.ptr & 0xFFFFF) | (msg->encodingData.size << 20);
entry->msgId = msg->msgId;
entry->type = msg->type;
entry->length = msg->length;
@@ -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->unk_0x50.ptr = (void*)offset4;
msg->unk_0x50.size = size4;
msg->unk_0x58.ptr = (void*)offset5;
msg->unk_0x58.size = size5;
msg->charsetData.ptr = (void*)offset4;
msg->charsetData.size = size4;
msg->encodingData.ptr = (void*)offset5;
msg->encodingData.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->unk_0x50.ptr = (const void*)(msg->length + 34);
msg->unk_0x50.size = Mail_strlen(name) + 1;
msg->charsetData.ptr = (const void*)(msg->length + 34);
msg->charsetData.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->unk_0x58.ptr = (const void*)(total + msg->length + 27);
msg->unk_0x58.size = Mail_strlen(encoding) + 1;
msg->encodingData.ptr = (const void*)(total + msg->length + 27);
msg->encodingData.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->unk_0x50);
NWC24Data_Init(&msgObj->unk_0x58);
NWC24Data_Init(&msgObj->charsetData);
NWC24Data_Init(&msgObj->encodingData);
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->unk_0x50.size >= charsetCapacity)
if (privateMsg->charsetData.size >= charsetCapacity)
result = NWC24_ERR_FORMAT;
else {
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 (privateMsg->charsetData.size != 0) {
NWC24FSeek(&file, (u32)privateMsg->charsetData.ptr, NWC24_SEEK_BEG);
result = NWC24FRead(charset, privateMsg->charsetData.size, &file);
if (result != NWC24_OK)
goto close;
}
if (privateMsg->unk_0x58.size != 0 && privateMsg->unk_0x58.size < 32) {
if (privateMsg->encodingData.size != 0 && privateMsg->encodingData.size < 32) {
Mail_memset(buffer, 0, 32);
NWC24FSeek(&file, (u32)privateMsg->unk_0x58.ptr, NWC24_SEEK_BEG);
result = NWC24FRead(buffer, privateMsg->unk_0x58.size, &file);
NWC24FSeek(&file, (u32)privateMsg->encodingData.ptr, NWC24_SEEK_BEG);
result = NWC24FRead(buffer, privateMsg->encodingData.size, &file);
if (result != NWC24_OK)
goto close;
result = NWC24ParseEncodingStr(encoding, buffer);