From 302c28edcb006510d84824c0da0291bf81507b04 Mon Sep 17 00:00:00 2001 From: Yanis002 <35189056+Yanis002@users.noreply.github.com> Date: Thu, 23 Jan 2025 19:24:03 +0100 Subject: more funcs + split BMG.cpp --- src/Main/Message/BMG.cpp | 202 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 src/Main/Message/BMG.cpp (limited to 'src/Main/Message/BMG.cpp') diff --git a/src/Main/Message/BMG.cpp b/src/Main/Message/BMG.cpp new file mode 100644 index 00000000..830fccba --- /dev/null +++ b/src/Main/Message/BMG.cpp @@ -0,0 +1,202 @@ +extern "C" { +#include +} +#include "Message/BMG.hpp" + +char* func_0202ab38(u32* lang); +u32* func_0202d550(int, u32*, char* path, int, int, int); +void func_0202d590(BMGHeader*); + +extern u32 *data_027e0ce0[]; +extern u32 data_027e05f4; // language +extern u32* data_ov002_0210016c; + +static char* sBMGFileNames[BMG_FILE_INDEX_MAX] = { + "system", // BMG_FILE_INDEX_SYSTEM + "regular", // BMG_FILE_INDEX_REGULAR + "battle", // BMG_FILE_INDEX_BATTLE + "test", // BMG_FILE_INDEX_TEST + "default", // BMG_FILE_INDEX_DEFAULT + "sea", // BMG_FILE_INDEX_SEA + "kaitei", // BMG_FILE_INDEX_KAITEI + "main_isl", // BMG_FILE_INDEX_MAIN_ISL + "brave", // BMG_FILE_INDEX_BRAVE + "flame", // BMG_FILE_INDEX_FLAME + "wind", // BMG_FILE_INDEX_WIND + "frost", // BMG_FILE_INDEX_FROST + "power", // BMG_FILE_INDEX_POWER + "wisdom", // BMG_FILE_INDEX_WISDOM + "ghost", // BMG_FILE_INDEX_GHOST + "hidari", // BMG_FILE_INDEX_HIDARI + "sennin", // BMG_FILE_INDEX_SENNIN + "ship", // BMG_FILE_INDEX_SHIP + "collect", // BMG_FILE_INDEX_COLLECT + "mainselect", // BMG_FILE_INDEX_MAINSELECT + "field", // BMG_FILE_INDEX_FIELD + "wisdom_dngn", // BMG_FILE_INDEX_WISDOM_DNGN + "demo", // BMG_FILE_INDEX_DEMO + "battleCommon", // BMG_FILE_INDEX_BATTLECOMMON + "bossLast1", // BMG_FILE_INDEX_BOSSLAST1 + "bossLast3", // BMG_FILE_INDEX_BOSSLAST3 + "torii", // BMG_FILE_INDEX_TORII + "myou", // BMG_FILE_INDEX_MYOU + "kojima1", // BMG_FILE_INDEX_KOJIMA1 + "kojima2", // BMG_FILE_INDEX_KOJIMA2 + "kojima5", // BMG_FILE_INDEX_KOJIMA5 + "kojima3", // BMG_FILE_INDEX_KOJIMA3 + "staff", // BMG_FILE_INDEX_STAFF + "kaitei_F", // BMG_FILE_INDEX_KAITEI_F +}; + +ARM void func_020371b0(void) { +} + +THUMB void func_020371b4(BMGFileInfo* pFileInfo) { + pFileInfo->pHeader = NULL; + pFileInfo->pINF1 = NULL; + pFileInfo->pFLW1 = NULL; + pFileInfo->pFLI1 = NULL; + pFileInfo->pDAT1 = NULL; + pFileInfo->unk_14 = NULL; + pFileInfo->unk_18 = 0; +} + +THUMB u16 func_020371c8(BMGFileInfo* pFileInfo, u32* pFile, s16 unk_18) { + SectionBase* pSection; + u16 groupId; + u32 i; + + groupId = -1; + pFileInfo->unk_14 = (BMGHeader*)pFile; + pFileInfo->pHeader = (BMGHeader*)pFile; + pFileInfo->unk_18 = unk_18; + pSection = (SectionBase*)((u8*)pFile + sizeof(BMGHeader)); + + for (i = 0; i < pFileInfo->pHeader->numSections; i++) { + switch (pSection->tag) { + case BMG_TAG_MID1: + // unused + break; + case BMG_TAG_STR1: + // unused + break; + case BMG_TAG_INF1: + pFileInfo->pINF1 = (SectionINF1*)pSection; + groupId = pFileInfo->pINF1->groupId; + break; + case BMG_TAG_DAT1: + //! TODO: fake? + pFileInfo->pDAT1 = (SectionDAT1*)(pSection + 1); + break; + case BMG_TAG_FLW1: + pFileInfo->pFLW1 = (SectionFLW1*)pSection; + break; + case BMG_TAG_FLI1: + pFileInfo->pFLI1 = (SectionFLI1*)pSection; + break; + } + + pSection = (SectionBase*)((u8*)pSection + pSection->size); + } + + return groupId; +} + +ARM EntryINF1* func_02037258(BMGFileInfo* pFileInfo, unk32 param_2) { + SectionINF1* pINF1 = pFileInfo->pINF1; + + if (pINF1 == NULL) { + return NULL; + } + + if (param_2 < pINF1->numEntries) { + return &pINF1->entries[pINF1->entrySize * param_2]; + } + + return NULL; +} + +ARM u16 func_0203728c(BMGFileInfo* pFileInfo, unk32 param_2) { + SectionFLI1* pFLI1; + u16 i; + + pFLI1 = pFileInfo->pFLI1; + + if (pFLI1 == NULL) { + return -1; + } + + for (i = 0; i < pFLI1->numEntries; i++) { + if (param_2 == pFLI1->entries[i * 2].msgFlowID) { + return pFLI1->entries[i].msgFlowNodeIndex; + } + } + + return -1; +} + +THUMB void func_020372f0(BMGGroups* pGroups, BMGFileIndex eIndex, s16 unk_18, int param_4) { + char bmgPath[64]; + BMGFileInfo bmgFile; + u32* pFile; + u16 groupId; + + // path to the bmg file for the current language (i.e.: "English/Message/battle.bmg") + strcpy(bmgPath, func_0202ab38(&data_027e05f4)); + strcat(bmgPath, "/Message/"); + strcat(bmgPath, sBMGFileNames[eIndex]); + strcat(bmgPath, ".bmg"); + + pFile = data_027e0ce0[1]; + + if (unk_18 != 1) { + if (unk_18 != 4) { + pFile = data_027e0ce0[0]; + } else { + pFile = data_ov002_0210016c; + } + } else { + // pFile = data_027e0ce0[0]; + } + + // get file data + pFile = func_0202d550(0xC4, pFile, bmgPath, 0, 0x10, 0); + + // initialize file info + bmgFile.groupId = 0; + func_020371b4(&bmgFile); + + // assign sections and set the file info in the groups entries + groupId = func_020371c8(&bmgFile, pFile, unk_18); + pGroups->entries[groupId] = bmgFile; + pGroups->entries[groupId].groupId = groupId; +} + +THUMB void func_020373b4(BMGGroups* pGroups, s16 unk_18) { + s32 i; + + for (i = 0; i < pGroups->numEntries; i++) { + if (pGroups->entries[i].unk_18 == unk_18) { + func_0202d590(pGroups->entries[i].unk_14); + func_020371b4(&pGroups->entries[i]); + } + } +} + +ARM u32 func_020373ec(BMGGroups* pGroups, unk32 param_2) { + u16 dVar1; + u16 uVar2; + s32 i; + + dVar1 = -1; + + for (i = 0; i < pGroups->numEntries; i++) { + uVar2 = func_0203728c(&pGroups->entries[i], param_2); + + if (uVar2 != dVar1) { + return uVar2 | i << 0x10; + } + } + + return -1; +} -- cgit v1.2.3 From b4d8083acebcd9564d4cac82f51e85fb431ac1df Mon Sep 17 00:00:00 2001 From: Yanis002 <35189056+Yanis002@users.noreply.github.com> Date: Fri, 24 Jan 2025 15:16:58 +0100 Subject: more progress --- src/Main/Message/BMG.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Main/Message/BMG.cpp') diff --git a/src/Main/Message/BMG.cpp b/src/Main/Message/BMG.cpp index 830fccba..db3623b8 100644 --- a/src/Main/Message/BMG.cpp +++ b/src/Main/Message/BMG.cpp @@ -135,7 +135,7 @@ ARM u16 func_0203728c(BMGFileInfo* pFileInfo, unk32 param_2) { return -1; } -THUMB void func_020372f0(BMGGroups* pGroups, BMGFileIndex eIndex, s16 unk_18, int param_4) { +THUMB void func_020372f0(BMGGroups* pGroups, BMGFileIndex eIndex, s16 unk_18) { char bmgPath[64]; BMGFileInfo bmgFile; u32* pFile; -- cgit v1.2.3 From 660c5e96554153dda38e8d2185db07ae70432266 Mon Sep 17 00:00:00 2001 From: Yanis002 <35189056+Yanis002@users.noreply.github.com> Date: Fri, 24 Jan 2025 22:11:59 +0100 Subject: convert BMGGroups to a class --- src/Main/Message/BMG.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/Main/Message/BMG.cpp') diff --git a/src/Main/Message/BMG.cpp b/src/Main/Message/BMG.cpp index db3623b8..69dae832 100644 --- a/src/Main/Message/BMG.cpp +++ b/src/Main/Message/BMG.cpp @@ -135,7 +135,7 @@ ARM u16 func_0203728c(BMGFileInfo* pFileInfo, unk32 param_2) { return -1; } -THUMB void func_020372f0(BMGGroups* pGroups, BMGFileIndex eIndex, s16 unk_18) { +THUMB void BMGGroups::func_020372f0(BMGFileIndex eIndex, s16 unk_18) { char bmgPath[64]; BMGFileInfo bmgFile; u32* pFile; @@ -168,30 +168,30 @@ THUMB void func_020372f0(BMGGroups* pGroups, BMGFileIndex eIndex, s16 unk_18) { // assign sections and set the file info in the groups entries groupId = func_020371c8(&bmgFile, pFile, unk_18); - pGroups->entries[groupId] = bmgFile; - pGroups->entries[groupId].groupId = groupId; + this->entries[groupId] = bmgFile; + this->entries[groupId].groupId = groupId; } -THUMB void func_020373b4(BMGGroups* pGroups, s16 unk_18) { +THUMB void BMGGroups::func_020373b4(s16 unk_18) { s32 i; - for (i = 0; i < pGroups->numEntries; i++) { - if (pGroups->entries[i].unk_18 == unk_18) { - func_0202d590(pGroups->entries[i].unk_14); - func_020371b4(&pGroups->entries[i]); + for (i = 0; i < this->numEntries; i++) { + if (this->entries[i].unk_18 == unk_18) { + func_0202d590(this->entries[i].unk_14); + func_020371b4(&this->entries[i]); } } } -ARM u32 func_020373ec(BMGGroups* pGroups, unk32 param_2) { +ARM u32 BMGGroups::func_020373ec(unk32 param_2) { u16 dVar1; u16 uVar2; s32 i; dVar1 = -1; - for (i = 0; i < pGroups->numEntries; i++) { - uVar2 = func_0203728c(&pGroups->entries[i], param_2); + for (i = 0; i < this->numEntries; i++) { + uVar2 = func_0203728c(&this->entries[i], param_2); if (uVar2 != dVar1) { return uVar2 | i << 0x10; -- cgit v1.2.3 From d4e8b81dde4aaa5947b53fffb2e2ba6644e3a860 Mon Sep 17 00:00:00 2001 From: Yanis002 <35189056+Yanis002@users.noreply.github.com> Date: Tue, 28 Jan 2025 18:47:44 +0100 Subject: more ctor/dtor progress --- src/Main/Message/BMG.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/Main/Message/BMG.cpp') diff --git a/src/Main/Message/BMG.cpp b/src/Main/Message/BMG.cpp index 69dae832..8d899b5b 100644 --- a/src/Main/Message/BMG.cpp +++ b/src/Main/Message/BMG.cpp @@ -48,9 +48,6 @@ static char* sBMGFileNames[BMG_FILE_INDEX_MAX] = { "kaitei_F", // BMG_FILE_INDEX_KAITEI_F }; -ARM void func_020371b0(void) { -} - THUMB void func_020371b4(BMGFileInfo* pFileInfo) { pFileInfo->pHeader = NULL; pFileInfo->pINF1 = NULL; -- cgit v1.2.3 From 7173439cd8424b562b3bc87b935e29aaaf14658e Mon Sep 17 00:00:00 2001 From: Yanis002 <35189056+Yanis002@users.noreply.github.com> Date: Wed, 5 Feb 2025 00:46:13 +0100 Subject: post-update cleanup: step 2 --- src/Main/Message/BMG.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Main/Message/BMG.cpp') diff --git a/src/Main/Message/BMG.cpp b/src/Main/Message/BMG.cpp index 8d899b5b..1d8c2f06 100644 --- a/src/Main/Message/BMG.cpp +++ b/src/Main/Message/BMG.cpp @@ -66,7 +66,7 @@ THUMB u16 func_020371c8(BMGFileInfo* pFileInfo, u32* pFile, s16 unk_18) { groupId = -1; pFileInfo->unk_14 = (BMGHeader*)pFile; pFileInfo->pHeader = (BMGHeader*)pFile; - pFileInfo->unk_18 = unk_18; + pFileInfo->unk_18 = mUnk_18; pSection = (SectionBase*)((u8*)pFile + sizeof(BMGHeader)); for (i = 0; i < pFileInfo->pHeader->numSections; i++) { -- cgit v1.2.3 From 5bd0f31b8bb36f54578a109a6dc6a24a2d6e4631 Mon Sep 17 00:00:00 2001 From: Yanis002 <35189056+Yanis002@users.noreply.github.com> Date: Wed, 5 Feb 2025 01:47:40 +0100 Subject: post-update cleanup: step 3 (1/2) --- src/Main/Message/BMG.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Main/Message/BMG.cpp') diff --git a/src/Main/Message/BMG.cpp b/src/Main/Message/BMG.cpp index 1d8c2f06..edf2f9f5 100644 --- a/src/Main/Message/BMG.cpp +++ b/src/Main/Message/BMG.cpp @@ -54,8 +54,8 @@ THUMB void func_020371b4(BMGFileInfo* pFileInfo) { pFileInfo->pFLW1 = NULL; pFileInfo->pFLI1 = NULL; pFileInfo->pDAT1 = NULL; - pFileInfo->unk_14 = NULL; - pFileInfo->unk_18 = 0; + pFileInfo->mUnk_14 = NULL; + pFileInfo->mUnk_18 = 0; } THUMB u16 func_020371c8(BMGFileInfo* pFileInfo, u32* pFile, s16 unk_18) { @@ -64,9 +64,9 @@ THUMB u16 func_020371c8(BMGFileInfo* pFileInfo, u32* pFile, s16 unk_18) { u32 i; groupId = -1; - pFileInfo->unk_14 = (BMGHeader*)pFile; + pFileInfo->mUnk_14 = (BMGHeader*)pFile; pFileInfo->pHeader = (BMGHeader*)pFile; - pFileInfo->unk_18 = mUnk_18; + pFileInfo->mUnk_18 = unk_18; pSection = (SectionBase*)((u8*)pFile + sizeof(BMGHeader)); for (i = 0; i < pFileInfo->pHeader->numSections; i++) { @@ -173,8 +173,8 @@ THUMB void BMGGroups::func_020373b4(s16 unk_18) { s32 i; for (i = 0; i < this->numEntries; i++) { - if (this->entries[i].unk_18 == unk_18) { - func_0202d590(this->entries[i].unk_14); + if (this->entries[i].mUnk_18 == unk_18) { + func_0202d590(this->entries[i].mUnk_14); func_020371b4(&this->entries[i]); } } -- cgit v1.2.3 From 308b9c2340f52fe99b18b42a2f9c324331ff4ba9 Mon Sep 17 00:00:00 2001 From: Yanis002 <35189056+Yanis002@users.noreply.github.com> Date: Thu, 6 Feb 2025 15:12:09 +0100 Subject: bmg improvements --- src/Main/Message/BMG.cpp | 88 ++++++++++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 36 deletions(-) (limited to 'src/Main/Message/BMG.cpp') diff --git a/src/Main/Message/BMG.cpp b/src/Main/Message/BMG.cpp index edf2f9f5..15fab32a 100644 --- a/src/Main/Message/BMG.cpp +++ b/src/Main/Message/BMG.cpp @@ -48,28 +48,30 @@ static char* sBMGFileNames[BMG_FILE_INDEX_MAX] = { "kaitei_F", // BMG_FILE_INDEX_KAITEI_F }; -THUMB void func_020371b4(BMGFileInfo* pFileInfo) { - pFileInfo->pHeader = NULL; - pFileInfo->pINF1 = NULL; - pFileInfo->pFLW1 = NULL; - pFileInfo->pFLI1 = NULL; - pFileInfo->pDAT1 = NULL; - pFileInfo->mUnk_14 = NULL; - pFileInfo->mUnk_18 = 0; +THUMB void BMGFileInfo::func_020371b4() { + this->pHeader = NULL; + this->pINF1 = NULL; + this->pFLW1 = NULL; + this->pFLI1 = NULL; + this->pDAT1 = NULL; + this->mUnk_14 = NULL; + this->mUnk_18 = 0; } -THUMB u16 func_020371c8(BMGFileInfo* pFileInfo, u32* pFile, s16 unk_18) { +// non-matching (equivalent) +THUMB u16 BMGFileInfo::func_020371c8(u32* pFile, s16 unk_18) { SectionBase* pSection; u16 groupId; u32 i; + BMGHeader* pHeader = (BMGHeader*)pFile; groupId = -1; - pFileInfo->mUnk_14 = (BMGHeader*)pFile; - pFileInfo->pHeader = (BMGHeader*)pFile; - pFileInfo->mUnk_18 = unk_18; + this->mUnk_14 = pHeader; + this->mUnk_18 = unk_18; + this->pHeader = pHeader; pSection = (SectionBase*)((u8*)pFile + sizeof(BMGHeader)); - for (i = 0; i < pFileInfo->pHeader->numSections; i++) { + for (i = 0; i < this->mUnk_14->numSections; i++) { switch (pSection->tag) { case BMG_TAG_MID1: // unused @@ -78,18 +80,18 @@ THUMB u16 func_020371c8(BMGFileInfo* pFileInfo, u32* pFile, s16 unk_18) { // unused break; case BMG_TAG_INF1: - pFileInfo->pINF1 = (SectionINF1*)pSection; - groupId = pFileInfo->pINF1->groupId; + this->pINF1 = (SectionINF1*)pSection; + groupId = this->pINF1->groupId; break; case BMG_TAG_DAT1: //! TODO: fake? - pFileInfo->pDAT1 = (SectionDAT1*)(pSection + 1); + this->pDAT1 = (SectionDAT1*)(pSection + 1); break; case BMG_TAG_FLW1: - pFileInfo->pFLW1 = (SectionFLW1*)pSection; + this->pFLW1 = (SectionFLW1*)pSection; break; case BMG_TAG_FLI1: - pFileInfo->pFLI1 = (SectionFLI1*)pSection; + this->pFLI1 = (SectionFLI1*)pSection; break; } @@ -99,35 +101,49 @@ THUMB u16 func_020371c8(BMGFileInfo* pFileInfo, u32* pFile, s16 unk_18) { return groupId; } -ARM EntryINF1* func_02037258(BMGFileInfo* pFileInfo, unk32 param_2) { - SectionINF1* pINF1 = pFileInfo->pINF1; +ARM EntryINF1* BMGFileInfo::func_02037258(u16 param_2) { + if (this->pINF1 != NULL) { + if (param_2 < this->pINF1->numEntries) { + return (EntryINF1*)((u32)&this->pINF1->entries + this->pINF1->entrySize * param_2); + } - if (pINF1 == NULL) { return NULL; } - if (param_2 < pINF1->numEntries) { - return &pINF1->entries[pINF1->entrySize * param_2]; - } - return NULL; } -ARM u16 func_0203728c(BMGFileInfo* pFileInfo, unk32 param_2) { +// non-matching +ARM u16 BMGFileInfo::func_0203728c(unk32 param_2) { SectionFLI1* pFLI1; - u16 i; + EntryFLI1* entry; + u32 i; + u16 j; - pFLI1 = pFileInfo->pFLI1; + pFLI1 = this->pFLI1; if (pFLI1 == NULL) { return -1; } - for (i = 0; i < pFLI1->numEntries; i++) { - if (param_2 == pFLI1->entries[i * 2].msgFlowID) { - return pFLI1->entries[i].msgFlowNodeIndex; + i = 0; + do { + entry = &pFLI1->entries[i]; + + if (param_2 > entry->msgFlowID) { + return entry->msgFlowNodeIndex; } - } + + // i++; + j = i + 1; + i = j & 0xFFFF; + } while (j < pFLI1->numEntries); + + // for (i = 0; (u16)i < pFLI1->numEntries; i++) { + // if (param_2 == pFLI1->entries[i].msgFlowID) { + // return pFLI1->entries[i].msgFlowNodeIndex; + // } + // } return -1; } @@ -161,10 +177,10 @@ THUMB void BMGGroups::func_020372f0(BMGFileIndex eIndex, s16 unk_18) { // initialize file info bmgFile.groupId = 0; - func_020371b4(&bmgFile); + bmgFile.func_020371b4(); // assign sections and set the file info in the groups entries - groupId = func_020371c8(&bmgFile, pFile, unk_18); + groupId = bmgFile.func_020371c8(pFile, unk_18); this->entries[groupId] = bmgFile; this->entries[groupId].groupId = groupId; } @@ -175,7 +191,7 @@ THUMB void BMGGroups::func_020373b4(s16 unk_18) { for (i = 0; i < this->numEntries; i++) { if (this->entries[i].mUnk_18 == unk_18) { func_0202d590(this->entries[i].mUnk_14); - func_020371b4(&this->entries[i]); + this->entries[i].func_020371b4(); } } } @@ -188,7 +204,7 @@ ARM u32 BMGGroups::func_020373ec(unk32 param_2) { dVar1 = -1; for (i = 0; i < this->numEntries; i++) { - uVar2 = func_0203728c(&this->entries[i], param_2); + uVar2 = this->entries[i].func_0203728c(param_2); if (uVar2 != dVar1) { return uVar2 | i << 0x10; -- cgit v1.2.3 From 30bd3562ab974bc479d75d7dcf6f9cb9845ba724 Mon Sep 17 00:00:00 2001 From: Yanis002 <35189056+Yanis002@users.noreply.github.com> Date: Wed, 12 Feb 2025 20:20:34 +0100 Subject: format --- src/Main/Message/BMG.cpp | 58 ++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 31 deletions(-) (limited to 'src/Main/Message/BMG.cpp') diff --git a/src/Main/Message/BMG.cpp b/src/Main/Message/BMG.cpp index 15fab32a..cb9deac8 100644 --- a/src/Main/Message/BMG.cpp +++ b/src/Main/Message/BMG.cpp @@ -3,15 +3,15 @@ extern "C" { } #include "Message/BMG.hpp" -char* func_0202ab38(u32* lang); -u32* func_0202d550(int, u32*, char* path, int, int, int); -void func_0202d590(BMGHeader*); +char *func_0202ab38(u32 *lang); +u32 *func_0202d550(int, u32 *, char *path, int, int, int); +void func_0202d590(BMGHeader *); extern u32 *data_027e0ce0[]; extern u32 data_027e05f4; // language -extern u32* data_ov002_0210016c; +extern u32 *data_ov002_0210016c; -static char* sBMGFileNames[BMG_FILE_INDEX_MAX] = { +static char *sBMGFileNames[BMG_FILE_INDEX_MAX] = { "system", // BMG_FILE_INDEX_SYSTEM "regular", // BMG_FILE_INDEX_REGULAR "battle", // BMG_FILE_INDEX_BATTLE @@ -50,26 +50,26 @@ static char* sBMGFileNames[BMG_FILE_INDEX_MAX] = { THUMB void BMGFileInfo::func_020371b4() { this->pHeader = NULL; - this->pINF1 = NULL; - this->pFLW1 = NULL; - this->pFLI1 = NULL; - this->pDAT1 = NULL; + this->pINF1 = NULL; + this->pFLW1 = NULL; + this->pFLI1 = NULL; + this->pDAT1 = NULL; this->mUnk_14 = NULL; this->mUnk_18 = 0; } // non-matching (equivalent) -THUMB u16 BMGFileInfo::func_020371c8(u32* pFile, s16 unk_18) { - SectionBase* pSection; +THUMB u16 BMGFileInfo::func_020371c8(u32 *pFile, s16 unk_18) { + SectionBase *pSection; u16 groupId; u32 i; - BMGHeader* pHeader = (BMGHeader*)pFile; + BMGHeader *pHeader = (BMGHeader *) pFile; - groupId = -1; + groupId = -1; this->mUnk_14 = pHeader; this->mUnk_18 = unk_18; this->pHeader = pHeader; - pSection = (SectionBase*)((u8*)pFile + sizeof(BMGHeader)); + pSection = (SectionBase *) ((u8 *) pFile + sizeof(BMGHeader)); for (i = 0; i < this->mUnk_14->numSections; i++) { switch (pSection->tag) { @@ -80,31 +80,27 @@ THUMB u16 BMGFileInfo::func_020371c8(u32* pFile, s16 unk_18) { // unused break; case BMG_TAG_INF1: - this->pINF1 = (SectionINF1*)pSection; - groupId = this->pINF1->groupId; + this->pINF1 = (SectionINF1 *) pSection; + groupId = this->pINF1->groupId; break; case BMG_TAG_DAT1: //! TODO: fake? - this->pDAT1 = (SectionDAT1*)(pSection + 1); - break; - case BMG_TAG_FLW1: - this->pFLW1 = (SectionFLW1*)pSection; - break; - case BMG_TAG_FLI1: - this->pFLI1 = (SectionFLI1*)pSection; + this->pDAT1 = (SectionDAT1 *) (pSection + 1); break; + case BMG_TAG_FLW1: this->pFLW1 = (SectionFLW1 *) pSection; break; + case BMG_TAG_FLI1: this->pFLI1 = (SectionFLI1 *) pSection; break; } - pSection = (SectionBase*)((u8*)pSection + pSection->size); + pSection = (SectionBase *) ((u8 *) pSection + pSection->size); } return groupId; } -ARM EntryINF1* BMGFileInfo::func_02037258(u16 param_2) { +ARM EntryINF1 *BMGFileInfo::func_02037258(u16 param_2) { if (this->pINF1 != NULL) { if (param_2 < this->pINF1->numEntries) { - return (EntryINF1*)((u32)&this->pINF1->entries + this->pINF1->entrySize * param_2); + return (EntryINF1 *) ((u32) & this->pINF1->entries + this->pINF1->entrySize * param_2); } return NULL; @@ -115,8 +111,8 @@ ARM EntryINF1* BMGFileInfo::func_02037258(u16 param_2) { // non-matching ARM u16 BMGFileInfo::func_0203728c(unk32 param_2) { - SectionFLI1* pFLI1; - EntryFLI1* entry; + SectionFLI1 *pFLI1; + EntryFLI1 *entry; u32 i; u16 j; @@ -151,7 +147,7 @@ ARM u16 BMGFileInfo::func_0203728c(unk32 param_2) { THUMB void BMGGroups::func_020372f0(BMGFileIndex eIndex, s16 unk_18) { char bmgPath[64]; BMGFileInfo bmgFile; - u32* pFile; + u32 *pFile; u16 groupId; // path to the bmg file for the current language (i.e.: "English/Message/battle.bmg") @@ -180,8 +176,8 @@ THUMB void BMGGroups::func_020372f0(BMGFileIndex eIndex, s16 unk_18) { bmgFile.func_020371b4(); // assign sections and set the file info in the groups entries - groupId = bmgFile.func_020371c8(pFile, unk_18); - this->entries[groupId] = bmgFile; + groupId = bmgFile.func_020371c8(pFile, unk_18); + this->entries[groupId] = bmgFile; this->entries[groupId].groupId = groupId; } -- cgit v1.2.3