fix bmg loading

This commit is contained in:
madeline
2026-03-02 15:34:04 -08:00
parent 27e4670b5b
commit 67ed8fbd84
3 changed files with 13 additions and 11 deletions
+3 -2
View File
@@ -4,6 +4,7 @@
#include "JSystem/JMessage/control.h"
#include "JSystem/JMessage/JMessage.h"
#include "SSystem/SComponent/c_xyz.h"
#include "dusk/endian.h"
#if REGION_JPN
#define D_MSG_CLASS_PAGE_CNT_MAX 30
@@ -38,8 +39,8 @@ public:
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
/* 0x08 */ BE(u16) entry_num; // number of entries in this section
/* 0x0A */ BE(u16) entry_size; // size of an entry
/* 0x0C */ u8 padding[4]; // padding
/* 0x10 */ JMSMesgEntry_c entries[0];
};
@@ -6,30 +6,31 @@
#else
#include <dolphin.h>
#endif
#include "dusk/endian.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
/* 0x08 */ BE(u32) size; // total size of file not including FLW1/FLI1 sections
/* 0x0C */ BE(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
/* 0x0 */ BE(u32) magic; // four character magic string
/* 0x4 */ BE(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
/* 0x0 */ BE(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
/* 0x08 */ BE(u16) entry_num; // number of entries in this section
/* 0x0A */ BE(u16) entry_size; // size of an entry
/* 0x0C */ u8 padding[4]; // padding
} inf1_section_t;
+2 -2
View File
@@ -369,8 +369,8 @@ void dMeter2Info_c::getString(u32 i_stringID, char* o_string, JMSMesgEntry_c* i_
u8* entry = ((u8*)bmg_inf + (i * sizeof(JMSMesgEntry_c)));
// check if i_stringID equals the message entry "Message ID"
if (i_stringID == *(u16*)(entry + 0x14)) {
string_ptr = (char*)(bmg_data + *(u32*)(entry + 0x10)); // use entry "String Offset" to get string pointer
if (i_stringID == *(BE(u16)*)(entry + 0x14)) {
string_ptr = (char*)(bmg_data + *(BE(u32)*)(entry + 0x10)); // use entry "String Offset" to get string pointer
strcpy(o_string, string_ptr);
if (i_msgEntry != NULL) {