diff --git a/include/d/actor/d_a_e_fb.h b/include/d/actor/d_a_e_fb.h index 3e8734b8b6..a4494c5e7a 100644 --- a/include/d/actor/d_a_e_fb.h +++ b/include/d/actor/d_a_e_fb.h @@ -71,10 +71,16 @@ private: /* 0xA30 */ dCcD_Sph mSphere2; /* 0xB68 */ dCcD_Sph mAtSph; /* 0xCA0 */ dCcU_AtInfo mAtInfo; +#if AVOID_UB + /* 0xCC4 */ u32 mKeys[8]; + /* 0xCE4 */ u8 mHIOInit; + /* 0xCE5 */ u8 field_0xce5[0xCE8 - 0xCE5]; +#else // !@bug Seems that the orig developers didn't size mKeys correctly, as ideally it should be len=8, not len=7: /* 0xCC4 */ u32 mKeys[7]; /* 0xCE0 */ u8 mHIOInit; /* 0xCE1 */ u8 field_0xce1[0xCE8 - 0xCE1]; +#endif }; STATIC_ASSERT(sizeof(daE_FB_c) == 0xce8); diff --git a/include/d/actor/d_a_e_tk2.h b/include/d/actor/d_a_e_tk2.h index e4d29cf674..12b0fef3a3 100644 --- a/include/d/actor/d_a_e_tk2.h +++ b/include/d/actor/d_a_e_tk2.h @@ -39,8 +39,7 @@ public: /* 0x680 */ s16 mPlayerAngleY; /* 0x684 */ f32 mPlayerDistanceLimit; /* 0x688 */ u8 field24_0x688[2]; - /* 0x68A */ s16 mActionTimer[3]; - /* 0x690 */ s16 mExecuteState; + /* 0x68A */ s16 mActionTimer[4]; /* 0x692 */ s16 mInvincibilityTimer; /* 0x694 */ s8 mAttentionOFF; /* 0x695 */ s8 mTKBallSpawned; diff --git a/include/d/actor/d_a_e_vt.h b/include/d/actor/d_a_e_vt.h index 5d6bf3dfd2..4b6082adae 100644 --- a/include/d/actor/d_a_e_vt.h +++ b/include/d/actor/d_a_e_vt.h @@ -159,8 +159,7 @@ private: /* 0x00958 */ mDoExt_3DlineMat1_c mRope; /* 0x00994 */ cXyz field_0x994[100]; /* 0x00E44 */ csXyz field_0xe44[100]; - /* 0x0109C */ u8 mRopeCutStatus[10]; - /* 0x010A6 */ u8 field_0x10A6[0x01100 - 0x010A6]; + /* 0x0109C */ u8 mRopeCutStatus[100]; /* 0x01100 */ u8 mDrawRopes; /* 0x01101 */ u8 field_0x1101[0x01104 - 0x01101]; /* 0x01104 */ f32 field_0x1104[10]; diff --git a/include/d/actor/d_a_mg_rod.h b/include/d/actor/d_a_mg_rod.h index 3786fbafcb..e8ef9a6128 100644 --- a/include/d/actor/d_a_mg_rod.h +++ b/include/d/actor/d_a_mg_rod.h @@ -128,10 +128,10 @@ public: /* 0x0760 */ f32 field_0x760; /* 0x0764 */ cXyz field_0x764; /* 0x0770 */ mg_line_s mg_line; // below to mg_hook_s part of mg_line_s? - /* 0x0C20 */ f32 field_0xc20[98]; - /* 0x0DA8 */ u8 field_0xDA8[0x0DB0 - 0x0DA8]; - /* 0x0DB0 */ f32 field_0xdb0[98]; - /* 0x0F38 */ u8 field_0xF38[0x0F40 - 0x0F38]; + /* 0x0C20 */ f32 field_0xc20[99]; + /* 0x0DA8 */ u8 field_0xDAC[0x0DB0 - 0x0DAC]; + /* 0x0DB0 */ f32 field_0xdb0[99]; + /* 0x0F3C */ u8 field_0xF38[0x0F40 - 0x0F3C]; /* 0x0F40 */ mDoExt_3DlineMat0_c linemat; /* 0x0F5C */ f32 field_0xf5c; /* 0x0F60 */ f32 field_0xf60; @@ -183,9 +183,8 @@ public: /* 0x102F */ u8 field_0x102f; /* 0x1030 */ J3DModel* esa_model[2]; /* 0x1038 */ u8 field_0x1038[0x103C - 0x1038]; - /* 0x103C */ s16 field_0x103c[8]; - /* 0x104C */ u8 field_0x104C[0x104E - 0x104C]; - /* 0x104E */ s16 field_0x104e[8]; + /* 0x103C */ s16 field_0x103c[9]; + /* 0x104E */ s16 field_0x104e[9]; /* 0x1060 */ cXyz hook_pos; /* 0x106C */ cXyz field_0x106c; /* 0x1078 */ cXyz field_0x1078; diff --git a/include/d/actor/d_a_npc_coach.h b/include/d/actor/d_a_npc_coach.h index d5ee60e2cf..3917d6f11c 100644 --- a/include/d/actor/d_a_npc_coach.h +++ b/include/d/actor/d_a_npc_coach.h @@ -25,10 +25,7 @@ public: /* 0x1C */ f32 max_speed; // 最大速度 - Maximum Speed /* 0x20 */ f32 spring_constant; // バネ係数 - Spring Constant /* 0x24 */ f32 damp_coeff[1]; // 減衰係数 - Damp Coefficient - /* 0x28 */ f32 field_0x28[1]; - /* 0x2C */ f32 field_0x2c; - /* 0x30 */ f32 field_0x30; - /* 0x34 */ f32 field_0x34; + /* 0x28 */ f32 field_0x28[4]; /* 0x38 */ f32 vert_swing_width; // 縦揺れ幅 - Vertical Swing Width /* 0x3C */ f32 shake_dist; // 揺れ距離 - Shake Distance /* 0x40 */ f32 jump_dist; // 跳ね距離 - Jump Distance diff --git a/include/d/actor/d_a_npc_lf.h b/include/d/actor/d_a_npc_lf.h index 73f66c286f..4b86f24686 100644 --- a/include/d/actor/d_a_npc_lf.h +++ b/include/d/actor/d_a_npc_lf.h @@ -24,8 +24,7 @@ struct lf_s { /* 0x44 */ f32 field_0x44; /* 0x48 */ f32 field_0x48; /* 0x4C */ s16 field_0x4c[2]; - /* 0x50 */ s16 field_0x50[2]; - /* 0x54 */ u8 field_0x54[4]; + /* 0x50 */ s16 field_0x50[4]; /* 0x58 */ f32 field_0x58; /* 0x5C */ f32 field_0x5c; /* 0x60 */ f32 field_0x60; diff --git a/include/d/actor/d_a_obj_maki.h b/include/d/actor/d_a_obj_maki.h index c15b0b9ac1..aad8028e9c 100644 --- a/include/d/actor/d_a_obj_maki.h +++ b/include/d/actor/d_a_obj_maki.h @@ -28,11 +28,9 @@ public: /* 0x580 */ s16 field_0x580[2]; /* 0x584*/ dCcD_Stts mStts; /* 0x5c0 */ dCcD_Sph mSph; - /* 0x6f8 */ u32 field_0x6f8[4]; - /* 0x6fc */ u8 field_0x6fc[0x70c - 0x708]; // Undefined + /* 0x6f8 */ u32 field_0x6f8[5]; /* 0x70c */ LIGHT_INFLUENCE mLightObj; /* 0x72c */ u8 field_0x72c; - /* 0x72d */ u8 field_0x72d[0x730 - 0x72d]; //Undefined }; STATIC_ASSERT(sizeof(obj_maki_class) == 0x730); diff --git a/include/d/actor/d_a_obj_tombo.h b/include/d/actor/d_a_obj_tombo.h index 3dacbe0dad..5dfdcb6451 100644 --- a/include/d/actor/d_a_obj_tombo.h +++ b/include/d/actor/d_a_obj_tombo.h @@ -55,8 +55,7 @@ private: /* 0x710 */ bool mIsHitByBoomerang; /* 0x711 */ u8 mAction; /* 0x712 */ u8 field_0x712; - /* 0x714 */ s16 field_0x714[2]; - /* 0x718 */ s16 field_0x718; + /* 0x714 */ s16 field_0x714[3]; /* 0x71C */ f32 field_0x71c; /* 0x720 */ f32 field_0x720; /* 0x724 */ s16 field_0x724; diff --git a/include/d/d_meter_HIO.h b/include/d/d_meter_HIO.h index c0b6b247c5..e52051095f 100644 --- a/include/d/d_meter_HIO.h +++ b/include/d/d_meter_HIO.h @@ -104,12 +104,8 @@ public: /* 0x18 */ f32 mWindowPosX; /* 0x1C */ f32 mWindowPosY; /* 0x20 */ f32 mWindowScale; - /* 0x24 */ f32 mOptionTypeBGPosX[4]; - /* 0x34 */ f32 mTVsettingPosX; - /* 0x38 */ f32 mPointerCalibrationPosX; - /* 0x3C */ f32 mOptionTypeBGPosY[4]; - /* 0x4C */ f32 mTVsettingPosY; - /* 0x50 */ f32 mPointerCalibrationPosY; + /* 0x24 */ f32 mOptionTypeBGPosX[6]; + /* 0x3C */ f32 mOptionTypeBGPosY[6]; /* 0x54 */ f32 mBarScale[2]; // 0: mSelectBarScale | 1: mUnselectBarScale /* 0x5C */ f32 mBackgroundPosY; /* 0x60 */ f32 mArrowOffsetX; @@ -547,8 +543,7 @@ public: /* 0x1C */ f32 mVesselTalkPosY; /* 0x20 */ f32 mVesselPosX_4x3; /* 0x24 */ f32 mVesselPosY_4x3; - /* 0x28 */ f32 mVesselAlpha[3]; - /* 0x34 */ f32 mDropAlpha; + /* 0x28 */ f32 mVesselAlpha[4]; /* 0x38 */ JUtility::TColor mDropOnColorWhite; /* 0x3C */ JUtility::TColor mDropOnColorBlack; /* 0x40 */ JUtility::TColor mDropOffColorWhite; diff --git a/include/dusk/gx_helper.h b/include/dusk/gx_helper.h index bf81424c99..8f71cbdf26 100644 --- a/include/dusk/gx_helper.h +++ b/include/dusk/gx_helper.h @@ -5,6 +5,7 @@ #include #include +#include "tracy/Tracy.hpp" #define GX_DEBUG_GROUP(name, ...) \ do { \ @@ -51,4 +52,6 @@ struct GXScopedDebugGroup { } }; +#define GX_AND_TRACY_SCOPED(name) GXScopedDebugGroup scope(name); ZoneScopedN(name); + #endif // DUSK_GX_HELPER_H diff --git a/include/m_Do/m_Do_graphic.h b/include/m_Do/m_Do_graphic.h index 1d3d0d16fb..5a97f4a326 100644 --- a/include/m_Do/m_Do_graphic.h +++ b/include/m_Do/m_Do_graphic.h @@ -8,12 +8,14 @@ #include #endif +#define FB_WIDTH_BASE (608) +#define FB_HEIGHT_BASE (448) #if WIDESCREEN_SUPPORT && !TARGET_PC #define FB_WIDTH (640) #define FB_HEIGHT (456) #else -#define FB_WIDTH (608) -#define FB_HEIGHT (448) +#define FB_WIDTH FB_WIDTH_BASE +#define FB_HEIGHT FB_HEIGHT_BASE #endif int mDoGph_Create(); @@ -276,7 +278,7 @@ public: #if TARGET_PC static void onWide(f32 width, f32 height); - #else + #else static void onWide(); #endif diff --git a/libs/JSystem/src/J2DGraph/J2DMatBlock.cpp b/libs/JSystem/src/J2DGraph/J2DMatBlock.cpp index 6fbf8444be..bae96551be 100644 --- a/libs/JSystem/src/J2DGraph/J2DMatBlock.cpp +++ b/libs/JSystem/src/J2DGraph/J2DMatBlock.cpp @@ -1418,7 +1418,7 @@ bool J2DTevBlock8::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette* } else { texture->storeTIMG(p_timg, p_tlut); } - bool local_38[4]; + bool local_38[8]; for (u8 i = 0; i < 8; i++) { local_38[i] = (mUndeleteFlag & 1 << i) != 0; } diff --git a/libs/JSystem/src/J2DGraph/J2DPicture.cpp b/libs/JSystem/src/J2DGraph/J2DPicture.cpp index 8072c32d41..774b3d31af 100644 --- a/libs/JSystem/src/J2DGraph/J2DPicture.cpp +++ b/libs/JSystem/src/J2DGraph/J2DPicture.cpp @@ -511,6 +511,7 @@ void J2DPicture::drawSelf(f32 param_0, f32 param_1) { } void J2DPicture::drawSelf(f32 param_0, f32 param_1, Mtx* param_2) { + GX_AND_TRACY_SCOPED("J2DPicture::drawSelf") if (mTexture[0] != NULL && mTextureNum != 0) { drawFullSet(mGlobalBounds.i.x + param_0, mGlobalBounds.i.y + param_1, getWidth(), getHeight(), param_2); @@ -527,6 +528,7 @@ void J2DPicture::drawFullSet(f32 param_0, f32 param_1, f32 param_2, f32 param_3, void J2DPicture::draw(f32 x, f32 y, f32 width, f32 height, bool mirrorX, bool mirrorY, bool rotate90) { + GX_AND_TRACY_SCOPED("J2DPicture::draw") if (isVisible() && mTextureNum != 0 && mTexture[0] != NULL) { f32 x2 = x + width; f32 y2 = y + height; diff --git a/libs/JSystem/src/J2DGraph/J2DPictureEx.cpp b/libs/JSystem/src/J2DGraph/J2DPictureEx.cpp index 6c4048ba31..ba69048a4b 100644 --- a/libs/JSystem/src/J2DGraph/J2DPictureEx.cpp +++ b/libs/JSystem/src/J2DGraph/J2DPictureEx.cpp @@ -78,8 +78,21 @@ bool J2DPictureEx::prepareTexture(u8 param_0) { return true; } +#if TARGET_PC +bool checkAlphaCull(const J2DPictureEx* pic) { + return pic->mColorAlpha == 0; +} +#endif + void J2DPictureEx::drawSelf(f32 param_0, f32 param_1, f32 (*param_2)[3][4]) { + GX_AND_TRACY_SCOPED("J2DPictureEx::drawSelf") if (mMaterial != NULL) { +#if TARGET_PC + if (checkAlphaCull(this)) { + return; + } +#endif + mMaterial->setGX(); GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); diff --git a/libs/JSystem/src/J2DGraph/J2DScreen.cpp b/libs/JSystem/src/J2DGraph/J2DScreen.cpp index eec5ef057d..c44859046d 100644 --- a/libs/JSystem/src/J2DGraph/J2DScreen.cpp +++ b/libs/JSystem/src/J2DGraph/J2DScreen.cpp @@ -278,6 +278,8 @@ J2DPane* J2DScreen::searchUserInfo(u64 tag) { } void J2DScreen::drawSelf(f32 param_0, f32 param_1, Mtx* param_2) { + GX_AND_TRACY_SCOPED("J2DScreen::drawSelf") + JUtility::TColor color(mColor); u8 alpha = (color.a * mAlpha) / 255; diff --git a/libs/JSystem/src/J2DGraph/J2DTextBox.cpp b/libs/JSystem/src/J2DGraph/J2DTextBox.cpp index 86b36bdadf..970f120140 100644 --- a/libs/JSystem/src/J2DGraph/J2DTextBox.cpp +++ b/libs/JSystem/src/J2DGraph/J2DTextBox.cpp @@ -391,6 +391,8 @@ void J2DTextBox::drawSelf(f32 param_0, f32 param_1) { } void J2DTextBox::drawSelf(f32 param_0, f32 param_1, Mtx* p_mtx) { + GX_AND_TRACY_SCOPED("J2DTextBox::drawSelf") + Mtx m; J2DPrint print(mFont, mCharSpacing, mLineSpacing, mCharColor, mGradientColor, mBlackColor, diff --git a/libs/JSystem/src/J2DGraph/J2DTextBoxEx.cpp b/libs/JSystem/src/J2DGraph/J2DTextBoxEx.cpp index f615c44c8c..0911740898 100644 --- a/libs/JSystem/src/J2DGraph/J2DTextBoxEx.cpp +++ b/libs/JSystem/src/J2DGraph/J2DTextBoxEx.cpp @@ -93,6 +93,7 @@ J2DTextBoxEx::~J2DTextBoxEx() { } void J2DTextBoxEx::drawSelf(f32 param_0, f32 param_1, Mtx* p_mtx) { + GX_AND_TRACY_SCOPED("J2DTextBoxEx::drawSelf") Mtx m; JUTFont* font = NULL; diff --git a/libs/JSystem/src/J2DGraph/J2DWindow.cpp b/libs/JSystem/src/J2DGraph/J2DWindow.cpp index 35de369709..655dff4938 100644 --- a/libs/JSystem/src/J2DGraph/J2DWindow.cpp +++ b/libs/JSystem/src/J2DGraph/J2DWindow.cpp @@ -410,6 +410,8 @@ void J2DWindow::drawSelf(f32 param_0, f32 param_1) { } void J2DWindow::drawSelf(f32 param_0, f32 param_1, Mtx* param_2) { + GX_AND_TRACY_SCOPED("J2DWindow::drawSelf") + JGeometry::TBox2 stack_50(mBounds); stack_50.addPos(JGeometry::TVec2(param_0, param_1)); if (stack_50.getWidth() >= field_0x140 && stack_50.getHeight() >= field_0x142) { diff --git a/libs/JSystem/src/J2DGraph/J2DWindowEx.cpp b/libs/JSystem/src/J2DGraph/J2DWindowEx.cpp index b8c4e5f79e..fe4c5df9e6 100644 --- a/libs/JSystem/src/J2DGraph/J2DWindowEx.cpp +++ b/libs/JSystem/src/J2DGraph/J2DWindowEx.cpp @@ -122,6 +122,7 @@ J2DWindowEx::~J2DWindowEx() { } void J2DWindowEx::drawSelf(f32 param_0, f32 param_1, f32 (*param_2)[3][4]) { + GX_AND_TRACY_SCOPED("J2DWindowEx::drawSelf") JGeometry::TBox2 aTStack_50(mBounds); Mtx auStack_40; aTStack_50.addPos(JGeometry::TVec2(param_0, param_1)); diff --git a/libs/JSystem/src/JUtility/JUTResFont.cpp b/libs/JSystem/src/JUtility/JUTResFont.cpp index 10443d6404..206968f053 100644 --- a/libs/JSystem/src/JUtility/JUTResFont.cpp +++ b/libs/JSystem/src/JUtility/JUTResFont.cpp @@ -435,10 +435,10 @@ void JUTResFont::loadImage(int code, GXTexMapID id){ mHeight = cellRow * cellH; #if TARGET_PC - const auto found = mGlyphTextures->textures.find(code); + const auto found = mGlyphTextures->textures.find(pageIdx); GXTexObj* texObj; if (found == mGlyphTextures->textures.end()) { - texObj = &mGlyphTextures->textures[code]; + texObj = &mGlyphTextures->textures[pageIdx]; void* pImg = &mpGlyphBlocks[i]->data[pageIdx * mpGlyphBlocks[i]->textureSize]; GXInitTexObj(texObj, pImg, mpGlyphBlocks[i]->textureWidth, mpGlyphBlocks[i]->textureHeight, (GXTexFmt)(u16)mpGlyphBlocks[i]->textureFormat, diff --git a/src/DynamicLink.cpp b/src/DynamicLink.cpp index 5c5a2030d4..dae7da52de 100644 --- a/src/DynamicLink.cpp +++ b/src/DynamicLink.cpp @@ -14,6 +14,7 @@ #include "os_report.h" #include "dusk/logging.h" +#if !TARGET_PC DynamicModuleControlBase* DynamicModuleControlBase::mFirst; DynamicModuleControlBase* DynamicModuleControlBase::mLast; @@ -139,6 +140,7 @@ DynamicModuleControl::DynamicModuleControl(char const* name) { mSize = 0; mAsyncLoadCallback = NULL; } +#endif u32 DynamicModuleControl::sAllocBytes; @@ -169,6 +171,7 @@ bool DynamicModuleControl::initialize() { return true; } +#if !TARGET_PC bool DynamicModuleControl::callback(void* moduleControlPtr) { DynamicModuleControl* moduleControl = (DynamicModuleControl*)moduleControlPtr; return moduleControl->do_load(); @@ -484,3 +487,5 @@ extern "C" void ModuleDestructorsX(void (*const *dtors)()) { dtors++; } } + +#endif \ No newline at end of file diff --git a/src/c/c_dylink.cpp b/src/c/c_dylink.cpp index e6417ebbf8..f982c254ee 100644 --- a/src/c/c_dylink.cpp +++ b/src/c/c_dylink.cpp @@ -898,6 +898,9 @@ BOOL cDyl_IsLinked(s16 i_ProfName) { } BOOL cDyl_Unlink(s16 i_ProfName) { +#if TARGET_PC + return FALSE; +#else #if DEBUG cCc_Check(); #endif @@ -911,9 +914,13 @@ BOOL cDyl_Unlink(s16 i_ProfName) { } return FALSE; +#endif } int cDyl_LinkASync(s16 i_ProfName) { +#if TARGET_PC + return cPhs_COMPLEATE_e; +#else #if DEBUG cCc_Check(); #endif @@ -953,6 +960,7 @@ int cDyl_LinkASync(s16 i_ProfName) { } return cPhs_COMPLEATE_e; +#endif } static int cDyl_InitCallback(void* param_0) { diff --git a/src/d/actor/d_a_alink_dusk.cpp b/src/d/actor/d_a_alink_dusk.cpp index 95218268ac..ae4cb2e96c 100644 --- a/src/d/actor/d_a_alink_dusk.cpp +++ b/src/d/actor/d_a_alink_dusk.cpp @@ -9,11 +9,6 @@ void daAlink_c::handleQuickTransform() { return; } - // Ensure that link is not in a cutscene. - if (checkEventRun()) { - return; - } - // Check to see if Link has the ability to transform. if (!dComIfGs_isEventBit(dSv_event_flag_c::M_077)) { return; @@ -30,8 +25,20 @@ void daAlink_c::handleQuickTransform() { return; } + // Ensure that link is not in a cutscene. + if (checkEventRun()) { + Z2GetAudioMgr()->seStart(Z2SE_SYS_ERROR, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); + return; + } + mDoCPd_c::getCpadInfo(PAD_1).mPressedButtonFlags = 0; + // Don't allow quick transform while in the STAR tent. + if (checkStageName("R_SP161")) { + Z2GetAudioMgr()->seStart(Z2SE_SYS_ERROR, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); + return; + } + // Ensure that the Z Button is not dimmed if (meterDrawPtr->getButtonZAlpha() != 1.f) { Z2GetAudioMgr()->seStart(Z2SE_SYS_ERROR, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); diff --git a/src/d/actor/d_a_e_tk2.cpp b/src/d/actor/d_a_e_tk2.cpp index f0bbc2fe6c..30c0cce9df 100644 --- a/src/d/actor/d_a_e_tk2.cpp +++ b/src/d/actor/d_a_e_tk2.cpp @@ -398,7 +398,7 @@ static int daE_TK2_Execute(e_tk2_class* i_this) { cXyz cStack_94; cXyz cStack_a0; - if (i_this->mExecuteState == 0x00) { + if (i_this->mActionTimer[3] == 0x00) { dBgS_ObjGndChk_Spl ground_check; cStack_94 = actor->current.pos; cStack_94.y += 200.0f; @@ -602,7 +602,7 @@ static int daE_TK2_Create(fopAc_ac_c* actor) { i_this->mSound.init(&actor->current.pos, &actor->eyePos, 0x3, 0x1); i_this->mSound.setEnemyName("E_tk2"); i_this->mAtInfo.mpSound = &i_this->mSound; - i_this->mExecuteState = 0x14; + i_this->mActionTimer[3] = 0x14; daE_TK2_Execute(i_this); } return phase; diff --git a/src/d/actor/d_a_e_vt.cpp b/src/d/actor/d_a_e_vt.cpp index d92992f22b..305e212401 100644 --- a/src/d/actor/d_a_e_vt.cpp +++ b/src/d/actor/d_a_e_vt.cpp @@ -167,6 +167,30 @@ static dCcD_SrcSph cc_vt_magic_src = { } // mSphAttr }; +// !@bug The i<40 loops that index these arrays read one element past the end; on +// GC/Wii the OOB reads land on adjacent rodata instead of a defined value. +#if AVOID_UB +static u8 va_tag_set_size[40] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x00, +}; + +static u8 va_tag_set_num[40] = { + 0x01, 0x0C, 0x16, 0x1F, 0x21, 0x2A, 0x2B, 0x02, 0x04, 0x0D, 0x0F, 0x15, 0x18, + 0x20, 0x2C, 0x03, 0x05, 0x06, 0x0B, 0x10, 0x17, 0x19, 0x1A, 0x22, 0x24, 0x29, + 0x2D, 0x34, 0x49, 0x52, 0x36, 0x3E, 0x54, 0x5C, 0x39, 0x41, 0x4C, 0x56, 0x5E, + 0x00, +}; + +static f32 va_tag_offset[40] = { + 20.0f, 20.0f, 20.0f, 20.0f, 20.0f, 0.0f, 40.0f, 0.0f, 30.0f, 10.0f, 0.0f, 0.0f, 20.0f, + 0.0f, 10.0f, 20.0f, 40.0f, 0.0f, 20.0f, 0.0f, 0.0f, 20.0f, 0.0f, 10.0f, 0.0f, 0.0f, + 20.0f, 10.0f, 20.0f, 30.0f, 0.0f, 10.0f, 20.0f, 0.0f, 0.0f, 10.0f, 20.0f, 30.0f, 0.0f, + 0.0f, +}; +#else static u8 va_tag_set_size[39] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, @@ -184,6 +208,7 @@ static f32 va_tag_offset[39] = { 0.0f, 10.0f, 20.0f, 40.0f, 0.0f, 20.0f, 0.0f, 0.0f, 20.0f, 0.0f, 10.0f, 0.0f, 0.0f, 20.0f, 10.0f, 20.0f, 30.0f, 0.0f, 10.0f, 20.0f, 0.0f, 0.0f, 10.0f, 20.0f, 30.0f, 0.0f, }; +#endif } // namespace diff --git a/src/d/actor/d_a_obj_tombo.cpp b/src/d/actor/d_a_obj_tombo.cpp index 48db14ac92..6fcbc938d9 100644 --- a/src/d/actor/d_a_obj_tombo.cpp +++ b/src/d/actor/d_a_obj_tombo.cpp @@ -411,7 +411,7 @@ void daObjTOMBO_c::BoomChk() { speedF = 5.0f; field_0x71c = 5.0f; mIsHitByBoomerang = false; - field_0x718 = 100; + field_0x714[2] = 100; mpMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Tombo", 6), 2, 5.0f, 1.0f, 0.0f, -1.0f); home.pos = current.pos; @@ -422,7 +422,7 @@ void daObjTOMBO_c::BoomChk() { mIsHitByBoomerang = false; speedF = 5.0f; field_0x71c = 5.0f; - field_0x718 = 100; + field_0x714[2] = 100; mpMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Tombo", 6), 2, 5.0f, 1.0f, 0.0f, -1.0f); current.pos.y = old.pos.y = playerPos.y + 100.0f; diff --git a/src/d/d_camera.cpp b/src/d/d_camera.cpp index 760556e7ae..0047978e7e 100644 --- a/src/d/d_camera.cpp +++ b/src/d/d_camera.cpp @@ -2180,9 +2180,9 @@ fopAc_ac_c* dCamera_c::getParamTargetActor(s32 param_0) { daAlink_c* player = daAlink_getAlinkActorClass(); fopAc_ac_c* result; - u32* name = (u32*)(mCamTypeData[param_0].name + 16); + BE(u32)* name = (BE(u32)*)(mCamTypeData[param_0].name + 16); //name += 16; - switch (*name) { + switch ((u32)*name) { case '@LOC': result = dComIfGp_getAttention()->LockonTarget(0); break; diff --git a/src/d/d_com_inf_game.cpp b/src/d/d_com_inf_game.cpp index b910b8290d..7397653989 100644 --- a/src/d/d_com_inf_game.cpp +++ b/src/d/d_com_inf_game.cpp @@ -1026,7 +1026,7 @@ bool dComIfG_inf_c::baseCsr_c::navi_c::draw(f32 param_1, f32 param_2, u8 param_3 f32 f27 = f31 - field_0x5c; field_0x58 = f29; field_0x5c = f31; - cXyz spdc(param_1 - 304.0f, param_2 - 224.0f, 0.0f); + cXyz spdc(param_1 - FB_WIDTH_BASE / 2, param_2 - FB_HEIGHT_BASE / 2, 0.0f); f32 target = param_3 != 0 ? 1.5f : 0.0f; diff --git a/src/d/d_drawlist.cpp b/src/d/d_drawlist.cpp index 8a564914c0..1474b6f24d 100644 --- a/src/d/d_drawlist.cpp +++ b/src/d/d_drawlist.cpp @@ -10,6 +10,11 @@ #include "SSystem/SComponent/c_math.h" #include "d/d_com_inf_game.h" #include "d/d_drawlist.h" + +#include + +#include "absl/container/flat_hash_map.h" +#include "client/TracyScoped.hpp" #include "d/d_s_play.h" #include "dusk/frame_interpolation.h" #include "dusk/gx_helper.h" @@ -1923,14 +1928,32 @@ int dDlst_list_c::set(dDlst_base_c**& p_start, dDlst_base_c**& p_end, dDlst_base return 1; } +#if TARGET_PC && (TRACY_ENABLE || PARTIAL_DEBUG) +static absl::flat_hash_map typeDrawNames; + +static const char* getTypeDrawName(dDlst_base_c* dlst) { + const auto& info = typeid(*dlst); + auto& elem = typeDrawNames[info]; + if (elem) [[likely]] { + return elem; + } + + const auto size = snprintf(nullptr, 0, "%s::draw()", info.name()); + // Note: pointer is intentionally never freed, Tracy needs it. + const auto buf = static_cast(malloc(size+1)); + snprintf(buf, size+1, "%s::draw()", info.name()); + elem = buf; + return buf; +} +#endif + void dDlst_list_c::draw(dDlst_base_c** p_start, dDlst_base_c** p_end) { for (; p_start < p_end; p_start++) { dDlst_base_c* dlst = *p_start; -#if DEBUG && TARGET_PC - char buf[64]; - snprintf(buf, sizeof(buf), "%s::draw()", typeid(dlst).name()); - GXScopedDebugGroup scope(buf); +#if TARGET_PC && (TRACY_ENABLE || PARTIAL_DEBUG) + const auto name = getTypeDrawName(dlst); + GXScopedDebugGroup scope(name); #endif dlst->draw(); } diff --git a/src/d/d_file_select.cpp b/src/d/d_file_select.cpp index 80b9748cfe..8fb441a91f 100644 --- a/src/d/d_file_select.cpp +++ b/src/d/d_file_select.cpp @@ -5591,7 +5591,7 @@ void dFile_select3D_c::toItem3Dpos(f32 param_0, f32 param_1, f32 param_2, cXyz* Mtx adStack_98; Mtx auStack_c8; param_0 = (2.0f * ((param_0 - mDoGph_gInf_c::getMinXF()) / mDoGph_gInf_c::getWidthF()) - 1.0f); - param_1 = (2.0f * ((param_1 - -100.0f) / 448.0f) - 1.0f); + param_1 = (2.0f * ((param_1 - -100.0f) / FB_HEIGHT_BASE) - 1.0f); calcViewMtx(adStack_98); cMtx_inverse(adStack_98, auStack_c8); f32 tangent = std::tan(M_PI / 8.0f); diff --git a/src/d/d_jcam_editor.cpp b/src/d/d_jcam_editor.cpp index 2d0d315e73..8d9ba72455 100644 --- a/src/d/d_jcam_editor.cpp +++ b/src/d/d_jcam_editor.cpp @@ -1,11 +1,12 @@ #include "d/d_jcam_editor.h" +#include "m_Do/m_Do_graphic.h" #include "m_Do/m_Do_hostIO.h" #include "m_Do/m_Do_ext.h" dJcame_c* dJcame_c::m_myObj; dJcame_c::dJcame_c(const JStage::TSystem* i_system, f32 param_1, JUTGamePad& i_pad) { - mOrthoGraph = JKR_NEW J2DOrthoGraph(0.0f, 0.0f, 608.0f, 448.0f, -1.0f, 1.0f); + mOrthoGraph = JKR_NEW J2DOrthoGraph(0.0f, 0.0f, FB_WIDTH_BASE, FB_HEIGHT_BASE, -1.0f, 1.0f); mFont = JKR_NEW JUTResFont((ResFONT*)JUTResFONT_Ascfont_fix12, NULL); mHeap = JKRExpHeap::create(0x100000, JKRHeap::getRootHeap2(), false); diff --git a/src/d/d_kankyo.cpp b/src/d/d_kankyo.cpp index 8644d433aa..753be77a40 100644 --- a/src/d/d_kankyo.cpp +++ b/src/d/d_kankyo.cpp @@ -10994,9 +10994,9 @@ void dKy_depth_dist_set(void* process_p) { if ((sp30.x >= 0.0f && sp30.x < FB_WIDTH) && (sp30.y >= 0.0f && #if DEBUG - sp30.y < 608.0f + sp30.y < FB_WIDTH_BASE #else - sp30.y < 600.0f + sp30.y < (FB_WIDTH_BASE - 8) #endif )) { cXyz sp18; diff --git a/src/d/d_menu_collect.cpp b/src/d/d_menu_collect.cpp index 72a390a0cc..c7e5bb7414 100644 --- a/src/d/d_menu_collect.cpp +++ b/src/d/d_menu_collect.cpp @@ -2708,7 +2708,7 @@ void dMenu_Collect3D_c::toItem3Dpos(f32 param_0, f32 param_1, f32 param_2, cXyz* Mtx auStack_c8; param_0 = (2.0f * ((param_0 - mDoGph_gInf_c::getMinXF()) / mDoGph_gInf_c::getWidthF()) - 1.0f); - param_1 = (2.0f * ((param_1 - -100.0f) / 448.0f) - 1.0f); + param_1 = (2.0f * ((param_1 - -100.0f) / FB_HEIGHT_BASE) - 1.0f); calcViewMtx(adStack_98); MTXInverse(adStack_98, auStack_c8); f32 tangent = tan(0.39269909262657166); diff --git a/src/d/d_menu_fmap.cpp b/src/d/d_menu_fmap.cpp index 851e22b7c7..652f3a06c5 100644 --- a/src/d/d_menu_fmap.cpp +++ b/src/d/d_menu_fmap.cpp @@ -229,17 +229,17 @@ dMenu_Fmap_c::dMenu_Fmap_c(JKRExpHeap* i_heap, STControl* i_stick, CSTControl* i } if (i_panDirection == 1) { - mTransX = -608.0f; + mTransX = -FB_WIDTH_BASE; mTransY = 0.0f; } else if (i_panDirection == 3) { - mTransX = 608.0f; + mTransX = FB_WIDTH_BASE; mTransY = 0.0f; } else if (i_panDirection == 2) { mTransX = 0.0f; - mTransY = -448.0f; + mTransY = -FB_HEIGHT_BASE; } else if (i_panDirection == 0) { mTransX = 0.0f; - mTransY = 448.0f; + mTransY = FB_HEIGHT_BASE; } else { mTransX = 0.0f; mTransY = 0.0f; @@ -1705,17 +1705,17 @@ bool dMenu_Fmap_c::isOpen() { f32 ratio = (f32)mDisplayFrame / (f32)display_frame_num; if (mPanDirection == 1) { - mTransX = (1.0f - ratio) * -608.0f; + mTransX = (1.0f - ratio) * -FB_WIDTH_BASE; mTransY = 0.0f; } else if (mPanDirection == 3) { - mTransX = (1.0f - ratio) * 608.0f; + mTransX = (1.0f - ratio) * FB_WIDTH_BASE; mTransY = 0.0f; } else if (mPanDirection == 2) { mTransX = 0.0f; - mTransY = (1.0f - ratio) * -448.0f; + mTransY = (1.0f - ratio) * -FB_HEIGHT_BASE; } else if (mPanDirection == 0) { mTransX = 0.0f; - mTransY = (1.0f - ratio) * 448.0f; + mTransY = (1.0f - ratio) * FB_HEIGHT_BASE; } mAlphaRatio = ratio; @@ -1755,17 +1755,17 @@ bool dMenu_Fmap_c::isClose() { } if (mPanDirection == 1) { - mTransX = (1.0f - ratio) * 608.0f; + mTransX = (1.0f - ratio) * FB_WIDTH_BASE; mTransY = 0.0f; } else if (mPanDirection == 3) { - mTransX = (1.0f - ratio) * -608.0f; + mTransX = (1.0f - ratio) * -FB_WIDTH_BASE; mTransY = 0.0f; } else if (mPanDirection == 2) { mTransX = 0.0f; - mTransY = (1.0f - ratio) * 448.0f; + mTransY = (1.0f - ratio) * FB_HEIGHT_BASE; } else if (mPanDirection == 0) { mTransX = 0.0f; - mTransY = (1.0f - ratio) * -448.0f; + mTransY = (1.0f - ratio) * -FB_HEIGHT_BASE; } mAlphaRatio = ratio; diff --git a/src/d/d_menu_insect.cpp b/src/d/d_menu_insect.cpp index 7558fe61b4..88e05226e8 100644 --- a/src/d/d_menu_insect.cpp +++ b/src/d/d_menu_insect.cpp @@ -183,6 +183,9 @@ void dMenu_Insect_c::_draw() { mpExpScreen->draw(0.0f, 0.0f, grafPort); mpSelect_c->setOffsetX(g_drawHIO.mInsectListScreen.mConfirmOptionPosX_4x3); + // the magic numbers here are correlated with the framebuffer size, but + // were likely either chosen by hand or had multiple arithmetic + // operations applied which cannot easily be reverse engineered mpSelect_c->translate(g_drawHIO.mInsectListScreen.mConfirmOptionPosX_4x3 + 486.0f, g_drawHIO.mInsectListScreen.mConfirmOptionPosY_4x3 + 209.0f); mpSelect_c->draw(0.0f, 0.0f); diff --git a/src/d/d_menu_item_explain.cpp b/src/d/d_menu_item_explain.cpp index c106b4bd8c..dd3af54571 100644 --- a/src/d/d_menu_item_explain.cpp +++ b/src/d/d_menu_item_explain.cpp @@ -330,6 +330,9 @@ void dMenu_ItemExplain_c::draw(J2DOrthoGraph* i_graph) { mpInfoString->drawOutFontLocal((J2DTextBox*)mpInfoText->getPanePtr(), -1.0f); drawKantera(); if (mpSelect_c != NULL) { + // the magic numbers here are correlated with the framebuffer size, but + // were likely either chosen by hand or had multiple arithmetic + // operations applied which cannot easily be reverse engineered mpSelect_c->translate(486.0f, 209.0f); mpSelect_c->draw(0.0f, 0.0f); } diff --git a/src/d/d_menu_ring.cpp b/src/d/d_menu_ring.cpp index 3949adffed..8e5b3cacd2 100644 --- a/src/d/d_menu_ring.cpp +++ b/src/d/d_menu_ring.cpp @@ -87,16 +87,16 @@ dMenu_Ring_c::dMenu_Ring_c(JKRExpHeap* i_heap, STControl* i_stick, CSTControl* i mPikariFlashingSpeed = 0.0f; if (mRingOrigin == 0) { mCenterPosX = 0.0f; - mCenterPosY = 448.0f; + mCenterPosY = FB_HEIGHT_BASE; } else if (mRingOrigin == 2) { mCenterPosX = 0.0f; - mCenterPosY = -448.0f; + mCenterPosY = -FB_HEIGHT_BASE; } if (mRingOrigin == 3) { - mCenterPosX = 608.0f; + mCenterPosX = FB_WIDTH_BASE; mCenterPosY = 0.0f; } else if (mRingOrigin == 1) { - mCenterPosX = -608.0f; + mCenterPosX = -FB_WIDTH_BASE; mCenterPosY = 0.0f; } else { mCenterPosX = 0.0f; @@ -644,15 +644,15 @@ bool dMenu_Ring_c::isOpen() { mAlphaRate = (f32)mOpenCloseFrames / (f32)g_ringHIO.mOpenFrames; if (mRingOrigin == 0) { mCenterPosX = 0.0f; - mCenterPosY = (1.0f - mAlphaRate) * 448.0f; + mCenterPosY = (1.0f - mAlphaRate) * FB_HEIGHT_BASE; } else if (mRingOrigin == 2) { mCenterPosX = 0.0f; - mCenterPosY = (1.0f - mAlphaRate) * -448.0f; + mCenterPosY = (1.0f - mAlphaRate) * -FB_HEIGHT_BASE; } else if (mRingOrigin == 3) { - mCenterPosX = (1.0f - mAlphaRate) * 608.0f; + mCenterPosX = (1.0f - mAlphaRate) * FB_WIDTH_BASE; mCenterPosY = 0.0f; } else if (mRingOrigin == 1) { - mCenterPosX = (1.0f - mAlphaRate) * -608.0f; + mCenterPosX = (1.0f - mAlphaRate) * -FB_WIDTH_BASE; mCenterPosY = 0.0f; } if (mOpenCloseFrames >= g_ringHIO.mOpenFrames) { @@ -715,15 +715,15 @@ bool dMenu_Ring_c::isClose() { } if (mRingOrigin == 0) { mCenterPosX = 0.0f; - mCenterPosY = (1.0f - mAlphaRate) * -448.0f; + mCenterPosY = (1.0f - mAlphaRate) * -FB_HEIGHT_BASE; } else if (mRingOrigin == 2) { mCenterPosX = 0.0f; - mCenterPosY = (1.0f - mAlphaRate) * 448.0f; + mCenterPosY = (1.0f - mAlphaRate) * FB_HEIGHT_BASE; } else if (mRingOrigin == 3) { - mCenterPosX = (1.0f - mAlphaRate) * -608.0f; + mCenterPosX = (1.0f - mAlphaRate) * -FB_WIDTH_BASE; mCenterPosY = 0.0f; } else if (mRingOrigin == 1) { - mCenterPosX = (1.0f - mAlphaRate) * 608.0f; + mCenterPosX = (1.0f - mAlphaRate) * FB_WIDTH_BASE; mCenterPosY = 0.0f; } mpDrawCursor->setPos(mItemSlotPosX[mCurrentSlot] + mCenterPosX, @@ -855,11 +855,11 @@ s16 dMenu_Ring_c::calcStickAngle(STControl* i_stick, u8 param_1) { } void dMenu_Ring_c::setRotate() { - clacEllipsePlotAverage(mItemsTotal, g_ringHIO.mItemRingPosX + 304.0f, - g_ringHIO.mItemRingPosY + 224.0f); + clacEllipsePlotAverage(mItemsTotal, g_ringHIO.mItemRingPosX + FB_WIDTH_BASE / 2, + g_ringHIO.mItemRingPosY + FB_HEIGHT_BASE / 2); for (int i = 0; i < mItemsTotal; i++) { - field_0x63e[i] = cM_atan2s(mItemSlotPosX[i] - (304.0f + g_ringHIO.mItemRingPosX), - mItemSlotPosY[i] - (224.0f + g_ringHIO.mItemRingPosY)); + field_0x63e[i] = cM_atan2s(mItemSlotPosX[i] - (FB_WIDTH_BASE / 2 + g_ringHIO.mItemRingPosX), + mItemSlotPosY[i] - (FB_HEIGHT_BASE / 2 + g_ringHIO.mItemRingPosY)); } } @@ -1446,9 +1446,9 @@ void dMenu_Ring_c::stick_move_proc() { setStatus(field_0x6b2); } else { f32 itemRingPosX = - g_ringHIO.mItemRingPosX + 304.0f + mRingRadiusH * cM_ssin(field_0x66e); + g_ringHIO.mItemRingPosX + FB_WIDTH_BASE / 2 + mRingRadiusH * cM_ssin(field_0x66e); f32 itemRingPosY = - g_ringHIO.mItemRingPosY + 224.0f + mRingRadiusV * cM_scos(field_0x66e); + g_ringHIO.mItemRingPosY + FB_HEIGHT_BASE / 2 + mRingRadiusV * cM_scos(field_0x66e); mpDrawCursor->setPos(itemRingPosX, itemRingPosY); } } diff --git a/src/d/d_meter2_draw.cpp b/src/d/d_meter2_draw.cpp index 28f25aa0cd..417dcad319 100644 --- a/src/d/d_meter2_draw.cpp +++ b/src/d/d_meter2_draw.cpp @@ -1562,6 +1562,7 @@ void dMeter2Draw_c::setAlphaLifeAnimeMax() { } void dMeter2Draw_c::drawKanteraScreen(u8 i_meterType) { + GX_AND_TRACY_SCOPED("drawKanteraScreen"); J2DGrafContext* graf_ctx = dComIfGp_getCurrentGrafPort(); mpMagicParent->setAlphaRate(mMeterAlphaRate[i_meterType]); diff --git a/src/d/d_meter2_info.cpp b/src/d/d_meter2_info.cpp index 7307755c04..bb533e6370 100644 --- a/src/d/d_meter2_info.cpp +++ b/src/d/d_meter2_info.cpp @@ -205,11 +205,11 @@ void dMeter2Info_c::init() { unk_0x5c = 0.0f; unk_0x60 = 1.0f; unk_0x64 = 30.0f; - unk_0x68 = 304.0f; - unk_0x6c = 224.0f; + unk_0x68 = FB_WIDTH_BASE / 2; + unk_0x6c = FB_HEIGHT_BASE / 2; - m2DWidth = 608.0f; - m2DHeight = 448.0f; + m2DWidth = FB_WIDTH_BASE; + m2DHeight = FB_HEIGHT_BASE; m2DPosH = 0.0f; m2DPosV = 0.0f; unk_0x80 = 0.0f; diff --git a/src/d/d_meter_HIO.cpp b/src/d/d_meter_HIO.cpp index c23e6c3230..0566494863 100644 --- a/src/d/d_meter_HIO.cpp +++ b/src/d/d_meter_HIO.cpp @@ -197,11 +197,11 @@ void dMeter_drawOptionHIO_c::genMessage(JORMContext* mctx) { mctx->genSlider("位置X", &mOptionTypeBGPosX[3], -300.0f, 300.0f); mctx->genSlider("位置Y", &mOptionTypeBGPosY[3], -300.0f, 300.0f); mctx->genLabel("*****テレビ画面の設定*****", 0); - mctx->genSlider("位置X", &mTVsettingPosX, -300.0f, 300.0f); - mctx->genSlider("位置Y", &mTVsettingPosY, -300.0f, 300.0f); + mctx->genSlider("位置X", &mOptionTypeBGPosX[4], -300.0f, 300.0f); + mctx->genSlider("位置Y", &mOptionTypeBGPosY[4], -300.0f, 300.0f); mctx->genLabel("*****キャリブレーション*****", 0); - mctx->genSlider("位置X", &mPointerCalibrationPosX, -300.0f, 300.0f); - mctx->genSlider("位置Y", &mPointerCalibrationPosY, -300.0f, 300.0f); + mctx->genSlider("位置X", &mOptionTypeBGPosX[5], -300.0f, 300.0f); + mctx->genSlider("位置Y", &mOptionTypeBGPosY[5], -300.0f, 300.0f); mctx->genLabel("*****設定確認*****", 0); mctx->genSlider("背景アルファ", &mBackgroundAlpha, 0, 255); mctx->genSlider("位置Y", &mBackgroundPosY, -300.0f, 300.0f); @@ -1493,7 +1493,7 @@ dMeter_drawLightDropHIO_c::dMeter_drawLightDropHIO_c() { mPikariInterval = 1; field_0x54 = 0xFFF1; mVesselAlpha[2] = 0.5f; - mDropAlpha = 1.0f; + mVesselAlpha[3] = 1.0f; mDropOnColorBlack.set(30, 255, 255, 0); mDropOnColorWhite.set(255, 255, 255, 255); @@ -1554,7 +1554,7 @@ void dMeter_drawLightDropHIO_c::genMessage(JORMContext* mctx) { mctx->genSlider("位置調整Y(会話)", &mVesselTalkPosY, -300.0f, 300.0f); mctx->genSlider("アルファ(会話)", &mVesselAlpha[1], 0.0f, 1.0f); mctx->genSlider("アルファ(器)", &mVesselAlpha[2], 0.0f, 1.0f); - mctx->genSlider("アルファ(雫)", &mDropAlpha, 0.0f, 1.0f); + mctx->genSlider("アルファ(雫)", &mVesselAlpha[3], 0.0f, 1.0f); mctx->genLabel("***光の器ゲット後***", 0); mctx->genSlider("拡大縮小", &mDropGetScale, 0.0f, 3.0f); mctx->genSlider("拡縮アニメフレーム数", &mDropGetScaleAnimFrameNum, 0, 30); @@ -4010,9 +4010,9 @@ void dMeter_fmapHIO_c::genMessage(JORMContext* mctx) { mctx->genSlider("リージョン拡大表示範囲", &mRegionZoomRange, 1000.0, 1000000.0); mctx->genCheckBox("表示基準領域枠表示", (u8*)&mDisplayReferenceArea, 0x1); mctx->genCheckBox("スクロール範囲を表示基準", (u8*)&field_0x308, 0x1); - mctx->genSlider("左上座標X", &mMapTopLeftPosX, 0.0, 608.0); - mctx->genSlider("左上座標Y", &mMapTopLeftPosY, 0.0, 448.0); - mctx->genSlider("領域幅", &mMapScale, 0.0, 608.0); + mctx->genSlider("左上座標X", &mMapTopLeftPosX, 0.0, FB_WIDTH_BASE); + mctx->genSlider("左上座標Y", &mMapTopLeftPosY, 0.0, FB_HEIGHT_BASE); + mctx->genSlider("領域幅", &mMapScale, 0.0, FB_WIDTH_BASE); mctx->genLabel("\n*** スクロール速度境界 ***", 0); mctx->genSlider("0~遅", &mScrollSpeedSlowBound, 0.0, 1.0); mctx->genSlider("遅~速", &mScrollSpeedFastBound, 0.0, 1.0); diff --git a/src/d/d_meter_button.cpp b/src/d/d_meter_button.cpp index 5de89f1da3..88f750d6ca 100644 --- a/src/d/d_meter_button.cpp +++ b/src/d/d_meter_button.cpp @@ -1035,7 +1035,7 @@ void dMeterButton_c::screenInitButton() { } field_0x4b0 = 0; - mParentCenterX = (608.0f / 2) - mpParent->getInitCenterPosX(); + mParentCenterX = (FB_WIDTH_BASE / 2.0f) - mpParent->getInitCenterPosX(); paneTrans(mpParent, mParentCenterX, 0.0f, 0xFF); mpButtonA = JKR_NEW CPaneMgr(mpButtonScreen, MULTI_CHAR('abtn_n'), 2, NULL); diff --git a/src/d/d_meter_haihai.cpp b/src/d/d_meter_haihai.cpp index e51e0b070e..daf30b9aae 100644 --- a/src/d/d_meter_haihai.cpp +++ b/src/d/d_meter_haihai.cpp @@ -99,28 +99,28 @@ void dMeterHaihai_c::draw() { } if (direction & DIR_DOWN_e || i_forceDraw) { - mpParent->getPanePtr()->translate(x_pos[0] + 304.0f, y_pos[0] + 224.0f); + mpParent->getPanePtr()->translate(x_pos[0] + FB_WIDTH_BASE / 2, y_pos[0] + FB_HEIGHT_BASE / 2); mpParent->getPanePtr()->rotate(mpParent->getPanePtr()->getWidth() / 2, mpParent->getPanePtr()->getHeight() / 2, ROTATE_Z, 0.0f); mpHaihaiScreen->draw(0.0f, 0.0f, dComIfGp_getCurrentGrafPort()); } if (direction & DIR_RIGHT_e || i_forceDraw) { - mpParent->getPanePtr()->translate(x_pos[1] + 304.0f, y_pos[1] + 224.0f); + mpParent->getPanePtr()->translate(x_pos[1] + FB_WIDTH_BASE / 2, y_pos[1] + FB_HEIGHT_BASE / 2); mpParent->getPanePtr()->rotate(mpParent->getPanePtr()->getWidth() / 2, mpParent->getPanePtr()->getHeight() / 2, ROTATE_Z, 90.0f); mpHaihaiScreen->draw(0.0f, 0.0f, dComIfGp_getCurrentGrafPort()); } if (direction & DIR_UP_e || i_forceDraw) { - mpParent->getPanePtr()->translate(x_pos[0] + 304.0f, 224.0f - y_pos[0]); + mpParent->getPanePtr()->translate(x_pos[0] + FB_WIDTH_BASE / 2, FB_HEIGHT_BASE / 2 - y_pos[0]); mpParent->getPanePtr()->rotate(mpParent->getPanePtr()->getWidth() / 2, mpParent->getPanePtr()->getHeight() / 2, ROTATE_Z, 180.0f); mpHaihaiScreen->draw(0.0f, 0.0f, dComIfGp_getCurrentGrafPort()); } if (direction & DIR_LEFT_e || i_forceDraw) { - mpParent->getPanePtr()->translate(304.0f - x_pos[1], y_pos[1] + 224.0f); + mpParent->getPanePtr()->translate(FB_WIDTH_BASE / 2 - x_pos[1], y_pos[1] + FB_HEIGHT_BASE / 2); mpParent->getPanePtr()->rotate(mpParent->getPanePtr()->getWidth() / 2, mpParent->getPanePtr()->getHeight() / 2, ROTATE_Z, 270.0f); mpHaihaiScreen->draw(0.0f, 0.0f, dComIfGp_getCurrentGrafPort()); @@ -128,8 +128,8 @@ void dMeterHaihai_c::draw() { } void dMeterHaihai_c::drawHaihai(u8 i_direction) { - f32 center_x = 304.0f; - f32 center_y = 224.0f; + f32 center_x = FB_WIDTH_BASE / 2; + f32 center_y = FB_HEIGHT_BASE / 2; if (mType == 1) { center_x += (3.0f + g_drawHIO.mScrollArrowCenterPosX); diff --git a/src/d/d_msg_flow.cpp b/src/d/d_msg_flow.cpp index d487b8f7bd..c461b179e1 100644 --- a/src/d/d_msg_flow.cpp +++ b/src/d/d_msg_flow.cpp @@ -2234,7 +2234,13 @@ int dMsgFlow_c::event027(mesg_flow_node_event* i_flowNode_p, fopAc_ac_c* i_speak u16 prm0; getParam(&prm0, &prm1, i_flowNode_p->params); + // !@bug aParam8 is undersized; getParam always writes 4 bytes, stomping the + // 2 bytes past the buffer. Harmless on GC/Wii (MWCC stack layout absorbs it). +#if AVOID_UB + u8 aParam8[4]; +#else u8 aParam8[2]; +#endif getParam(aParam8, i_flowNode_p->params); JUT_ASSERT(4509, (aParam8[0] >= 0 && aParam8[0] <= dSv_player_item_c::BOMB_BAG_MAX) || (aParam8[0] == 4)); diff --git a/src/d/d_msg_scrn_explain.cpp b/src/d/d_msg_scrn_explain.cpp index de4ee0caf0..945f75e927 100644 --- a/src/d/d_msg_scrn_explain.cpp +++ b/src/d/d_msg_scrn_explain.cpp @@ -70,7 +70,7 @@ dMsgScrnExplain_c::dMsgScrnExplain_c(STControl* i_stick, u8 param_1, bool i_isUs mpTxScreen = JKR_NEW J2DScreen(); JUT_ASSERT(102, mpTxScreen != NULL); - field_0x48 = 608.0f; + field_0x48 = FB_WIDTH_BASE; if (param_1 == 1 || param_1 == 3) { #if PLATFORM_GCN @@ -309,7 +309,7 @@ void dMsgScrnExplain_c::draw(J2DOrthoGraph* i_graf) { } if (mpBackTex != NULL) { - mpBackTex->draw(0.0f, 0.0f, 608.0f, 448.0f, false, false, false); + mpBackTex->draw(0.0f, 0.0f, FB_WIDTH_BASE, FB_HEIGHT_BASE, false, false, false); } if (field_0x66 != 2 && field_0x66 != 3) { @@ -330,6 +330,9 @@ void dMsgScrnExplain_c::draw(J2DOrthoGraph* i_graf) { strcpy(((J2DTextBox*)mpTm_c[0]->getPanePtr())->getStringPtr(), string_buf); if (mpSelect_c != NULL && (field_0x64 == 1 || field_0x64 == 2)) { + // the magic numbers here are relative to the framebuffer size, but were likely + // either chosen by hand or had multiple arithmetic operations applied which + // cannot easily be reverse engineered f32 y_offset = 0.0f; if (field_0x66 == 2) { y_offset = -100.0f; @@ -385,7 +388,7 @@ void dMsgScrnExplain_c::open_request_proc() { void dMsgScrnExplain_c::open_init() { field_0x5a = 0; - field_0x48 = 608.0f; + field_0x48 = FB_WIDTH_BASE; for (int i = 0; i < 2; i++) { mpRoot_c[i]->setAlphaRate(0.0f); } @@ -403,7 +406,7 @@ void dMsgScrnExplain_c::open_proc() { } } - field_0x48 = 608.0f * getAlphaRatio(); + field_0x48 = FB_WIDTH_BASE * getAlphaRatio(); for (int i = 0; i < 2; i++) { mpRoot_c[i]->setAlphaRate(1.0f - getAlphaRatio()); } @@ -583,7 +586,7 @@ void dMsgScrnExplain_c::close_proc() { } } - field_0x48 = 608.0f * getAlphaRatio(); + field_0x48 = FB_WIDTH_BASE * getAlphaRatio(); for (int i = 0; i < 2; i++) { mpRoot_c[i]->setAlphaRate(1.0f - getAlphaRatio()); } diff --git a/src/d/d_msg_scrn_item.cpp b/src/d/d_msg_scrn_item.cpp index 40732eff25..53ef97607c 100644 --- a/src/d/d_msg_scrn_item.cpp +++ b/src/d/d_msg_scrn_item.cpp @@ -609,6 +609,9 @@ void dMsgScrnItem_c::fukiPosCalc(u8 param_1) { field_0x180 = 0.0f; field_0x19c = param_1; f32 yOffset; + // the magic numbers here are correlated with the framebuffer size, but + // were likely either chosen by hand or had multiple arithmetic + // operations applied which cannot easily be reverse engineered switch(field_0x19c) { case 1: yOffset = g_MsgObject_HIO_c.mBoxPos[2][3]; diff --git a/src/d/d_msg_scrn_talk.cpp b/src/d/d_msg_scrn_talk.cpp index 546e42112f..68b471a14d 100644 --- a/src/d/d_msg_scrn_talk.cpp +++ b/src/d/d_msg_scrn_talk.cpp @@ -454,11 +454,11 @@ void dMsgScrnTalk_c::fukiPosCalc(u8 param_1) { #if TARGET_PC mDoLib_project(&msgActor->pos, &local_70, {0, 0, FB_WIDTH, FB_HEIGHT}); #else - mDoLib_project(&msgActor->pos, &local_70,); + mDoLib_project(&msgActor->pos, &local_70); #endif - - if (local_70.x >= 0.0f && local_70.x <= 608.0f && local_70.y >= 0.0f && - local_70.y <= 448.0f) + + if (local_70.x >= 0.0f && local_70.x <= FB_WIDTH_BASE && local_70.y >= 0.0f && + local_70.y <= FB_HEIGHT_BASE) { f3y = 0.5f * (cStack_7c.y + local_70.y); } else { @@ -493,6 +493,9 @@ void dMsgScrnTalk_c::fukiPosCalc(u8 param_1) { field_0xf0 = 0.0f; field_0x488 = param_1; f32 dVar15; + // the magic numbers here are correlated with the framebuffer size, but + // were likely either chosen by hand or had multiple arithmetic + // operations applied which cannot easily be reverse engineered switch (field_0x488) { case 1: dVar15 = g_MsgObject_HIO_c.mBoxPos[2][0]; diff --git a/src/d/d_s_logo.cpp b/src/d/d_s_logo.cpp index 6aa3778dbf..71b4d21de4 100644 --- a/src/d/d_s_logo.cpp +++ b/src/d/d_s_logo.cpp @@ -1176,19 +1176,20 @@ void dScnLogo_c::logoInitWii() { break; } - width = 608; - height = 456; + // this uses the standard width but the widescreen height? + width = FB_WIDTH_BASE; + height = FB_HEIGHT; } JUT_ASSERT(2309, timg != NULL); - mStrapImg = JKR_NEW dDlst_2D_c(timg, 304 - (width / 2), 224 - (height / 2), width, height, 255); + mStrapImg = JKR_NEW dDlst_2D_c(timg, (FB_WIDTH_BASE / 2) - (width / 2), (FB_HEIGHT_BASE / 2) - (height / 2), width, height, 255); #if VERSION == VERSION_SHIELD timg = (ResTIMG*)dComIfG_getObjectRes("LogoUsWii", 5); - mNvLogo = JKR_NEW dDlst_2D_c(timg, 304 - (width / 2), 224 - (height / 2), width, height, 255); + mNvLogo = JKR_NEW dDlst_2D_c(timg, (FB_WIDTH_BASE / 2) - (width / 2), (FB_HEIGHT_BASE / 2) - (height / 2), width, height, 255); timg = (ResTIMG*)dComIfG_getObjectRes("LogoUsWii", 4); - mMocImg = JKR_NEW dDlst_2D_c(timg, 304 - (width / 2), 224 - (height / 2), width, height, 255); + mMocImg = JKR_NEW dDlst_2D_c(timg, (FB_WIDTH_BASE / 2) - (width / 2), (FB_HEIGHT_BASE / 2) - (height / 2), width, height, 255); #endif OS_REPORT("\x1b[32m%d archiveHeap->getTotalFreeSize %08x\n\x1b[m", 2316, archiveHeap->getTotalFreeSize()); diff --git a/src/d/d_scope.cpp b/src/d/d_scope.cpp index 3e2c18131d..2f68f534ed 100644 --- a/src/d/d_scope.cpp +++ b/src/d/d_scope.cpp @@ -136,24 +136,24 @@ void dScope_c::draw() { u8 alpha = mAlpha * 255.0f; if (dComIfGp_checkPlayerStatus0(0, 0x1000)) { - J2DDrawLine(304.0f, mDoGph_gInf_c::getMinYF(), 304.0f, mDoGph_gInf_c::getMaxYF(), - JUtility::TColor(255, 0, 0, alpha), 6); - J2DDrawLine(mDoGph_gInf_c::getMinXF(), 224.0f, mDoGph_gInf_c::getMaxXF(), 224.0f, - JUtility::TColor(255, 0, 0, alpha), 6); + J2DDrawLine(FB_WIDTH_BASE / 2, mDoGph_gInf_c::getMinYF(), FB_WIDTH_BASE / 2, + mDoGph_gInf_c::getMaxYF(), JUtility::TColor(255, 0, 0, alpha), 6); + J2DDrawLine(mDoGph_gInf_c::getMinXF(), FB_HEIGHT_BASE / 2, mDoGph_gInf_c::getMaxXF(), + FB_HEIGHT_BASE / 2, JUtility::TColor(255, 0, 0, alpha), 6); } mpWipeTex->setAlpha(alpha); mpBlackTex->setAlpha(alpha); - f32 temp_f29 = 304.0f - temp_f31; - f32 temp_f28 = 304.0f + temp_f31; - f32 temp_f27 = 224.0f - temp_f30; - f32 temp_f26 = 224.0f + temp_f30; + f32 temp_f29 = FB_WIDTH_BASE / 2 - temp_f31; + f32 temp_f28 = FB_WIDTH_BASE / 2 + temp_f31; + f32 temp_f27 = FB_HEIGHT_BASE / 2 - temp_f30; + f32 temp_f26 = FB_HEIGHT_BASE / 2 + temp_f30; mpWipeTex->draw(temp_f29, temp_f27, temp_f31, temp_f30, false, false, false); - mpWipeTex->draw(304.0f, temp_f27, temp_f31, temp_f30, true, false, false); - mpWipeTex->draw(temp_f29, 224.0f, temp_f31, temp_f30, false, true, false); - mpWipeTex->draw(304.0f, 224.0f, temp_f31, temp_f30, true, true, false); + mpWipeTex->draw(FB_WIDTH_BASE / 2, temp_f27, temp_f31, temp_f30, true, false, false); + mpWipeTex->draw(temp_f29, FB_HEIGHT_BASE / 2, temp_f31, temp_f30, false, true, false); + mpWipeTex->draw(FB_WIDTH_BASE / 2, FB_HEIGHT_BASE / 2, temp_f31, temp_f30, true, true, false); mpBlackTex->draw(mDoGph_gInf_c::getMinXF(), mDoGph_gInf_c::getMinYF(), mDoGph_gInf_c::getWidthF(), temp_f27 - mDoGph_gInf_c::getMinYF(), false, false, diff --git a/src/dusk/imgui/ImGuiMenuEnhancements.cpp b/src/dusk/imgui/ImGuiMenuEnhancements.cpp index f93ed14630..39cf09a9cd 100644 --- a/src/dusk/imgui/ImGuiMenuEnhancements.cpp +++ b/src/dusk/imgui/ImGuiMenuEnhancements.cpp @@ -14,48 +14,48 @@ namespace dusk { config::ImGuiCheckbox("Bigger Wallets", getSettings().game.biggerWallets); if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("Wallet sizes are like in the HD version (500, 1000, 2000)"); + ImGui::SetTooltip("Wallet sizes are like in the HD version. (500, 1000, 2000)"); } config::ImGuiCheckbox("No Rupee Returns", getSettings().game.noReturnRupees); if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("Always collect Rupees even if your Wallet is too full"); + ImGui::SetTooltip("Always collect Rupees even if your Wallet is too full."); } config::ImGuiCheckbox("Disable Rupee Cutscenes", getSettings().game.disableRupeeCutscenes); if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("Rupees won't play cutscenes after you've collected them the first time"); + ImGui::SetTooltip("Rupees won't play cutscenes after you've collected them the first time."); } config::ImGuiCheckbox("No Sword Recoil", getSettings().game.noSwordRecoil); if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("Link won't recoil when his sword hits walls"); + ImGui::SetTooltip("Link won't recoil when his sword hits walls."); } config::ImGuiCheckbox("Faster Climbing", getSettings().game.fastClimbing); if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("Quicker climbing on ladders and vines like the HD version"); + ImGui::SetTooltip("Quicker climbing on ladders and vines like the HD version."); } config::ImGuiCheckbox("No Climbing Miss Animation", getSettings().game.noMissClimbing); if (ImGui::IsItemHovered()) { ImGui::SetTooltip("Prevents Link from playing a struggle animation\n" - "when using the Clawshot on vines at a weird angle"); + "when grabbing ledges or climbing on vines."); } config::ImGuiCheckbox("Faster Tears of Light", getSettings().game.fastTears); if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("Tears of Light dropped by Shadow Insects pop out faster like the HD version"); + ImGui::SetTooltip("Tears of Light dropped by Shadow Insects pop out faster like the HD version."); } config::ImGuiCheckbox("Hide TV Settings Screen", getSettings().game.hideTvSettingsScreen); if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("Hides the TV calibration screen shown when loading a save"); + ImGui::SetTooltip("Hides the TV calibration screen shown when loading a save."); } config::ImGuiCheckbox("Instant Saves", getSettings().game.instantSaves); if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("Skip the delay when writing to the Memory Card"); + ImGui::SetTooltip("Skip the delay when writing to the Memory Card."); } ImGui::EndMenu(); @@ -64,7 +64,7 @@ namespace dusk { if (ImGui::BeginMenu("Preferences")) { config::ImGuiCheckbox("Mirror Mode", getSettings().game.enableMirrorMode); if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("Mirrors the world, matching the Wii version of the game"); + ImGui::SetTooltip("Mirrors the world, matching the Wii version of the game."); } config::ImGuiCheckbox("Invert Camera X Axis", getSettings().game.invertCameraXAxis); @@ -91,12 +91,12 @@ namespace dusk { if (ImGui::BeginMenu("Audio")) { config::ImGuiCheckbox("No Low HP Sound", getSettings().game.noLowHpSound); if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("Disable the beeping sound when having low health"); + ImGui::SetTooltip("Disable the beeping sound when having low health."); } config::ImGuiCheckbox("Non-Stop Midna's Lament", getSettings().game.midnasLamentNonStop); if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("Prevents enemy music while Midna's Lament is playing"); + ImGui::SetTooltip("Prevents enemy music while Midna's Lament is playing."); } ImGui::EndMenu(); @@ -107,7 +107,7 @@ namespace dusk { config::ImGuiCheckbox("Can Transform Anywhere", getSettings().game.canTransformAnywhere); if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("Allows you to transform even if NPCs are looking"); + ImGui::SetTooltip("Allows you to transform even if NPCs are looking."); } config::ImGuiCheckbox("Fast Spinner", getSettings().game.fastSpinner); @@ -128,7 +128,7 @@ namespace dusk { config::ImGuiCheckbox("Instant Death", getSettings().game.instantDeath); if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("Any hit will instantly kill you"); + ImGui::SetTooltip("Any hit will instantly kill you."); } ImGui::EndMenu(); @@ -138,7 +138,7 @@ namespace dusk { config::ImGuiCheckbox("Restore Wii 1.0 Glitches", getSettings().game.restoreWiiGlitches); if (ImGui::IsItemHovered()) { ImGui::SetTooltip("Restores patched glitches from Wii USA 1.0,\n" - "the first released version"); + "the first released version."); } ImGui::EndMenu(); @@ -146,6 +146,10 @@ namespace dusk { if (ImGui::BeginMenu("Tools")) { config::ImGuiCheckbox("Enable Turbo Key", getSettings().game.enableTurboKeybind); + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("Holding TAB will speed up the game.\n" + "This will not work with the \"Unlock Framerate\" enhancement."); + } ImGui::EndMenu(); } diff --git a/src/dusk/imgui/ImGuiMenuGame.cpp b/src/dusk/imgui/ImGuiMenuGame.cpp index eeb6521b61..ac738c6e24 100644 --- a/src/dusk/imgui/ImGuiMenuGame.cpp +++ b/src/dusk/imgui/ImGuiMenuGame.cpp @@ -67,7 +67,7 @@ namespace dusk { config::ImGuiCheckbox("Water Projection Offset", getSettings().game.useWaterProjectionOffset); if (ImGui::IsItemHovered()) { ImGui::SetTooltip("Adds GC-specific -0.01 transS offset\n" - "that causes ~6px ghost artifacts in water reflections"); + "that causes ~6px ghost artifacts in water reflections."); } ImGui::EndMenu(); diff --git a/src/m_Do/m_Do_graphic.cpp b/src/m_Do/m_Do_graphic.cpp index 9f3a6f7210..22dffad197 100644 --- a/src/m_Do/m_Do_graphic.cpp +++ b/src/m_Do/m_Do_graphic.cpp @@ -580,29 +580,29 @@ f32 mDoGph_gInf_c::m_scale = 1.0f; f32 mDoGph_gInf_c::m_invScale = 1.0f; -int mDoGph_gInf_c::m_maxX = 608 - 1; +int mDoGph_gInf_c::m_maxX = FB_WIDTH_BASE - 1; -int mDoGph_gInf_c::m_maxY = 448 - 1; +int mDoGph_gInf_c::m_maxY = FB_HEIGHT_BASE - 1; -int mDoGph_gInf_c::m_width = 608; +int mDoGph_gInf_c::m_width = FB_WIDTH_BASE; -int mDoGph_gInf_c::m_height = 448; +int mDoGph_gInf_c::m_height = FB_HEIGHT_BASE; -f32 mDoGph_gInf_c::m_maxXF = 608.0f - 1; +f32 mDoGph_gInf_c::m_maxXF = FB_WIDTH_BASE - 1; -f32 mDoGph_gInf_c::m_maxYF = 448.0f - 1; +f32 mDoGph_gInf_c::m_maxYF = FB_HEIGHT_BASE - 1; -f32 mDoGph_gInf_c::m_widthF = 608.0f; +f32 mDoGph_gInf_c::m_widthF = FB_WIDTH_BASE; -f32 mDoGph_gInf_c::m_heightF = 448.0f; +f32 mDoGph_gInf_c::m_heightF = FB_HEIGHT_BASE; struct tvSize { u16 width; u16 height; }; const tvSize l_tvSize[2] = { - {608, 448}, - {808, 448}, + {FB_WIDTH_BASE, FB_HEIGHT_BASE}, + {808, FB_HEIGHT_BASE}, }; #if TARGET_PC @@ -618,8 +618,8 @@ void mDoGph_gInf_c::setTvSize() { m_width = tvsize->width; m_height = tvsize->height; - m_minX = -((m_width - 608) / 2); - m_minY = -((m_height - 448) / 2); + m_minX = -((m_width - FB_WIDTH_BASE) / 2); + m_minY = -((m_height - FB_HEIGHT_BASE) / 2); m_maxX = m_minX + m_width; m_maxY = m_minY + m_height; @@ -2215,7 +2215,7 @@ int mDoGph_Painter() { if (fapGmHIO_getParticle()) { #if WIDESCREEN_SUPPORT if (mDoGph_gInf_c::isWideZoom()) { - ortho.setOrtho(0.0f, 0.0f, 608.0f, 448.0f, 100000.0f, -100000.0f); + ortho.setOrtho(0.0f, 0.0f, FB_WIDTH_BASE, FB_HEIGHT_BASE, 100000.0f, -100000.0f); } else #endif { @@ -2226,8 +2226,8 @@ int mDoGph_Painter() { ortho.setPort(); Mtx m3; - MTXTrans(m3, FB_WIDTH / 2, FB_HEIGHT / 2, 0.0f); - JPADrawInfo draw_info2(m3, 0.0f, FB_HEIGHT, 0.0f, FB_WIDTH); + MTXTrans(m3, FB_WIDTH_BASE / 2, FB_HEIGHT_BASE / 2, 0.0f); + JPADrawInfo draw_info2(m3, 0.0f, FB_HEIGHT_BASE, 0.0f, FB_WIDTH_BASE); dComIfGp_particle_draw2Dgame(&draw_info2); } @@ -2329,9 +2329,9 @@ int mDoGph_Painter() { cMtx_copy(j3dSys.getViewMtx(), m4); Mtx m5; - MTXTrans(m5, FB_WIDTH / 2, FB_HEIGHT / 2, 0.0f); + MTXTrans(m5, FB_WIDTH_BASE / 2, FB_HEIGHT_BASE / 2, 0.0f); - JPADrawInfo draw_info3(m5, 0.0f, FB_HEIGHT, 0.0f, FB_WIDTH); + JPADrawInfo draw_info3(m5, 0.0f, FB_HEIGHT_BASE, 0.0f, FB_WIDTH_BASE); if (!dComIfGp_isPauseFlag()) { GX_DEBUG_GROUP(dComIfGp_particle_draw2Dback, &draw_info3);