diff --git a/configure.py b/configure.py index 2e96d3687..0c72c126c 100644 --- a/configure.py +++ b/configure.py @@ -215,6 +215,7 @@ if args.debug: # Or -sym dwarf-2 for Wii compilers cflags_base.extend(["-sym on", "-DDEBUG=1"]) cflags_base.extend(['-pragma "dont_inline on"']) + cflags_base.extend(['-pragma "optimization_level 0"']) else: cflags_base.append("-DNDEBUG=1") if args.warn == "all": diff --git a/include/JSystem/JGeometry.h b/include/JSystem/JGeometry.h index 9a14863cd..7d581d29d 100644 --- a/include/JSystem/JGeometry.h +++ b/include/JSystem/JGeometry.h @@ -2,7 +2,6 @@ #define JGEOMETRY_H #include "dolphin/mtx/vec.h" -#include "float.h" #include "math.h" namespace JGeometry { diff --git a/include/SSystem/SComponent/c_lib.h b/include/SSystem/SComponent/c_lib.h index 948949fd6..44ac0e8b0 100644 --- a/include/SSystem/SComponent/c_lib.h +++ b/include/SSystem/SComponent/c_lib.h @@ -59,6 +59,9 @@ inline void cLib_setBit(T& value, T bit) { template inline T cLib_minMaxLimit(T val, T min, T max) { return (T)((T)val < (T)min ? (T)min : ((T)val > (T)max ? (T)max : (T)val)); + // Might also be one of these? Try them first if having issues getting this inline to match. + // return (T)((T)val < min ? min : ((T)val > max ? max : (T)val)); + // return (T)(val < min ? min : (val > max ? max : val)); } template diff --git a/include/d/d_lib.h b/include/d/d_lib.h index 39e7be557..9f7c43279 100644 --- a/include/d/d_lib.h +++ b/include/d/d_lib.h @@ -18,7 +18,7 @@ public: setWaitParm(0xF, 0xF, 0, 0, 0.9f, 0.5f, 0, 0x2000); init(); } - STControl(s16, s16, s16, s16, f32, f32, s16, s16); + STControl(s16, s16, s16, s16, f32 = 0.9f, f32 = 0.5f, s16 = 0, s16 = 0x2000); void setWaitParm(s16, s16, s16, s16, f32, f32, s16, s16); void init(); void Xinit(); diff --git a/include/d/d_menu_option.h b/include/d/d_menu_option.h index e7054ff3b..055fef205 100644 --- a/include/d/d_menu_option.h +++ b/include/d/d_menu_option.h @@ -1,15 +1,19 @@ #ifndef D_MENU_OPTION_H #define D_MENU_OPTION_H -#include "dolphin/types.h" +#include "JSystem/J2DGraph/J2DScreen.h" +#include "d/d_drawlist.h" +#include "d/d_lib.h" +#include "f_op/f_op_msg_mng.h" +#include "m_Do/m_Do_hostIO.h" class fopMsgM_pane_class; class JKRArchive; class JUTFont; -class dMenu_Option_c { +class dMenu_Option_c : public dDlst_base_c { public: - void alphaChange(fopMsgM_pane_class*, float) {} + void alphaChange(fopMsgM_pane_class*, f32) {} void getQuitStatus() {} void setArchive(JKRArchive*) {} void setFont(JUTFont*, JUTFont*) {} @@ -27,14 +31,14 @@ public: void typeMove(); void yazAnime(); void ccAnime(); - void stickMove(unsigned char); + void stickMove(u8); void noteSet(); void outFontInit(); void outFontMove(); void outFontDraw(); void stringlength(fopMsgM_pane_class*, char*); void changeScaleCenter(fopMsgM_pane_class*, char*); - void setSoundMode(unsigned long); + void setSoundMode(u32); void changeScaleRight(fopMsgM_pane_class*, char*); void initialize(); void _create(); @@ -43,12 +47,61 @@ public: void _draw(); void _open(); void _close(); -}; -class dMo_HIO_c { +private: + /* 0x004 */ J2DScreen* scrn; + /* 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[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; + /* 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; + /* 0xCF0 */ fopMsgM_pane_class mCF0; + /* 0xD28 */ JKRArchive* mpArchive; + /* 0xD2C */ JUTFont* mD2C; + /* 0xD30 */ JUTFont* mD30; + /* 0xD34 */ STControl* stick; + /* 0xD38 */ u8 mD38[0xD48 - 0xD38]; + /* 0xD48 */ char mD48[20]; + /* 0xD5C */ char mD5C[2][20]; + /* 0xD84 */ char mD84[2][20]; + /* 0xDAC */ char mDAC[3][20]; + /* 0xDE8 */ char mDE8[4][20]; + /* 0xE38 */ u8 mE38; + /* 0xE39 */ u8 mE39; + /* 0xE3A */ u8 mE3A; + /* 0xE3B */ u8 mE3B; + /* 0xE3C */ u8 mE3C[0xE40 - 0xE3C]; + /* 0xE40 */ u8 mE40; + /* 0xE41 */ u8 mE41[0xE42 - 0xE41]; +}; // Size: 0xE42 + +class dMo_HIO_c : public JORReflexible { public: dMo_HIO_c(); -}; + virtual ~dMo_HIO_c() {} + +public: + /* 0x04 */ s8 mChildID; +}; // Size: 0x08 #endif /* D_MENU_OPTION_H */ diff --git a/include/f_op/f_op_msg_mng.h b/include/f_op/f_op_msg_mng.h index 0a75dfe37..5c1eabc65 100644 --- a/include/f_op/f_op_msg_mng.h +++ b/include/f_op/f_op_msg_mng.h @@ -205,4 +205,6 @@ void fopMsgM_demoMsgFlagOn(); void fopMsgM_demoMsgFlagOff(); bool fopMsgM_demoMsgFlagCheck(); +void fopMsgM_blendInit(fopMsgM_pane_class* i_this, const char* data); + #endif diff --git a/include/global.h b/include/global.h index 147214413..09227b728 100644 --- a/include/global.h +++ b/include/global.h @@ -41,6 +41,7 @@ #endif extern int __cntlzw(uint); +extern void __dcbz(void*, int); #define VERSION_JPN 0 #define VERSION_USA 1 diff --git a/src/d/actor/d_a_movie_player.cpp b/src/d/actor/d_a_movie_player.cpp index a83c31994..2b2e0327d 100644 --- a/src/d/actor/d_a_movie_player.cpp +++ b/src/d/actor/d_a_movie_player.cpp @@ -2005,7 +2005,11 @@ static void __THPHuffDecodeDCTCompY(register THPFileInfo* info, THPCoeff* block) } block[__THPJpegNaturalOrder[k]] = (s16)ssss; +#ifdef __MWERKS__ goto _RECV_END; +#else + continue; +#endif } { @@ -2246,7 +2250,7 @@ _FailedCheckEnoughbits_Updated: goto __CODE_PLUS_VP_CNT; _FailedCheckNoBits0: -_FailedCheckNoBits1 : +_FailedCheckNoBits1: { register u32 mask = 0xFFFFFFFF << (33 - cnt); diff --git a/src/d/actor/d_a_npc_bs1.cpp b/src/d/actor/d_a_npc_bs1.cpp index 2537735f1..04ad24174 100644 --- a/src/d/actor/d_a_npc_bs1.cpp +++ b/src/d/actor/d_a_npc_bs1.cpp @@ -1548,7 +1548,6 @@ BOOL daNpc_Bs1_c::isSellBomb() { /* 00003090-00003478 .text CreateInit__11daNpc_Bs1_cFv */ BOOL daNpc_Bs1_c::CreateInit() { - /* Nonmatching */ cXyz dummy(0.0f, 0.0f, 0.0f); m726.x = current.angle.x; diff --git a/src/d/actor/d_a_npc_os.cpp b/src/d/actor/d_a_npc_os.cpp index 7df508f05..67fe99b38 100644 --- a/src/d/actor/d_a_npc_os.cpp +++ b/src/d/actor/d_a_npc_os.cpp @@ -1081,7 +1081,7 @@ BOOL daNpc_Os_c::searchNpcAction(void*) { if(!door) { if(cLib_calcTimer(&field_0x7A7) == 0) { field_0x7A6 ^= 1; - field_0x7A7 = cLib_getRndValue(8, 0x14); + field_0x7A7 = cLib_getRndValue(8, 20); } mpMorf->setPlaySpeed(2.0f); diff --git a/src/d/actor/d_a_obj_quake.cpp b/src/d/actor/d_a_obj_quake.cpp index 0cacdd7dc..777e2fe8e 100644 --- a/src/d/actor/d_a_obj_quake.cpp +++ b/src/d/actor/d_a_obj_quake.cpp @@ -51,7 +51,7 @@ s32 daObjQuake_c::_create() { } if (l_HIO.mChildID < 0) { - l_HIO.mChildID = mDoHIO_root.mDoHIO_createChild("振動効果", &l_HIO); + l_HIO.mChildID = mDoHIO_root.mDoHIO_createChild("振動効果", &l_HIO); // "Vibration Effect" } l_HIO.field_0x08 += 1; diff --git a/src/d/d_menu_option.cpp b/src/d/d_menu_option.cpp index 4079c582f..76705a250 100644 --- a/src/d/d_menu_option.cpp +++ b/src/d/d_menu_option.cpp @@ -4,16 +4,117 @@ // #include "d/d_menu_option.h" -#include "dolphin/types.h" +#include "JSystem/J2DGraph/J2DTextBox.h" +#include "JSystem/JUtility/JUTAssert.h" +#include "d/d_lib.h" +#include "f_op/f_op_msg_mng.h" +#include "global.h" + +dMo_HIO_c g_moHIO; + +static const u32 soundMode[3] = {0, 1, 2}; /* 801D2B68-801D2B78 .text __ct__9dMo_HIO_cFv */ dMo_HIO_c::dMo_HIO_c() { - /* Nonmatching */ } /* 801D2B78-801D3388 .text screenSet__14dMenu_Option_cFv */ void dMenu_Option_c::screenSet() { - /* Nonmatching */ + static const u32 label_t[] = { + 'ft00', 'ft01', 'ft02', 'ft03', 'ft04', 'ft05', 'ft06', 'ft07', + 'ft08', 'ft09', 'ft10', 'ft11', 'ft12', 'ft13', 'ft14', + }; + static const u32 label_d[] = { + 'fd00', 'fd01', 'fd02', 'fd03', 'fd04', 'fd05', 'fd06', 'fd07', + 'fd08', 'fd09', 'fd10', 'fd11', 'fd12', 'fd13', 'fd14', + }; + + fopMsgM_setPaneData(&m008, scrn->search('topt')); + fopMsgM_setPaneData(&m040, scrn->search('sp01')); + fopMsgM_setPaneData(&m078, scrn->search('sk01')); + + for (int i = 0; i < (s32)ARRAY_SIZE(m0B0); i++) { + fopMsgM_setPaneData(&m0B0[i], scrn->search(label_t[i])); + fopMsgM_setPaneData(&m3F8[i], scrn->search(label_d[i])); + ((J2DPicture*)m0B0[i].pane)->changeTexture("font_07_02.bti", 0); + fopMsgM_blendInit(&m0B0[i], "font_00.bti"); + } + + fopMsgM_setPaneData(&m778, scrn->search('str0')); + fopMsgM_setPaneData(&m740, scrn->search('st00')); + 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(&m8C8[0], scrn->search('ttyu')); + fopMsgM_setPaneData(&m9A8[0], scrn->search('thld')); + fopMsgM_setPaneData(&m9A8[1], scrn->search('tsic')); + fopMsgM_setPaneData(&m8C8[3], scrn->search('tsou')); + fopMsgM_setPaneData(&mA18[0], scrn->search('tmon')); + fopMsgM_setPaneData(&mA18[1], scrn->search('tste')); + fopMsgM_setPaneData(&mA18[2], scrn->search('tsur')); + 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(&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(&mCF0, scrn->search('blak')); + + fopMsgM_messageGet(mD48, 0x19D); + fopMsgM_messageGet(mD5C[0], 0x19B); + fopMsgM_messageGet(mD5C[1], 0x1A9); + fopMsgM_messageGet(mD84[0], 0x1D5); + fopMsgM_messageGet(mD84[1], 0x1D4); + fopMsgM_messageGet(mDAC[0], 0x1D7); + fopMsgM_messageGet(mDAC[1], 0x1D8); + fopMsgM_messageGet(mDAC[2], 0x1EB); + fopMsgM_messageGet(mDE8[0], 0x19A); + fopMsgM_messageGet(mDE8[1], 0x19A); + fopMsgM_messageGet(mDE8[2], 0x1D1); + fopMsgM_messageGet(mDE8[3], 0x1D6); + + ((J2DTextBox*)m008.pane)->setFont(mD2C); + ((J2DTextBox*)m008.pane)->setString(mD48); + ((J2DTextBox*)m740.pane)->setFont(mD2C); + ((J2DTextBox*)m778.pane)->setFont(mD30); + + for (int i = 0; i < 2; i++) { + ((J2DTextBox*)m9A8[i].pane)->setFont(mD2C); + ((J2DTextBox*)m9A8[i].pane)->setString(mD5C[i]); + ((J2DTextBox*)mAC0[i].pane)->setFont(mD2C); + ((J2DTextBox*)mAC0[i].pane)->setString(mD84[i]); + changeScaleCenter(&m9A8[i], mD5C[i]); + changeScaleCenter(&mAC0[i], mD84[i]); + } + + for (int i = 0; i < 3; i++) { + ((J2DTextBox*)mA18[i].pane)->setFont(mD2C); + ((J2DTextBox*)mA18[i].pane)->setString(mDAC[i]); + changeScaleCenter(&mA18[i], mDAC[i]); + } + + for (int i = 0; i < 4; i++) { + if (i == 1) continue; + ((J2DTextBox*)m8C8[i].pane)->setFont(mD2C); + ((J2DTextBox*)m8C8[i].pane)->setString(mDE8[i]); + changeScaleRight(&m8C8[i], mDE8[i]); + } + + m820.mUserArea = m820.pane->mRotation; + 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; + if (m078.mUserArea > 180) m078.mUserArea -= 360; } /* 801D3388-801D3518 .text mainInit__14dMenu_Option_cFv */ @@ -64,6 +165,7 @@ 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}; } /* 801D41C4-801D428C .text ccAnime__14dMenu_Option_cFv */ @@ -72,7 +174,7 @@ void dMenu_Option_c::ccAnime() { } /* 801D428C-801D47A4 .text stickMove__14dMenu_Option_cFUc */ -void dMenu_Option_c::stickMove(unsigned char) { +void dMenu_Option_c::stickMove(u8) { /* Nonmatching */ } @@ -107,7 +209,7 @@ void dMenu_Option_c::changeScaleCenter(fopMsgM_pane_class*, char*) { } /* 801D50A0-801D50E8 .text setSoundMode__14dMenu_Option_cFUl */ -void dMenu_Option_c::setSoundMode(unsigned long) { +void dMenu_Option_c::setSoundMode(u32) { /* Nonmatching */ } @@ -124,6 +226,23 @@ void dMenu_Option_c::initialize() { /* 801D5224-801D53F0 .text _create__14dMenu_Option_cFv */ void dMenu_Option_c::_create() { /* Nonmatching */ + scrn = new J2DScreen(); + JUT_ASSERT(1074, scrn != NULL); + scrn->set("option.blo", mpArchive); + + stick = new STControl(5, 2, 3, 2); + JUT_ASSERT(1078, stick != NULL); + + screenSet(); + initialize(); + + mE40 = 0; + mE38 = 0; + mE39 = 10; + mE3A = 0xFF; + mE3B = 0xC0; + + g_moHIO.mChildID = mDoHIO_root.mDoHIO_createChild("オプション画面", &g_moHIO); // "Option Screen" } /* 801D53F0-801D546C .text _delete__14dMenu_Option_cFv */