From 07b55421f9ce2db2fecbaaa34a3e1b59d6f231a7 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Fri, 7 Aug 2026 16:40:56 -0400 Subject: [PATCH] msg inline fixes, remove some fake jsystem inlines --- include/JSystem/J2DGraph/J2DPane.h | 8 +- include/JSystem/JGeometry.h | 10 ++- include/JSystem/JSupport/JSUList.h | 6 +- include/JSystem/JUtility/JUTDataHeader.h | 4 - include/f_op/f_op_scene_mng.h | 4 +- src/JSystem/J2DGraph/J2DPrint.cpp | 4 +- src/JSystem/J3DGraphLoader/J3DAnmLoader.cpp | 8 +- .../J3DGraphLoader/J3DClusterLoader.cpp | 2 +- src/JSystem/J3DGraphLoader/J3DModelLoader.cpp | 6 +- .../J3DGraphLoader/J3DModelLoaderCalcSize.cpp | 9 ++- src/JSystem/JUtility/JUTResFont.cpp | 22 +++--- src/d/d_mesg.cpp | 74 ++++++++----------- src/d/d_name.cpp | 5 +- src/f_op/f_op_msg_mng.cpp | 44 +++++------ src/m_Do/m_Do_ext.cpp | 8 +- 15 files changed, 95 insertions(+), 119 deletions(-) diff --git a/include/JSystem/J2DGraph/J2DPane.h b/include/JSystem/J2DGraph/J2DPane.h index 81b2e28c0..646c7ce36 100644 --- a/include/JSystem/J2DGraph/J2DPane.h +++ b/include/JSystem/J2DGraph/J2DPane.h @@ -54,13 +54,9 @@ public: virtual void move(f32 x, f32 y); virtual void add(f32 x, f32 y); - // fakematch, this fake inline is only needed by the J2DPane::resize call inside of J2DWindow::resize - f32 resize__getMinX() const { return mBounds.i.x; } virtual void resize(f32 w, f32 h) { - f32 x = resize__getMinX(); - x += w; - mBounds.f.x = x; - mBounds.f.y = mBounds.i.y + h; + JGeometry::TVec2 size(w, h); + mBounds.setSize(size); } virtual bool setConnectParent(bool connected) { mIsConnectParent = 0; diff --git a/include/JSystem/JGeometry.h b/include/JSystem/JGeometry.h index 505c315c4..4185b93b4 100644 --- a/include/JSystem/JGeometry.h +++ b/include/JSystem/JGeometry.h @@ -306,6 +306,11 @@ struct TVec2 { y += other.y; } + void add(const TVec2& a, const TVec2& b) { + x = a.x + b.x; + y = a.y + b.y; + } + bool isAbove(const TVec2& other) const { return (x >= other.x) && (y >= other.y) ? true : false; } @@ -346,9 +351,8 @@ template<> struct TBox > { addPos(TVec2(x, y)); } - void setSize(TVec2 size) { - f.x = size.x; - f.y = size.y; + void setSize(const TVec2& size) { + f.add(i, size); } void addPos(const TVec2& pos) { diff --git a/include/JSystem/JSupport/JSUList.h b/include/JSystem/JSupport/JSUList.h index f28f60828..4f00f4ec6 100644 --- a/include/JSystem/JSupport/JSUList.h +++ b/include/JSystem/JSupport/JSUList.h @@ -173,15 +173,15 @@ public: JSUTree* getLastChild() const { return (JSUTree*)this->getLast(); } - JSUTree* getNextChild() const { return (JSUTree*)this->getNext(); } + JSUTree* getNextChild() const { return (JSUTree*)this->mNext; } - JSUTree* getPrevChild() const { return (JSUTree*)this->getPrev(); } + JSUTree* getPrevChild() const { return (JSUTree*)this->mPrev; } u32 getNumChildren() const { return this->getNumLinks(); } T* getObject() const { return (T*)this->getObjectPtr(); } - JSUTree* getParent() const { return (JSUTree*)this->getList(); } + JSUTree* getParent() const { return (JSUTree*)this->mList; } }; template diff --git a/include/JSystem/JUtility/JUTDataHeader.h b/include/JSystem/JUtility/JUTDataHeader.h index e00ac58c6..1307541a5 100644 --- a/include/JSystem/JUtility/JUTDataHeader.h +++ b/include/JSystem/JUtility/JUTDataHeader.h @@ -8,10 +8,6 @@ struct JUTDataBlockHeader { /* 0x00 */ u32 mType; /* 0x04 */ u32 mSize; - - const JUTDataBlockHeader* getNext() const { // fake inline - return reinterpret_cast(reinterpret_cast(this) + mSize); - } }; struct JUTDataFileHeader { // actual struct name unknown diff --git a/include/f_op/f_op_scene_mng.h b/include/f_op/f_op_scene_mng.h index bb14472ca..aed2ee9d5 100644 --- a/include/f_op/f_op_scene_mng.h +++ b/include/f_op/f_op_scene_mng.h @@ -14,7 +14,7 @@ u32 fopScnM_ReRequest(s16, u32); void fopScnM_Management(void); void fopScnM_Init(void); -inline u32 fpcM_LayerID(const void* pProc) { +inline u32 fpcM_LayerID(void* pProc) { if (fpcBs_Is_JustOfType(g_fpcNd_type, ((base_process_class*)pProc)->mSubType)) { return ((scene_class*)pProc)->base.mLayer.mLayerID; } else { @@ -22,7 +22,7 @@ inline u32 fpcM_LayerID(const void* pProc) { } } -inline layer_class * fpcM_Layer(const void* pProc) { +inline layer_class* fpcM_Layer(void* pProc) { return &((process_node_class*)pProc)->mLayer; } diff --git a/src/JSystem/J2DGraph/J2DPrint.cpp b/src/JSystem/J2DGraph/J2DPrint.cpp index 132f0c761..bfb5dc203 100644 --- a/src/JSystem/J2DGraph/J2DPrint.cpp +++ b/src/JSystem/J2DGraph/J2DPrint.cpp @@ -237,9 +237,7 @@ f32 J2DPrint::parse(const u8* param_1, int param_2, int param_3, u16* param_4, J if (mFont->isFixed()) { field_0x34 = mFont->getFixedWidth(); } else { - JUTFont::TWidth uStack_ec; - mFont->getWidthEntry(r27, &uStack_ec); - field_0x34 = uStack_ec.field_0x1; + field_0x34 = (u32)mFont->getWidth(r27); } field_0x34 *= field_0x18 / mFont->getCellWidth(); diff --git a/src/JSystem/J3DGraphLoader/J3DAnmLoader.cpp b/src/JSystem/J3DGraphLoader/J3DAnmLoader.cpp index 81a93622d..027ab190b 100644 --- a/src/JSystem/J3DGraphLoader/J3DAnmLoader.cpp +++ b/src/JSystem/J3DGraphLoader/J3DAnmLoader.cpp @@ -205,7 +205,7 @@ J3DAnmBase* J3DAnmFullLoader_v15::load(const void* dst) { OSReport("Unknown data block\n"); break; } - block = block->getNext(); + block = (JUTDataBlockHeader*)((u8*)block + block->mSize); } return mAnm; } @@ -250,7 +250,7 @@ void J3DAnmFullLoader_v15::setResource(J3DAnmBase* dst, const void* data) { OSReport("Unknown data block\n"); break; } - block = block->getNext(); + block = (JUTDataBlockHeader*)((u8*)block + block->mSize); } } @@ -397,7 +397,7 @@ J3DAnmBase* J3DAnmKeyLoader_v15::load(const void* dst) { OSReport("Unknown data block\n"); break; } - block = block->getNext(); + block = (JUTDataBlockHeader*)((u8*)block + block->mSize); } return mAnm; } @@ -442,7 +442,7 @@ void J3DAnmKeyLoader_v15::setResource(J3DAnmBase* dst, const void* data) { OSReport("Unknown data block\n"); break; } - block = block->getNext(); + block = (JUTDataBlockHeader*)((u8*)block + block->mSize); } } diff --git a/src/JSystem/J3DGraphLoader/J3DClusterLoader.cpp b/src/JSystem/J3DGraphLoader/J3DClusterLoader.cpp index 11c7002e4..e4b307c29 100644 --- a/src/JSystem/J3DGraphLoader/J3DClusterLoader.cpp +++ b/src/JSystem/J3DGraphLoader/J3DClusterLoader.cpp @@ -45,7 +45,7 @@ void* J3DClusterLoader_v15::load(const void* i_data) { OSReport("Unknown data block\n"); break; } - block = block->getNext(); + block = (JUTDataBlockHeader*)((u8*)block + block->mSize); } return mpDeformData; diff --git a/src/JSystem/J3DGraphLoader/J3DModelLoader.cpp b/src/JSystem/J3DGraphLoader/J3DModelLoader.cpp index f79c93b77..6fabb49de 100644 --- a/src/JSystem/J3DGraphLoader/J3DModelLoader.cpp +++ b/src/JSystem/J3DGraphLoader/J3DModelLoader.cpp @@ -104,7 +104,7 @@ J3DModelData* J3DModelLoader::load(const void* i_data, u32 i_flags) { OSReport("Unknown data block\n"); break; } - block = block->getNext(); + block = (JUTDataBlockHeader*)((u8*)block + block->mSize); } const J3DModelHierarchy* hierarchy = mpModelData->getHierarchy(); mpModelData->makeHierarchy(NULL, &hierarchy); @@ -139,7 +139,7 @@ J3DMaterialTable* J3DModelLoader::loadMaterialTable(const void* i_data) { OSReport("Unknown data block\n"); break; } - block = block->getNext(); + block = (JUTDataBlockHeader*)((u8*)block + block->mSize); } if (mpMaterialTable->getTexture() == NULL) { mpMaterialTable->setTexture(new J3DTexture(0, NULL)); @@ -199,7 +199,7 @@ J3DModelData* J3DModelLoader::loadBinaryDisplayList(const void* i_data, u32 i_fl OSReport("Unknown data block\n"); break; } - block = block->getNext(); + block = (JUTDataBlockHeader*)((u8*)block + block->mSize); } J3DModelHierarchy const* hierarchy = mpModelData->getHierarchy(); mpModelData->makeHierarchy(NULL, &hierarchy); diff --git a/src/JSystem/J3DGraphLoader/J3DModelLoaderCalcSize.cpp b/src/JSystem/J3DGraphLoader/J3DModelLoaderCalcSize.cpp index 09f022a29..4f4c5b93b 100644 --- a/src/JSystem/J3DGraphLoader/J3DModelLoaderCalcSize.cpp +++ b/src/JSystem/J3DGraphLoader/J3DModelLoaderCalcSize.cpp @@ -17,10 +17,11 @@ u16 J3DModelLoader::countMaterialNum(const void* i_data) { const JUTDataFileHeader* header = (const JUTDataFileHeader*)i_data; const JUTDataBlockHeader* block = &header->mFirstBlock; - for (int i = 0; i < header->mBlockNum; block = block->getNext(), i++) { + for (int i = 0; i < header->mBlockNum; i++) { if (block->mType == 'MAT3') { return ((const J3DMaterialBlock*)block)->mMaterialNum; } + block = (JUTDataBlockHeader*)((u8*)block + block->mSize); } return 0; } @@ -63,7 +64,7 @@ u32 J3DModelLoader::calcLoadSize(const void* i_data, u32 i_flags) { OSReport("Unknown data block\n"); break; } - block = block->getNext(); + block = (JUTDataBlockHeader*)((u8*)block + block->mSize); } return size; } @@ -91,7 +92,7 @@ u32 J3DModelLoader::calcLoadMaterialTableSize(const void* i_data) { OSReport("Unknown data block\n"); break; } - block = block->getNext(); + block = (JUTDataBlockHeader*)((u8*)block + block->mSize); } if (!hasTextureTable) { @@ -150,7 +151,7 @@ u32 J3DModelLoader::calcLoadBinaryDisplayListSize(const void* i_data, u32 i_flag OSReport("Unknown data block\n"); break; } - block = block->getNext(); + block = (JUTDataBlockHeader*)((u8*)block + block->mSize); } return size; } diff --git a/src/JSystem/JUtility/JUTResFont.cpp b/src/JSystem/JUtility/JUTResFont.cpp index 979824ce2..17b2329c9 100644 --- a/src/JSystem/JUtility/JUTResFont.cpp +++ b/src/JSystem/JUtility/JUTResFont.cpp @@ -110,9 +110,9 @@ void JUTResFont::countBlock() { mGlyphBlockNum = 0; mMapBlockNum = 0; - const JUTDataBlockHeader* header = (JUTDataBlockHeader*)mResFont->data; - for (u32 i = 0; i < mResFont->numBlocks; i++, header = header->getNext()) { - switch (header->mType) { + const JUTDataBlockHeader* block = (JUTDataBlockHeader*)mResFont->data; + for (u32 i = 0; i < mResFont->numBlocks; i++) { + switch (block->mType) { case 'WID1': mWidthBlockNum++; break; @@ -127,6 +127,7 @@ void JUTResFont::countBlock() { default: JUTReportConsole("JUTResFont: Unknown data block\n"); } + block = (JUTDataBlockHeader*)((u8*)block + block->mSize); } } @@ -137,26 +138,26 @@ void JUTResFont::setBlock() { int mapNum = 0; mMaxCode = -1; - const JUTDataBlockHeader* header = (JUTDataBlockHeader*)mResFont->data; - for (u32 i = 0; i < mResFont->numBlocks; i++, header = header->getNext()) { - switch (header->mType) { + const JUTDataBlockHeader* block = (JUTDataBlockHeader*)mResFont->data; + for (u32 i = 0; i < mResFont->numBlocks; i++) { + switch (block->mType) { case 'INF1': { - mInfoBlock = (ResFONT::INF1*)header; + mInfoBlock = (ResFONT::INF1*)block; u32 u = mInfoBlock->fontType; JUT_ASSERT(0xF3, u < suAboutEncoding_) mIsLeadByte = (IsLeadByte_func*)&saoAboutEncoding_[u]; break; } case 'WID1': - mpWidthBlocks[widthNum] = (ResFONT::WID1*)header; + mpWidthBlocks[widthNum] = (ResFONT::WID1*)block; widthNum++; break; case 'GLY1': - mpGlyphBlocks[glyphNum] = (ResFONT::GLY1*)header; + mpGlyphBlocks[glyphNum] = (ResFONT::GLY1*)block; glyphNum++; break; case 'MAP1': - mpMapBlocks[mapNum] = (ResFONT::MAP1*)header; + mpMapBlocks[mapNum] = (ResFONT::MAP1*)block; if (mMaxCode > mpMapBlocks[mapNum]->startCode) { mMaxCode = mpMapBlocks[mapNum]->startCode; } @@ -166,6 +167,7 @@ void JUTResFont::setBlock() { JUTReportConsole("Unknown data block\n"); break; } + block = (JUTDataBlockHeader*)((u8*)block + block->mSize); } } diff --git a/src/d/d_mesg.cpp b/src/d/d_mesg.cpp index 3011b2032..3024323ee 100644 --- a/src/d/d_mesg.cpp +++ b/src/d/d_mesg.cpp @@ -346,17 +346,15 @@ void dMesg_tSequenceProcessor::do_character(int param_1) { } #endif } - JUTFont::TWidth twidth; + f32 f31 = f32(mesgControl->getNowFontSize()) / f32(mesgControl->getMainFont()->getCellWidth()); - int char_code = mesgControl->getCharCode(); - mesgControl->getMainFont()->getWidthEntry(char_code, &twidth); - int tmp = twidth.field_0x1; + int width = mesgControl->getMainFont()->getWidth(char_code); if (!mesgControl->isHeader()) { - field_0x44 += tmp * f31; + field_0x44 += width * f31; mesgControl->setHeaderOn(); } else { - field_0x44 += tmp * f31 + mesgControl->getCharSpace(); + field_0x44 += width * f31 + mesgControl->getCharSpace(); } if (field_0x74 > 0) { field_0x74--; @@ -487,15 +485,14 @@ bool dMesg_tSequenceProcessor::do_tag(u32 param_1, const void* param_2, u32 para sp14[0] = sp54[r30++]; sp14[1] = 0; } - JUTFont::TWidth twidth; + f32 f29 = f32(mesgControl->getNowFontSize()) / f32(mesgControl->getMainFont()->getCellWidth()); - mesgControl->getMainFont()->getWidthEntry(char_code, &twidth); - int temp = twidth.field_0x1; + int width = mesgControl->getMainFont()->getWidth(char_code); if (field_0x44 == 0.0f) { - f32 temp2 = temp * f29; + f32 temp2 = width * f29; field_0x44 = temp2; } else { - f32 temp2 = temp * f29; + f32 temp2 = width * f29; field_0x44 += temp2 + mesgControl->getCharSpace(); } strcat(mMesg->text[0], sp14); @@ -595,15 +592,13 @@ bool dMesg_tSequenceProcessor::do_tag(u32 param_1, const void* param_2, u32 para sp10[1] = 0; } - JUTFont::TWidth twidth; int r25 = mesgControl->getNowFontSize(); f32 f29 = f32(r25) / f32(mesgControl->getMainFont()->getCellWidth()); - mesgControl->getMainFont()->getWidthEntry(char_code, &twidth); - int tmp = twidth.field_0x1; + int width = mesgControl->getMainFont()->getWidth(char_code); if (field_0x44 == 0.0f) { - field_0x44 = tmp * f29; + field_0x44 = width * f29; } else { - field_0x44 += tmp * f29 + mesgControl->getCharSpace(); + field_0x44 += width * f29 + mesgControl->getCharSpace(); } strcat(mMesg->text[0], sp10); strcat(mMesg->text[2], sp10); @@ -667,9 +662,7 @@ char* dMesg_tSequenceProcessor::ruby_character(char* param_1, int param_2) { int char_code = (byte << 8); byte = src[1]; char_code |= byte; - JUTFont::TWidth twidth; - mesgControl->getRubyFont()->getWidthEntry(char_code, &twidth); - f32 tmp = (int)twidth.field_0x1; + f32 tmp = (f32)mesgControl->getRubyFont()->getWidth(char_code); if (param_2 == 1) { if (field_0x50 == 0.0f) { field_0x54 = tmp * f31; @@ -784,7 +777,6 @@ void dMesg_tMeasureProcessor::do_character(int param_1) { dMesg_tControl* mesgControl = (dMesg_tControl*)getControl(); int r30 = field_0x50 - field_0x4c; bool r29 = false; - JUTFont::TWidth twidth; if (param_1 == 10) { if (r30 >= 0 && r30 < linemax - 1) { retFlag++; @@ -810,13 +802,12 @@ void dMesg_tMeasureProcessor::do_character(int param_1) { if (r29 && r30 >= 0 && r30 <= linemax) { f32 f31 = f32(mesgControl->getNowFontSize()) / f32(mesgControl->getMainFont()->getCellWidth()); int char_code = mesgControl->getCharCode(); - mesgControl->getMainFont()->getWidthEntry(char_code, &twidth); - int tmp = twidth.field_0x1; + int width = mesgControl->getMainFont()->getWidth(char_code); if (!mesgControl->isHeader()) { - field_0x38[r30] += tmp * f31; + field_0x38[r30] += width * f31; mesgControl->setHeaderOn(); } else { - field_0x38[r30] += mesgControl->getCharSpace() + tmp * f31; + field_0x38[r30] += mesgControl->getCharSpace() + width * f31; } } } @@ -900,16 +891,14 @@ bool dMesg_tMeasureProcessor::do_tag(u32 param_1, const void* param_2, u32 param char_code = byte; } - JUTFont::TWidth twidth; int r23 = mesgControl->getNowFontSize(); f32 f30 = f32(r23) / f32(mesgControl->getMainFont()->getCellWidth()); - mesgControl->getMainFont()->getWidthEntry(char_code, &twidth); - int tmp = twidth.field_0x1; + int width = mesgControl->getMainFont()->getWidth(char_code); if (r27 >= 0 && r27 <= linemax) { if (field_0x38[r27] == 0.0f) { - field_0x38[r27] = tmp * f30; + field_0x38[r27] = width * f30; } else { - field_0x38[r27] += tmp * f30 + mesgControl->getCharSpace(); + field_0x38[r27] += width * f30 + mesgControl->getCharSpace(); } } } @@ -964,14 +953,13 @@ bool dMesg_tMeasureProcessor::do_tag(u32 param_1, const void* param_2, u32 param #else int char_code = 'H'; #endif - JUTFont::TWidth twidth; + f32 f29 = f32(mesgControl->getNowFontSize()) / f32(mesgControl->getMainFont()->getCellWidth()); - mesgControl->getMainFont()->getWidthEntry(char_code, &twidth); - int tmp = twidth.field_0x1; + int width = mesgControl->getMainFont()->getWidth(char_code); if (field_0x48 == 0.0f) { - field_0x48 = tmp * f29; + field_0x48 = width * f29; } else { - field_0x48 += mesgControl->getCharSpace() + tmp * f29; + field_0x48 += mesgControl->getCharSpace() + width * f29; } } r26 = true; @@ -985,14 +973,13 @@ bool dMesg_tMeasureProcessor::do_tag(u32 param_1, const void* param_2, u32 param #else int char_code = 'H'; #endif - JUTFont::TWidth twidth; + f32 f29 = f32(mesgControl->getNowFontSize()) / f32(mesgControl->getMainFont()->getCellWidth()); - mesgControl->getMainFont()->getWidthEntry(char_code, &twidth); - int tmp = twidth.field_0x1; + int width = mesgControl->getMainFont()->getWidth(char_code); if (field_0x48 == 0.0f) { - field_0x48 = tmp * f29; + field_0x48 = width * f29; } else { - field_0x48 += mesgControl->getCharSpace() + tmp * f29; + field_0x48 += mesgControl->getCharSpace() + width * f29; } } r26 = true; @@ -1021,15 +1008,14 @@ bool dMesg_tMeasureProcessor::do_tag(u32 param_1, const void* param_2, u32 param byte = sp18[r25++]; char_code = byte; } - JUTFont::TWidth twidth; + f32 f30 = f32(mesgControl->getNowFontSize()) / f32(mesgControl->getMainFont()->getCellWidth()); - mesgControl->getMainFont()->getWidthEntry(char_code, &twidth); - int tmp = twidth.field_0x1; + int width = mesgControl->getMainFont()->getWidth(char_code); if (r27 >= 0 && r27 <= linemax) { if (field_0x38[r27] == 0.0f) { - field_0x38[r27] = tmp * f30; + field_0x38[r27] = width * f30; } else { - field_0x38[r27] += tmp * f30 + mesgControl->getCharSpace(); + field_0x38[r27] += width * f30 + mesgControl->getCharSpace(); } } } diff --git a/src/d/d_name.cpp b/src/d/d_name.cpp index 930e21a60..af6919ce2 100644 --- a/src/d/d_name.cpp +++ b/src/d/d_name.cpp @@ -781,11 +781,8 @@ void dName_c::setNameText() { for (int i = 0; i < 8; i++) { if (chrInfo[i].field_0x3 != 0) { - JUTFont::TWidth twidth; int character = chrInfo[i].character; - nameIn.font->getWidthEntry(character, &twidth); - - f32 temp = (int)twidth.field_0x1; + f32 temp = (f32)nameIn.font->getWidth(character); temp *= ratio; int sp50 = temp * 10000.0f; diff --git a/src/f_op/f_op_msg_mng.cpp b/src/f_op/f_op_msg_mng.cpp index cacacffdf..b2ce7f1d5 100644 --- a/src/f_op/f_op_msg_mng.cpp +++ b/src/f_op/f_op_msg_mng.cpp @@ -1556,14 +1556,14 @@ mesg_header* fopMsgM_msgGet_c::getMesgHeader(u32 i_msgNo) { sprintf(path, "zel_e%02d.bmg", mGroupID); } JKRArchive* arc = dComIfGp_getMsgDtArchive(); - return (mesg_header*)JKRArchive::getGlbResource('ROOT', path, arc); + return (mesg_header*)JKRGetTypeResource('ROOT', path, arc); #else if (fopMsgM_hyrule_language_check(i_msgNo)) { JKRArchive* arc = dComIfGp_getMsgDt2Archive(); - return (mesg_header*)JKRArchive::getGlbResource('ROOT', "zel_01.bmg", arc); + return (mesg_header*)JKRGetTypeResource('ROOT', "zel_01.bmg", arc); } else { JKRArchive* arc = dComIfGp_getMsgDtArchive(); - return (mesg_header*)JKRArchive::getGlbResource('ROOT', "zel_00.bmg", arc); + return (mesg_header*)JKRGetTypeResource('ROOT', "zel_00.bmg", arc); } #endif } @@ -1575,7 +1575,8 @@ mesg_info* fopMsgM_msgGet_c::getMesgInfo(mesg_header* i_head) { /* 8002E2E0-8002E308 .text getMesgData__16fopMsgM_msgGet_cFP11mesg_header */ mesg_data* fopMsgM_msgGet_c::getMesgData(mesg_header* i_head) { - return (mesg_data*)getMesgInfo(i_head)->getNext(); + mesg_info* info = getMesgInfo(i_head); + return (mesg_data*)((u8*)info + info->mSize); } /* 8002E308-8002E378 .text getMesgEntry__16fopMsgM_msgGet_cFP11mesg_header */ @@ -1621,14 +1622,14 @@ mesg_header* fopMsgM_itemMsgGet_c::getMesgHeader(u32 i_msgNo) { sprintf(path, "zel_e%02d.bmg", groupID); } JKRArchive* arc = dComIfGp_getMsgDtArchive(); - return (mesg_header*)JKRArchive::getGlbResource('ROOT', path, arc); + return (mesg_header*)JKRGetTypeResource('ROOT', path, arc); #else if (fopMsgM_hyrule_language_check(i_msgNo)) { JKRArchive* arc = dComIfGp_getMsgDt2Archive(); - return (mesg_header*)JKRArchive::getGlbResource('ROOT', "zel_01.bmg", arc); + return (mesg_header*)JKRGetTypeResource('ROOT', "zel_01.bmg", arc); } else { JKRArchive* arc = dComIfGp_getMsgDtArchive(); - return (mesg_header*)JKRArchive::getGlbResource('ROOT', "zel_00.bmg", arc); + return (mesg_header*)JKRGetTypeResource('ROOT', "zel_00.bmg", arc); } #endif } @@ -1640,7 +1641,8 @@ mesg_info* fopMsgM_itemMsgGet_c::getMesgInfo(mesg_header* i_head) { /* 8002E4B4-8002E4DC .text getMesgData__20fopMsgM_itemMsgGet_cFP11mesg_header */ mesg_data* fopMsgM_itemMsgGet_c::getMesgData(mesg_header* i_head) { - return (mesg_data*)getMesgInfo(i_head)->getNext(); + mesg_info* info = getMesgInfo(i_head); + return (mesg_data*)((u8*)info + info->mSize); } /* 8002E4DC-8002E54C .text getMesgEntry__20fopMsgM_itemMsgGet_cFP11mesg_header */ @@ -1743,7 +1745,7 @@ fopMsgM_msgDataProc_c::fopMsgM_msgDataProc_c() { actorPosition = NULL; field_0x299 = 0; field_0x29A = 0; - selectFlag = Select_OFF; + setSelectFlagOff(); field_0x29B = 0; autoSendFlag = 0; handSendFlag = 0; @@ -1825,7 +1827,7 @@ void fopMsgM_msgDataProc_c::dataInit() { } field_0x299 = 0; field_0x29A = 0; - selectFlag = Select_OFF; + setSelectFlagOff(); field_0x29B = 0; autoSendFlag = 0; handSendFlag = 0; @@ -1838,9 +1840,7 @@ void fopMsgM_msgDataProc_c::dataInit() { /* 8002E95C-8002EA58 .text charLength__21fopMsgM_msgDataProc_cFiib */ f32 fopMsgM_msgDataProc_c::charLength(int i_scale, int i_charNo, bool param_2) { - JUTFont::TWidth width; - font->getWidthEntry(i_charNo, &width); - f32 charWidth = (f32)(int)width.field_0x1; + f32 charWidth = (f32)font->getWidth(i_charNo); f32 cellWidth = (f32)i_scale / (f32)font->getCellWidth(); if (param_2) { @@ -1852,22 +1852,18 @@ f32 fopMsgM_msgDataProc_c::charLength(int i_scale, int i_charNo, bool param_2) { /* 8002EA58-8002EB4C .text rubyLength__21fopMsgM_msgDataProc_cFib */ f32 fopMsgM_msgDataProc_c::rubyLength(int i_charNo, bool param_2) { - JUTFont::TWidth width; - rubyFont->getWidthEntry(i_charNo, &width); - s32 advance = width.field_0x1; + int width = rubyFont->getWidth(i_charNo); f32 cellWidth = rubyFont->getCellWidth(); f32 temp = ((s32)rubyFontSize / cellWidth); if (param_2) { #if VERSION == VERSION_DEMO - JUTFont::TWidth width2; - rubyFont->getWidthEntry(i_charNo, &width2); - return (f32)(advance + width2.field_0x0) * temp; + return (f32)(width + rubyFont->getOffset(i_charNo)) * temp; #else - return (f32)advance * temp; + return (f32)width * temp; #endif } - return (s32)rubyCharSpace + advance * temp; + return (s32)rubyCharSpace + width * temp; } /* 8002EB4C-80031064 .text stringLength__21fopMsgM_msgDataProc_cFv */ @@ -4158,8 +4154,8 @@ void fopMsgM_msgDataProc_c::stringSet() { ) { #if VERSION <= VERSION_JPN int i = 0; - char buf[20]; + int num = dComIfGp_getMessageCountNumber(); fopMsgM_int_to_char(buf, num, false); @@ -5800,7 +5796,7 @@ u8 fopMsgM_itemNum(u8 i_itemNo) { /* 80035060-800350B8 .text fopMsgM_getColorTable__FUs */ u32 fopMsgM_getColorTable(u16 i_colorNo) { JKRArchive* arc = dComIfGp_getMsgDtArchive(); - JUTDataFileHeader* bmc = (JUTDataFileHeader*)JKRArchive::getGlbResource('ROOT', "color.bmc", arc); + JUTDataFileHeader* bmc = (JUTDataFileHeader*)JKRGetTypeResource('ROOT', "color.bmc", arc); clt1_header* clt1 = (clt1_header*)&bmc->mFirstBlock; return clt1->mColors[i_colorNo]; } @@ -10194,7 +10190,7 @@ void fopMsgM_setFontsizeCenter2(char* param_1, char* param_2, char* param_3, cha /* 8003C414-8003C450 .text fopMsgM_createExpHeap__FUl */ JKRExpHeap* fopMsgM_createExpHeap(u32 i_size) { - return JKRExpHeap::create(i_size, mDoExt_getGameHeap(), FALSE); + return JKRCreateExpHeap(i_size, mDoExt_getGameHeap(), FALSE); } /* 8003C450-8003C470 .text fopMsgM_destroyExpHeap__FP10JKRExpHeap */ diff --git a/src/m_Do/m_Do_ext.cpp b/src/m_Do/m_Do_ext.cpp index 46e9ade4d..09c1f1078 100644 --- a/src/m_Do/m_Do_ext.cpp +++ b/src/m_Do/m_Do_ext.cpp @@ -849,7 +849,7 @@ JKRExpHeap* gameHeap; /* 80011734-800117E4 .text mDoExt_createGameHeap__FUlP7JKRHeap */ JKRExpHeap* mDoExt_createGameHeap(u32 heapSize, JKRHeap* i_heap) { JUT_ASSERT(VERSION_SELECT(2036, 2035, 2050, 2050), gameHeap == NULL || heapSize == 0); - gameHeap = JKRExpHeap::create(heapSize, i_heap, true); + gameHeap = JKRCreateExpHeap(heapSize, i_heap, true); #if VERSION > VERSION_DEMO gameHeap->setAllocationMode(JKRExpHeap::ALLOC_MODE_1); #endif @@ -880,7 +880,7 @@ JKRExpHeap* zeldaHeap; /* 8001181C-800118C0 .text mDoExt_createZeldaHeap__FUlP7JKRHeap */ JKRExpHeap* mDoExt_createZeldaHeap(u32 heapSize, JKRHeap* i_heap) { JUT_ASSERT(VERSION_SELECT(2081, 2097, 2112, 2112), zeldaHeap == NULL || heapSize == 0); - return zeldaHeap = JKRExpHeap::create(heapSize, i_heap, true); + return zeldaHeap = JKRCreateExpHeap(heapSize, i_heap, true); } /* 800118C0-800118C8 .text mDoExt_getZeldaHeap__Fv */ @@ -907,7 +907,7 @@ JKRExpHeap* commandHeap; /* 800118F8-8001199C .text mDoExt_createCommandHeap__FUlP7JKRHeap */ JKRExpHeap* mDoExt_createCommandHeap(u32 heapSize, JKRHeap* i_heap) { JUT_ASSERT(VERSION_SELECT(2126, 2158, 2173, 2173), commandHeap == NULL || heapSize == 0); - return commandHeap = JKRExpHeap::create(heapSize, i_heap, true); + return commandHeap = JKRCreateExpHeap(heapSize, i_heap, true); } /* 8001199C-800119A4 .text mDoExt_getCommandHeap__Fv */ @@ -934,7 +934,7 @@ JKRExpHeap* archiveHeap; /* 800119D4-80011A84 .text mDoExt_createArchiveHeap__FUlP7JKRHeap */ JKRExpHeap* mDoExt_createArchiveHeap(u32 heapSize, JKRHeap* i_heap) { JUT_ASSERT(VERSION_SELECT(2173, 2222, 2237, 2237), archiveHeap == NULL || heapSize == 0); - archiveHeap = JKRExpHeap::create(heapSize, i_heap, true); + archiveHeap = JKRCreateExpHeap(heapSize, i_heap, true); #if VERSION > VERSION_DEMO archiveHeap->setAllocationMode(JKRExpHeap::ALLOC_MODE_1); #endif