summaryrefslogtreecommitdiff
path: root/src/d/d_msg_unit.cpp
diff options
context:
space:
mode:
authorLagoLunatic <LagoLunatic@users.noreply.github.com>2025-12-20 02:00:17 -0500
committerGitHub <noreply@github.com>2025-12-19 23:00:17 -0800
commit917d93664d5fa6d4d52237b6b2476f97bbee5947 (patch)
tree48a93069ae70182a324f49fc5d83f3981910b810 /src/d/d_msg_unit.cpp
parent039505373732d70534f598f0d3f8d3eca62482ab (diff)
Match dMsgUnit_c::setTag (#2974)
* Match dMsgUnit_c::setTag for GCN USA Co-authored-by: Cuyler36 <Cuyler36@users.noreply.github.com> * Match dMsgUnit_c::setTag for debug * Minor cleanup --------- Co-authored-by: Cuyler36 <Cuyler36@users.noreply.github.com>
Diffstat (limited to 'src/d/d_msg_unit.cpp')
-rw-r--r--src/d/d_msg_unit.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/d/d_msg_unit.cpp b/src/d/d_msg_unit.cpp
index bebfec7a0c..9e641220c8 100644
--- a/src/d/d_msg_unit.cpp
+++ b/src/d/d_msg_unit.cpp
@@ -33,14 +33,13 @@ typedef struct dMsgUnit_inf1_section_t {
/* 0x08 */ u16 entryCount;
/* 0x0A */ u16 entryLength;
/* 0x0C */ u16 msgArchiveId;
- /* 0x0E */ dMsgUnit_inf1_entry entries[0];
+ /* 0x10 */ dMsgUnit_inf1_entry entries[0];
} dMsgUnit_inf1_section_t;
dMsgUnit_c::dMsgUnit_c() {}
dMsgUnit_c::~dMsgUnit_c() {}
-// NONMATCHING - regalloc
#if REGION_JPN
void dMsgUnit_c::setTag(int i_type, int i_value, char* o_buffer, bool param_4) {
*o_buffer = 0;
@@ -245,7 +244,6 @@ void dMsgUnit_c::setTag(int i_type, int i_value, char* o_buffer, bool param_4) {
}
if (i_type == 3 && param_4 == true) {
- (void)seconds; // dummy use to force into register instead of stack
f32 iVar8b;
f32 dayTime = g_env_light.getDaytime();
f32 hour = dayTime / 15.0f;
@@ -265,21 +263,21 @@ void dMsgUnit_c::setTag(int i_type, int i_value, char* o_buffer, bool param_4) {
if (!stack9) {
bmg_header_t* pHeader = (bmg_header_t*)dMeter2Info_getMsgUnitResource();
- dMsgUnit_inf1_section_t* pInfoBlock = NULL;
+ bmg_section_t* pInfoBlock = NULL;
const void* pMsgDataBlock = NULL;
str1_section_t* pStrAttributeBlock = NULL;
int filepos = sizeof(bmg_header_t);
u32 filesize = pHeader->size;
- bmg_section_t* pSection = (bmg_section_t*)(((u8*)pHeader) + filepos);
+ u8* pSection = ((u8*)pHeader) + filepos;
- for (; filepos < filesize; filepos += pSection->size) {
- switch (pSection->magic) {
+ for (; filepos < filesize; filepos += ((bmg_section_t*)pSection)->size) {
+ switch (((bmg_section_t*)pSection)->magic) {
case 'FLW1':
break;
case 'FLI1':
break;
case 'INF1':
- pInfoBlock = (dMsgUnit_inf1_section_t*)pSection;
+ pInfoBlock = (bmg_section_t*)pSection;
break;
case 'DAT1':
pMsgDataBlock = pSection;
@@ -288,27 +286,26 @@ void dMsgUnit_c::setTag(int i_type, int i_value, char* o_buffer, bool param_4) {
pStrAttributeBlock = (str1_section_t*)pSection;
break;
}
- pSection = (bmg_section_t*)((u8*)pSection + pSection->size);
+ pSection += ((bmg_section_t*)pSection)->size;
}
// This section is weird. The debug seems like entriesStr is outside the condition
// but the normal build doesn't really work with that. Same for pInfoBlock->entries.
#if DEBUG
- dMsgUnit_inf1_entry* entriesInf = &pInfoBlock->entries[i_type];
+ dMsgUnit_inf1_entry* entriesInf = &((dMsgUnit_inf1_section_t*)pInfoBlock)->entries[i_type];
u32 dat1EntryOffset = entriesInf->dat1EntryOffset;
const char* uVar5;
u16 vals[14];
vals[0] = entriesInf->startFrame;
vals[1] = entriesInf->endFrame;
- (void)entriesInf; // dummy use to force into register instead of stack
str1_entry_t* entriesStr = pStrAttributeBlock->entries;
#else
- u32 dat1EntryOffset = pInfoBlock->entries[i_type].dat1EntryOffset;
+ u32 dat1EntryOffset = ((dMsgUnit_inf1_section_t*)pInfoBlock)->entries[i_type].dat1EntryOffset;
const char* uVar5;
u16 vals[14];
- vals[0] = pInfoBlock->entries[i_type].startFrame;
- vals[1] = pInfoBlock->entries[i_type].endFrame;
+ vals[0] = ((dMsgUnit_inf1_section_t*)pInfoBlock)->entries[i_type].startFrame;
+ vals[1] = ((dMsgUnit_inf1_section_t*)pInfoBlock)->entries[i_type].endFrame;
#endif
#if REGION_PAL