From ea930e97d84fec2a4fd2377b59414449ba38403f Mon Sep 17 00:00:00 2001 From: mattias-blum <142374929+mattias-blum@users.noreply.github.com> Date: Tue, 6 May 2025 01:35:53 -0400 Subject: [PATCH 01/19] initial progress --- include/JSystem/J2DGraph/J2DTextBox.h | 3 +- include/d/d_com_inf_game.h | 4 + include/d/d_menu_collect.h | 95 ++++++++ src/d/d_menu_collect.cpp | 315 +++++++++++++++++++++++++- 4 files changed, 415 insertions(+), 2 deletions(-) diff --git a/include/JSystem/J2DGraph/J2DTextBox.h b/include/JSystem/J2DGraph/J2DTextBox.h index c7e778a2b..06786acba 100644 --- a/include/JSystem/J2DGraph/J2DTextBox.h +++ b/include/JSystem/J2DGraph/J2DTextBox.h @@ -52,7 +52,8 @@ public: void setCharColor(JUtility::TColor c) { mCharColor.set(c); } void setGradColor(JUtility::TColor c) { mGradColor.set(c); } void setBlack(JUtility::TColor c) { mBlack = c; } - void setWhite(JUtility::TColor c) { mBlack = c; } + void setWhite(JUtility::TColor c) { mWhite = c; } + void setLineSpace(f32 x) { mLineSpace = x; } f32 getLineSpace() const { return mLineSpace; } f32 getCharSpace() const { return mCharSpace; } diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 636e71458..8b8c73969 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -1141,6 +1141,10 @@ inline void dComIfGs_offCompleteCollectMap(int i_no) { g_dComIfG_gameInfo.save.getPlayer().getMap().offCompleteMap(i_no - 1); } +inline s32 dComIfGs_getCollectMapNum() { + return g_dComIfG_gameInfo.save.getPlayer().getMap().getCollectMapNum(); +} + inline void dComIfGs_onSaveArriveGridForAgb(int i_no) { g_dComIfG_gameInfo.save.getPlayer().getMap().onSaveArriveGridForAgb(i_no); } diff --git a/include/d/d_menu_collect.h b/include/d/d_menu_collect.h index a556326b7..577a683cf 100644 --- a/include/d/d_menu_collect.h +++ b/include/d/d_menu_collect.h @@ -2,6 +2,10 @@ #define D_MENU_COLLECT_H #include "dolphin/types.h" +#include "JSystem/J2DGraph/J2DScreen.h" +#include "JSystem/J2DGraph/J2DTextBox.h" +#include "f_op/f_op_msg_mng.h" +#include "d/d_2dnumber.h" struct fopMsgM_pane_class; class JKRArchive; @@ -84,11 +88,102 @@ public: void animeStep4(short, short); void _open2(); void _close2(); + + /* 0x000 */ u8 m000[0x004 - 0x000]; + /* 0x004 */ J2DScreen* m004; + /* 0x008 */ fopMsgM_pane_class m008; + /* 0x040 */ fopMsgM_pane_class m040; + /* 0x078 */ fopMsgM_pane_class m078; + /* 0x0B0 */ fopMsgM_pane_class m0B0[15]; + /* 0x3F8 */ fopMsgM_pane_class m3F8[15]; + /* 0x740 */ fopMsgM_pane_class m740; + /* 0x778 */ fopMsgM_pane_class m778; + /* 0x7B0 */ fopMsgM_pane_class m7B0; + /* 0x7E8 */ fopMsgM_pane_class m7E8; + /* 0x820 */ fopMsgM_pane_class m820; + /* 0x858 */ fopMsgM_pane_class m858; + /* 0x890 */ fopMsgM_pane_class m890; + /* 0x8C8 */ fopMsgM_pane_class m8C8; + /* 0x900 */ fopMsgM_pane_class m900; + /* 0x938 */ fopMsgM_pane_class m938; + /* 0x970 */ fopMsgM_pane_class m970; + /* 0x9A8 */ fopMsgM_pane_class m9A8; + /* 0x9E0 */ fopMsgM_pane_class m9E0; + /* 0xA18 */ fopMsgM_pane_class mA18[4]; + /* 0xAF8 */ fopMsgM_pane_class mAF8; + /* 0xB30 */ fopMsgM_pane_class mB30; + /* 0xB68 */ fopMsgM_pane_class mB68[4]; + /* 0xC48 */ fopMsgM_pane_class mC48; + /* 0xC80 */ fopMsgM_pane_class mC80; + /* 0xCB8 */ fopMsgM_pane_class mCB8; + /* 0xCF0 */ fopMsgM_pane_class mCF0; + /* 0xD28 */ fopMsgM_pane_class mD28; + /* 0xD60 */ fopMsgM_pane_class mD60; + /* 0xD98 */ fopMsgM_pane_class mD98; + /* 0xDD0 */ fopMsgM_pane_class mDD0; + /* 0xE08 */ fopMsgM_pane_class mE08[8]; + /* 0xFC8 */ fopMsgM_pane_class mFC8; + /* 0x1000 */ fopMsgM_pane_class m1000[3]; + /* 0x10A8 */ fopMsgM_pane_class m10A8[3]; + /* 0x1150 */ fopMsgM_pane_class m1150[11]; + /* 0x13B8 */ fopMsgM_pane_class m13B8[3]; + /* 0x1460 */ fopMsgM_pane_class m1460; + /* 0x1498 */ fopMsgM_pane_class m1498[6]; + /* 0x15E8 */ fopMsgM_pane_class m15E8[6]; + /* 0x1738 */ fopMsgM_pane_class m1738; + /* 0x1770 */ fopMsgM_pane_class m1770; + /* 0x17A8 */ fopMsgM_pane_class m17A8[6]; + /* 0x18F8 */ fopMsgM_pane_class m18F8[6]; + /* 0x1A48 */ fopMsgM_pane_class m1A48[6]; + /* 0x1B98 */ fopMsgM_pane_class m1B98[6]; + /* 0x1CE8 */ fopMsgM_pane_class m1CE8[6]; + /* 0x1E38 */ fopMsgM_pane_class m1E38[6]; + /* 0x1460 */ fopMsgM_pane_class m1F88; + /* 0x1460 */ fopMsgM_pane_class m1FC0; + /* 0x1460 */ fopMsgM_pane_class m1FF8; + /* 0x2030 */ fopMsgM_pane_class m2030[5]; + /* 0x2148 */ fopMsgM_pane_class m2148[5]; + /* 0x2260 */ fopMsgM_pane_class m2260[5]; + /* 0x2378 */ fopMsgM_pane_class m2378; + /* 0x23B0 */ fopMsgM_pane_class m23B0; + /* 0x23E8 */ fopMsgM_pane_class m23E8; + /* 0x2420 */ fopMsgM_pane_class m2420; + /* 0x2458 */ u8 m2458[0x2460 - 0x2458]; + /* 0x2460 */ dDlst_2DOutFont_c* m2460; + /* 0x2464 */ u8 m2464[0x2470 - 0x2464]; + /* 0x2470 */ JUTFont* m2470; + /* 0x2474 */ JUTFont* m2474; + /* 0x2478 */ J2DPane* m2478; + /* 0x247C */ u8 m247C[0x2498 - 0x247C]; + /* 0x2498 */ ResTIMG* m2498; + /* 0x249C */ ResTIMG* m249C; + /* 0x24A0 */ ResTIMG* m24A0[6]; + /* 0x24B8 */ u8 m24B8[0x27A8 - 0x24B8]; + /* 0x27A8 */ f32 m27A8; + /* 0x27AC */ f32 m27AC; }; class dMc_HIO_c { public: dMc_HIO_c(); + virtual ~dMc_HIO_c() {} + +public: + /* 0x00 */ // vtable + /* 0x04 */ u8 m04[0x44 - 0x04]; + /* 0x44 */ s16 m44; + /* 0x46 */ s16 m46; + /* 0x48 */ s16 m48; + /* 0x4A */ s16 m4A; + /* 0x4C */ s16 m4C; + /* 0x4E */ s16 m4E; + /* 0x50 */ s16 m50; + /* 0x52 */ u8 m52; + /* 0x53 */ u8 m53; + /* 0x54 */ f32 m54; + /* 0x58 */ int m58; + /* 0x5C */ u8 m5C; + /* 0x5D */ u8 m5D; }; #endif /* D_MENU_COLLECT_H */ diff --git a/src/d/d_menu_collect.cpp b/src/d/d_menu_collect.cpp index 4e6061774..7f8831ac9 100644 --- a/src/d/d_menu_collect.cpp +++ b/src/d/d_menu_collect.cpp @@ -5,15 +5,328 @@ #include "d/d_menu_collect.h" #include "dolphin/types.h" +#include "stdio.h" +#include "d/d_com_inf_game.h" + +#include "weak_bss_936_to_1036.h" // IWYU pragma: keep +#include "weak_data_1811.h" // IWYU pragma: keep + +static dMc_HIO_c g_mcHIO; /* 8019BE8C-8019BF14 .text __ct__9dMc_HIO_cFv */ dMc_HIO_c::dMc_HIO_c() { - /* Nonmatching */ + /* Fakematch */ + m58 = -1; + m46 = 40; + m48 = 10; + m4A = 120; + m4C = 100; + m54 = 4.0f; + m5C = 0xff; + m5D = 70; + m52 = 130; + m4E = 250; + m50 = 20; + ((u8*)&m58)[0] = -1; + ((u8*)&m58)[1] = 170; + ((u8*)&m58)[2] = 0; + ((u8*)&m58)[3] = 0; + m44 = 13; } /* 8019BF14-8019CB5C .text screenSet__15dMenu_Collect_cFv */ void dMenu_Collect_c::screenSet() { /* Nonmatching */ + char* print_format; + + static const u32 l_ft[] = { + 'ft00', 'ft01', 'ft02', 'ft03', 'ft04', 'ft05', 'ft06', 'ft07', + 'ft08', 'ft09', 'ft10', 'ft11', 'ft12', 'ft13', 'ft14', + }; + + static const u32 l_fd[] = { + 'fd00', 'fd01', 'fd02', 'fd03', 'fd04', 'fd05', 'fd06', 'fd07', + 'fd08', 'fd09', 'fd10', 'fd11', 'fd12', 'fd13', 'fd14', + }; + + static const u32 l_car[] = { + 'car1', 'car2', 'car3', 'car4', + }; + + static const u32 l_tri[] = { + 'tri0', 'tri1', 'tri2', 'tri3', 'tri4', 'tri5', 'tri6', 'tri7', + }; + + static const u32 l_sit[] = { + 'it16', 'it14', 'it15', + }; + + static const u32 l_sik[] = { + 'ik16', 'ik14', 'ik15', + }; + + static const u32 l_ci[] = { + 'ci10', 'ci09', 'ci08', 'ci07', 'ci06', 'ci05', + 'ci04', 'ci03', 'ci02', 'ci01', 'ci00', + }; + + static const u32 l_htp[] = { + 'htp2', 'htp1', 'htp3', + }; + + static const u32 l_tit[] = { + 'it08', 'it09', 'it10', 'it11', 'it12', 'it13', + }; + + static const u32 l_tik[] = { + 'ik08', 'ik09', 'ik10', 'ik11', 'ik12', 'ik13' + }; + + static const u32 l_cn[] = { + 'cn01', 'cn02', 'cn03', 'cn04', 'cn05', 'cn06' + }; + + static const u32 l_wn[] = { + 'wn01', 'wn02', 'wn03', 'wn04', 'wn05', 'wn06' + }; + + static const u32 l_i0[] = { + 'i011', 'i021', 'i031', 'i041', 'i051', + 'i061' + }; + + static const u32 l_i1[] = { + 'i012', 'i022', 'i032', 'i042', 'i052', 'i062' + }; + + static const u32 l_bs[] = { + 'bs01', 'bs02', 'bs03', 'bs04', 'bs05', 'bs06' + }; + + static const u32 l_hmb[] = { + 'hmb1', 'hmb2', 'hmb3', 'hmb4', 'hmb5', 'hmb6' + }; + + static const u32 l_wit[] = { + 'it00', 'it01', 'it02', 'it03', 'it04' + }; + + static const u32 l_wik[] = { + 'ik00', 'ik01', 'ik02', 'ik03', 'ik04' + }; + + static const u32 l_ip[] = { + 'ip09', 'ip07', 'ip05', 'ip03', 'ip01' + }; + + static const u32 l_wk[] = { + 'wk00', 'wk01', 'wk02', 'wk03', + }; + + static char* triTex[8] = { + "triforce_00.bti", "triforce_01.bti", "triforce_02.bti", "triforce_03.bti", + "triforce_04.bti", "triforce_05.bti", "triforce_06.bti", "triforce_07.bti", + }; + static char* symTex[3] = { + "god_symbol_02.bti", "god_symbol_00.bti", "god_symbol_01.bti", + }; + static char* wepTex[5] = { + "sword_00.bti", "shield_00.bti", "gloves_00.bti", "amulet_00.bti", "amulet_01.bti", + }; + + J2DPane* mPane = m004->search('ROOT'); + m2478 = mPane; + + fopMsgM_setPaneData(&m008, m004, 'ft15'); + fopMsgM_setPaneData(&m040, m004, 'ft16'); + fopMsgM_setPaneData(&m078, m004, 'ft17'); + + for (int i = 0; i < (s32)ARRAY_SIZE(m0B0); i++) { + fopMsgM_setPaneData(&m0B0[i], m004, l_ft[i]); + fopMsgM_setPaneData(&m3F8[i], m004, l_fd[i]); + + m0B0[i].mUserArea = 0xFFFF; + } + + fopMsgM_setPaneData(&m740, m004, 'str0'); + fopMsgM_setPaneData(&m778, m004, 'st00'); + fopMsgM_setPaneData(&m7B0, m004, 'nt00'); + fopMsgM_setPaneData(&m7E8, m004, 'nk00'); + fopMsgM_setPaneData(&m820, m004, 'no11'); + + m820.mUserArea = m820.pane->mRotation; + + if (m820.mUserArea > 180) m820.mUserArea -= 360; + + ((J2DTextBox*)(m740).pane)->setFont(m2474); + ((J2DTextBox*)(m778).pane)->setFont(m2470); + + // Couple of functions missing here + ((J2DTextBox*)(m740).pane)->setWhite(-1); + ((J2DTextBox*)(m740).pane)->setCharColor(0xff); + ((J2DTextBox*)(m740).pane)->setGradColor(0xff); + + ((J2DTextBox*)(m778).pane)->setWhite(-1); + ((J2DTextBox*)(m778).pane)->setCharColor(0xff); + ((J2DTextBox*)(m778).pane)->setGradColor(0xff); + + + fopMsgM_setPaneData(&m858, m004, 'wd'); + ((J2DTextBox*)(m858).pane)->setFont(m2470); + + m2460->setPane(m2470, &m858, &m008, &m040, &m078); + + fopMsgM_setPaneData(&m890, m004, 'nm00'); + ((J2DTextBox*)(m890).pane)->setFont(m2470); + + fopMsgM_setPaneData(&m8C8, m004, 'nm01'); + ((J2DTextBox*)(m8C8).pane)->setFont(m2470); + + fopMsgM_setPaneData(&m900, m004, 'itnm'); + fopMsgM_setPaneData(&m938, m004, 'itnk'); + fopMsgM_setPaneData(&m970, m004, 'msk0'); + fopMsgM_setPaneData(&m9A8, m004, 'tl00'); + fopMsgM_setPaneData(&m9E0, m004, 'tk00'); + + for(int i = 0; i < 4; i++) { + fopMsgM_setPaneData(&mA18[i], m004, l_car[i]); + } + + fopMsgM_setPaneData(&mAF8, m004, 'wdsv'); + fopMsgM_setPaneData(&mB30, m004, 'wdop'); + + for(int i = 0; i < 4; i++) { + fopMsgM_setPaneData(&mB68[i], m004, l_wk[i]); + } + + fopMsgM_setPaneData(&mC48, m004, 'num1'); + fopMsgM_setPaneData(&mC80, m004, 'num2'); + fopMsgM_setPaneData(&mCB8, m004, 'numc'); + fopMsgM_setPaneData(&mCF0, m004, 'cmap'); + fopMsgM_setPaneData(&mD28, m004, 'wk1'); + fopMsgM_setPaneData(&mD60, m004, 'wk0'); + fopMsgM_setPaneData(&mD98, m004, 'trim'); + fopMsgM_setPaneData(&mDD0, m004, 'tril'); + + mD98.pane->mDrawAlpha = 1; + mDD0.pane->mDrawAlpha = 1; + + for(int i = 0; i < 8; i++) { + fopMsgM_setPaneData(&mE08[i], m004, l_tri[i]); + } + + fopMsgM_setPaneData(&mFC8, m004, 'trib'); + + for(int i = 0; i < 3; i++) { + fopMsgM_setPaneData(&m10A8[i], m004, l_sit[i]); + fopMsgM_setPaneData(&m3F8[i], m004, l_sik[i]); + } + + if (dComIfGs_isEventBit(0x1480)) { + m1000[1].mInitAlpha *= 0.5f; + m10A8[1].mInitAlpha *= 0.5f; + } + + if (dComIfGs_isEventBit(0x1440)) { + m1000[2].mInitAlpha *= 0.5f; + m10A8[2].mInitAlpha *= 0.5f; + } + + if (dComIfGs_isEventBit(0x1410)) { + m1000[0].mInitAlpha *= 0.5f; + m10A8[0].mInitAlpha *= 0.5f; + } + + for(int i = 0; i < 11; i++) { + fopMsgM_setPaneData(&m1150[i], m004, l_ci[i]); + } + + for(int i = 0; i < 3; i++) { + fopMsgM_setPaneData(&m10A8[i], m004, l_htp[i]); + } + + fopMsgM_setPaneData(&m1460, m004, 'htpb'); + + for(int i = 0; i < 6; i++) { + fopMsgM_setPaneData(&m1498[i], m004, l_tit[i]); + fopMsgM_setPaneData(&m15E8[i], m004, l_tik[i]); + fopMsgM_setPaneData(&m17A8[i], m004, l_cn[i]); + fopMsgM_pane_class* pPane = &m18F8[i]; + fopMsgM_setPaneData(pPane, m004, l_wn[i]); + fopMsgM_setPaneData(&m1A48[i], m004, l_i0[i]); + fopMsgM_setPaneData(&m1B98[i], m004, l_i1[i]); + fopMsgM_setPaneData(&m1CE8[i], m004, l_bs[i]); + fopMsgM_setPaneData(&m1E38[i], m004, l_hmb[i]); + + pPane->mPosCenterOrig.x -= 4.0f; + pPane->mPosCenterOrig.y -= 4.0f; + + fopMsgM_paneTrans(pPane, 0.0f, 0.0f); + } + + fopMsgM_setPaneData(&m1738, m004, 'i111'); + fopMsgM_setPaneData(&m1770, m004, 'i122'); + fopMsgM_setPaneData(&m1F88, m004, 'cc43'); + fopMsgM_setPaneData(&m1FC0, m004, 'cc32'); + fopMsgM_setPaneData(&m1FF8, m004, 'cc21'); + + for (int i = 0; i < 5; i++) { + fopMsgM_setPaneData(&m2030[i], m004, l_wit[i]); + fopMsgM_setPaneData(&m2148[i], m004, l_wik[i]); + } + + for (int i = 0; i < 5; i++) { + fopMsgM_setPaneData(&m2260[i], m004, l_ip[i]); + } + + fopMsgM_setPaneData(&m2378, m004, 'ip00'); + fopMsgM_setPaneData(&m23B0, m004, 'cc14'); + fopMsgM_setPaneData(&m23E8, m004, 'cc07'); + fopMsgM_setPaneData(&m2420, m004, 'cc00'); + + JKRArchive::readTypeResource(m2498, 0xc00, 'TIMG', "baton.bti", dComIfGp_getItemIconArchive()); + DCStoreRangeNoSync(m2498, 0xc00); + + JKRArchive::readTypeResource(m249C, 0xc00, 'TIMG', "cmap_treasure2.bti", dComIfGp_getItemIconArchive()); + DCStoreRangeNoSync(m249C, 0xc00); + + for(int i = 0; i < 6; i++) { + ((J2DPicture*)m1498[i].pane)->changeTexture(m2498, 0); + ((J2DPicture*)m15E8[i].pane)->changeTexture(m2498, 0); + } + + ((J2DPicture*)mCF0.pane)->changeTexture(m249C, 0); + + for(int i = 0; i < 8; i++) { + JKRArchive::readTypeResource(m24A0[i], 0xc00, 'TIMG', triTex[i], dComIfGp_getItemIconArchive()); + DCStoreRangeNoSync(m24A0[i], 0xc00); + ((J2DPicture*)mE08[i].pane)->changeTexture(m24A0[i], 0); + } + + mE08[4].mUserArea = -1; + m27A8 = mE08[4].mPosCenterOrig.x - mFC8.mPosCenterOrig.x; + m27AC = mE08[4].mPosCenterOrig.y - mFC8.mPosCenterOrig.y; + + for(int i = 0; i < 3; i++) { + JKRArchive::readTypeResource(m24A0[i], 0xc00, 'TIMG', symTex[i], dComIfGp_getItemIconArchive()); + DCStoreRangeNoSync(m24A0[i], 0xc00); + ((J2DPicture*)m1000[i].pane)->changeTexture(m24A0[i], 0); + ((J2DPicture*)m10A8[i].pane)->changeTexture(m24A0[i], 0); + } + + for(int i = 0; i < 5; i++) { + JKRArchive::readTypeResource(m24A0[i], 0xc00, 'TIMG', wepTex[i], dComIfGp_getItemIconArchive()); + DCStoreRangeNoSync(m24A0[i], 0xc00); + ((J2DPicture*)m2030[i].pane)->changeTexture(m24A0[i], 0); + ((J2DPicture*)m2148[i].pane)->changeTexture(m24A0[i], 0); + } + + sprintf(print_format, "rupy_num_%02d.bti", dComIfGs_getCollectMapNum() / 10); + ((J2DPicture*)mC48.pane)->changeTexture(print_format, 0); + + sprintf(print_format, "rupy_num_%02d.bti", dComIfGs_getCollectMapNum() % 10); + ((J2DPicture*)mC80.pane)->changeTexture(print_format, 0); + return; } /* 8019CB5C-8019CD40 .text initialize__15dMenu_Collect_cFv */ From 9d1cd5c6df56416a4bab28941b1fbe99d382fa95 Mon Sep 17 00:00:00 2001 From: mattias-blum <142374929+mattias-blum@users.noreply.github.com> Date: Thu, 15 May 2025 11:05:44 -0400 Subject: [PATCH 02/19] more progress --- include/d/d_menu_option.h | 14 ++-- src/d/d_menu_option.cpp | 155 ++++++++++++++++++++++++++++++++++---- 2 files changed, 148 insertions(+), 21 deletions(-) diff --git a/include/d/d_menu_option.h b/include/d/d_menu_option.h index c3529d8bf..5c8634a61 100644 --- a/include/d/d_menu_option.h +++ b/include/d/d_menu_option.h @@ -60,20 +60,17 @@ private: /* 0x7B0 */ fopMsgM_pane_class m7B0; /* 0x7E8 */ fopMsgM_pane_class m7E8; /* 0x820 */ fopMsgM_pane_class m820; - /* 0x858 */ fopMsgM_pane_class m858; - /* 0x890 */ fopMsgM_pane_class m890; + /* 0x858 */ fopMsgM_pane_class m858[2]; /* 0x8C8 */ fopMsgM_pane_class m8C8[4]; /* 0x9A8 */ fopMsgM_pane_class m9A8[2]; /* 0xA18 */ fopMsgM_pane_class mA18[3]; /* 0xAC0 */ fopMsgM_pane_class mAC0[2]; - /* 0xB30 */ fopMsgM_pane_class mB30; - /* 0xB68 */ fopMsgM_pane_class mB68; + /* 0xB30 */ fopMsgM_pane_class mB30[2]; /* 0xBA0 */ fopMsgM_pane_class mBA0; /* 0xBD8 */ fopMsgM_pane_class mBD8; /* 0xC10 */ fopMsgM_pane_class mC10; /* 0xC48 */ fopMsgM_pane_class mC48; - /* 0xC80 */ fopMsgM_pane_class mC80; - /* 0xCB8 */ fopMsgM_pane_class mCB8; + /* 0xC80 */ fopMsgM_pane_class mC80[2]; /* 0xCF0 */ fopMsgM_pane_class mCF0; /* 0xD28 */ JKRArchive* mpArchive; /* 0xD2C */ JUTFont* mD2C; @@ -89,7 +86,10 @@ private: /* 0xE39 */ u8 mE39; /* 0xE3A */ u8 mE3A; /* 0xE3B */ u8 mE3B; - /* 0xE3C */ u8 mE3C[0xE40 - 0xE3C]; + /* 0xE3C */ u8 mE3C; + /* 0xE3D */ u8 mE3D; + /* 0xE3E */ u8 mE3E; + /* 0xE3F */ u8 mE3F; /* 0xE40 */ u8 mE40; /* 0xE41 */ u8 mE41[0xE42 - 0xE41]; }; // Size: 0xE42 diff --git a/src/d/d_menu_option.cpp b/src/d/d_menu_option.cpp index 94e6ad176..9d2065bd5 100644 --- a/src/d/d_menu_option.cpp +++ b/src/d/d_menu_option.cpp @@ -8,6 +8,7 @@ #include "JSystem/JUtility/JUTAssert.h" #include "d/d_lib.h" #include "f_op/f_op_msg_mng.h" +#include "m_Do/m_Do_audio.h" #include "global.h" dMo_HIO_c g_moHIO; @@ -45,8 +46,8 @@ void dMenu_Option_c::screenSet() { fopMsgM_setPaneData(&m7B0, scrn->search('nt00')); fopMsgM_setPaneData(&m7E8, scrn->search('nk00')); fopMsgM_setPaneData(&m820, scrn->search('no11')); - fopMsgM_setPaneData(&m858, scrn->search('yaz2')); - fopMsgM_setPaneData(&m890, scrn->search('yaz1')); + fopMsgM_setPaneData(&m858[0], scrn->search('yaz2')); + fopMsgM_setPaneData(&m858[1], scrn->search('yaz1')); fopMsgM_setPaneData(&m8C8[0], scrn->search('ttyu')); fopMsgM_setPaneData(&m9A8[0], scrn->search('thld')); fopMsgM_setPaneData(&m9A8[1], scrn->search('tsic')); @@ -57,16 +58,16 @@ void dMenu_Option_c::screenSet() { fopMsgM_setPaneData(&m8C8[2], scrn->search('tvib')); fopMsgM_setPaneData(&mAC0[1], scrn->search('tari')); fopMsgM_setPaneData(&mAC0[0], scrn->search('tnas')); - fopMsgM_setPaneData(&mB30, scrn->search('cr32')); - fopMsgM_setPaneData(&mB68, scrn->search('cr31')); + fopMsgM_setPaneData(&mB30[0], scrn->search('cr32')); + fopMsgM_setPaneData(&mB30[1], scrn->search('cr31')); fopMsgM_setPaneData(&mBA0, scrn->search('cc22')); fopMsgM_setPaneData(&mBD8, scrn->search('cc21')); fopMsgM_setPaneData(&mC10, scrn->search('cc12')); fopMsgM_setPaneData(&mC48, scrn->search('cr11')); - fopMsgM_setPaneData(&mC80, scrn->search('bs09')); - fopMsgM_setPaneData(&mCB8, scrn->search('bs00')); + fopMsgM_setPaneData(&mC80[0], scrn->search('bs09')); + fopMsgM_setPaneData(&mC80[1], scrn->search('bs00')); fopMsgM_setPaneData(&mCF0, scrn->search('blak')); - + fopMsgM_messageGet(mD48, 0x19D); fopMsgM_messageGet(mD5C[0], 0x19B); fopMsgM_messageGet(mD5C[1], 0x1A9); @@ -120,31 +121,157 @@ void dMenu_Option_c::screenSet() { /* 801D3388-801D3518 .text mainInit__14dMenu_Option_cFv */ void dMenu_Option_c::mainInit() { /* Nonmatching */ + fopMsgM_pane_class* mpPane; + + fopMsgM_setNowAlphaZero(&mCF0); + + for (int i = 0; i < 2; i++) { + mpPane = &m858[i]; + fopMsgM_paneTrans(mpPane, 0.0f, 0.0f); + + m858[i].pane->rotate(m858[i].mSize.x / 2.0f, m858[i].mSize.y / 2.0f, ROTATE_Z, 90.0f); + + fopMsgM_setNowAlphaZero((fopMsgM_pane_class*)(&mC80[i].pane)); + fopMsgM_setNowAlphaZero(mpPane); + fopMsgM_setNowAlphaZero((fopMsgM_pane_class*)(&m9A8[i].pane)); + fopMsgM_setNowAlphaZero((fopMsgM_pane_class*)(&mAC0[i].pane)); + } + + for (int i = 0; i < 3; i++) { + fopMsgM_setNowAlphaZero((fopMsgM_pane_class*)(&mA18[i].pane)); + } + + for (int i = 0; i < 4; i++) { + if (i != 1) { + fopMsgM_setNowAlphaZero((fopMsgM_pane_class*)(&m8C8[i].pane)); + } + } + + for (int i = 0; i < 6; i++) { + mpPane = (fopMsgM_pane_class*)(&mB30[i].pane); + fopMsgM_paneTrans(mpPane, 0.0f, 0.0f); + fopMsgM_setNowAlphaZero(mpPane); + } + + mB30[0].mUserArea = 0; + mB30[1].mUserArea = 0; + mBA0.mUserArea = 0; + m858[0].mUserArea = 0; + m858[1].mUserArea = 0; + + cursorMove(); } /* 801D3518-801D35DC .text noteInit__14dMenu_Option_cFv */ -void dMenu_Option_c::noteInit() { - /* Nonmatching */ +void dMenu_Option_c::noteInit() { + fopMsgM_paneTrans(&m820, 0.0f, 35.0f); + + m820.pane->rotate(m820.mSize.x / 2.0f, m820.mSize.y / 2.0f, ROTATE_Z, m820.mUserArea + -12.0f); + + fopMsgM_setNowAlphaZero(&m740); + fopMsgM_setNowAlphaZero(&m778); + fopMsgM_setNowAlphaZero(&m7B0); + fopMsgM_setNowAlphaZero(&m7E8); + fopMsgM_setNowAlphaZero(&m820); } /* 801D35DC-801D37C8 .text titleInit__14dMenu_Option_cFv */ -void dMenu_Option_c::titleInit() { - /* Nonmatching */ +void dMenu_Option_c::titleInit() { + float rotate_angle = m008.mUserArea + 20; + if (rotate_angle > 180.0f) { + rotate_angle -= 360.0f; + } + + if (rotate_angle < -180.0f) { + rotate_angle += 360.0f; + } + + fopMsgM_paneTrans(&m008, 0.0f, -50.0f); + fopMsgM_paneTrans(&m040, 0.0f, -50.0f); + fopMsgM_paneTrans(&m078, 0.0f, -50.0f); + + m008.pane->rotate(m008.mSize.x / 2.0f, m008.mSize.y / 2.0f, ROTATE_Z, rotate_angle + m008.mUserArea); + m040.pane->rotate(m040.mSize.x / 2.0f, m040.mSize.y / 2.0f, ROTATE_Z, rotate_angle + m040.mUserArea); + m078.pane->rotate(m078.mSize.x / 2.0f, m078.mSize.y / 2.0f, ROTATE_Z, rotate_angle + m078.mUserArea); + + fopMsgM_setNowAlphaZero(&m008); + fopMsgM_setNowAlphaZero(&m040); + fopMsgM_setNowAlphaZero(&m078); } /* 801D37C8-801D38E0 .text mainMove__14dMenu_Option_cFv */ void dMenu_Option_c::mainMove() { - /* Nonmatching */ + float alpha = fopMsgM_valueIncrease(7, mC80[0].mUserArea, 0); + + fopMsgM_setNowAlpha(&mCF0, alpha); + + fopMsgM_setNowAlpha(&m9A8[mE3C], alpha); + fopMsgM_setNowAlpha(&mAC0[mE3F], alpha); + fopMsgM_setNowAlpha(&mA18[mE3E], alpha); + + for(int i = 0; i < 2; i++) { + fopMsgM_setNowAlpha((fopMsgM_pane_class*)(&mC80[i].pane), alpha); + fopMsgM_setNowAlpha((fopMsgM_pane_class*)(&m858[i].pane), alpha); + } + + for (int i = 0; i < 4; i++) { + if (i != 1) { + fopMsgM_setNowAlpha((fopMsgM_pane_class*)(&m8C8[i].pane), alpha); + } + } + + fopMsgM_setNowAlpha(&mB30[0], alpha); + fopMsgM_setNowAlpha(&mB30[1], alpha); } /* 801D38E0-801D39F4 .text noteMove__14dMenu_Option_cFv */ void dMenu_Option_c::noteMove() { - /* Nonmatching */ + float alpha; + + alpha = fopMsgM_valueIncrease(7, mC80[0].mUserArea + -7, 0); + fopMsgM_paneTrans(&m820, 0.0f, (1.0f - alpha) * 35.0f); + + m820.pane->rotate(m820.mSize.x / 2.0f, m820.mSize.y / 2.0f, ROTATE_Z, (1.0f - alpha) * -12.0f + m820.mUserArea); + + fopMsgM_setNowAlpha(&m740, alpha); + fopMsgM_setNowAlpha(&m778, alpha); + fopMsgM_setNowAlpha(&m7B0, alpha); + fopMsgM_setNowAlpha(&m7E8, alpha); } /* 801D39F4-801D3C6C .text titleMove__14dMenu_Option_cFv */ void dMenu_Option_c::titleMove() { - /* Nonmatching */ + /* Nonmatching - regalloc */ + float alpha = fopMsgM_valueIncrease(7, mC80[0].mUserArea + -7,0); + + float rotate_angle = m008.mUserArea + 20; + if (rotate_angle > 180.0f) { + rotate_angle -= 360.0f; + } + + if (rotate_angle < -180.0f) { + rotate_angle += 360.0f; + } + + rotate_angle *= 1.0f - alpha; + + if (mC80[0].mUserArea == 8) { + mDoAud_seStart(0x84e, NULL, 0, 0); + } + + float y = 1.0f - alpha; + + fopMsgM_paneTrans(&m008, 0.0f, y * -50.0f); + fopMsgM_paneTrans(&m040, 0.0f, y * -50.0f); + fopMsgM_paneTrans(&m078, 0.0f, y * -50.0f); + + m008.pane->rotate(m008.mSize.x / 2.0f, m008.mSize.y / 2.0f, ROTATE_Z, rotate_angle + m008.mUserArea); + m040.pane->rotate(m040.mSize.x / 2.0f, m040.mSize.y / 2.0f, ROTATE_Z, rotate_angle + m040.mUserArea); + m078.pane->rotate(m078.mSize.x / 2.0f, m078.mSize.y / 2.0f, ROTATE_Z, rotate_angle + m078.mUserArea); + + fopMsgM_setNowAlpha(&m008, alpha); + fopMsgM_setNowAlpha(&m040, alpha); + fopMsgM_setNowAlpha(&m078, alpha); } /* 801D3C6C-801D3D34 .text cursorMove__14dMenu_Option_cFv */ From f72d6b5910ce4323cfbc2abc5f253ac2960ae3d0 Mon Sep 17 00:00:00 2001 From: mattias-blum <142374929+mattias-blum@users.noreply.github.com> Date: Thu, 15 May 2025 11:48:36 -0400 Subject: [PATCH 03/19] more progress --- include/d/d_menu_option.h | 6 +-- src/d/d_menu_option.cpp | 85 ++++++++++++++++++++++++++++----------- 2 files changed, 63 insertions(+), 28 deletions(-) diff --git a/include/d/d_menu_option.h b/include/d/d_menu_option.h index 5c8634a61..99b4f9987 100644 --- a/include/d/d_menu_option.h +++ b/include/d/d_menu_option.h @@ -65,11 +65,7 @@ private: /* 0x9A8 */ fopMsgM_pane_class m9A8[2]; /* 0xA18 */ fopMsgM_pane_class mA18[3]; /* 0xAC0 */ fopMsgM_pane_class mAC0[2]; - /* 0xB30 */ fopMsgM_pane_class mB30[2]; - /* 0xBA0 */ fopMsgM_pane_class mBA0; - /* 0xBD8 */ fopMsgM_pane_class mBD8; - /* 0xC10 */ fopMsgM_pane_class mC10; - /* 0xC48 */ fopMsgM_pane_class mC48; + /* 0xB30 */ fopMsgM_pane_class mB30[6]; /* 0xC80 */ fopMsgM_pane_class mC80[2]; /* 0xCF0 */ fopMsgM_pane_class mCF0; /* 0xD28 */ JKRArchive* mpArchive; diff --git a/src/d/d_menu_option.cpp b/src/d/d_menu_option.cpp index 9d2065bd5..747ea379f 100644 --- a/src/d/d_menu_option.cpp +++ b/src/d/d_menu_option.cpp @@ -60,10 +60,10 @@ void dMenu_Option_c::screenSet() { fopMsgM_setPaneData(&mAC0[0], scrn->search('tnas')); fopMsgM_setPaneData(&mB30[0], scrn->search('cr32')); fopMsgM_setPaneData(&mB30[1], scrn->search('cr31')); - fopMsgM_setPaneData(&mBA0, scrn->search('cc22')); - fopMsgM_setPaneData(&mBD8, scrn->search('cc21')); - fopMsgM_setPaneData(&mC10, scrn->search('cc12')); - fopMsgM_setPaneData(&mC48, scrn->search('cr11')); + fopMsgM_setPaneData(&mB30[2], scrn->search('cc22')); + fopMsgM_setPaneData(&mB30[3], scrn->search('cc21')); + fopMsgM_setPaneData(&mB30[4], scrn->search('cc12')); + fopMsgM_setPaneData(&mB30[5], scrn->search('cr11')); fopMsgM_setPaneData(&mC80[0], scrn->search('bs09')); fopMsgM_setPaneData(&mC80[1], scrn->search('bs00')); fopMsgM_setPaneData(&mCF0, scrn->search('blak')); @@ -112,6 +112,7 @@ void dMenu_Option_c::screenSet() { m008.mUserArea = m008.pane->mRotation; m040.mUserArea = m040.pane->mRotation; m078.mUserArea = m078.pane->mRotation; + if (m820.mUserArea > 180) m820.mUserArea -= 360; if (m008.mUserArea > 180) m008.mUserArea -= 360; if (m040.mUserArea > 180) m040.mUserArea -= 360; @@ -120,42 +121,38 @@ void dMenu_Option_c::screenSet() { /* 801D3388-801D3518 .text mainInit__14dMenu_Option_cFv */ void dMenu_Option_c::mainInit() { - /* Nonmatching */ - fopMsgM_pane_class* mpPane; - + /* Nonmatching - regalloc */ fopMsgM_setNowAlphaZero(&mCF0); for (int i = 0; i < 2; i++) { - mpPane = &m858[i]; - fopMsgM_paneTrans(mpPane, 0.0f, 0.0f); + fopMsgM_paneTrans(&m858[i], 0.0f, 0.0f); m858[i].pane->rotate(m858[i].mSize.x / 2.0f, m858[i].mSize.y / 2.0f, ROTATE_Z, 90.0f); - fopMsgM_setNowAlphaZero((fopMsgM_pane_class*)(&mC80[i].pane)); - fopMsgM_setNowAlphaZero(mpPane); - fopMsgM_setNowAlphaZero((fopMsgM_pane_class*)(&m9A8[i].pane)); - fopMsgM_setNowAlphaZero((fopMsgM_pane_class*)(&mAC0[i].pane)); + fopMsgM_setNowAlphaZero(&mC80[i]); + fopMsgM_setNowAlphaZero(&m858[i]); + fopMsgM_setNowAlphaZero(&m9A8[i]); + fopMsgM_setNowAlphaZero(&mAC0[i]); } for (int i = 0; i < 3; i++) { - fopMsgM_setNowAlphaZero((fopMsgM_pane_class*)(&mA18[i].pane)); + fopMsgM_setNowAlphaZero(&mA18[i]); } for (int i = 0; i < 4; i++) { if (i != 1) { - fopMsgM_setNowAlphaZero((fopMsgM_pane_class*)(&m8C8[i].pane)); + fopMsgM_setNowAlphaZero(&m8C8[i]); } } for (int i = 0; i < 6; i++) { - mpPane = (fopMsgM_pane_class*)(&mB30[i].pane); - fopMsgM_paneTrans(mpPane, 0.0f, 0.0f); - fopMsgM_setNowAlphaZero(mpPane); + fopMsgM_paneTrans(&mB30[i], 0.0f, 0.0f); + fopMsgM_setNowAlphaZero(&mB30[i]); } mB30[0].mUserArea = 0; mB30[1].mUserArea = 0; - mBA0.mUserArea = 0; + mB30[2].mUserArea = 0; m858[0].mUserArea = 0; m858[1].mUserArea = 0; @@ -210,13 +207,13 @@ void dMenu_Option_c::mainMove() { fopMsgM_setNowAlpha(&mA18[mE3E], alpha); for(int i = 0; i < 2; i++) { - fopMsgM_setNowAlpha((fopMsgM_pane_class*)(&mC80[i].pane), alpha); - fopMsgM_setNowAlpha((fopMsgM_pane_class*)(&m858[i].pane), alpha); + fopMsgM_setNowAlpha(&mC80[i], alpha); + fopMsgM_setNowAlpha(&m858[i], alpha); } for (int i = 0; i < 4; i++) { if (i != 1) { - fopMsgM_setNowAlpha((fopMsgM_pane_class*)(&m8C8[i].pane), alpha); + fopMsgM_setNowAlpha(&m8C8[i], alpha); } } @@ -277,11 +274,53 @@ void dMenu_Option_c::titleMove() { /* 801D3C6C-801D3D34 .text cursorMove__14dMenu_Option_cFv */ void dMenu_Option_c::cursorMove() { /* Nonmatching */ + short sVar2 = mB30[1].mUserArea; + + for (int i = 0; i < 6; i++) { + mB30[i].mPosCenter.x = m8C8[sVar2].mPosCenterOrig.x; + mB30[i].mPosCenter.y = m8C8[sVar2].mPosCenterOrig.y; + + mB30[i].mSize.x = m8C8[sVar2].mSizeOrig.x; + + fopMsgM_cposMove((fopMsgM_pane_class *)(&mB30[i].pane)); + + mB30[i].pane->rotate(mB30[i].mSize.x / 2.0f, mB30[i].mSize.y / 2.0f, ROTATE_Z, 0.5f); + } + + cursorScale(); } /* 801D3D34-801D3E70 .text cursorScale__14dMenu_Option_cFv */ void dMenu_Option_c::cursorScale() { - /* Nonmatching */ + float x[2]; + float y; + + switch (mB30[1].mUserArea) { + case 0: { + x[0] = m9A8[mE3C].mPosTopLeftOrig.x - 20.0f; + x[1] = m9A8[mE3C].mPosTopLeftOrig.x + m9A8[mE3C].mSizeOrig.x + 20.0f; + y = m9A8[mE3C].mPosCenterOrig.y; + break; + } + case 3: { + x[0] = mA18[mE3E].mPosTopLeftOrig.x - 20.0f; + x[1] = mA18[mE3E].mPosTopLeftOrig.x + mA18[mE3E].mSizeOrig.x + 20.0f; + y = mA18[mE3E].mPosCenterOrig.y; + break; + } + case 2: { + x[0] = mAC0[mE3F].mPosTopLeftOrig.x - 20.0f; + x[1] = mAC0[mE3F].mPosTopLeftOrig.x + mAC0[mE3F].mSizeOrig.x + 20.0f; + y = mAC0[mE3F].mPosCenterOrig.y; + break; + } + } + + for (int i = 0; i < 2; i++) { + m858[i].mPosCenter.x = x[i]; + m858[i].mPosCenter.y = y; + fopMsgM_cposMove(&m858[i]); + } } /* 801D3E70-801D3F98 .text typeMove__14dMenu_Option_cFv */ From 6da63960c1da5d2ae70ec7a340333b6257293b09 Mon Sep 17 00:00:00 2001 From: mattias-blum <142374929+mattias-blum@users.noreply.github.com> Date: Thu, 15 May 2025 11:53:43 -0400 Subject: [PATCH 04/19] more progress --- src/d/d_menu_option.cpp | 42 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/src/d/d_menu_option.cpp b/src/d/d_menu_option.cpp index 747ea379f..02771010c 100644 --- a/src/d/d_menu_option.cpp +++ b/src/d/d_menu_option.cpp @@ -294,7 +294,7 @@ void dMenu_Option_c::cursorMove() { void dMenu_Option_c::cursorScale() { float x[2]; float y; - + switch (mB30[1].mUserArea) { case 0: { x[0] = m9A8[mE3C].mPosTopLeftOrig.x - 20.0f; @@ -324,8 +324,44 @@ void dMenu_Option_c::cursorScale() { } /* 801D3E70-801D3F98 .text typeMove__14dMenu_Option_cFv */ -void dMenu_Option_c::typeMove() { - /* Nonmatching */ +void dMenu_Option_c::typeMove() { + switch (mB30[1].mUserArea) { + case 0: { + for (int i = 0; i < 2; i++) { + if(i == mE3C) { + fopMsgM_setInitAlpha(&m9A8[i]); + } + else { + fopMsgM_setNowAlphaZero(&m9A8[i]); + } + } + break; + } + case 3: { + for (int i = 0; i < 3; i++) { + if(i == mE3E) { + fopMsgM_setInitAlpha(&mA18[i]); + } + else { + fopMsgM_setNowAlphaZero(&mA18[i]); + } + } + break; + } + case 2: { + for (int i = 0; i < 2; i++) { + if(i == mE3F) { + fopMsgM_setInitAlpha(&mAC0[i]); + } + else { + fopMsgM_setNowAlphaZero(&mAC0[i]); + } + } + break; + } + } + + cursorScale(); } /* 801D3F98-801D41C4 .text yazAnime__14dMenu_Option_cFv */ From 0a2e18900f5244073952de9062aa58cb8b1b268f Mon Sep 17 00:00:00 2001 From: mattias-blum <142374929+mattias-blum@users.noreply.github.com> Date: Thu, 15 May 2025 17:51:38 -0400 Subject: [PATCH 05/19] more progress --- include/JSystem/J2DGraph/J2DPane.h | 5 +- include/d/d_menu_option.h | 6 +- include/f_op/f_op_msg_mng.h | 23 ++- src/d/d_menu_option.cpp | 315 ++++++++++++++++++++++++++++- src/f_op/f_op_msg_mng.cpp | 22 -- 5 files changed, 341 insertions(+), 30 deletions(-) diff --git a/include/JSystem/J2DGraph/J2DPane.h b/include/JSystem/J2DGraph/J2DPane.h index df3641ba8..291a0bbab 100644 --- a/include/JSystem/J2DGraph/J2DPane.h +++ b/include/JSystem/J2DGraph/J2DPane.h @@ -93,7 +93,10 @@ public: void getGlbBounds() {} void getRotate() const {} void place(const JGeometry::TBox2&) {} - void rotate(f32) {} + void rotate(f32 angle) { + mRotation = angle; + calcMtx(); + } void rotate(f32 offsetX, f32 offsetY, J2DRotateAxis axis, f32 angle) { mBasePosition.x = offsetX; mBasePosition.y = offsetY; diff --git a/include/d/d_menu_option.h b/include/d/d_menu_option.h index 99b4f9987..854c2f7ad 100644 --- a/include/d/d_menu_option.h +++ b/include/d/d_menu_option.h @@ -10,6 +10,7 @@ struct fopMsgM_pane_class; class JKRArchive; class JUTFont; +struct mesg_entry; class dMenu_Option_c : public dDlst_base_c { public: @@ -72,7 +73,10 @@ private: /* 0xD2C */ JUTFont* mD2C; /* 0xD30 */ JUTFont* mD30; /* 0xD34 */ STControl* stick; - /* 0xD38 */ u8 mD38[0xD48 - 0xD38]; + /* 0xD38 */ char* mD38; + /* 0xD3C */ char* mD3C; + /* 0xD40 */ char* mD40; + /* 0xD44 */ char* mD44; /* 0xD48 */ char mD48[20]; /* 0xD5C */ char mD5C[2][20]; /* 0xD84 */ char mD84[2][20]; diff --git a/include/f_op/f_op_msg_mng.h b/include/f_op/f_op_msg_mng.h index 0892d1356..b154d81c6 100644 --- a/include/f_op/f_op_msg_mng.h +++ b/include/f_op/f_op_msg_mng.h @@ -17,7 +17,28 @@ class JUTFont; struct mesg_header; struct mesg_data; struct mesg_info; -struct mesg_entry; + +struct mesg_entry { + // mesg_entry() {} // fixes fopMsgM_selectMessageGet, but messes up getMesgEntry + + /* 0x00 */ u32 mDataOffs; + /* 0x04 */ u16 mMesgID; + /* 0x06 */ s16 mItemPrice; + /* 0x08 */ u16 mNextMessageID; + /* 0x0A */ u16 field_0x0a; + /* 0x0C */ u8 mTextboxType; + /* 0x0D */ u8 mDrawType; + /* 0x0E */ u8 mTextboxPosition; + /* 0x0F */ u8 mItemImage; + /* 0x10 */ u8 field_0x10; + /* 0x11 */ u8 mInitialSound; + /* 0x12 */ u8 mInitialCamera; + /* 0x13 */ u8 mInitialAnimation; + /* 0x14 */ u8 field_0x14; + /* 0x15 */ u8 field_0x15; + /* 0x16 */ u8 field_0x16; + /* 0x17 */ u8 field_0x17; +}; struct msg_process_profile_definition { /* 0x00 */ leaf_process_profile_definition base; diff --git a/src/d/d_menu_option.cpp b/src/d/d_menu_option.cpp index 02771010c..e66f4ef0d 100644 --- a/src/d/d_menu_option.cpp +++ b/src/d/d_menu_option.cpp @@ -7,9 +7,10 @@ #include "JSystem/J2DGraph/J2DTextBox.h" #include "JSystem/JUtility/JUTAssert.h" #include "d/d_lib.h" -#include "f_op/f_op_msg_mng.h" #include "m_Do/m_Do_audio.h" +#include "m_Do/m_Do_controller_pad.h" #include "global.h" +#include "f_op/f_op_msg_mng.h" dMo_HIO_c g_moHIO; @@ -367,27 +368,331 @@ void dMenu_Option_c::typeMove() { /* 801D3F98-801D41C4 .text yazAnime__14dMenu_Option_cFv */ void dMenu_Option_c::yazAnime() { /* Nonmatching */ - static const u32 moveX[6] = { 0, 2, 8, 18, 8, 2}; + static const int moveX[6] = { 0, 2, 8, 18, 8, 2}; + float fVar1; + + if (m858[0].mUserArea < 10) { + fVar1 = 6.0f; + } + else { + fVar1 = -6.0f; + } + + m858[0].pane->rotate(m858[0].mSize.x / 2.0f, m858[0].mSize.y / 2.0f, ROTATE_Z, 90.0f + fVar1); + m858[1].pane->rotate(m858[1].mSize.x / 2.0f, m858[1].mSize.y / 2.0f, ROTATE_Z, 90.0f + fVar1); + + m858[0].mUserArea++; + + if(m858[1].mUserArea > 0) { + m858[1].mUserArea--; + m858[1].pane->move((int)(m858[1].mPosTopLeft.x + 0.5f) + moveX[m858[1].mUserArea], m858[1].mPosTopLeft.y + 0.5f); + } + else if (m858[1].mUserArea < 0) { + m858[1].mUserArea++; + m858[0].pane->move((int)(m858[0].mPosTopLeft.x + 0.5f) - moveX[abs(m858[1].mUserArea)], m858[0].mPosTopLeft.y + 0.5f); + } + + if (m858[0].mUserArea >= 0x14) { + m858[0].mUserArea = 0; + } } /* 801D41C4-801D428C .text ccAnime__14dMenu_Option_cFv */ void dMenu_Option_c::ccAnime() { /* Nonmatching */ + int j = 0; + for (int i = 0; i < 3; i++) { + if (i == mB30[0].mUserArea / 7) { + fopMsgM_setInitAlpha(&mB30[i]); + fopMsgM_setInitAlpha(&mB30[j+1]); + } + else { + fopMsgM_setNowAlphaZero(&mB30[i]); + fopMsgM_setNowAlphaZero(&mB30[j+1]); + } + j += 2; + } + + mB30[0].mUserArea++; + + if (mB30[0].mUserArea >= 0x15) { + mB30[0].mUserArea = 0; + } } /* 801D428C-801D47A4 .text stickMove__14dMenu_Option_cFUc */ -void dMenu_Option_c::stickMove(u8) { - /* Nonmatching */ +void dMenu_Option_c::stickMove(u8 param_1) { + switch (param_1) { + case 4: { + if (mB30[1].mUserArea > 0) { + mB30[1].mUserArea--; + if (mB30[1].mUserArea == 1) { + mB30[1].mUserArea = 0; + } + cursorMove(); + noteSet(); + mDoAud_seStart(0x80e, NULL, 0, 0); + } + break; + } + case 8: { + if (mB30[1].mUserArea < 3) { + mB30[1].mUserArea++; + if (mB30[1].mUserArea == 1) { + mB30[1].mUserArea = 2; + } + cursorMove(); + noteSet(); + mDoAud_seStart(0x80e, NULL, 0, 0); + } + break; + } + case 2: { + switch (mB30[1].mUserArea) { + case 0: { + if (mE3C) { + mE3C = 0; + } + else { + mE3C = 1; + } + m858[1].mUserArea = 6; + mDoAud_seStart(0x84f, NULL, 0, 0); + break; + } + case 1: { + if (mE3D) { + mE3D = 0; + } + else { + mE3D = 1; + } + m858[1].mUserArea = 6; + mDoAud_seStart(0x84f, NULL, 0, 0); + ; + break; + } + case 3: { + if (mE3E < 2) { + mE3E++; + } + else { + mE3E = 0; + } + m858[1].mUserArea = 6; + mDoAud_seStart(0x84f, NULL, 0, 0); + mDoAud_setOutputMode(soundMode[mE3E]); + setSoundMode(soundMode[mE3E]); + break; + } + case 2: { + if ((JUTGamePad::sRumbleSupported & 0x80000000) != 0) { + if (mE3F) { + mE3F = 0; + } + else { + mE3F = 1; + g_mDoCPd_gamePad[0]->mRumble.startPatternedRumble(&mE38, JUTGamePad::CRumble::LOOP_ONCE, 0x3c); + } + m858[1].mUserArea = 6; + mDoAud_seStart(0x84f, NULL, 0, 0); + } + break; + } + } + typeMove(); + break; + } + case 1: { + switch (mB30[1].mUserArea) { + case 0: { + if (mE3C) { + mE3C = 0; + } + else { + mE3C = 1; + } + m858[1].mUserArea = -6; + mDoAud_seStart(0x84f, NULL, 0, 0); + break; + } + case 1: { + if (mE3D) { + mE3D = 0; + } + else { + mE3D = 1; + } + m858[1].mUserArea = -6; + mDoAud_seStart(0x84f, NULL, 0, 0); + break; + } + case 3: { + if (mE3E) { + mE3E--; + } + else { + mE3E = 2; + } + m858[1].mUserArea = -6; + mDoAud_seStart(0x84f, NULL, 0, 0); + mDoAud_setOutputMode(soundMode[mE3E]); + setSoundMode(soundMode[mE3E]); + break; + } + case 2: { + if ((JUTGamePad::sRumbleSupported & 0x80000000) != 0) { + if (mE3F) { + mE3F = 0; + } + else { + mE3F = 1; + g_mDoCPd_gamePad[0]->mRumble.startPatternedRumble(&mE38, JUTGamePad::CRumble::LOOP_ONCE, 0x3c); + } + m858[1].mUserArea = -6; + mDoAud_seStart(0x84f, NULL, 0, 0); + } + break; + } + } + typeMove(); + break; + } + } } /* 801D47A4-801D4C00 .text noteSet__14dMenu_Option_cFv */ void dMenu_Option_c::noteSet() { /* Nonmatching */ + fopMsgM_itemMsgGet_c msgGet; + //local_354.x = 0; + //local_354.y = 0; + //local_354.z = 0; + fopMsgM_msgDataProc_c msgDataProc; + + strcpy(mD38, ""); + strcpy(mD3C, ""); + strcpy(mD40, ""); + strcpy(mD44, ""); + + outFontInit(); + + float fVar1 = (m740).pane[1].mBounds.getHeight(); + float fVar2 = (m778).pane[1].mBounds.getHeight(); + + mesg_header* mesg_header = msgGet.getMesgHeader(0x262); + if (mesg_header == NULL) { + JUTAssertion::showAssert(JUTAssertion::getSDevice(), "d_menu_option.cpp", 0x313, "head_p"); + OSPanic("d_menu_option.cpp", 0x313, "Halt"); + } + + const char* mesg = msgGet.getMessage(mesg_header); + mesg_entry mesg_entry = msgGet.getMesgEntry(mesg_header); + + //local_334.mTextOffs = local_34c; + //local_334.mMesgID = local_348; + //local_334.mItemPrice = local_346; + //local_334.mNextMessageID = local_344; + //local_334.field4_0xa = local_342; + //local_334.mTextboxType = local_340; + //local_334.mDrawType = local_33f; + //local_334.mTextboxPosition = local_33e; + //local_334.mItemImage = local_33d; + //local_334.field9_0x10 = local_33c; + //local_334.mInitialSound = local_33b; + //local_334.mInitialCamera = local_33a; + //local_334.mInitialAnimation = local_339; + //local_334.field13_0x14 = local_338; + //local_334.field14_0x15 = local_337; + //local_334.mTotalRows = local_336; + //local_334.field16_0x17 = local_335; + + msgDataProc.dataInit(); + + //local_2d0 = *(char **)&field_0xd44; + //local_2d4 = *(char **)&field_0xd40; + //local_2d8 = *(char **)&field_0xd3c; + //auStack_31c._64_4_ = *(undefined4 *)&field_0xd38; + //auStack_31c._4_4_ = field21_0xd2c; + //auStack_31c._8_4_ = field22_0xd30; + //pJVar7 = (m740).pane; + //local_200 = (int)pJVar7[1].parent.mBounds.mTL.x; + //local_78 = (longlong)local_200; + //local_1f8 = (int)(m778).pane[1].parent.mBounds.mTL.x; + //local_70 = (longlong)local_1f8; + //local_1fc = (int)pJVar7[1].parent.mBounds.mTL.y; + //local_68 = (longlong)local_1fc; + //auStack_31c._12_4_ = &local_334; + //local_1d8 = (int)fVar1; + //local_60 = (longlong)local_1d8; + //local_1d0 = (int)fVar2; + //local_58 = (longlong)local_1d0; + //local_1f4 = 0x1d0; + //local_1f0 = 0x1d0; + //local_1bc = 2; + //local_1c0 = 0; + //local_83 = 1; + //local_80 = 0; + //auStack_31c._60_4_ = pcVar6; + //local_2bc = (char *)auStack_31c._64_4_; + //local_2b8 = local_2d8; + //local_2b4 = local_2d4; + //local_2b0 = local_2d0; + //fopMsgM_msgDataProc_c::stringLength((fopMsgM_msgDataProc_c *)auStack_31c); + //fopMsgM_msgDataProc_c::stringShift((fopMsgM_msgDataProc_c *)auStack_31c); + //fopMsgM_msgDataProc_c::iconIdxRefresh((fopMsgM_msgDataProc_c *)auStack_31c); + //iVar9 = (int)local_1ec._2_2_; + //local_1ec = 0; + //fopMsgM_msgDataProc_c::stringSet((fopMsgM_msgDataProc_c *)auStack_31c); + //pJVar7 = (m740).pane; + //uStack_4c = iVar9 ^ 0x80000000; + //local_50 = 0x43300000; + //fVar1 = ((((pJVar7->parent).mBounds.mBR.y - (pJVar7->parent).mBounds.mTL.y) - fVar1) - + // (float)iVar9 * pJVar7[1].parent.mBounds.mTL.y) * 0.5; + //*(float *)pJVar7[1].parent.mMagic = 0.0; + //pJVar7[1].parent.mName = (int)fVar1; + //pJVar7 = (m778).pane; + //*(float *)pJVar7[1].parent.mMagic = 0.0; + //pJVar7[1].parent.mName = (int)fVar1; + //J2DTextBox::setString((J2DTextBox *)(m740).pane,*(char **)&field_0xd38); + //J2DTextBox::setString((J2DTextBox *)(m778).pane,*(char **)&field_0xd3c); + //iVar9 = (int)((m740).pane[1].parent.mBounds.mTL.y * 0.5); + //local_48 = (longlong)iVar9; + //iVar12 = 0; + //iVar11 = 0; + //iVar10 = 0; + //do { + // uVar8 = (uint)abStack_9b[iVar12]; + // if (((uVar8 != 0xff) && (*(short *)((int)&m0B0[0].mUserArea + iVar10) == -1)) && + // (uVar8 != 0x16)) { + // local_48 = CONCAT44(0x43300000,*(int *)((int)local_1b4 + iVar11) ^ 0x80000000); + // *(float *)((int)&m0B0[0].mPosTopLeft.x + iVar10) = + // (float)*(int *)((int)local_1b4 + iVar11); + // iVar3 = iVar9 * *(int *)((int)local_178 + iVar11) * 2; + // uStack_4c = iVar3 ^ 0x80000000; + // local_50 = 0x43300000; + // *(float *)((int)&m0B0[0].mPosTopLeft.y + iVar10) = fVar1 + (float)iVar3; + // local_58 = CONCAT44(0x43300000,uVar8); + // *(float *)((int)&m0B0[0].mPosTopLeftOrig.y + iVar10) = (float)uVar8; + // f_op_msg_mng::fopMsgM_outFontSet + // (*(undefined4 *)((int)&m0B0[0].pane + iVar10), + // (int)&m0B0[0].mUserArea + iVar10,0xff); + // } + // iVar12 = iVar12 + 1; + // iVar11 = iVar11 + 4; + // iVar10 = iVar10 + 0x38; + //} while (iVar12 < 0xf); + //fopMsgM_msgDataProc_c::~fopMsgM_msgDataProc_c((fopMsgM_msgDataProc_c *)auStack_31c); } /* 801D4C00-801D4C88 .text outFontInit__14dMenu_Option_cFv */ void dMenu_Option_c::outFontInit() { - /* Nonmatching */ + for (int i = 0; i < 15; i++) { + m0B0[i].mUserArea = -1; + m0B0[i].pane->rotate(0.0f); + fopMsgM_setNowAlphaZero(&m0B0[i]); + + } } /* 801D4C88-801D4D74 .text outFontMove__14dMenu_Option_cFv */ diff --git a/src/f_op/f_op_msg_mng.cpp b/src/f_op/f_op_msg_mng.cpp index bb371bc0a..ee754a368 100644 --- a/src/f_op/f_op_msg_mng.cpp +++ b/src/f_op/f_op_msg_mng.cpp @@ -36,28 +36,6 @@ struct mesg_header : JUTDataFileHeader { // first block is mesg_info }; -struct mesg_entry { - // mesg_entry() {} // fixes fopMsgM_selectMessageGet, but messes up getMesgEntry - - /* 0x00 */ u32 mDataOffs; - /* 0x04 */ u16 mMesgID; - /* 0x06 */ s16 mItemPrice; - /* 0x08 */ u16 mNextMessageID; - /* 0x0A */ u16 field_0x0a; - /* 0x0C */ u8 mTextboxType; - /* 0x0D */ u8 mDrawType; - /* 0x0E */ u8 mTextboxPosition; - /* 0x0F */ u8 mItemImage; - /* 0x10 */ u8 field_0x10; - /* 0x11 */ u8 mInitialSound; - /* 0x12 */ u8 mInitialCamera; - /* 0x13 */ u8 mInitialAnimation; - /* 0x14 */ u8 field_0x14; - /* 0x15 */ u8 field_0x15; - /* 0x16 */ u8 field_0x16; - /* 0x17 */ u8 field_0x17; -}; - struct mesg_info : JUTDataBlockHeader { /* 0x08 */ u16 mNumEntry; /* 0x0A */ u16 mEntrySize; From 393e708996e6e64bdff20084401e582e83824a12 Mon Sep 17 00:00:00 2001 From: mattias-blum <142374929+mattias-blum@users.noreply.github.com> Date: Thu, 15 May 2025 18:09:57 -0400 Subject: [PATCH 06/19] more progress --- src/d/d_menu_option.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/d/d_menu_option.cpp b/src/d/d_menu_option.cpp index e66f4ef0d..cdbc548ee 100644 --- a/src/d/d_menu_option.cpp +++ b/src/d/d_menu_option.cpp @@ -691,13 +691,24 @@ void dMenu_Option_c::outFontInit() { m0B0[i].mUserArea = -1; m0B0[i].pane->rotate(0.0f); fopMsgM_setNowAlphaZero(&m0B0[i]); - } } /* 801D4C88-801D4D74 .text outFontMove__14dMenu_Option_cFv */ -void dMenu_Option_c::outFontMove() { - /* Nonmatching */ +void dMenu_Option_c::outFontMove() { + for (int i = 0; i < 15; i++) { + if (m0B0[i].mUserArea != -1) { + m3F8[i].mPosTopLeft.x = m0B0[i].mPosTopLeft.x + (m740.mPosTopLeft.x + (m820.mPosTopLeft.x + m7B0.mPosTopLeft.x)); + m3F8[i].mPosTopLeft.y = m0B0[i].mPosTopLeft.y + (m740.mPosTopLeft.y + (m820.mPosTopLeft.y + m7B0.mPosTopLeft.y)); + + f32 rotation_offset_x = m820.mPosCenter.x - m3F8[i].mPosTopLeft.x; + f32 rotation_offset_y = m820.mPosCenter.y - m3F8[i].mPosTopLeft.y; + m3F8[i].pane->rotate(rotation_offset_x, rotation_offset_y, ROTATE_Z, m820.pane->mRotation); + } + else { + fopMsgM_setNowAlphaZero(&m0B0[i]); + } + } } /* 801D4D74-801D4E34 .text outFontDraw__14dMenu_Option_cFv */ From b92b0db6a68c143c97df47261bf9c7beec7e387e Mon Sep 17 00:00:00 2001 From: mattias-blum <142374929+mattias-blum@users.noreply.github.com> Date: Thu, 15 May 2025 18:23:10 -0400 Subject: [PATCH 07/19] more progress --- include/f_op/f_op_msg_mng.h | 1 + src/d/d_menu_option.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/f_op/f_op_msg_mng.h b/include/f_op/f_op_msg_mng.h index b154d81c6..5b6db0058 100644 --- a/include/f_op/f_op_msg_mng.h +++ b/include/f_op/f_op_msg_mng.h @@ -378,5 +378,6 @@ void fopMsgM_setFontsizeCenter2(char* a, char* b, char* c, char* d, int, int siz void fopMsgM_outFontSet(J2DPicture*, J2DPicture*, s16*, u32, u8); void fopMsgM_outFontDraw(J2DPicture*, J2DPicture*, int, int, int, s16*, u8, u8); +void fopMsgM_outFontDraw2(J2DPicture*, J2DPicture*, int, int, int, int, s16*, u8, u8); #endif /* F_OP_MSG_MNG_H */ diff --git a/src/d/d_menu_option.cpp b/src/d/d_menu_option.cpp index cdbc548ee..f9278a839 100644 --- a/src/d/d_menu_option.cpp +++ b/src/d/d_menu_option.cpp @@ -713,7 +713,15 @@ void dMenu_Option_c::outFontMove() { /* 801D4D74-801D4E34 .text outFontDraw__14dMenu_Option_cFv */ void dMenu_Option_c::outFontDraw() { - /* Nonmatching */ + for (int i = 0; i < 15; i++) { + if (m0B0[i].mUserArea != -1) { + m0B0[i].mNowAlpha = m740.pane->getAlpha(); + fopMsgM_outFontDraw2((J2DPicture*)m0B0[i].pane, (J2DPicture*)m3F8[i].pane, m3F8[i].mPosTopLeft.x, m3F8[i].mPosTopLeft.y, 0x19, 0x19, &m0B0[i].mUserArea, m0B0[i].mNowAlpha, m0B0[i].mPosTopLeftOrig.y); + } + else { + fopMsgM_setAlpha(&m0B0[i]); + } + } } /* 801D4E34-801D505C .text stringlength__14dMenu_Option_cFP18fopMsgM_pane_classPc */ From a4947d09f991229e880ad039d431ec52903aff1b Mon Sep 17 00:00:00 2001 From: mattias-blum <142374929+mattias-blum@users.noreply.github.com> Date: Thu, 15 May 2025 21:27:27 -0400 Subject: [PATCH 08/19] more progress --- include/d/d_menu_option.h | 2 +- src/d/d_menu_option.cpp | 30 ++++++++++++++++++++---------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/include/d/d_menu_option.h b/include/d/d_menu_option.h index 854c2f7ad..92c22576f 100644 --- a/include/d/d_menu_option.h +++ b/include/d/d_menu_option.h @@ -37,7 +37,7 @@ public: void outFontInit(); void outFontMove(); void outFontDraw(); - void stringlength(fopMsgM_pane_class*, char*); + f32 stringlength(fopMsgM_pane_class*, char*); void changeScaleCenter(fopMsgM_pane_class*, char*); void setSoundMode(u32); void changeScaleRight(fopMsgM_pane_class*, char*); diff --git a/src/d/d_menu_option.cpp b/src/d/d_menu_option.cpp index f9278a839..1f60d6d70 100644 --- a/src/d/d_menu_option.cpp +++ b/src/d/d_menu_option.cpp @@ -587,7 +587,7 @@ void dMenu_Option_c::noteSet() { } const char* mesg = msgGet.getMessage(mesg_header); - mesg_entry mesg_entry = msgGet.getMesgEntry(mesg_header); + mesg_entry msg_entry = msgGet.getMesgEntry(mesg_header); //local_334.mTextOffs = local_34c; //local_334.mMesgID = local_348; @@ -638,12 +638,16 @@ void dMenu_Option_c::noteSet() { //local_2b8 = local_2d8; //local_2b4 = local_2d4; //local_2b0 = local_2d0; - //fopMsgM_msgDataProc_c::stringLength((fopMsgM_msgDataProc_c *)auStack_31c); - //fopMsgM_msgDataProc_c::stringShift((fopMsgM_msgDataProc_c *)auStack_31c); - //fopMsgM_msgDataProc_c::iconIdxRefresh((fopMsgM_msgDataProc_c *)auStack_31c); + + msgDataProc.stringLength(); + msgDataProc.stringShift(); + msgDataProc.iconIdxRefresh(); + //iVar9 = (int)local_1ec._2_2_; //local_1ec = 0; - //fopMsgM_msgDataProc_c::stringSet((fopMsgM_msgDataProc_c *)auStack_31c); + + msgDataProc.stringSet(); + //pJVar7 = (m740).pane; //uStack_4c = iVar9 ^ 0x80000000; //local_50 = 0x43300000; @@ -654,8 +658,10 @@ void dMenu_Option_c::noteSet() { //pJVar7 = (m778).pane; //*(float *)pJVar7[1].parent.mMagic = 0.0; //pJVar7[1].parent.mName = (int)fVar1; - //J2DTextBox::setString((J2DTextBox *)(m740).pane,*(char **)&field_0xd38); - //J2DTextBox::setString((J2DTextBox *)(m778).pane,*(char **)&field_0xd3c); + + ((J2DTextBox*)m740.pane)->setString(mD38); + ((J2DTextBox*)m778.pane)->setString(mD3C); + //iVar9 = (int)((m740).pane[1].parent.mBounds.mTL.y * 0.5); //local_48 = (longlong)iVar9; //iVar12 = 0; @@ -725,13 +731,17 @@ void dMenu_Option_c::outFontDraw() { } /* 801D4E34-801D505C .text stringlength__14dMenu_Option_cFP18fopMsgM_pane_classPc */ -void dMenu_Option_c::stringlength(fopMsgM_pane_class*, char*) { +f32 dMenu_Option_c::stringlength(fopMsgM_pane_class*, char*) { /* Nonmatching */ } /* 801D505C-801D50A0 .text changeScaleCenter__14dMenu_Option_cFP18fopMsgM_pane_classPc */ -void dMenu_Option_c::changeScaleCenter(fopMsgM_pane_class*, char*) { - /* Nonmatching */ +void dMenu_Option_c::changeScaleCenter(fopMsgM_pane_class* param_1, char* param_2) { + f32 str_length = stringlength(param_1, param_2); + param_1->mSize.x = str_length; + param_1->mSizeOrig.x = str_length; + fopMsgM_cposMove(param_1); + param_1->mPosTopLeftOrig.x = param_1->mPosTopLeft.x; } /* 801D50A0-801D50E8 .text setSoundMode__14dMenu_Option_cFUl */ From 448a96bbfcf0fa32c17a2ed88494ed443319e58f Mon Sep 17 00:00:00 2001 From: mattias-blum <142374929+mattias-blum@users.noreply.github.com> Date: Thu, 15 May 2025 21:34:46 -0400 Subject: [PATCH 09/19] more progress --- src/d/d_menu_option.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/d/d_menu_option.cpp b/src/d/d_menu_option.cpp index 1f60d6d70..0fd4f8c01 100644 --- a/src/d/d_menu_option.cpp +++ b/src/d/d_menu_option.cpp @@ -738,15 +738,28 @@ f32 dMenu_Option_c::stringlength(fopMsgM_pane_class*, char*) { /* 801D505C-801D50A0 .text changeScaleCenter__14dMenu_Option_cFP18fopMsgM_pane_classPc */ void dMenu_Option_c::changeScaleCenter(fopMsgM_pane_class* param_1, char* param_2) { f32 str_length = stringlength(param_1, param_2); + param_1->mSize.x = str_length; param_1->mSizeOrig.x = str_length; + fopMsgM_cposMove(param_1); + param_1->mPosTopLeftOrig.x = param_1->mPosTopLeft.x; } /* 801D50A0-801D50E8 .text setSoundMode__14dMenu_Option_cFUl */ -void dMenu_Option_c::setSoundMode(u32) { - /* Nonmatching */ +void dMenu_Option_c::setSoundMode(u32 i_soundMode) { + switch(i_soundMode) { + case 0: + OSSetSoundMode(0); + break; + case 1: + case 2: + OSSetSoundMode(1); + break; + default: + break; + } } /* 801D50E8-801D5148 .text changeScaleRight__14dMenu_Option_cFP18fopMsgM_pane_classPc */ From 5eea4fda29fb59312a31829a8a5262ac2127bc7a Mon Sep 17 00:00:00 2001 From: mattias-blum <142374929+mattias-blum@users.noreply.github.com> Date: Thu, 15 May 2025 21:45:56 -0400 Subject: [PATCH 10/19] more progress --- src/d/d_menu_option.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/d/d_menu_option.cpp b/src/d/d_menu_option.cpp index 0fd4f8c01..b6e8ca90a 100644 --- a/src/d/d_menu_option.cpp +++ b/src/d/d_menu_option.cpp @@ -763,8 +763,20 @@ void dMenu_Option_c::setSoundMode(u32 i_soundMode) { } /* 801D50E8-801D5148 .text changeScaleRight__14dMenu_Option_cFP18fopMsgM_pane_classPc */ -void dMenu_Option_c::changeScaleRight(fopMsgM_pane_class*, char*) { - /* Nonmatching */ +void dMenu_Option_c::changeScaleRight(fopMsgM_pane_class* param_1, char* param_2) { + /* Nonmatching - regalloc */ + float str_length = stringlength(param_1, param_2); + float str_pos = (param_1->mPosTopLeft.x + param_1->mSize.x); + + param_1->mSize.x = str_length; + param_1->mSizeOrig.x = str_length; + + str_pos -= param_1->mSize.x / 2.0f; + + param_1->mPosCenter.x = str_pos; + param_1->mPosCenterOrig.x = str_pos; + + fopMsgM_cposMove(param_1); } /* 801D5148-801D5224 .text initialize__14dMenu_Option_cFv */ From 49023df9799d4e8c2166ef26e0bceef60f35a13c Mon Sep 17 00:00:00 2001 From: mattias-blum <142374929+mattias-blum@users.noreply.github.com> Date: Sat, 17 May 2025 17:08:14 -0400 Subject: [PATCH 11/19] more progress --- include/d/d_menu_option.h | 4 +-- include/d/d_meter.h | 1 + src/d/d_menu_option.cpp | 53 ++++++++++++++++++++++++++++++++++++--- 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/include/d/d_menu_option.h b/include/d/d_menu_option.h index 92c22576f..02f7812ba 100644 --- a/include/d/d_menu_option.h +++ b/include/d/d_menu_option.h @@ -47,7 +47,7 @@ public: void _move(); void _draw(); void _open(); - void _close(); + bool _close(); private: /* 0x004 */ J2DScreen* scrn; @@ -91,7 +91,7 @@ private: /* 0xE3E */ u8 mE3E; /* 0xE3F */ u8 mE3F; /* 0xE40 */ u8 mE40; - /* 0xE41 */ u8 mE41[0xE42 - 0xE41]; + /* 0xE41 */ u8 mE41; }; // Size: 0xE42 class dMo_HIO_c : public JORReflexible { diff --git a/include/d/d_meter.h b/include/d/d_meter.h index f67692867..df5f53d69 100644 --- a/include/d/d_meter.h +++ b/include/d/d_meter.h @@ -596,5 +596,6 @@ extern dMeter_msg_HIO_c g_msgHIO; extern dMeter_message_HIO_c g_messageHIO; void dMeter_mtrShow(); +void dMenu_setPushMenuButton(u8); #endif /* D_METER_H */ diff --git a/src/d/d_menu_option.cpp b/src/d/d_menu_option.cpp index b6e8ca90a..286ba8a87 100644 --- a/src/d/d_menu_option.cpp +++ b/src/d/d_menu_option.cpp @@ -10,7 +10,9 @@ #include "m_Do/m_Do_audio.h" #include "m_Do/m_Do_controller_pad.h" #include "global.h" +#include "d/d_meter.h" #include "f_op/f_op_msg_mng.h" +#include "d/d_com_inf_game.h" dMo_HIO_c g_moHIO; @@ -781,7 +783,37 @@ void dMenu_Option_c::changeScaleRight(fopMsgM_pane_class* param_1, char* param_2 /* 801D5148-801D5224 .text initialize__14dMenu_Option_cFv */ void dMenu_Option_c::initialize() { - /* Nonmatching */ + mainInit(); + + noteInit(); + + titleInit(); + + outFontInit(); + + mE40 = 1; + + mCF0.mUserArea = 0; + m7B0.mUserArea = 0; + + mC80[0].mUserArea = 0; + mC80[1].mUserArea = 0; + + mE3C = dComIfGs_getOptAttentionType(); + mE3D = dComIfGs_getOptRuby(); + mE3E = dComIfGs_getOptSound(); + + if ((JUTGamePad::sRumbleSupported & 0x80000000)) { + mE3F = dComIfGp_getNowVibration(); + } + else { + mE3F = 0; + } + + mE41 = 0; + + mDoAud_setOutputMode(soundMode[mE3E]); + setSoundMode(soundMode[mE3E]); } /* 801D5224-801D53F0 .text _create__14dMenu_Option_cFv */ @@ -827,6 +859,21 @@ void dMenu_Option_c::_open() { } /* 801D5CBC-801D5D38 .text _close__14dMenu_Option_cFv */ -void dMenu_Option_c::_close() { - /* Nonmatching */ +bool dMenu_Option_c::_close() { + bool ret = false; + + mC80[0].mUserArea++; + s16 user_area = mC80[0].mUserArea; + + fopMsgM_valueIncrease(10, user_area, 0); + + dMenu_setPushMenuButton(2); + + if (user_area >= 10) { + initialize(); + mE40 = 0; + ret = true; + } + + return ret; } From 8b96b0ed35bb8783b38980e37bcb687755b0db1e Mon Sep 17 00:00:00 2001 From: mattias-blum <142374929+mattias-blum@users.noreply.github.com> Date: Sat, 17 May 2025 17:16:15 -0400 Subject: [PATCH 12/19] more progress --- src/d/d_menu_option.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/d/d_menu_option.cpp b/src/d/d_menu_option.cpp index 286ba8a87..8c56383ea 100644 --- a/src/d/d_menu_option.cpp +++ b/src/d/d_menu_option.cpp @@ -840,7 +840,10 @@ void dMenu_Option_c::_create() { /* 801D53F0-801D546C .text _delete__14dMenu_Option_cFv */ void dMenu_Option_c::_delete() { - /* Nonmatching */ + mpArchive->removeResourceAll(); + delete scrn; + delete stick; + mDoHIO_deleteChild(g_moHIO.mNo); } /* 801D546C-801D576C .text _move__14dMenu_Option_cFv */ From a4e5f77721c21c30b9fb09abace4ea29a92e94ad Mon Sep 17 00:00:00 2001 From: mattias-blum <142374929+mattias-blum@users.noreply.github.com> Date: Sat, 17 May 2025 17:22:15 -0400 Subject: [PATCH 13/19] more progress --- include/d/d_menu_option.h | 2 +- src/d/d_menu_option.cpp | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/include/d/d_menu_option.h b/include/d/d_menu_option.h index 02f7812ba..a1cc796e5 100644 --- a/include/d/d_menu_option.h +++ b/include/d/d_menu_option.h @@ -46,7 +46,7 @@ public: void _delete(); void _move(); void _draw(); - void _open(); + bool _open(); bool _close(); private: diff --git a/src/d/d_menu_option.cpp b/src/d/d_menu_option.cpp index 8c56383ea..34046fae5 100644 --- a/src/d/d_menu_option.cpp +++ b/src/d/d_menu_option.cpp @@ -818,7 +818,7 @@ void dMenu_Option_c::initialize() { /* 801D5224-801D53F0 .text _create__14dMenu_Option_cFv */ void dMenu_Option_c::_create() { - /* Nonmatching */ + /* Nonmatching - Code 100% */ scrn = new J2DScreen(); JUT_ASSERT(1074, scrn != NULL); scrn->set("option.blo", mpArchive); @@ -857,8 +857,37 @@ void dMenu_Option_c::_draw() { } /* 801D5C04-801D5CBC .text _open__14dMenu_Option_cFv */ -void dMenu_Option_c::_open() { - /* Nonmatching */ +bool dMenu_Option_c::_open() { + bool ret = false; + + dMenu_setPushMenuButton(0); + + if (mC80[0].mUserArea == 0) { + noteSet(); + } + + mC80[0].mUserArea++; + + if (mC80[0].mUserArea <= 7) { + mainMove(); + } + else if (mC80[0].mUserArea <= 0xe) { + noteMove(); + + titleMove(); + + _move(); + + if (mC80[0].mUserArea == 0xe) { + mE40 = 2; + + mC80[0].mUserArea = 0; + + ret = true; + } + } + + return ret; } /* 801D5CBC-801D5D38 .text _close__14dMenu_Option_cFv */ From 5f7d4c3745f5cf073ad447f4f397df76bd5b290f Mon Sep 17 00:00:00 2001 From: mattias-blum <142374929+mattias-blum@users.noreply.github.com> Date: Sat, 17 May 2025 20:30:16 -0400 Subject: [PATCH 14/19] more progress --- include/f_op/f_op_msg_mng.h | 1 + src/d/d_menu_option.cpp | 225 ++++++++++++++++++++---------------- 2 files changed, 129 insertions(+), 97 deletions(-) diff --git a/include/f_op/f_op_msg_mng.h b/include/f_op/f_op_msg_mng.h index 5b6db0058..51b05a298 100644 --- a/include/f_op/f_op_msg_mng.h +++ b/include/f_op/f_op_msg_mng.h @@ -377,6 +377,7 @@ void fopMsgM_setFontsizeCenter(char* param_1, char* param_2, char* param_3, char void fopMsgM_setFontsizeCenter2(char* a, char* b, char* c, char* d, int, int size, int, int); void fopMsgM_outFontSet(J2DPicture*, J2DPicture*, s16*, u32, u8); +void fopMsgM_outFontSet(J2DPicture*, s16*, u32, u8); void fopMsgM_outFontDraw(J2DPicture*, J2DPicture*, int, int, int, s16*, u8, u8); void fopMsgM_outFontDraw2(J2DPicture*, J2DPicture*, int, int, int, int, s16*, u8, u8); diff --git a/src/d/d_menu_option.cpp b/src/d/d_menu_option.cpp index 34046fae5..2bf2d7de9 100644 --- a/src/d/d_menu_option.cpp +++ b/src/d/d_menu_option.cpp @@ -387,11 +387,11 @@ void dMenu_Option_c::yazAnime() { if(m858[1].mUserArea > 0) { m858[1].mUserArea--; - m858[1].pane->move((int)(m858[1].mPosTopLeft.x + 0.5f) + moveX[m858[1].mUserArea], m858[1].mPosTopLeft.y + 0.5f); + m858[1].pane->move((int)(m858[1].mPosTopLeft.x + 0.5f) + moveX[m858[1].mUserArea], (int)(m858[1].mPosTopLeft.y + 0.5f)); } else if (m858[1].mUserArea < 0) { m858[1].mUserArea++; - m858[0].pane->move((int)(m858[0].mPosTopLeft.x + 0.5f) - moveX[abs(m858[1].mUserArea)], m858[0].mPosTopLeft.y + 0.5f); + m858[0].pane->move((int)(m858[0].mPosTopLeft.x + 0.5f) - moveX[abs(m858[1].mUserArea)], (int)(m858[0].mPosTopLeft.y + 0.5f)); } if (m858[0].mUserArea >= 0x14) { @@ -401,7 +401,7 @@ void dMenu_Option_c::yazAnime() { /* 801D41C4-801D428C .text ccAnime__14dMenu_Option_cFv */ void dMenu_Option_c::ccAnime() { - /* Nonmatching */ + /* Nonmatching - Tried a double `for` loop with `mB30` as shape `[2][3]`, didn't work */ int j = 0; for (int i = 0; i < 3; i++) { if (i == mB30[0].mUserArea / 7) { @@ -565,11 +565,8 @@ void dMenu_Option_c::stickMove(u8 param_1) { /* 801D47A4-801D4C00 .text noteSet__14dMenu_Option_cFv */ void dMenu_Option_c::noteSet() { - /* Nonmatching */ + /* Nonmatching - heavily inlined, Ghidra output isn't helpful */ fopMsgM_itemMsgGet_c msgGet; - //local_354.x = 0; - //local_354.y = 0; - //local_354.z = 0; fopMsgM_msgDataProc_c msgDataProc; strcpy(mD38, ""); @@ -591,106 +588,28 @@ void dMenu_Option_c::noteSet() { const char* mesg = msgGet.getMessage(mesg_header); mesg_entry msg_entry = msgGet.getMesgEntry(mesg_header); - //local_334.mTextOffs = local_34c; - //local_334.mMesgID = local_348; - //local_334.mItemPrice = local_346; - //local_334.mNextMessageID = local_344; - //local_334.field4_0xa = local_342; - //local_334.mTextboxType = local_340; - //local_334.mDrawType = local_33f; - //local_334.mTextboxPosition = local_33e; - //local_334.mItemImage = local_33d; - //local_334.field9_0x10 = local_33c; - //local_334.mInitialSound = local_33b; - //local_334.mInitialCamera = local_33a; - //local_334.mInitialAnimation = local_339; - //local_334.field13_0x14 = local_338; - //local_334.field14_0x15 = local_337; - //local_334.mTotalRows = local_336; - //local_334.field16_0x17 = local_335; - msgDataProc.dataInit(); - //local_2d0 = *(char **)&field_0xd44; - //local_2d4 = *(char **)&field_0xd40; - //local_2d8 = *(char **)&field_0xd3c; - //auStack_31c._64_4_ = *(undefined4 *)&field_0xd38; - //auStack_31c._4_4_ = field21_0xd2c; - //auStack_31c._8_4_ = field22_0xd30; - //pJVar7 = (m740).pane; - //local_200 = (int)pJVar7[1].parent.mBounds.mTL.x; - //local_78 = (longlong)local_200; - //local_1f8 = (int)(m778).pane[1].parent.mBounds.mTL.x; - //local_70 = (longlong)local_1f8; - //local_1fc = (int)pJVar7[1].parent.mBounds.mTL.y; - //local_68 = (longlong)local_1fc; - //auStack_31c._12_4_ = &local_334; - //local_1d8 = (int)fVar1; - //local_60 = (longlong)local_1d8; - //local_1d0 = (int)fVar2; - //local_58 = (longlong)local_1d0; - //local_1f4 = 0x1d0; - //local_1f0 = 0x1d0; - //local_1bc = 2; - //local_1c0 = 0; - //local_83 = 1; - //local_80 = 0; - //auStack_31c._60_4_ = pcVar6; - //local_2bc = (char *)auStack_31c._64_4_; - //local_2b8 = local_2d8; - //local_2b4 = local_2d4; - //local_2b0 = local_2d0; - msgDataProc.stringLength(); msgDataProc.stringShift(); msgDataProc.iconIdxRefresh(); - - //iVar9 = (int)local_1ec._2_2_; - //local_1ec = 0; msgDataProc.stringSet(); - //pJVar7 = (m740).pane; - //uStack_4c = iVar9 ^ 0x80000000; - //local_50 = 0x43300000; - //fVar1 = ((((pJVar7->parent).mBounds.mBR.y - (pJVar7->parent).mBounds.mTL.y) - fVar1) - - // (float)iVar9 * pJVar7[1].parent.mBounds.mTL.y) * 0.5; - //*(float *)pJVar7[1].parent.mMagic = 0.0; - //pJVar7[1].parent.mName = (int)fVar1; - //pJVar7 = (m778).pane; - //*(float *)pJVar7[1].parent.mMagic = 0.0; - //pJVar7[1].parent.mName = (int)fVar1; - ((J2DTextBox*)m740.pane)->setString(mD38); ((J2DTextBox*)m778.pane)->setString(mD3C); - //iVar9 = (int)((m740).pane[1].parent.mBounds.mTL.y * 0.5); - //local_48 = (longlong)iVar9; - //iVar12 = 0; - //iVar11 = 0; - //iVar10 = 0; - //do { - // uVar8 = (uint)abStack_9b[iVar12]; - // if (((uVar8 != 0xff) && (*(short *)((int)&m0B0[0].mUserArea + iVar10) == -1)) && - // (uVar8 != 0x16)) { - // local_48 = CONCAT44(0x43300000,*(int *)((int)local_1b4 + iVar11) ^ 0x80000000); - // *(float *)((int)&m0B0[0].mPosTopLeft.x + iVar10) = - // (float)*(int *)((int)local_1b4 + iVar11); - // iVar3 = iVar9 * *(int *)((int)local_178 + iVar11) * 2; - // uStack_4c = iVar3 ^ 0x80000000; - // local_50 = 0x43300000; - // *(float *)((int)&m0B0[0].mPosTopLeft.y + iVar10) = fVar1 + (float)iVar3; - // local_58 = CONCAT44(0x43300000,uVar8); - // *(float *)((int)&m0B0[0].mPosTopLeftOrig.y + iVar10) = (float)uVar8; - // f_op_msg_mng::fopMsgM_outFontSet - // (*(undefined4 *)((int)&m0B0[0].pane + iVar10), - // (int)&m0B0[0].mUserArea + iVar10,0xff); - // } - // iVar12 = iVar12 + 1; - // iVar11 = iVar11 + 4; - // iVar10 = iVar10 + 0x38; - //} while (iVar12 < 0xf); - //fopMsgM_msgDataProc_c::~fopMsgM_msgDataProc_c((fopMsgM_msgDataProc_c *)auStack_31c); + for (int i = 0; i < 0xf; i++) { + if(m0B0[i].mUserArea == -1) { + m0B0[i].mPosTopLeft.x = m740.mPosTopLeft.x; + m0B0[i].mPosTopLeftOrig.x = m740.mPosTopLeftOrig.x; + + m0B0[i].mPosTopLeft.y = m740.mPosTopLeft.y; + m0B0[i].mPosTopLeftOrig.y = m740.mPosTopLeftOrig.y; + + fopMsgM_outFontSet((J2DPicture*)&m0B0[i], &m0B0[i].mUserArea, 0, 0); + } + } } /* 801D4C00-801D4C88 .text outFontInit__14dMenu_Option_cFv */ @@ -734,7 +653,7 @@ void dMenu_Option_c::outFontDraw() { /* 801D4E34-801D505C .text stringlength__14dMenu_Option_cFP18fopMsgM_pane_classPc */ f32 dMenu_Option_c::stringlength(fopMsgM_pane_class*, char*) { - /* Nonmatching */ + /* Nonmatching - also heavily inlined */ } /* 801D505C-801D50A0 .text changeScaleCenter__14dMenu_Option_cFP18fopMsgM_pane_classPc */ @@ -849,6 +768,117 @@ void dMenu_Option_c::_delete() { /* 801D546C-801D576C .text _move__14dMenu_Option_cFv */ void dMenu_Option_c::_move() { /* Nonmatching */ + u8 check_trigger = stick->checkTrigger(); + + if (mE3F) { + if ((JUTGamePad::sRumbleSupported & 0x80000000U) == 0) { + mE3F = 0; + + for(int i = 0; i < 2; i++) { + if (i == mE3F) { + fopMsgM_setInitAlpha(&mAC0[i]); + } + else { + fopMsgM_setNowAlphaZero(&mAC0[i]); + } + } + + cursorScale(); + } + } + + if (CPad_CHECK_TRIG_A(0) && + !CPad_CHECK_TRIG_START(0) && + !CPad_CHECK_TRIG_B(0) && + !CPad_CHECK_TRIG_UP(0) && + !CPad_CHECK_TRIG_DOWN(0) && + !CPad_CHECK_TRIG_LEFT(0) && + !CPad_CHECK_TRIG_RIGHT(0) + ) { + mE40 = 3; + + mC80[0].mUserArea = 0; + + mE41 = 1; + + dComIfGs_setOptAttentionType(mE3C); + dComIfGs_setOptRuby(mE3D); + + if (JUTGamePad::sRumbleSupported & 0x80000000) { + dComIfGs_setOptVibration(mE3F); + } + + dComIfGp_setNowVibration(mE3F); + dComIfGs_setOptSound(mE3E); + + mDoAud_seStart(0x84D, NULL, 0); + } + else if (CPad_CHECK_TRIG_B(0) && + !CPad_CHECK_TRIG_START(0) && + !CPad_CHECK_TRIG_A(0) && + !CPad_CHECK_TRIG_UP(0) && + !CPad_CHECK_TRIG_DOWN(0) && + !CPad_CHECK_TRIG_LEFT(0) && + !CPad_CHECK_TRIG_RIGHT(0) + ) { + mE40 = 3; + mE41 = 1; + mC80[0].mUserArea = 0; + mDoAud_seStart(0x84D, NULL, 0); + } + else { + if (!check_trigger) { + m7B0.mUserArea = 0; + mC80[1].mUserArea = 0; + } + else { + if (mC80[1].mUserArea == 0) { + stickMove(check_trigger); + } + + int sVar2 = 4; + if (m7B0.mUserArea < 2) { + sVar2 = 10; + } + + mC80[1].mUserArea++; + + if (mC80[1].mUserArea > sVar2) { + sVar2 = m7B0.mUserArea; + + if (sVar2 < 2) { + m7B0.mUserArea = sVar2 + 1; + } + + mC80[1].mUserArea = 0; + } + } + } + + + yazAnime(); + + if (mB30[1].mUserArea != 2 || JUTGamePad::sRumbleSupported & 0x80000000) + { + m858[0].pane->show(); + m858[1].pane->show(); + } + else { + m858[0].pane->hide(); + m858[1].pane->hide(); + } + + ccAnime(); + + outFontMove(); + + if (mE3D) { + m778.pane->hide(); + } + else { + m778.pane->show(); + } + return; } /* 801D576C-801D5C04 .text _draw__14dMenu_Option_cFv */ @@ -892,6 +922,7 @@ bool dMenu_Option_c::_open() { /* 801D5CBC-801D5D38 .text _close__14dMenu_Option_cFv */ bool dMenu_Option_c::_close() { + /* Nonmatching */ bool ret = false; mC80[0].mUserArea++; From b27c3f63af236cd025482f568c917a6bcf30b543 Mon Sep 17 00:00:00 2001 From: mattias-blum <142374929+mattias-blum@users.noreply.github.com> Date: Sat, 17 May 2025 21:04:58 -0400 Subject: [PATCH 15/19] more progress --- src/d/d_menu_option.cpp | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/d/d_menu_option.cpp b/src/d/d_menu_option.cpp index 2bf2d7de9..46869b470 100644 --- a/src/d/d_menu_option.cpp +++ b/src/d/d_menu_option.cpp @@ -124,13 +124,13 @@ void dMenu_Option_c::screenSet() { /* 801D3388-801D3518 .text mainInit__14dMenu_Option_cFv */ void dMenu_Option_c::mainInit() { - /* Nonmatching - regalloc */ fopMsgM_setNowAlphaZero(&mCF0); for (int i = 0; i < 2; i++) { fopMsgM_paneTrans(&m858[i], 0.0f, 0.0f); - m858[i].pane->rotate(m858[i].mSize.x / 2.0f, m858[i].mSize.y / 2.0f, ROTATE_Z, 90.0f); + // Potential bug: Why access 0th index multiple times? + m858[0].pane->rotate(m858[0].mSize.x / 2.0f, m858[0].mSize.y / 2.0f, ROTATE_Z, 90.0f); fopMsgM_setNowAlphaZero(&mC80[i]); fopMsgM_setNowAlphaZero(&m858[i]); @@ -241,7 +241,6 @@ void dMenu_Option_c::noteMove() { /* 801D39F4-801D3C6C .text titleMove__14dMenu_Option_cFv */ void dMenu_Option_c::titleMove() { - /* Nonmatching - regalloc */ float alpha = fopMsgM_valueIncrease(7, mC80[0].mUserArea + -7,0); float rotate_angle = m008.mUserArea + 20; @@ -253,7 +252,7 @@ void dMenu_Option_c::titleMove() { rotate_angle += 360.0f; } - rotate_angle *= 1.0f - alpha; + f32 f30 = rotate_angle * (1.0f - alpha); if (mC80[0].mUserArea == 8) { mDoAud_seStart(0x84e, NULL, 0, 0); @@ -265,9 +264,9 @@ void dMenu_Option_c::titleMove() { fopMsgM_paneTrans(&m040, 0.0f, y * -50.0f); fopMsgM_paneTrans(&m078, 0.0f, y * -50.0f); - m008.pane->rotate(m008.mSize.x / 2.0f, m008.mSize.y / 2.0f, ROTATE_Z, rotate_angle + m008.mUserArea); - m040.pane->rotate(m040.mSize.x / 2.0f, m040.mSize.y / 2.0f, ROTATE_Z, rotate_angle + m040.mUserArea); - m078.pane->rotate(m078.mSize.x / 2.0f, m078.mSize.y / 2.0f, ROTATE_Z, rotate_angle + m078.mUserArea); + m008.pane->rotate(m008.mSize.x / 2.0f, m008.mSize.y / 2.0f, ROTATE_Z, f30 + m008.mUserArea); + m040.pane->rotate(m040.mSize.x / 2.0f, m040.mSize.y / 2.0f, ROTATE_Z, f30 + m040.mUserArea); + m078.pane->rotate(m078.mSize.x / 2.0f, m078.mSize.y / 2.0f, ROTATE_Z, f30 + m078.mUserArea); fopMsgM_setNowAlpha(&m008, alpha); fopMsgM_setNowAlpha(&m040, alpha); @@ -285,7 +284,7 @@ void dMenu_Option_c::cursorMove() { mB30[i].mSize.x = m8C8[sVar2].mSizeOrig.x; - fopMsgM_cposMove((fopMsgM_pane_class *)(&mB30[i].pane)); + fopMsgM_cposMove(&mB30[i]); mB30[i].pane->rotate(mB30[i].mSize.x / 2.0f, mB30[i].mSize.y / 2.0f, ROTATE_Z, 0.5f); } @@ -401,18 +400,16 @@ void dMenu_Option_c::yazAnime() { /* 801D41C4-801D428C .text ccAnime__14dMenu_Option_cFv */ void dMenu_Option_c::ccAnime() { - /* Nonmatching - Tried a double `for` loop with `mB30` as shape `[2][3]`, didn't work */ - int j = 0; + int r29 = mB30[0].mUserArea / 7; for (int i = 0; i < 3; i++) { - if (i == mB30[0].mUserArea / 7) { - fopMsgM_setInitAlpha(&mB30[i]); - fopMsgM_setInitAlpha(&mB30[j+1]); + if (i == r29) { + fopMsgM_setInitAlpha(&mB30[(i*2)+0]); + fopMsgM_setInitAlpha(&mB30[(i*2)+1]); } else { - fopMsgM_setNowAlphaZero(&mB30[i]); - fopMsgM_setNowAlphaZero(&mB30[j+1]); + fopMsgM_setNowAlphaZero(&mB30[(i*2)+0]); + fopMsgM_setNowAlphaZero(&mB30[(i*2)+1]); } - j += 2; } mB30[0].mUserArea++; From 6c3f33263dc8669c01379e1540f1e28a8416768f Mon Sep 17 00:00:00 2001 From: mattias-blum <142374929+mattias-blum@users.noreply.github.com> Date: Sat, 17 May 2025 22:40:49 -0400 Subject: [PATCH 16/19] more progress --- include/JSystem/J2DGraph/J2DPane.h | 2 +- include/d/d_lib.h | 2 +- include/d/d_menu_option.h | 3 +- src/d/d_lib.cpp | 2 +- src/d/d_menu_option.cpp | 161 +++++++++++++++++++++-------- 5 files changed, 120 insertions(+), 50 deletions(-) diff --git a/include/JSystem/J2DGraph/J2DPane.h b/include/JSystem/J2DGraph/J2DPane.h index 291a0bbab..cff8fa9f2 100644 --- a/include/JSystem/J2DGraph/J2DPane.h +++ b/include/JSystem/J2DGraph/J2DPane.h @@ -91,7 +91,7 @@ public: void getBounds() {} void getGlbBounds() {} - void getRotate() const {} + f32 getRotate() const { return mRotation; } void place(const JGeometry::TBox2&) {} void rotate(f32 angle) { mRotation = angle; diff --git a/include/d/d_lib.h b/include/d/d_lib.h index ea6359c45..89881b724 100644 --- a/include/d/d_lib.h +++ b/include/d/d_lib.h @@ -25,7 +25,7 @@ public: void Yinit(); virtual f32 getValueStick(); virtual s16 getAngleStick(); - s32 checkTrigger(); + u8 checkTrigger(); bool checkLeftTrigger(); bool checkRightTrigger(); bool checkUpTrigger(); diff --git a/include/d/d_menu_option.h b/include/d/d_menu_option.h index a1cc796e5..14131258f 100644 --- a/include/d/d_menu_option.h +++ b/include/d/d_menu_option.h @@ -56,8 +56,7 @@ private: /* 0x078 */ fopMsgM_pane_class m078; /* 0x0B0 */ fopMsgM_pane_class m0B0[15]; /* 0x3F8 */ fopMsgM_pane_class m3F8[15]; - /* 0x740 */ fopMsgM_pane_class m740; - /* 0x778 */ fopMsgM_pane_class m778; + /* 0x740 */ fopMsgM_pane_class m740[2]; /* 0x7B0 */ fopMsgM_pane_class m7B0; /* 0x7E8 */ fopMsgM_pane_class m7E8; /* 0x820 */ fopMsgM_pane_class m820; diff --git a/src/d/d_lib.cpp b/src/d/d_lib.cpp index c34e5c5b6..c870fbe76 100644 --- a/src/d/d_lib.cpp +++ b/src/d/d_lib.cpp @@ -353,7 +353,7 @@ s16 CSTControl::getAngleStick() { } /* 80058340-800585D0 .text checkTrigger__9STControlFv */ -s32 STControl::checkTrigger() { +u8 STControl::checkTrigger() { field_0x0d = field_0x0c; f32 valueStick = getValueStick(); s16 angleStick = getAngleStick(); diff --git a/src/d/d_menu_option.cpp b/src/d/d_menu_option.cpp index 46869b470..40d820350 100644 --- a/src/d/d_menu_option.cpp +++ b/src/d/d_menu_option.cpp @@ -44,8 +44,8 @@ void dMenu_Option_c::screenSet() { fopMsgM_blendInit(&m0B0[i], "font_00.bti"); } - fopMsgM_setPaneData(&m778, scrn->search('str0')); - fopMsgM_setPaneData(&m740, scrn->search('st00')); + fopMsgM_setPaneData(&m740[1], scrn->search('str0')); + fopMsgM_setPaneData(&m740[0], scrn->search('st00')); fopMsgM_setPaneData(&m7B0, scrn->search('nt00')); fopMsgM_setPaneData(&m7E8, scrn->search('nk00')); fopMsgM_setPaneData(&m820, scrn->search('no11')); @@ -86,8 +86,8 @@ void dMenu_Option_c::screenSet() { ((J2DTextBox*)m008.pane)->setFont(mD2C); ((J2DTextBox*)m008.pane)->setString(mD48); - ((J2DTextBox*)m740.pane)->setFont(mD2C); - ((J2DTextBox*)m778.pane)->setFont(mD30); + ((J2DTextBox*)m740[0].pane)->setFont(mD2C); + ((J2DTextBox*)m740[1].pane)->setFont(mD30); for (int i = 0; i < 2; i++) { ((J2DTextBox*)m9A8[i].pane)->setFont(mD2C); @@ -168,8 +168,8 @@ void dMenu_Option_c::noteInit() { m820.pane->rotate(m820.mSize.x / 2.0f, m820.mSize.y / 2.0f, ROTATE_Z, m820.mUserArea + -12.0f); - fopMsgM_setNowAlphaZero(&m740); - fopMsgM_setNowAlphaZero(&m778); + fopMsgM_setNowAlphaZero(&m740[0]); + fopMsgM_setNowAlphaZero(&m740[1]); fopMsgM_setNowAlphaZero(&m7B0); fopMsgM_setNowAlphaZero(&m7E8); fopMsgM_setNowAlphaZero(&m820); @@ -233,8 +233,8 @@ void dMenu_Option_c::noteMove() { m820.pane->rotate(m820.mSize.x / 2.0f, m820.mSize.y / 2.0f, ROTATE_Z, (1.0f - alpha) * -12.0f + m820.mUserArea); - fopMsgM_setNowAlpha(&m740, alpha); - fopMsgM_setNowAlpha(&m778, alpha); + fopMsgM_setNowAlpha(&m740[0], alpha); + fopMsgM_setNowAlpha(&m740[1], alpha); fopMsgM_setNowAlpha(&m7B0, alpha); fopMsgM_setNowAlpha(&m7E8, alpha); } @@ -275,7 +275,6 @@ void dMenu_Option_c::titleMove() { /* 801D3C6C-801D3D34 .text cursorMove__14dMenu_Option_cFv */ void dMenu_Option_c::cursorMove() { - /* Nonmatching */ short sVar2 = mB30[1].mUserArea; for (int i = 0; i < 6; i++) { @@ -285,8 +284,9 @@ void dMenu_Option_c::cursorMove() { mB30[i].mSize.x = m8C8[sVar2].mSizeOrig.x; fopMsgM_cposMove(&mB30[i]); - - mB30[i].pane->rotate(mB30[i].mSize.x / 2.0f, mB30[i].mSize.y / 2.0f, ROTATE_Z, 0.5f); + + J2DPane* mpPane = mB30[i].pane; + mpPane->rotate(mB30[i].mSize.x / 2.0f, mB30[i].mSize.y / 2.0f, ROTATE_Z, mpPane->getRotate()); } cursorScale(); @@ -368,7 +368,6 @@ void dMenu_Option_c::typeMove() { /* 801D3F98-801D41C4 .text yazAnime__14dMenu_Option_cFv */ void dMenu_Option_c::yazAnime() { - /* Nonmatching */ static const int moveX[6] = { 0, 2, 8, 18, 8, 2}; float fVar1; @@ -386,11 +385,15 @@ void dMenu_Option_c::yazAnime() { if(m858[1].mUserArea > 0) { m858[1].mUserArea--; - m858[1].pane->move((int)(m858[1].mPosTopLeft.x + 0.5f) + moveX[m858[1].mUserArea], (int)(m858[1].mPosTopLeft.y + 0.5f)); + int x = (int)(m858[1].mPosTopLeft.x + 0.5f) + moveX[m858[1].mUserArea]; + int y = (int)(m858[1].mPosTopLeft.y + 0.5f); + m858[1].pane->move(x, y); } else if (m858[1].mUserArea < 0) { m858[1].mUserArea++; - m858[0].pane->move((int)(m858[0].mPosTopLeft.x + 0.5f) - moveX[abs(m858[1].mUserArea)], (int)(m858[0].mPosTopLeft.y + 0.5f)); + int x = (int)(m858[0].mPosTopLeft.x + 0.5f) - moveX[abs(m858[1].mUserArea)]; + int y = (int)(m858[0].mPosTopLeft.y + 0.5f); + m858[0].pane->move(x, y); } if (m858[0].mUserArea >= 0x14) { @@ -573,8 +576,8 @@ void dMenu_Option_c::noteSet() { outFontInit(); - float fVar1 = (m740).pane[1].mBounds.getHeight(); - float fVar2 = (m778).pane[1].mBounds.getHeight(); + float fVar1 = m740[0].pane[1].mBounds.getHeight(); + float fVar2 = m740[1].pane[1].mBounds.getHeight(); mesg_header* mesg_header = msgGet.getMesgHeader(0x262); if (mesg_header == NULL) { @@ -593,16 +596,16 @@ void dMenu_Option_c::noteSet() { msgDataProc.stringSet(); - ((J2DTextBox*)m740.pane)->setString(mD38); - ((J2DTextBox*)m778.pane)->setString(mD3C); + ((J2DTextBox*)m740[0].pane)->setString(mD38); + ((J2DTextBox*)m740[1].pane)->setString(mD3C); for (int i = 0; i < 0xf; i++) { if(m0B0[i].mUserArea == -1) { - m0B0[i].mPosTopLeft.x = m740.mPosTopLeft.x; - m0B0[i].mPosTopLeftOrig.x = m740.mPosTopLeftOrig.x; + m0B0[i].mPosTopLeft.x = m740[0].mPosTopLeft.x; + m0B0[i].mPosTopLeftOrig.x = m740[0].mPosTopLeftOrig.x; - m0B0[i].mPosTopLeft.y = m740.mPosTopLeft.y; - m0B0[i].mPosTopLeftOrig.y = m740.mPosTopLeftOrig.y; + m0B0[i].mPosTopLeft.y = m740[0].mPosTopLeft.y; + m0B0[i].mPosTopLeftOrig.y = m740[0].mPosTopLeftOrig.y; fopMsgM_outFontSet((J2DPicture*)&m0B0[i], &m0B0[i].mUserArea, 0, 0); } @@ -622,8 +625,8 @@ void dMenu_Option_c::outFontInit() { void dMenu_Option_c::outFontMove() { for (int i = 0; i < 15; i++) { if (m0B0[i].mUserArea != -1) { - m3F8[i].mPosTopLeft.x = m0B0[i].mPosTopLeft.x + (m740.mPosTopLeft.x + (m820.mPosTopLeft.x + m7B0.mPosTopLeft.x)); - m3F8[i].mPosTopLeft.y = m0B0[i].mPosTopLeft.y + (m740.mPosTopLeft.y + (m820.mPosTopLeft.y + m7B0.mPosTopLeft.y)); + m3F8[i].mPosTopLeft.x = m0B0[i].mPosTopLeft.x + (m740[0].mPosTopLeft.x + (m820.mPosTopLeft.x + m7B0.mPosTopLeft.x)); + m3F8[i].mPosTopLeft.y = m0B0[i].mPosTopLeft.y + (m740[0].mPosTopLeft.y + (m820.mPosTopLeft.y + m7B0.mPosTopLeft.y)); f32 rotation_offset_x = m820.mPosCenter.x - m3F8[i].mPosTopLeft.x; f32 rotation_offset_y = m820.mPosCenter.y - m3F8[i].mPosTopLeft.y; @@ -639,7 +642,7 @@ void dMenu_Option_c::outFontMove() { void dMenu_Option_c::outFontDraw() { for (int i = 0; i < 15; i++) { if (m0B0[i].mUserArea != -1) { - m0B0[i].mNowAlpha = m740.pane->getAlpha(); + m0B0[i].mNowAlpha = m740[0].pane->getAlpha(); fopMsgM_outFontDraw2((J2DPicture*)m0B0[i].pane, (J2DPicture*)m3F8[i].pane, m3F8[i].mPosTopLeft.x, m3F8[i].mPosTopLeft.y, 0x19, 0x19, &m0B0[i].mUserArea, m0B0[i].mNowAlpha, m0B0[i].mPosTopLeftOrig.y); } else { @@ -654,8 +657,8 @@ f32 dMenu_Option_c::stringlength(fopMsgM_pane_class*, char*) { } /* 801D505C-801D50A0 .text changeScaleCenter__14dMenu_Option_cFP18fopMsgM_pane_classPc */ -void dMenu_Option_c::changeScaleCenter(fopMsgM_pane_class* param_1, char* param_2) { - f32 str_length = stringlength(param_1, param_2); +void dMenu_Option_c::changeScaleCenter(fopMsgM_pane_class* param_1, char* i_str) { + f32 str_length = stringlength(param_1, i_str); param_1->mSize.x = str_length; param_1->mSizeOrig.x = str_length; @@ -681,18 +684,17 @@ void dMenu_Option_c::setSoundMode(u32 i_soundMode) { } /* 801D50E8-801D5148 .text changeScaleRight__14dMenu_Option_cFP18fopMsgM_pane_classPc */ -void dMenu_Option_c::changeScaleRight(fopMsgM_pane_class* param_1, char* param_2) { - /* Nonmatching - regalloc */ - float str_length = stringlength(param_1, param_2); +void dMenu_Option_c::changeScaleRight(fopMsgM_pane_class* param_1, char* i_str) { + float str_length = stringlength(param_1, i_str); float str_pos = (param_1->mPosTopLeft.x + param_1->mSize.x); param_1->mSize.x = str_length; param_1->mSizeOrig.x = str_length; - str_pos -= param_1->mSize.x / 2.0f; + float new_str_pos = str_pos - param_1->mSize.x / 2.0f; - param_1->mPosCenter.x = str_pos; - param_1->mPosCenterOrig.x = str_pos; + param_1->mPosCenter.x = new_str_pos; + param_1->mPosCenterOrig.x = new_str_pos; fopMsgM_cposMove(param_1); } @@ -764,7 +766,6 @@ void dMenu_Option_c::_delete() { /* 801D546C-801D576C .text _move__14dMenu_Option_cFv */ void dMenu_Option_c::_move() { - /* Nonmatching */ u8 check_trigger = stick->checkTrigger(); if (mE3F) { @@ -833,9 +834,11 @@ void dMenu_Option_c::_move() { stickMove(check_trigger); } - int sVar2 = 4; + int sVar2; if (m7B0.mUserArea < 2) { sVar2 = 10; + } else { + sVar2 = 4; } mC80[1].mUserArea++; @@ -852,7 +855,6 @@ void dMenu_Option_c::_move() { } } - yazAnime(); if (mB30[1].mUserArea != 2 || JUTGamePad::sRumbleSupported & 0x80000000) @@ -870,17 +872,88 @@ void dMenu_Option_c::_move() { outFontMove(); if (mE3D) { - m778.pane->hide(); + m740[1].pane->hide(); } else { - m778.pane->show(); + m740[1].pane->show(); } - return; } /* 801D576C-801D5C04 .text _draw__14dMenu_Option_cFv */ void dMenu_Option_c::_draw() { - /* Nonmatching */ + /* Nonmatching */ + if (mE41 == 0) { + fopMsgM_setAlpha(&m008); + fopMsgM_setAlpha(&m040); + fopMsgM_setAlpha(&m078); + + for (int i = 0; i < 2; i++) { + fopMsgM_setAlpha(&m740[i]); + fopMsgM_setAlpha(&m858[i]); + fopMsgM_setAlpha(&m9A8[i]); + fopMsgM_setAlpha(&mAC0[i]); + fopMsgM_setAlpha(&mC80[i]); + } + + fopMsgM_setAlpha(&m7B0); + fopMsgM_setAlpha(&m7E8); + fopMsgM_setAlpha(&m820); + + for (int i = 0; i < 4; i++) { + if (i != 1) { + fopMsgM_setAlpha(&m8C8[i]); + } + } + + for (int i = 0; i < 3; i++) { + fopMsgM_setAlpha(&mA18[i]); + } + + for (int i = 0; i < 6; i++) { + fopMsgM_setAlpha(&mB30[i]); + } + + fopMsgM_setAlpha(&mCF0); + } + else { + float alpha_scale = 1.0f - fopMsgM_valueIncrease(10, mC80[0].mUserArea, 0); + + m008.pane->mAlpha *= alpha_scale; + m040.pane->mAlpha *= alpha_scale; + m078.pane->mAlpha *= alpha_scale; + + for (int i = 0; i < 2; i++) { + m740[i].pane->mAlpha *= alpha_scale; + m8C8[i].pane->mAlpha *= alpha_scale; + m9A8[i].pane->mAlpha *= alpha_scale; + mAC0[i].pane->mAlpha *= alpha_scale; + mC80[i].pane->mAlpha *= alpha_scale; + } + + m7B0.pane->mAlpha *= alpha_scale; + m7E8.pane->mAlpha *= alpha_scale; + m820.pane->mAlpha *= alpha_scale; + + for (int i = 0; i < 4; i++) { + if (i != 1) { + m8C8[i].pane->mAlpha *= alpha_scale; + } + } + + for (int i = 0; i < 3; i++) { + mA18[i].pane->mAlpha *= alpha_scale; + } + + for (int i = 0; i < 6; i++) { + mAC0[i].pane->setAlpha(mB30[i].pane->getAlpha() * alpha_scale); + } + + mCF0.pane->mAlpha *= alpha_scale; + } + + outFontDraw(); + + scrn->draw(0.0f, 0.0f, (J2DGrafContext*)dComIfGp_getCurrentGrafPort()); } /* 801D5C04-801D5CBC .text _open__14dMenu_Option_cFv */ @@ -919,17 +992,15 @@ bool dMenu_Option_c::_open() { /* 801D5CBC-801D5D38 .text _close__14dMenu_Option_cFv */ bool dMenu_Option_c::_close() { - /* Nonmatching */ bool ret = false; - mC80[0].mUserArea++; - s16 user_area = mC80[0].mUserArea; + int value = ++mC80[0].mUserArea; - fopMsgM_valueIncrease(10, user_area, 0); + fopMsgM_valueIncrease(10, value, 0); dMenu_setPushMenuButton(2); - if (user_area >= 10) { + if (value >= 10) { initialize(); mE40 = 0; ret = true; From 03a9a0c38e5bfc9f1811b0794a2413a6dcbcb2c3 Mon Sep 17 00:00:00 2001 From: mattias-blum <142374929+mattias-blum@users.noreply.github.com> Date: Sat, 17 May 2025 22:57:24 -0400 Subject: [PATCH 17/19] cleanup --- src/d/d_menu_option.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/d/d_menu_option.cpp b/src/d/d_menu_option.cpp index 40d820350..17189fd3c 100644 --- a/src/d/d_menu_option.cpp +++ b/src/d/d_menu_option.cpp @@ -255,7 +255,7 @@ void dMenu_Option_c::titleMove() { f32 f30 = rotate_angle * (1.0f - alpha); if (mC80[0].mUserArea == 8) { - mDoAud_seStart(0x84e, NULL, 0, 0); + mDoAud_seStart(JA_SE_ITM_MENU_OPT_STR, NULL, 0, 0); } float y = 1.0f - alpha; @@ -396,7 +396,7 @@ void dMenu_Option_c::yazAnime() { m858[0].pane->move(x, y); } - if (m858[0].mUserArea >= 0x14) { + if (m858[0].mUserArea >= 20) { m858[0].mUserArea = 0; } } @@ -433,7 +433,7 @@ void dMenu_Option_c::stickMove(u8 param_1) { } cursorMove(); noteSet(); - mDoAud_seStart(0x80e, NULL, 0, 0); + mDoAud_seStart(JA_SE_ITM_MENU_CURSOR, NULL, 0, 0); } break; } @@ -445,7 +445,7 @@ void dMenu_Option_c::stickMove(u8 param_1) { } cursorMove(); noteSet(); - mDoAud_seStart(0x80e, NULL, 0, 0); + mDoAud_seStart(JA_SE_ITM_MENU_CURSOR, NULL, 0, 0); } break; } @@ -459,7 +459,7 @@ void dMenu_Option_c::stickMove(u8 param_1) { mE3C = 1; } m858[1].mUserArea = 6; - mDoAud_seStart(0x84f, NULL, 0, 0); + mDoAud_seStart(JA_SE_ITM_MENU_OPT_SW, NULL, 0, 0); break; } case 1: { @@ -470,7 +470,7 @@ void dMenu_Option_c::stickMove(u8 param_1) { mE3D = 1; } m858[1].mUserArea = 6; - mDoAud_seStart(0x84f, NULL, 0, 0); + mDoAud_seStart(JA_SE_ITM_MENU_OPT_SW, NULL, 0, 0); ; break; } @@ -482,7 +482,7 @@ void dMenu_Option_c::stickMove(u8 param_1) { mE3E = 0; } m858[1].mUserArea = 6; - mDoAud_seStart(0x84f, NULL, 0, 0); + mDoAud_seStart(JA_SE_ITM_MENU_OPT_SW, NULL, 0, 0); mDoAud_setOutputMode(soundMode[mE3E]); setSoundMode(soundMode[mE3E]); break; @@ -497,7 +497,7 @@ void dMenu_Option_c::stickMove(u8 param_1) { g_mDoCPd_gamePad[0]->mRumble.startPatternedRumble(&mE38, JUTGamePad::CRumble::LOOP_ONCE, 0x3c); } m858[1].mUserArea = 6; - mDoAud_seStart(0x84f, NULL, 0, 0); + mDoAud_seStart(JA_SE_ITM_MENU_OPT_SW, NULL, 0, 0); } break; } @@ -515,7 +515,7 @@ void dMenu_Option_c::stickMove(u8 param_1) { mE3C = 1; } m858[1].mUserArea = -6; - mDoAud_seStart(0x84f, NULL, 0, 0); + mDoAud_seStart(JA_SE_ITM_MENU_OPT_SW, NULL, 0, 0); break; } case 1: { @@ -526,7 +526,7 @@ void dMenu_Option_c::stickMove(u8 param_1) { mE3D = 1; } m858[1].mUserArea = -6; - mDoAud_seStart(0x84f, NULL, 0, 0); + mDoAud_seStart(JA_SE_ITM_MENU_OPT_SW, NULL, 0, 0); break; } case 3: { @@ -537,7 +537,7 @@ void dMenu_Option_c::stickMove(u8 param_1) { mE3E = 2; } m858[1].mUserArea = -6; - mDoAud_seStart(0x84f, NULL, 0, 0); + mDoAud_seStart(JA_SE_ITM_MENU_OPT_SW, NULL, 0, 0); mDoAud_setOutputMode(soundMode[mE3E]); setSoundMode(soundMode[mE3E]); break; @@ -552,7 +552,7 @@ void dMenu_Option_c::stickMove(u8 param_1) { g_mDoCPd_gamePad[0]->mRumble.startPatternedRumble(&mE38, JUTGamePad::CRumble::LOOP_ONCE, 0x3c); } m858[1].mUserArea = -6; - mDoAud_seStart(0x84f, NULL, 0, 0); + mDoAud_seStart(JA_SE_ITM_MENU_OPT_SW, NULL, 0, 0); } break; } @@ -809,7 +809,7 @@ void dMenu_Option_c::_move() { dComIfGp_setNowVibration(mE3F); dComIfGs_setOptSound(mE3E); - mDoAud_seStart(0x84D, NULL, 0); + mDoAud_seStart(JA_SE_ITM_MENU_OPT_OUT, NULL, 0); } else if (CPad_CHECK_TRIG_B(0) && !CPad_CHECK_TRIG_START(0) && @@ -822,7 +822,7 @@ void dMenu_Option_c::_move() { mE40 = 3; mE41 = 1; mC80[0].mUserArea = 0; - mDoAud_seStart(0x84D, NULL, 0); + mDoAud_seStart(JA_SE_ITM_MENU_OPT_OUT, NULL, 0); } else { if (!check_trigger) { @@ -881,7 +881,7 @@ void dMenu_Option_c::_move() { /* 801D576C-801D5C04 .text _draw__14dMenu_Option_cFv */ void dMenu_Option_c::_draw() { - /* Nonmatching */ + /* Nonmatching - probably some inlining, tried using `setAlpha` and `getAlpha` but didn't work */ if (mE41 == 0) { fopMsgM_setAlpha(&m008); fopMsgM_setAlpha(&m040); @@ -945,7 +945,7 @@ void dMenu_Option_c::_draw() { } for (int i = 0; i < 6; i++) { - mAC0[i].pane->setAlpha(mB30[i].pane->getAlpha() * alpha_scale); + mAC0[i].pane->mAlpha = mB30[i].pane->mAlpha * alpha_scale; } mCF0.pane->mAlpha *= alpha_scale; From 568fe41d61e27b97e25861d46a529d94de8962a4 Mon Sep 17 00:00:00 2001 From: mattias-blum <142374929+mattias-blum@users.noreply.github.com> Date: Sun, 18 May 2025 10:15:09 -0400 Subject: [PATCH 18/19] PR changes made --- include/d/d_menu_collect.h | 2 +- src/d/d_menu_collect.cpp | 15 +++++---------- src/d/d_menu_option.cpp | 12 +++++------- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/include/d/d_menu_collect.h b/include/d/d_menu_collect.h index 577a683cf..8b33a2ad9 100644 --- a/include/d/d_menu_collect.h +++ b/include/d/d_menu_collect.h @@ -181,7 +181,7 @@ public: /* 0x52 */ u8 m52; /* 0x53 */ u8 m53; /* 0x54 */ f32 m54; - /* 0x58 */ int m58; + /* 0x58 */ JUtility::TColor m58; /* 0x5C */ u8 m5C; /* 0x5D */ u8 m5D; }; diff --git a/src/d/d_menu_collect.cpp b/src/d/d_menu_collect.cpp index 7f8831ac9..21eedf8e2 100644 --- a/src/d/d_menu_collect.cpp +++ b/src/d/d_menu_collect.cpp @@ -15,8 +15,6 @@ static dMc_HIO_c g_mcHIO; /* 8019BE8C-8019BF14 .text __ct__9dMc_HIO_cFv */ dMc_HIO_c::dMc_HIO_c() { - /* Fakematch */ - m58 = -1; m46 = 40; m48 = 10; m4A = 120; @@ -27,10 +25,7 @@ dMc_HIO_c::dMc_HIO_c() { m52 = 130; m4E = 250; m50 = 20; - ((u8*)&m58)[0] = -1; - ((u8*)&m58)[1] = 170; - ((u8*)&m58)[2] = 0; - ((u8*)&m58)[3] = 0; + m58.set(-1, 170, 0, 0); m44 = 13; } @@ -163,12 +158,12 @@ void dMenu_Collect_c::screenSet() { // Couple of functions missing here ((J2DTextBox*)(m740).pane)->setWhite(-1); - ((J2DTextBox*)(m740).pane)->setCharColor(0xff); - ((J2DTextBox*)(m740).pane)->setGradColor(0xff); + ((J2DTextBox*)(m740).pane)->setCharColor(-1); + ((J2DTextBox*)(m740).pane)->setGradColor(-1); ((J2DTextBox*)(m778).pane)->setWhite(-1); - ((J2DTextBox*)(m778).pane)->setCharColor(0xff); - ((J2DTextBox*)(m778).pane)->setGradColor(0xff); + ((J2DTextBox*)(m778).pane)->setCharColor(-1); + ((J2DTextBox*)(m778).pane)->setGradColor(-1); fopMsgM_setPaneData(&m858, m004, 'wd'); diff --git a/src/d/d_menu_option.cpp b/src/d/d_menu_option.cpp index 17189fd3c..fa43b0a66 100644 --- a/src/d/d_menu_option.cpp +++ b/src/d/d_menu_option.cpp @@ -579,14 +579,12 @@ void dMenu_Option_c::noteSet() { float fVar1 = m740[0].pane[1].mBounds.getHeight(); float fVar2 = m740[1].pane[1].mBounds.getHeight(); - mesg_header* mesg_header = msgGet.getMesgHeader(0x262); - if (mesg_header == NULL) { - JUTAssertion::showAssert(JUTAssertion::getSDevice(), "d_menu_option.cpp", 0x313, "head_p"); - OSPanic("d_menu_option.cpp", 0x313, "Halt"); - } + mesg_header* head_p = msgGet.getMesgHeader(0x262); + + JUT_ASSERT(0x313, head_p); - const char* mesg = msgGet.getMessage(mesg_header); - mesg_entry msg_entry = msgGet.getMesgEntry(mesg_header); + const char* mesg = msgGet.getMessage(head_p); + mesg_entry msg_entry = msgGet.getMesgEntry(head_p); msgDataProc.dataInit(); From c99dc9334775b5fdeeb1de5de85605ea811f0147 Mon Sep 17 00:00:00 2001 From: mattias-blum <142374929+mattias-blum@users.noreply.github.com> Date: Wed, 21 May 2025 10:07:26 -0400 Subject: [PATCH 19/19] PR changes + added inlines --- include/d/d_menu_option.h | 16 +++++++++++++--- src/d/d_menu_collect.cpp | 14 +++++++------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/include/d/d_menu_option.h b/include/d/d_menu_option.h index 14131258f..38f78e262 100644 --- a/include/d/d_menu_option.h +++ b/include/d/d_menu_option.h @@ -16,9 +16,19 @@ class dMenu_Option_c : public dDlst_base_c { public: void alphaChange(fopMsgM_pane_class*, f32) {} void getQuitStatus() {} - void setArchive(JKRArchive*) {} - void setFont(JUTFont*, JUTFont*) {} - void setTextArea(char*, char*, char*, char*) {} + void setArchive(JKRArchive* archive) { + mpArchive = archive; + } + void setFont(JUTFont* font_1, JUTFont* font_2) { + mD2C = font_1; + mD30 = font_2; + } + void setTextArea(char* param_1, char* param_2, char* param_3, char* param_4) { + mD38 = param_1; + mD3C = param_2; + mD40 = param_3; + mD44 = param_4; + } void screenSet(); void mainInit(); diff --git a/src/d/d_menu_collect.cpp b/src/d/d_menu_collect.cpp index 21eedf8e2..bf5f31bc7 100644 --- a/src/d/d_menu_collect.cpp +++ b/src/d/d_menu_collect.cpp @@ -25,7 +25,7 @@ dMc_HIO_c::dMc_HIO_c() { m52 = 130; m4E = 250; m50 = 20; - m58.set(-1, 170, 0, 0); + m58.set(0xFF, 0xAA, 0x00, 0x00); m44 = 13; } @@ -157,13 +157,13 @@ void dMenu_Collect_c::screenSet() { ((J2DTextBox*)(m778).pane)->setFont(m2470); // Couple of functions missing here - ((J2DTextBox*)(m740).pane)->setWhite(-1); - ((J2DTextBox*)(m740).pane)->setCharColor(-1); - ((J2DTextBox*)(m740).pane)->setGradColor(-1); + ((J2DTextBox*)(m740).pane)->setWhite(0xFFFFFFFF); + ((J2DTextBox*)(m740).pane)->setCharColor(0xFFFFFFFF); + ((J2DTextBox*)(m740).pane)->setGradColor(0xFFFFFFFF); - ((J2DTextBox*)(m778).pane)->setWhite(-1); - ((J2DTextBox*)(m778).pane)->setCharColor(-1); - ((J2DTextBox*)(m778).pane)->setGradColor(-1); + ((J2DTextBox*)(m778).pane)->setWhite(0xFFFFFFFF); + ((J2DTextBox*)(m778).pane)->setCharColor(0xFFFFFFFF); + ((J2DTextBox*)(m778).pane)->setGradColor(0xFFFFFFFF); fopMsgM_setPaneData(&m858, m004, 'wd');