Link d_msg_class (all) and d_msg_unit (JP only), minor alink fix (#2846)

This commit is contained in:
Max Roncace
2025-11-22 00:45:29 -05:00
committed by GitHub
parent d161aec619
commit 3dbd600aab
9 changed files with 545 additions and 231 deletions
+2 -2
View File
@@ -766,13 +766,13 @@ int daAlink_c::procCanoeRowInit(int param_0) {
}
if (spC == 1) {
var_r29 = var_r28 == 2 ? ANM_CANOE_ROW_RIGHT_BACK : ANM_CANOE_ROW_LEFT_BACK;
var_r29 = (daAlink_ANM)(var_r28 == 2 ? (int)ANM_CANOE_ROW_RIGHT_BACK : (int)ANM_CANOE_ROW_LEFT_BACK);
if ((var_r29 == ANM_CANOE_ROW_RIGHT_BACK && mProcVar5.field_0x3012 == 0) || (var_r29 == ANM_CANOE_ROW_LEFT_BACK && mProcVar5.field_0x3012 == 1)) {
return procCanoePaddleShiftInit(var_r29);
}
} else {
var_r29 = var_r28 == 2 ? ANM_CANOE_ROW_RIGHT : ANM_CANOE_ROW_LEFT;
var_r29 = (daAlink_ANM)(var_r28 == 2 ? (int)ANM_CANOE_ROW_RIGHT : (int)ANM_CANOE_ROW_LEFT);
if ((var_r29 == ANM_CANOE_ROW_RIGHT && mProcVar5.field_0x3012 == 0) || (var_r29 == ANM_CANOE_ROW_LEFT && mProcVar5.field_0x3012 == 1)) {
return procCanoePaddleShiftInit(var_r29);
+7
View File
@@ -73,10 +73,17 @@ void dFile_warning_c::screenSet() {
JUT_ASSERT(0, mpRootPane != NULL);
field_0x34 = mpRootPane->getTranslateY();
#if REGION_JPN
mFileWarn.Scr->search('ms_for_2')->hide();
mFileWarn.Scr->search('ms_for_3')->hide();
field_0x20 = static_cast<J2DTextBox*>(mFileWarn.Scr->search('w_msg_jp'));
#else
mFileWarn.Scr->search('w_msg_jp')->hide();
mFileWarn.Scr->search('ms_for_2')->hide();
field_0x20 = static_cast<J2DTextBox*>(mFileWarn.Scr->search('ms_for_3'));
#endif
field_0x20->show();
field_0x20->setFont(mFileWarn.mFont);
field_0x20->setString(0x200, "");
+179 -40
View File
@@ -11,6 +11,26 @@
#include "d/d_lib.h"
#include "JSystem/JUtility/JUTFont.h"
#if REGION_JPN
#define CHAR_CODE_MALE_ICON 0x8189
#define CHAR_CODE_FEMALE_ICON 0x818A
#define CHAR_CODE_STAR_ICON 0x819A
#define CHAR_CODE_REFMARK 0x81A6
#define CHAR_CODE_THIN_LEFT_ARROW 0x81A9
#define CHAR_CODE_THIN_RIGHT_ARROW 0x81A8
#define CHAR_CODE_THIN_UP_ARROW 0x81AA
#define CHAR_CODE_THIN_DOWN_ARROW 0x81AB
#else
#define CHAR_CODE_MALE_ICON 0xB2
#define CHAR_CODE_FEMALE_ICON 0xB3
#define CHAR_CODE_STAR_ICON 0xB1
#define CHAR_CODE_REFMARK 0x89
#define CHAR_CODE_THIN_LEFT_ARROW 0xB9
#define CHAR_CODE_THIN_RIGHT_ARROW 0xBC
#define CHAR_CODE_THIN_UP_ARROW 0xBD
#define CHAR_CODE_THIN_DOWN_ARROW 0xBE
#endif
/* 80228578-802285CC 222EB8 0054+00 1/1 0/0 0/0 .text checkCharInfoCharactor__Fi */
static bool checkCharInfoCharactor(int c) {
if (c != 0x8140 && c != 0x8141 && c != 0x8142 && c != 0x0020 && c != 0x0022 && c != 0x0027 &&
@@ -420,6 +440,19 @@ void jmessage_tReference::calcDistance() {
u8 jmessage_tReference::getLineMax() {
int line_max;
#if REGION_JPN
if (isKanban()) {
line_max = 6;
} else if (isBook()) {
line_max = 7;
} else if (isStaffRoll()) {
line_max = 10;
} else if (isSaveSeq()) {
line_max = 5;
} else {
line_max = 3;
}
#else
if (isKanban()) {
line_max = 7;
} else if (isBook()) {
@@ -431,6 +464,7 @@ u8 jmessage_tReference::getLineMax() {
} else {
line_max = 4;
}
#endif
return line_max;
}
@@ -732,7 +766,7 @@ void jmessage_tReference::addCharactor(u16 i_character) {
/* 802297B0-802297E4 2240F0 0034+00 3/3 0/0 0/0 .text resetCharactor__19jmessage_tReferenceFv */
void jmessage_tReference::resetCharactor() {
for (int i = 0; i < 0x200; i++) {
for (int i = 0; i < ARRAY_SIZE(mCharactor.data); i++) {
mCharactor.data[i] = 0;
}
@@ -896,7 +930,7 @@ void jmessage_tMeasureProcessor::do_begin(void const* pEntry, char const* pszTex
mSeSpeaker = ((JMSMesgEntry_c*)pEntry)->se_speaker;
mSeMood = ((JMSMesgEntry_c*)pEntry)->se_mood;
for (int i = 0; i < 40; i++) {
for (int i = 0; i < D_MSG_CLASS_PAGE_CNT_MAX; i++) {
pReference->setLineLength(i, 0.0f, 0.0f);
pReference->setPageLine(i, 0);
pReference->setPageLineMax(i, 0);
@@ -913,9 +947,11 @@ void jmessage_tMeasureProcessor::do_begin(void const* pEntry, char const* pszTex
pReference->setLineArrange(i, 1);
}
#if !REGION_JPN
if (((JMSMesgEntry_c*)pEntry)->unk_0xd == 0) {
pReference->setLineArrange(i, 1);
}
#endif
}
}
@@ -1524,28 +1560,28 @@ bool jmessage_tMeasureProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_siz
push_word(buffer);
return true;
case MSGTAG_MALE_ICON:
push_word(changeCodeToChar(0xB2));
push_word(changeCodeToChar(CHAR_CODE_MALE_ICON));
return true;
case MSGTAG_FEMALE_ICON:
push_word(changeCodeToChar(0xB3));
push_word(changeCodeToChar(CHAR_CODE_FEMALE_ICON));
return true;
case MSGTAG_STAR_ICON:
push_word(changeCodeToChar(0xB1));
push_word(changeCodeToChar(CHAR_CODE_STAR_ICON));
return true;
case MSGTAG_REFMARK:
push_word(changeCodeToChar(0x89));
push_word(changeCodeToChar(CHAR_CODE_REFMARK));
return true;
case MSGTAG_THIN_LEFT_ARROW:
push_word(changeCodeToChar(0xB9));
push_word(changeCodeToChar(CHAR_CODE_THIN_LEFT_ARROW));
return true;
case MSGTAG_THIN_RIGHT_ARROW:
push_word(changeCodeToChar(0xBC));
push_word(changeCodeToChar(CHAR_CODE_THIN_RIGHT_ARROW));
return true;
case MSGTAG_THIN_UP_ARROW:
push_word(changeCodeToChar(0xBD));
push_word(changeCodeToChar(CHAR_CODE_THIN_UP_ARROW));
return true;
case MSGTAG_THIN_DOWN_ARROW:
push_word(changeCodeToChar(0xBE));
push_word(changeCodeToChar(CHAR_CODE_THIN_DOWN_ARROW));
return true;
case MSGTAG_BULLET:
case MSGTAG_BULLET_SPACE:
@@ -1596,6 +1632,11 @@ void jmessage_tMeasureProcessor::do_scale(f32 i_scale) {
mPageLineMax--;
JUT_ASSERT(0x930, mPageLineMax > 0);
#if REGION_JPN
if (field_0x3e == 0) {
pReference->setPageType(field_0x40, 2);
}
#else
if (field_0x3e == 0) {
pReference->setPageType(field_0x40, 2);
} else if (field_0x3e == 2 && mPageLineMax == 3) {
@@ -1604,7 +1645,9 @@ void jmessage_tMeasureProcessor::do_scale(f32 i_scale) {
} else {
pReference->setPageType(field_0x40, 8);
}
} else {
}
#endif
else {
pReference->setPageType(field_0x40, 3);
if (field_0x3e == 1 && pReference->getPageType(field_0x40) == 2) {
pReference->setPageType(field_0x40, 4);
@@ -1764,6 +1807,13 @@ void jmessage_tMeasureProcessor::do_pageType(int param_0) {
/* 8022B454-8022B458 225D94 0004+00 1/1 0/0 0/0 .text do_name1__26jmessage_tMeasureProcessorFv */
void jmessage_tMeasureProcessor::do_name1() {
const char* name = dComIfGs_getPlayerName();
#if REGION_JPN
int c = (((char)name[0] & 0xFF) << 8) | ((char)name[1] & 0xFF);
// if first character is hiragana or katakana
if ((c >= 0x829F && c <= 0x82F1) || (c >= 0x8340 && c <= 0x8396)) {
push_word(changeCodeToChar(c));
}
#endif
}
/* 8022B458-8022B4E0 225D98 0088+00 1/1 0/0 0/0 .text
@@ -2036,7 +2086,7 @@ bool jmessage_tSequenceProcessor::do_isReady() {
field_0xae = 1;
field_0xa4 = 0;
pReference->onBatchFlag();
pReference->setCharCnt(0x200);
pReference->setCharCnt(D_MSG_CLASS_CHAR_CNT_MAX);
field_0xa4 = field_0xa8;
return true;
}
@@ -2056,7 +2106,7 @@ bool jmessage_tSequenceProcessor::do_isReady() {
field_0xae = 1;
field_0xa4 = 0;
pReference->onBatchFlag();
pReference->setCharCnt(0x200);
pReference->setCharCnt(D_MSG_CLASS_CHAR_CNT_MAX);
return true;
}
@@ -2079,7 +2129,7 @@ bool jmessage_tSequenceProcessor::do_isReady() {
if (mDoCPd_c::getTrigA(PAD_1) || field_0xb2 != 0) {
field_0xa4 = 0;
pReference->onBatchFlag();
pReference->setCharCnt(0x200);
pReference->setCharCnt(D_MSG_CLASS_CHAR_CNT_MAX);
}
break;
case 1:
@@ -2088,7 +2138,7 @@ bool jmessage_tSequenceProcessor::do_isReady() {
case 9:
field_0xa4 = 0;
pReference->onBatchFlag();
pReference->setCharCnt(0x200);
pReference->setCharCnt(D_MSG_CLASS_CHAR_CNT_MAX);
break;
case 2:
if (field_0xb2 != 0) {
@@ -2103,7 +2153,11 @@ bool jmessage_tSequenceProcessor::do_isReady() {
}
field_0xa6++;
#if REGION_JPN
if (field_0xa6 >= 1) {
#else
if (field_0xa6 >= 2) {
#endif
field_0xa4 = field_0xa8;
field_0xa6 = 0;
}
@@ -2519,6 +2573,13 @@ bool jmessage_tSequenceProcessor::do_jump_isReady() {
/* 8022C904-8022C908 227244 0004+00 1/1 0/0 0/0 .text do_name1__27jmessage_tSequenceProcessorFv */
void jmessage_tSequenceProcessor::do_name1() {
const char* name = dComIfGs_getPlayerName();
#if REGION_JPN
int c = (((char)name[0] & 0xFF) << 8) | ((char)name[1] & 0xFF);
// if first character is hiragana or katakana
if ((c >= 0x829F && c <= 0x82F1) || (c >= 0x8340 && c <= 0x8396)) {
push_word();
}
#endif
}
/* 8022C908-8022CA24 227248 011C+00 2/1 0/0 0/0 .text do_space__27jmessage_tSequenceProcessorFUl
@@ -2713,7 +2774,7 @@ jmessage_tRenderingProcessor::jmessage_tRenderingProcessor(jmessage_tReference c
field_0x151 = 0;
field_0x138 = 0.0f;
for (int i = 0; i < 40; i++) {
for (int i = 0; i < ARRAY_SIZE(field_0x7c); i++) {
field_0x7c[i] = 0.0f;
}
}
@@ -2767,7 +2828,7 @@ void jmessage_tRenderingProcessor::do_begin(void const* pEntry, char const* pszT
mpOutFont->initialize();
for (int i = 0; i < 40; i++) {
for (int i = 0; i < ARRAY_SIZE(field_0x7c); i++) {
field_0x7c[i] = 0.0f;
}
@@ -3367,6 +3428,73 @@ void jmessage_tRenderingProcessor::do_heightcenter() {
}
break;
}
#if REGION_JPN
case 2:
if ((s8)pReference->getLineMax() == 3) {
int nowPageLine = pReference->getNowPageLine();
field_0x138 = pReference->getLineSpace() * (0.5f * (pReference->getLineMax() - (s16)nowPageLine));
var_f31 += field_0x138;
break;
}
if (field_0x142 == 0) {
field_0x138 = pReference->getLineSpace();
var_f31 += field_0x138;
} else if (field_0x142 == 1) {
field_0x138 = 0.5f * pReference->getLineSpace();
var_f31 += field_0x138;
}
break;
case 3: {
if (field_0x142 == 1) {
int nowPageLine = pReference->getNowPageLine();
field_0x138 = pReference->getLineSpace() * (0.5f * (pReference->getLineMax() - (s16)nowPageLine));
var_f31 += field_0x138;
break;
}
break;
}
case 4: {
if (field_0x142 == 1) {
var_f31 += 0.5f * pReference->getLineSpace();
}
f32 sp8 = pReference->getLineScale(field_0x142) / 100.0f;
f32 dVar15 = (pReference->getLineSpace() - (sp8 * pReference->getFontSizeY())) / 2;
field_0x138 += dVar15;
var_f31 += dVar15;
break;
}
case 5: {
if (field_0x142 >= 1) {
field_0x138 = 0.5f * pReference->getLineSpace();
var_f31 += field_0x138;
}
f32 sp8 = pReference->getLineScale(field_0x142) / 100.0f;
f32 dVar15 = (pReference->getLineSpace() - (sp8 * pReference->getFontSizeY())) / 2;
field_0x138 += dVar15;
var_f31 += dVar15;
break;
}
case 6:
if (field_0x142 <= 1) {
field_0x138 = 0.5f * pReference->getLineSpace();
var_f31 += field_0x138;
}
break;
case 7:
if (field_0x142 == 1 || field_0x142 == 2) {
field_0x138 = 0.5f * pReference->getLineSpace();
var_f31 += field_0x138;
}
break;
case 8:
if (field_0x142 == 2) {
field_0x138 = 0.5f * pReference->getLineSpace();
var_f31 += field_0x138;
}
#else
case 2:
if (field_0x142 == 0) {
field_0x138 = pReference->getLineSpace();
@@ -3429,6 +3557,7 @@ void jmessage_tRenderingProcessor::do_heightcenter() {
field_0x138 = 0.5f * pReference->getLineSpace();
var_f31 += field_0x138;
}
#endif
}
if (field_0x142 == 0) {
@@ -3620,7 +3749,7 @@ void jmessage_tRenderingProcessor::do_strcat(char* i_str, bool param_2, bool par
} else {
JUT_WARN(5316, "%s", "TextBox Alloc Byte Over!!");
}
} else if (field_0x11c < 0x200) {
} else if (field_0x11c < D_MSG_CLASS_CHAR_CNT_MAX) {
if (param_2) {
field_0x146++;
if (pReference->getBatchColorFlag() != 0) {
@@ -3655,7 +3784,7 @@ void jmessage_tRenderingProcessor::do_strcat(char* i_str, bool param_2, bool par
int length = 0;
length = strlen(buffer);
if (field_0x11c + length < 0x200) {
if (field_0x11c + length < D_MSG_CLASS_CHAR_CNT_MAX) {
field_0x148 = strlen(pReference->getTextPtr());
field_0x14a = strlen(pReference->getTextSPtr());
@@ -3756,6 +3885,13 @@ void jmessage_tRenderingProcessor::do_rubystrcat(char* i_src, char* i_dst, f32 i
*/
void jmessage_tRenderingProcessor::do_name1() {
const char* name = dComIfGs_getPlayerName();
#if REGION_JPN
int c = (((char)name[0] & 0xFF) << 8) | ((char)name[1] & 0xFF);
// if first character is hiragana or katakana
if ((c >= 0x829F && c <= 0x82F1) || (c >= 0x8340 && c <= 0x8396)) {
push_word();
}
#endif
}
/* 8022F540-8022F734 229E80 01F4+00 1/1 0/0 0/0 .text do_numset__28jmessage_tRenderingProcessorFs
@@ -3836,7 +3972,7 @@ jmessage_string_tReference::jmessage_string_tReference() {
mRubyPanePtr = NULL;
mpFont = mDoExt_getMesgFont();
for (int i = 0; i < 12; i++) {
for (int i = 0; i < ARRAY_SIZE(mLineLength); i++) {
mLineLength[i] = 0.0f;
mOutfontLength[i] = 0.0f;
}
@@ -3844,6 +3980,9 @@ jmessage_string_tReference::jmessage_string_tReference() {
resetCharactor();
}
jmessage_string_tReference::~jmessage_string_tReference() {
}
/* 8022F9AC-8022FA2C 22A2EC 0080+00 0/0 3/3 0/0 .text
* init__26jmessage_string_tReferenceFP10J2DTextBoxP10J2DTextBoxP7JUTFontP10COutFont_cUc */
void jmessage_string_tReference::init(J2DTextBox* panePtr, J2DTextBox* runyPanePtr,
@@ -3852,14 +3991,14 @@ void jmessage_string_tReference::init(J2DTextBox* panePtr, J2DTextBox* runyPaneP
mRubyPanePtr = runyPanePtr;
mOutFontPtr = outFontPtr;
mLineCount = 0;
mLineMax = 12;
mLineMax = D_MSG_CLASS_LINE_MAX;
mNowPage = 0;
mFlags = flags;
if (font != NULL) {
mpFont = font;
}
for (int i = 0; i < 12; i++) {
for (int i = 0; i < ARRAY_SIZE(mLineLength); i++) {
mLineLength[i] = 0.0f;
mOutfontLength[i] = 0.0f;
}
@@ -4299,28 +4438,28 @@ bool jmessage_string_tMeasureProcessor::do_tag(u32 i_tag, void const* i_data, u3
stack_pushCurrent(buffer);
break;
case MSGTAG_MALE_ICON:
stack_pushCurrent(changeCodeToChar(0xB2));
stack_pushCurrent(changeCodeToChar(CHAR_CODE_MALE_ICON));
break;
case MSGTAG_FEMALE_ICON:
stack_pushCurrent(changeCodeToChar(0xB3));
stack_pushCurrent(changeCodeToChar(CHAR_CODE_FEMALE_ICON));
break;
case MSGTAG_STAR_ICON:
stack_pushCurrent(changeCodeToChar(0xB1));
stack_pushCurrent(changeCodeToChar(CHAR_CODE_STAR_ICON));
break;
case MSGTAG_REFMARK:
stack_pushCurrent(changeCodeToChar(0x89));
stack_pushCurrent(changeCodeToChar(CHAR_CODE_REFMARK));
break;
case MSGTAG_THIN_LEFT_ARROW:
stack_pushCurrent(changeCodeToChar(0xB9));
stack_pushCurrent(changeCodeToChar(CHAR_CODE_THIN_LEFT_ARROW));
break;
case MSGTAG_THIN_RIGHT_ARROW:
stack_pushCurrent(changeCodeToChar(0xBC));
stack_pushCurrent(changeCodeToChar(CHAR_CODE_THIN_RIGHT_ARROW));
break;
case MSGTAG_THIN_UP_ARROW:
stack_pushCurrent(changeCodeToChar(0xBD));
stack_pushCurrent(changeCodeToChar(CHAR_CODE_THIN_UP_ARROW));
break;
case MSGTAG_THIN_DOWN_ARROW:
stack_pushCurrent(changeCodeToChar(0xBE));
stack_pushCurrent(changeCodeToChar(CHAR_CODE_THIN_DOWN_ARROW));
break;
case MSGTAG_BULLET:
case MSGTAG_BULLET_SPACE:
@@ -4942,28 +5081,28 @@ bool jmessage_string_tRenderingProcessor::do_tag(u32 i_tag, void const* i_data,
push_word(buffer);
break;
case MSGTAG_MALE_ICON:
push_word(changeCodeToChar(0xB2));
push_word(changeCodeToChar(CHAR_CODE_MALE_ICON));
break;
case MSGTAG_FEMALE_ICON:
push_word(changeCodeToChar(0xB3));
push_word(changeCodeToChar(CHAR_CODE_FEMALE_ICON));
break;
case MSGTAG_STAR_ICON:
push_word(changeCodeToChar(0xB1));
push_word(changeCodeToChar(CHAR_CODE_STAR_ICON));
break;
case MSGTAG_REFMARK:
push_word(changeCodeToChar(0x89));
push_word(changeCodeToChar(CHAR_CODE_REFMARK));
break;
case MSGTAG_THIN_LEFT_ARROW:
push_word(changeCodeToChar(0xB9));
push_word(changeCodeToChar(CHAR_CODE_THIN_LEFT_ARROW));
break;
case MSGTAG_THIN_RIGHT_ARROW:
push_word(changeCodeToChar(0xBC));
push_word(changeCodeToChar(CHAR_CODE_THIN_RIGHT_ARROW));
break;
case MSGTAG_THIN_UP_ARROW:
push_word(changeCodeToChar(0xBD));
push_word(changeCodeToChar(CHAR_CODE_THIN_UP_ARROW));
break;
case MSGTAG_THIN_DOWN_ARROW:
push_word(changeCodeToChar(0xBE));
push_word(changeCodeToChar(CHAR_CODE_THIN_DOWN_ARROW));
break;
case MSGTAG_BULLET:
do_outfont(42);
@@ -5134,7 +5273,7 @@ void jmessage_string_tRenderingProcessor::do_heightcenter() {
void jmessage_string_tRenderingProcessor::do_strcat(char* i_str) {
if (getLineCountNowPage() >= 0) {
field_0x54e += strlen(i_str);
if (field_0x54e < 512) {
if (field_0x54e < ARRAY_SIZE(field_0x54)) {
strcat(field_0x54, i_str);
} else {
JUT_WARN(7531, "%s", "Message Alloc Byte Over!!");
@@ -5187,7 +5326,7 @@ void jmessage_string_tRenderingProcessor::do_rubyset(void const* i_data, u32 i_s
void jmessage_string_tRenderingProcessor::do_rubystrcat(char* i_str) {
if (getLineCountNowPage() >= 0) {
field_0x550 += strlen(i_str);
if (field_0x550 < 512) {
if (field_0x550 < ARRAY_SIZE(field_0x254)) {
strcat(field_0x254, i_str);
} else {
JUT_WARN(7613, "%s", "Message Alloc Byte Over!!");
+183 -2
View File
@@ -14,8 +14,22 @@
// temporary until a better solution is found
typedef struct dMsgUnit_inf1_entry {
u32 dat1EntryOffset;
#if REGION_JPN
u16 field_0x04;
u16 field_0x06;
u16 field_0x08;
u16 field_0x0a;
u16 field_0x0c;
u16 field_0x0e;
u16 field_0x10;
u16 field_0x12;
u16 field_0x14;
u16 field_0x16;
u16 field_0x18;
#else
u16 startFrame;
u16 endFrame;
#endif
} dMsgUnit_inf1_entry;
typedef struct dMsgUnit_inf1_section_t {
@@ -35,6 +49,172 @@ dMsgUnit_c::~dMsgUnit_c() {}
/* 80238CEC-8023907C 23362C 0390+00 0/0 5/5 0/0 .text setTag__10dMsgUnit_cFiiPcb */
// NONMATCHING - regalloc
#if REGION_JPN
void dMsgUnit_c::setTag(int i_type, int i_value, char* o_buffer, bool param_4) {
*o_buffer = 0;
bool stack9 = false;
bool stack8 = false;
int value = i_value;
if (i_type == 0x10000) {
sprintf(o_buffer, "%d", i_value);
return;
}
if (i_type == 0x10001) {
int tens_digit = i_value / 10;
int ones_digit = i_value % 10;
sprintf(o_buffer, "%d-%d", tens_digit, ones_digit);
return;
}
if ((i_type == 4 && param_4 == true) || (i_type == 5 && param_4 == false)) {
int seconds = i_value / 1000;
int minutes = seconds / 60;
seconds -= minutes * 60;
if (minutes > 99) {
minutes = 99;
seconds = 59;
}
if (minutes == 0 && seconds == 0) {
if (strcmp(dComIfGp_getStartStageName(), "F_SP00") == 0) {
return;
}
}
if (i_type == 4) {
i_value = minutes;
if (minutes == 0) {
stack9 = true;
}
}
if (i_type == 5) {
if (seconds == 0 && minutes != 0) {
return;
}
i_value = seconds;
}
}
if ((i_type == 3 && param_4 == true) || i_type == 4 && param_4 == false) {
f32 dayTime = g_env_light.getDaytime();
f32 hour = dayTime / 15.0f;
f32 iVar8b = ((s32)(1000000.0f * dayTime) % 15000000) / 1000000.0f;
f32 minute = 60.0f * (iVar8b / 15.0f);
// not sure why this affects codegen, in theory it should be optimized out
f32 minute2 = 60.0f * (iVar8b / 15.0f);
if (i_type == 3) {
i_value = (s32)hour;
}
if (i_type == 4) {
i_value = (s32)minute;
}
}
if (i_type == 9 && param_4 == true) {
sprintf(o_buffer, "%d", i_value);
stack8 = true;
}
if (!stack9) {
bmg_header_t* pHeader = (bmg_header_t*)dMeter2Info_getMsgUnitResource();
dMsgUnit_inf1_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);
for (; filepos < filesize; filepos += pSection->size) {
switch(pSection->magic) {
case 'FLW1':
break;
case 'FLI1':
break;
case 'INF1':
pInfoBlock = (dMsgUnit_inf1_section_t*)pSection;
break;
case 'DAT1':
pMsgDataBlock = pSection;
break;
case 'STR1':
pStrAttributeBlock = (str1_section_t*)pSection;
break;
}
pSection = (bmg_section_t*)((u8*)pSection + pSection->size);
}
u16 vals[12];
vals[0] = pInfoBlock->entries[i_type].field_0x04;
vals[1] = pInfoBlock->entries[i_type].field_0x06;
vals[2] = pInfoBlock->entries[i_type].field_0x08;
vals[3] = pInfoBlock->entries[i_type].field_0x0a;
vals[4] = pInfoBlock->entries[i_type].field_0x0c;
vals[5] = pInfoBlock->entries[i_type].field_0x0e;
vals[6] = pInfoBlock->entries[i_type].field_0x10;
vals[7] = pInfoBlock->entries[i_type].field_0x12;
vals[8] = pInfoBlock->entries[i_type].field_0x14;
vals[9] = pInfoBlock->entries[i_type].field_0x16;
vals[10] = pInfoBlock->entries[i_type].field_0x18;
int entryOff = pInfoBlock->entries[i_type].dat1EntryOffset;
char* value2 = (char*)((uintptr_t)pMsgDataBlock + entryOff + 8);
const char* uVar5;
if (i_value == 0) {
uVar5 = pStrAttributeBlock->entries->str + vals[0];
} else {
if ((i_value % 10) == 0) {
uVar5 = pStrAttributeBlock->entries->str + (vals[10]);
} else {
uVar5 = pStrAttributeBlock->entries->str + vals[i_value % 10];
}
}
int uVar5Len = strlen(uVar5);
if (uVar5Len == 0) {
if (stack8) {
strcat(o_buffer, value2);
} else {
sprintf(o_buffer, "%d%s", i_value, value2);
}
} else {
char unkCharArr[7];
unkCharArr[0] = 26;
unkCharArr[1] = uVar5Len + 6;
unkCharArr[2] = -1;
unkCharArr[3] = -1;
unkCharArr[4] = 2;
unkCharArr[5] = strlen(value2) / 2;
unkCharArr[6] = 0;
if (stack8) {
strcat(o_buffer, unkCharArr);
strcat(o_buffer, uVar5);
strcat(o_buffer, value2);
} else {
sprintf(o_buffer, "%d%s%s%s", i_value, unkCharArr, uVar5, value2);
}
}
}
if (i_type == 3 && param_4 == true) {
char buffer[20];
setTag(4, 0, buffer, false);
strcat(o_buffer, buffer);
}
if (i_type == 4 && param_4 == true) {
char buffer[20];
setTag(5, value, buffer, false);
strcat(o_buffer, buffer);
}
}
#else
void dMsgUnit_c::setTag(int i_type, int i_value, char* o_buffer, bool param_4) {
*o_buffer = 0;
bool stack9 = false;
@@ -103,7 +283,7 @@ void dMsgUnit_c::setTag(int i_type, int i_value, char* o_buffer, bool param_4) {
}
pSection = (bmg_section_t*)((u8*)pSection + 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.
@@ -120,7 +300,7 @@ void dMsgUnit_c::setTag(int i_type, int i_value, char* o_buffer, bool param_4) {
#endif
const char* uVar5;
if (i_value == 1
if (i_value == 1
#ifdef DEBUG
|| (dComIfGs_getPalLanguage() == dSv_player_config_c::LANGAUGE_SPANISH && i_value == 0)
#elif VERSION == VERSION_GCN_PAL
@@ -162,6 +342,7 @@ void dMsgUnit_c::setTag(int i_type, int i_value, char* o_buffer, bool param_4) {
}
}
}
#endif
/* 804510D0-804510D8 0005D0 0004+04 1/1 5/5 0/0 .sbss g_msg_unit */
dMsgUnit_c g_msg_unit;