cleanup d_meter2_info / little JMessage work (#2460)

* d_meter2_info cleanup

* parseBlock_next matching
This commit is contained in:
TakaRikka
2025-05-28 14:04:30 +03:00
committed by GitHub
parent 9a98863aff
commit e8e36445ba
15 changed files with 1243 additions and 744 deletions
+7
View File
@@ -231,6 +231,7 @@ struct TLinkList_factory : public TLinkList<T, I> {
inline virtual ~TLinkList_factory() = 0;
virtual T* Do_create() = 0;
virtual void Do_destroy(T*) = 0;
void Clear_destroy() {
while (!this->empty()) {
T* item = &this->front();
@@ -238,6 +239,12 @@ struct TLinkList_factory : public TLinkList<T, I> {
Do_destroy(item);
}
}
TLinkList<T, I>::iterator Erase_destroy(T* param_0) {
TLinkList<T, I>::iterator spC(Erase(param_0));
Do_destroy(param_0);
return spC;
}
};
template <typename T, int I>
+2 -2
View File
@@ -247,8 +247,8 @@ inline void JKRUnmountArchive(JKRArchive* arc) {
arc->unmount();
}
inline void JKRReadIdxResource(void* param_1, u32 param_2, u32 param_3, JKRArchive* param_4) {
param_4->readIdxResource(param_1, param_2, param_3);
inline u32 JKRReadIdxResource(void* buffer, u32 bufsize, u32 resIdx, JKRArchive* archive) {
return archive->readIdxResource(buffer, bufsize, resIdx);
}
#endif
+41
View File
@@ -0,0 +1,41 @@
#ifndef JMESSAGE_H
#define JMESSAGE_H
#include <dolphin.h>
// Struct definitions might be wrong
typedef struct bmg_header_t {
/* 0x00 */ char magic[8]; // "MESGbmg1"
/* 0x08 */ u32 size; // total size of file not including FLW1/FLI1 sections
/* 0x0C */ u32 n_sections; // number of sections
/* 0x10 */ u8 encoding; // text encoding
/* 0x11 */ u8 padding[0x20 - 0x11]; // padding
} bmg_header_t;
typedef struct bmg_section_t {
/* 0x0 */ u32 magic; // four character magic string
/* 0x4 */ u32 size; // total size of the section
} bmg_section_t;
typedef struct inf1_entry_t {
/* 0x0 */ u32 string_offset; // offset into DAT1 section entries, pointing to where message text starts
/* 0x4 */ // attributes // attribute data. size fills up the rest of defined INF1 "entry_size"
} inf1_entry_t;
typedef struct inf1_section_t {
/* 0x00 */ bmg_section_t header; // section header
/* 0x08 */ u16 entry_num; // number of entries in this section
/* 0x0A */ u16 entry_size; // size of an entry
/* 0x0C */ u8 padding[4]; // padding
} inf1_section_t;
typedef struct str1_entry_t {
char str[0];
} str1_entry_t;
typedef struct str1_section_t {
/* 0x00 */ bmg_section_t header; // section header
/* 0x08 */ str1_entry_t entries[0];
} str1_section_t;
#endif /* JMESSAGE_H */
+17
View File
@@ -24,6 +24,11 @@ struct data {
struct TParse_TBlock : public JGadget::binary::TParseData_aligned<4> {
TParse_TBlock(const void* data) : TParseData_aligned(data) {}
const char* get() const { return (char*)getRaw(); }
u32 get_size() const { return *(u32*)(get() + 0x4); }
const void* getNext() const { return (char*)getRaw() + get_size(); }
u32 get_type() const { return *(u32*)(get() + 0x0); }
};
struct TParse_TBlock_info : public TParse_TBlock {
@@ -55,6 +60,18 @@ struct data {
TParse_TBlock_color(const void* data) : TParse_TBlock(data) {}
};
struct TParse_TBlock_messageText : public TParse_TBlock {
TParse_TBlock_messageText(const void* data) : TParse_TBlock(data) {}
char* getContent() const { return (char*)getRaw() + 0x8; }
};
struct TParse_TBlock_stringAttribute : public TParse_TBlock {
TParse_TBlock_stringAttribute(const void* data) : TParse_TBlock(data) {}
char* getContent() const { return (char*)getRaw() + 0x8; }
};
static u32 getTagCode(u32 tag) { return tag & 0xFFFF; }
static u32 getTagGroup(u32 tag) { return (tag >> 0x10) & 0xFF; }
+19 -2
View File
@@ -13,7 +13,7 @@ namespace JMessage {
*/
struct TResource {
TResource()
: field_0x8(NULL), field_0xc(NULL), field_0x10(NULL), field_0x14(0), mMessageID(NULL) {}
: field_0x8(NULL), field_0xc(NULL), field_0x10(NULL), field_0x14(NULL), mMessageID(NULL) {}
/* 802A8CDC */ u16 toMessageIndex_messageID(u32, u32, bool*) const;
@@ -50,11 +50,28 @@ struct TResource {
void setData_header(const void* pData) {
field_0x8.setRaw(pData);
}
void setData_block_info(const void* pData) {
field_0xc.setRaw(pData);
}
void setData_block_messageText(const void* pData) {
field_0x10 = data::TParse_TBlock_messageText(pData).getContent();
}
void setData_block_stringAttribute(const void* pData) {
field_0x14 = data::TParse_TBlock_stringAttribute(pData).getContent();
}
void setData_block_messageID(const void* pData) {
mMessageID.setRaw(pData);
}
JGadget::TLinkListNode ocObject_;
/* 0x08 */ data::TParse_THeader field_0x8;
/* 0x0C */ data::TParse_TBlock_info field_0xc;
/* 0x10 */ char* field_0x10;
/* 0x14 */ int field_0x14;
/* 0x14 */ char* field_0x14;
/* 0x18 */ data::TParse_TBlock_messageID mMessageID;
};
+1 -7
View File
@@ -166,15 +166,9 @@ public:
/* 0xC0 */ f32 field_0xc0;
/* 0xC4 */ f32 field_0xc4;
};
#include "f_op/f_op_actor_mng.h"
class JMSMesgEntry_c : public fopEn_enemy_c {
private:
/* 0x5ac */ u8 field_0x5ac[0x748 - 0x5ac];
};
STATIC_ASSERT(sizeof(JMSMesgEntry_c) == 0x748);
struct JKRExpHeap {};
+208 -202
View File
File diff suppressed because it is too large Load Diff
+28 -25
View File
@@ -2,37 +2,40 @@
#define D_MSG_D_MSG_CLASS_H
#include "JSystem/JMessage/control.h"
#include "JSystem/JMessage/JMessage.h"
#include "SSystem/SComponent/c_xyz.h"
class JMSMesgEntry_c {
public:
/* 0x0 */ u32 string_offset;
// Attributes
/* 0x04 */ u16 message_id;
/* 0x06 */ u16 unk_0x6;
/* 0x08 */ u8 unk_0x8;
/* 0x09 */ u8 display_style;
/* 0x0A */ u8 print_style;
/* 0x0B */ u8 position;
/* 0x0C */ u8 unk_0xc;
/* 0x0D */ u8 unk_0xd;
/* 0x0E */ u8 unk_0xe;
/* 0x0F */ u8 camera_id;
/* 0x10 */ u32 unk_0x10;
};
class JMSMesgInfo_c {
public:
/* 0x00 */ bmg_section_t header; // section header
/* 0x08 */ u16 entry_num; // number of entries in this section
/* 0x0A */ u16 entry_size; // size of an entry
/* 0x0C */ u8 padding[4]; // padding
/* 0x10 */ JMSMesgEntry_c entries[0];
};
class COutFont_c;
class J2DTextBox;
class JUTFont;
struct JMSMesgEntry_c {
/* 0x00 */ u32 mStringOffset;
/* 0x04 */ u16 mStringId;
/* 0x06 */ u16 field_0x06;
/* 0x08 */ u8 field_0x08;
/* 0x09 */ u8 field_0x09;
/* 0x0A */ u8 field_0x0a;
/* 0x0B */ u8 field_0x0b;
/* 0x0C */ u8 field_0x0c;
/* 0x0D */ u8 field_0x0d;
/* 0x0E */ u8 field_0x0e;
/* 0x0F */ u8 field_0x0f;
/* 0x10 */ u32 field_0x10;
}; // Size: 0x14
struct JMSMesgHeader_c {
/* 0x00 */ u32 magic;
/* 0x04 */ u32 sectionSize;
/* 0x08 */ u16 entryCount;
/* 0x0A */ u16 entrySize;
/* 0x0C */ u16 field_0xc;
/* 0x0E */ u16 field_0xe;
/* 0x10 */ JMSMesgEntry_c entries[0];
}; // Size: 0x10
class STControl;
class dMsgObject_c;
struct jmessage_tReference : public JMessage::TReference {
+1 -42
View File
@@ -1,48 +1,7 @@
#ifndef D_MSG_D_MSG_UNIT_H
#define D_MSG_D_MSG_UNIT_H
#include "global.h"
// Struct definitions might be wrong
typedef struct bmg_section_t {
u32 msgType; // sectionType
u32 size; // total size of the section
u8 data[0]; // section data
} bmg_section_t;
typedef struct bmg_header_t {
/* 0x00 */ char magic[8]; // = BMG_MAGIC
/* 0x08 */ u32 size; // total size of file
/* 0x0c */ u32 n_sections; // number of sections
/* 0x10 */ u32 encoding; // text encoding
/* 0x11 */ u8 unknown[12]; // unknown data
/* 0x20 */ bmg_section_t section[0]; // first section header
} bmg_header_t;
typedef struct inf1_entry_t {
u32 dat1EntryOffset;
u16 startFrame;
u16 endFrame;
} inf1_entry_t;
typedef struct inf1_section_t {
/* 0x00 */ u32 msgType; // sectionType
/* 0x04 */ u32 size; // total size of the section
/* 0x08 */ u16 entryCount;
/* 0x0A */ u16 entryLength;
/* 0x0C */ u16 msgArchiveId;
/* 0x0E */ inf1_entry_t entries[0];
} inf1_section_t;
typedef struct str1_entry_t {
char str[0];
} str1_entry_t;
typedef struct str1_section_t {
/* 0x00 */ u32 msgType; // sectionType
/* 0x04 */ u32 size; // total size of the section
/* 0x08 */ str1_entry_t entries[0];
} str1_section_t;
#include "JSystem/JMessage/JMessage.h"
class dMsgUnit_c {
public:
+68 -2
View File
@@ -5,6 +5,7 @@
#include "JSystem/JMessage/resource.h"
#include "JSystem/JGadget/search.h"
#include "JSystem/JGadget/define.h"
#include <algorithm.h>
#include "string.h"
@@ -205,8 +206,73 @@ bool JMessage::TParse::parseHeader_next(void const** ppData_inout, u32* puBlock_
/* 802A92F4-802A9490 2A3C34 019C+00 1/0 0/0 0/0 .text
* parseBlock_next__Q28JMessage6TParseFPPCvPUlUl */
bool JMessage::TParse::parseBlock_next(void const** param_0, u32* param_1, u32 param_2) {
// NONMATCHING
bool JMessage::TParse::parseBlock_next(void const** ppData_inout, u32* puData_out, u32 param_2) {
JUT_ASSERT(401, ppData_inout!=0);
JUT_ASSERT(402, puData_out!=0);
const void* pData = *ppData_inout;
JUT_ASSERT(404, pData!=0);
data::TParse_TBlock sp34(pData);
*ppData_inout = sp34.getNext();
*puData_out = sp34.get_size();
TResourceContainer::TCResource& rcResource = pContainer_->resContainer_;
JUT_ASSERT(412, pResource_==&*--(rcResource.end()));
u32 sp30 = sp34.get_type();
switch (sp30) {
case 'INF1':
pResource_->setData_block_info(pData);
break;
case 'FLI1':
break;
case 'FLW1':
break;
case 'DAT1':
pResource_->setData_block_messageText(pData);
u16 temp_r26 = pResource_->getGroupID();
if (param_2 & 0x80) {
JGadget::TLinkList<JMessage::TResource, 0>::iterator sp2C(rcResource.begin());
JMessage::TResource* sp28;
while ((sp28 = &*sp2C) != pResource_) {
if ((u16)temp_r26 != sp28->getGroupID()) {
++sp2C;
} else {
sp2C = rcResource.Erase_destroy(sp28);
}
}
} else {
#ifdef DEBUG
JMessage::TResource* sp24 = rcResource.Get_groupID(temp_r26);
if (sp24 != pResource_) {
JGadget_outMessage sp148(JGadget_outMessage::warning, __FILE__, 444);
sp148 << "group-ID already exist : " << temp_r26;
}
#endif
}
break;
case 'STR1':
pResource_->setData_block_stringAttribute(pData);
break;
case 'MID1':
pResource_->setData_block_messageID(pData);
break;
default:
#ifdef DEBUG
JGadget_outMessage sp148(JGadget_outMessage::warning, __FILE__, 463);
sp148 << "unknown block : " << sp30;
#endif
if (!(param_2 & 0x40)) {
return 0;
}
break;
}
return 1;
}
/* 802A9490-802A94A8 2A3DD0 0018+00 1/0 0/0 0/0 .text
+1 -1
View File
@@ -684,7 +684,7 @@ extern actor_process_profile_definition g_profile_BALLOON2D = {
fpcPi_CURRENT_e, // mListPrio
PROC_BALLOON2D, // mProcName
&g_fpcLf_Method.base, // sub_method
sizeof(JMSMesgEntry_c), // mSize
sizeof(daBalloon2D_c), // mSize
0, // mSizeOther
0, // mParameters
&g_fopAc_Method.base, // sub_method
+2 -2
View File
@@ -3346,7 +3346,7 @@ char* dMeter2Draw_c::getActionString(u8 i_action, u8 i_type, u8* param_2) {
}
if (param_2 != NULL) {
*param_2 = mesg_entry.field_0x0a;
*param_2 = mesg_entry.print_style;
if (g_drawHIO.mButtonATextActionID == 0x3E6) {
*param_2 = 7;
@@ -3363,7 +3363,7 @@ char* dMeter2Draw_c::getActionString(u8 i_action, u8 i_type, u8* param_2) {
}
if (param_2 != NULL) {
*param_2 = mesg_entry.field_0x0a;
*param_2 = mesg_entry.print_style;
if (i_action_num[i_action] == 0x3E6) {
*param_2 = 7;
+797 -424
View File
File diff suppressed because it is too large Load Diff
+31 -31
View File
@@ -620,9 +620,9 @@ void dMsgObject_c::setMessageIndex(u32 param_1, u32 param_2, bool param_3) {
field_0x172 = 0;
mpRefer->setPageNum(field_0x172);
JMSMesgHeader_c* pMsg = (JMSMesgHeader_c*)((char*)mpMsgDt + 0x20);
u8* iVar2 = (u8*)pMsg + pMsg->sectionSize;
dComIfGp_setMesgCameraAttrInfo(pMsg->entries[getMessageIndex(revoIndex)].field_0x0f);
JMSMesgInfo_c* pMsg = (JMSMesgInfo_c*)((char*)mpMsgDt + 0x20);
u8* iVar2 = (u8*)pMsg + pMsg->header.size;
dComIfGp_setMesgCameraAttrInfo(pMsg->entries[getMessageIndex(revoIndex)].camera_id);
if (field_0x15c == 1000) {
mpRefer->setSelMsgPtr(NULL);
} else {
@@ -630,7 +630,7 @@ void dMsgObject_c::setMessageIndex(u32 param_1, u32 param_2, bool param_3) {
if (msgIndex == 0x264) {
mpRefer->setSelMsgPtr(NULL);
} else {
mpRefer->setSelMsgPtr(((char*)iVar2 + pMsg->entries[msgIndex].mStringOffset + 8));
mpRefer->setSelMsgPtr(((char*)iVar2 + pMsg->entries[msgIndex].string_offset + 8));
}
}
if (param_3) {
@@ -659,10 +659,10 @@ void dMsgObject_c::setMessageIndexDemo(u32 param_1, bool param_2) {
changeGroup(groupID);
field_0x172 = 0;
mpRefer->setPageNum(field_0x172);
JMSMesgHeader_c* info_header_p = (JMSMesgHeader_c*)((char*)mpMsgDt + 0x20);
JMSMesgInfo_c* info_header_p = (JMSMesgInfo_c*)((char*)mpMsgDt + 0x20);
int ind = getMessageIndex(revoMsgIndex);
JMSMesgEntry_c* info_entries = (JMSMesgEntry_c*)((char*)info_header_p + 0x10);
dComIfGp_setMesgCameraAttrInfo(info_entries[ind].field_0x0f);
dComIfGp_setMesgCameraAttrInfo(info_entries[ind].camera_id);
mpRefer->setSelMsgPtr(NULL);
if (param_2) {
mpCtrl->setMessageID(mMessageID, 0, NULL);
@@ -673,11 +673,11 @@ void dMsgObject_c::setMessageIndexDemo(u32 param_1, bool param_2) {
*/
u32 dMsgObject_c::getMessageIndex(u32 param_0) {
u32 i = 0;
JMSMesgHeader_c* pMsg = (JMSMesgHeader_c*)((char*)mpMsgDt + 0x20);
JMSMesgInfo_c* pMsg = (JMSMesgInfo_c*)((char*)mpMsgDt + 0x20);
u32 msgIndexCount = *((u16*)((char*)mpMsgDt + 0x28));
int rv;
for (; i < msgIndexCount; i++) {
if (pMsg->entries[i].mStringId == param_0) {
if (pMsg->entries[i].message_id == param_0) {
rv = i;
break;
}
@@ -695,19 +695,19 @@ u32 dMsgObject_c::getRevoMessageIndex(u32 param_1) {
return param_1;
}
u32 msgIndexCount;
JMSMesgHeader_c* pMsg;
JMSMesgInfo_c* pMsg;
int i = 0;
int rv;
s16 groupID = getMessageGroup(param_1);
JUT_ASSERT(1916, groupID==s_groupID || groupID == 0)
changeGroup(groupID);
pMsg = (JMSMesgHeader_c*)((char*)mpMsgDt + 0x20);
pMsg = (JMSMesgInfo_c*)((char*)mpMsgDt + 0x20);
msgIndexCount = *((u16*)((char*)mpMsgDt + 0x28));
for (; i < msgIndexCount; i++) {
if (pMsg->entries[i].mStringId == param_1) {
s8* ptr = (s8*)pMsg + pMsg->sectionSize + pMsg->entries[i].mStringOffset + 8;
if (pMsg->entries[i].message_id == param_1) {
s8* ptr = (s8*)pMsg + pMsg->header.size + pMsg->entries[i].string_offset + 8;
if (ptr[0] == 26 && ptr[2] == 3 && (s8)ptr[4] == 0) {
rv = pMsg->entries[*(int*)(ptr + 5)].mStringId;
rv = pMsg->entries[*(int*)(ptr + 5)].message_id;
} else {
rv = param_1;
}
@@ -725,11 +725,11 @@ u32 dMsgObject_c::getRevoMessageIndex(u32 param_1) {
/* 802340D4-80234128 22EA14 0054+00 3/3 0/0 0/0 .text getMessageIndexAlways__12dMsgObject_cFUl */
u32 dMsgObject_c::getMessageIndexAlways(u32 param_0) {
u32 i = 0;
JMSMesgHeader_c* pMsg = (JMSMesgHeader_c*)((char*)mpMsgRes + 0x20);
JMSMesgInfo_c* pMsg = (JMSMesgInfo_c*)((char*)mpMsgRes + 0x20);
u32 msgIndexCount = *((u16*)((char*)mpMsgRes + 0x28));
int rv;
for (; i < msgIndexCount; i++) {
if (pMsg->entries[i].mStringId == param_0) {
if (pMsg->entries[i].message_id == param_0) {
rv = i;
break;
}
@@ -743,7 +743,7 @@ u32 dMsgObject_c::getMessageIndexAlways(u32 param_0) {
/* 80234128-8023413C 22EA68 0014+00 1/1 0/0 0/0 .text getMessageIDAlways__12dMsgObject_cFUl */
u32 dMsgObject_c::getMessageIDAlways(u32 param_0) {
return ((JMSMesgHeader_c*)((u8*)mpMsgRes + 0x20))->entries[param_0].mStringId;
return ((JMSMesgInfo_c*)((u8*)mpMsgRes + 0x20))->entries[param_0].message_id;
}
/* 8023413C-80234150 22EA7C 0014+00 4/4 0/0 0/0 .text getMessageGroup__12dMsgObject_cFUl
@@ -1859,22 +1859,22 @@ bool dMsgObject_c::isTalkMessage() {
/* 802372CC-80237334 231C0C 0068+00 0/0 5/5 0/0 .text getSmellName__12dMsgObject_cFv */
const char* dMsgObject_c::getSmellName() {
JMSMesgHeader_c* info_header_p = (JMSMesgHeader_c*)((char*)mpMsgRes + 0x20);
char* data_ptr = (char*)info_header_p + info_header_p->sectionSize;
JMSMesgInfo_c* info_header_p = (JMSMesgInfo_c*)((char*)mpMsgRes + 0x20);
char* data_ptr = (char*)info_header_p + info_header_p->header.size;
JMSMesgEntry_c* info_entries = (JMSMesgEntry_c*)((char*)info_header_p + 0x10);
JMSMesgEntry_c* msg_entry = &info_entries[(u16)getMessageIndex(getSmellTypeMessageID())];
return data_ptr + msg_entry->mStringOffset + 8;
return data_ptr + msg_entry->string_offset + 8;
}
/* 80237334-8023738C 231C74 0058+00 0/0 5/5 0/0 .text getPortalName__12dMsgObject_cFv */
const char* dMsgObject_c::getPortalName() {
JMSMesgHeader_c* info_header_p = (JMSMesgHeader_c*)((char*)mpMsgRes + 0x20);
char* data_ptr = (char*)info_header_p + info_header_p->sectionSize;
JMSMesgInfo_c* info_header_p = (JMSMesgInfo_c*)((char*)mpMsgRes + 0x20);
char* data_ptr = (char*)info_header_p + info_header_p->header.size;
JMSMesgEntry_c* info_entries = (JMSMesgEntry_c*)((char*)info_header_p + 0x10);
JMSMesgEntry_c* msg_entry = &info_entries[getMessageIndex(getPortalMessageID())];
return data_ptr + msg_entry->mStringOffset + 8;
return data_ptr + msg_entry->string_offset + 8;
}
/* 8023738C-8023741C 231CCC 0090+00 0/0 5/5 0/0 .text getBombName__12dMsgObject_cFv */
@@ -1888,32 +1888,32 @@ const char* dMsgObject_c::getBombName() {
i_cursorPos = i_selectPos;
}
JUT_ASSERT(4083, i_cursorPos >= 0 && i_cursorPos < dSv_player_item_c::BOMB_BAG_MAX);
JMSMesgHeader_c* info_header_p = (JMSMesgHeader_c*)((char*)mpMsgRes + 0x20);
char* data_ptr = (char*)info_header_p + info_header_p->sectionSize;
JMSMesgInfo_c* info_header_p = (JMSMesgInfo_c*)((char*)mpMsgRes + 0x20);
char* data_ptr = (char*)info_header_p + info_header_p->header.size;
JMSMesgEntry_c* info_entries = (JMSMesgEntry_c*)((char*)info_header_p + 0x10);
JMSMesgEntry_c* msg_entry = &info_entries[getMessageIndexAlways(getBombMessageIDLocal(i_cursorPos) + 0x165)];
return data_ptr + msg_entry->mStringOffset + 8;
return data_ptr + msg_entry->string_offset + 8;
}
/* 8023741C-80237478 231D5C 005C+00 0/0 5/5 0/0 .text getInsectName__12dMsgObject_cFv */
const char* dMsgObject_c::getInsectName() {
JMSMesgHeader_c* info_header_p = (JMSMesgHeader_c*)((char*)mpMsgRes + 0x20);
char* data_ptr = (char*)info_header_p + info_header_p->sectionSize;
JMSMesgInfo_c* info_header_p = (JMSMesgInfo_c*)((char*)mpMsgRes + 0x20);
char* data_ptr = (char*)info_header_p + info_header_p->header.size;
JMSMesgEntry_c* info_entries = (JMSMesgEntry_c*)((char*)info_header_p + 0x10);
JMSMesgEntry_c* msg_entry = &info_entries[getMessageIndexAlways(getInsectItemNoLocal() + 0x165)];
return data_ptr + msg_entry->mStringOffset + 8;
return data_ptr + msg_entry->string_offset + 8;
}
/* 80237478-802374D0 231DB8 0058+00 0/0 5/5 0/0 .text getLetterName__12dMsgObject_cFv */
const char* dMsgObject_c::getLetterName() {
JMSMesgHeader_c* info_header_p = (JMSMesgHeader_c*)((char*)mpMsgRes + 0x20);
char* data_ptr = (char*)info_header_p + info_header_p->sectionSize;
JMSMesgInfo_c* info_header_p = (JMSMesgInfo_c*)((char*)mpMsgRes + 0x20);
char* data_ptr = (char*)info_header_p + info_header_p->header.size;
JMSMesgEntry_c* info_entries = (JMSMesgEntry_c*)((char*)info_header_p + 0x10);
JMSMesgEntry_c* msg_entry = &info_entries[getMessageIndexAlways(getLetterNameIDLocal())];
return data_ptr + msg_entry->mStringOffset + 8;
return data_ptr + msg_entry->string_offset + 8;
}
/* 802374D0-80237520 231E10 0050+00 1/1 5/5 0/0 .text getSelectBombNum__12dMsgObject_cFv
+20 -4
View File
@@ -9,6 +9,22 @@
#include "d/d_kankyo.h"
#include "d/d_meter2_info.h"
// temporary until a better solution is found
typedef struct dMsgUnit_inf1_entry {
u32 dat1EntryOffset;
u16 startFrame;
u16 endFrame;
} dMsgUnit_inf1_entry;
typedef struct dMsgUnit_inf1_section_t {
/* 0x00 */ u32 msgType; // sectionType
/* 0x04 */ u32 size; // total size of the section
/* 0x08 */ u16 entryCount;
/* 0x0A */ u16 entryLength;
/* 0x0C */ u16 msgArchiveId;
/* 0x0E */ dMsgUnit_inf1_entry entries[0];
} dMsgUnit_inf1_section_t;
/* 80238C94-80238CA4 2335D4 0010+00 1/1 0/0 0/0 .text __ct__10dMsgUnit_cFv */
dMsgUnit_c::dMsgUnit_c() {}
@@ -57,20 +73,20 @@ void dMsgUnit_c::setTag(int param_1, int param_2, char* param_3, bool param_4) {
if (!stack9) {
bmg_header_t* iVar9 = (bmg_header_t*)dMeter2Info_getMsgUnitResource();
inf1_section_t* inf1 = NULL;
dMsgUnit_inf1_section_t* inf1 = NULL;
const void* dat1 = NULL;
str1_section_t* str1 = NULL;
int local_114 = sizeof(bmg_header_t);
u32 size = iVar9->size;
bmg_section_t* piVar12 = (bmg_section_t*)(((u8*)iVar9) + local_114);
for (; local_114 < size; local_114 += piVar12->size) {
switch(piVar12->msgType) {
switch(piVar12->magic) {
case 'FLW1':
break;
case 'FLI1':
break;
case 'INF1':
inf1 = (inf1_section_t*)piVar12;
inf1 = (dMsgUnit_inf1_section_t*)piVar12;
break;
case 'DAT1':
dat1 = piVar12;
@@ -86,7 +102,7 @@ void dMsgUnit_c::setTag(int param_1, int param_2, char* param_3, bool param_4) {
// but the normal build doesn't really work with that. Same for inf1->entries.
#ifdef DEBUG
inf1_entry_t* entry = &inf1->entries[param_1];
dMsgUnit_inf1_entry* entry = &inf1->entries[param_1];
u32 dat1EntryOffset = entry->dat1EntryOffset;
u16 startFrame = entry->startFrame;
u16 endFrame = entry->endFrame;