From b0728f9b8d3eaaaf547c525cd6627aea9c756fb1 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sat, 11 Apr 2026 08:37:03 +0200 Subject: [PATCH 01/22] Replace some pointer casts with field references. (#3141) --- src/d/actor/d_a_npc_tk.cpp | 2 +- src/d/actor/d_a_obj_stone.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/d/actor/d_a_npc_tk.cpp b/src/d/actor/d_a_npc_tk.cpp index 8ecae48dd1..4f72a5d124 100644 --- a/src/d/actor/d_a_npc_tk.cpp +++ b/src/d/actor/d_a_npc_tk.cpp @@ -2512,7 +2512,7 @@ void daNPC_TK_c::executeResistanceDemo() { 0x200, 0x10); shape_angle.x = -current.angle.x; - cLib_addCalcAngleS(¤t.angle.y, cLib_targetAngleY((Vec*)¤t, &posWithOffset), 8, + cLib_addCalcAngleS(¤t.angle.y, cLib_targetAngleY(¤t.pos, &posWithOffset), 8, 0x400, 0x10); shape_angle.y = current.angle.y; diff --git a/src/d/actor/d_a_obj_stone.cpp b/src/d/actor/d_a_obj_stone.cpp index 432b96bb70..c0ef1e98d6 100644 --- a/src/d/actor/d_a_obj_stone.cpp +++ b/src/d/actor/d_a_obj_stone.cpp @@ -126,7 +126,7 @@ static f32 bound(cXyz* param_0, cBgS_PolyInfo const& param_1, f32 param_2) { cXyz pos; f32 abs = param_0->abs(); - C_VECReflect(param_0, (Vec*)&plane, &pos); + C_VECReflect(param_0, &plane.mNormal, &pos); *param_0 = pos * abs * param_2; return param_0->absXZ(); From c2113abd62300b22632f7cff6bf90e9b613d742c Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sat, 11 Apr 2026 08:41:24 +0200 Subject: [PATCH 02/22] Couple names in dMeterMap_c (#3142) --- include/d/d_meter_map.h | 10 +++---- src/d/d_meter_map.cpp | 66 ++++++++++++++++++++--------------------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/include/d/d_meter_map.h b/include/d/d_meter_map.h index ecf645a6ac..b17f51846e 100644 --- a/include/d/d_meter_map.h +++ b/include/d/d_meter_map.h @@ -89,7 +89,7 @@ public: virtual void draw(); virtual ~dMeterMap_c(); - bool isDispPosInsideFlg() { return field_0x2d != 0; } + bool isDispPosInsideFlg() { return mMapIsInside != 0; } dMeterMap_c* getMapPointer() { return (dMeterMap_c*)mMap; } void setSizeW(f32 w) { mSizeW = w; } void setSizeH(f32 h) { mSizeH = h; } @@ -108,15 +108,15 @@ private: /* 0x0C */ s32 mIsCompass; /* 0x10 */ s32 mIsMap; /* 0x14 */ u32 field_0x14; - /* 0x18 */ f32 field_0x18; - /* 0x1C */ f32 field_0x1c; + /* 0x18 */ f32 mDrawPosX; + /* 0x1C */ f32 mDrawPosY; /* 0x20 */ f32 mSizeW; /* 0x24 */ f32 mSizeH; - /* 0x28 */ s16 field_0x28; + /* 0x28 */ s16 mSlidePositionOffset; /* 0x2A */ u8 field_0x2a; /* 0x2B */ u8 field_0x2b; /* 0x2C */ u8 mMapAlpha; - /* 0x2D */ u8 field_0x2d; + /* 0x2D */ u8 mMapIsInside; /* 0x2E */ u8 field_0x2e; /* 0x30 */ int field_0x30; }; diff --git a/src/d/d_meter_map.cpp b/src/d/d_meter_map.cpp index 79bffe0018..e37c28398f 100644 --- a/src/d/d_meter_map.cpp +++ b/src/d/d_meter_map.cpp @@ -302,12 +302,12 @@ bool dMeterMap_c::isEventRunCheck() { f32 dMeterMap_c::getMapDispEdgeLeftX_Layout() { #if (PLATFORM_WII || PLATFORM_SHIELD) if (mDoGph_gInf_c::isWide()) { - return g_meter_mapHIO.mWideBottomLeftX + field_0x28; + return g_meter_mapHIO.mWideBottomLeftX + mSlidePositionOffset; } - return g_meter_mapHIO.mNormalBottomLeftX + field_0x28; + return g_meter_mapHIO.mNormalBottomLeftX + mSlidePositionOffset; #else - return field_0x28 + 35; + return mSlidePositionOffset + 35; #endif } @@ -349,14 +349,14 @@ s16 dMeterMap_c::getDispPosOutSide_OffsetX() { void dMeterMap_c::setDispPosInsideFlg_SE_On() { if (isEnableDispMapAndMapDispSizeTypeNo()) { dComIfGp_mapShow(); - field_0x2d = 1; + mMapIsInside = 1; field_0x2e = 7; } } void dMeterMap_c::setDispPosOutsideFlg_SE_On() { dComIfGp_mapHide(); - field_0x2d = 0; + mMapIsInside = 0; field_0x2e = 7; } @@ -456,44 +456,44 @@ void dMeterMap_c::_create(J2DScreen* unused) { field_0x2a = 0; if (dComIfGp_checkMapShow()) { - field_0x2d = 1; + mMapIsInside = 1; if (!isEnableDispMapAndMapDispSizeTypeNo()) { - field_0x2d = 0; + mMapIsInside = 0; } if (!isMapOpenCheck()) { - field_0x2d = 0; + mMapIsInside = 0; } } else { - field_0x2d = 0; + mMapIsInside = 0; } - if (field_0x2d != 0) { - field_0x2d = 1; - field_0x28 = getDispPosInside_OffsetX(); + if (mMapIsInside != 0) { + mMapIsInside = 1; + mSlidePositionOffset = getDispPosInside_OffsetX(); dMeter2Info_setMapStatus(1); } else { - field_0x2d = 0; - field_0x28 = getDispPosOutSide_OffsetX(); + mMapIsInside = 0; + mSlidePositionOffset = getDispPosOutSide_OffsetX(); dMeter2Info_setMapStatus(0); } field_0x2e = 0; - field_0x28 = 0; + mSlidePositionOffset = 0; field_0x30 = 0; /* dSv_event_flag_c::M_085 - Twilight Hyrule Field - Midna dialogue right before Boss Bug's Tear of Light appears */ field_0x2b = dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[118]); } void dMeterMap_c::setDispPosOutSide() { - field_0x2d = 0; - field_0x28 = getDispPosOutSide_OffsetX(); + mMapIsInside = 0; + mSlidePositionOffset = getDispPosOutSide_OffsetX(); } void dMeterMap_c::setDispPosInSide() { - field_0x2d = 1; - field_0x28 = getDispPosInside_OffsetX(); + mMapIsInside = 1; + mSlidePositionOffset = getDispPosInside_OffsetX(); } void dMeterMap_c::_delete() { @@ -506,7 +506,7 @@ void dMeterMap_c::_delete() { } if (isEnableDispMapAndMapDispSizeTypeNo()) { - if (field_0x2d != 0) { + if (mMapIsInside != 0) { dComIfGp_mapShow(); } else { dComIfGp_mapHide(); @@ -548,16 +548,16 @@ void dMeterMap_c::_move(u32 param_0) { ctrlShowMap(); } - if (field_0x2d != 0) { - if (field_0x28 != getDispPosInside_OffsetX()) { - if (!cLib_addCalcAngleS(&field_0x28, getDispPosInside_OffsetX(), 2, 60, 10)) { + if (mMapIsInside != 0) { + if (mSlidePositionOffset != getDispPosInside_OffsetX()) { + if (!cLib_addCalcAngleS(&mSlidePositionOffset, getDispPosInside_OffsetX(), 2, 60, 10)) { #if DEBUG cLib_checkBit((int)field_0x2e, 4); #endif } } } else { - cLib_addCalcAngleS(&field_0x28, getDispPosOutSide_OffsetX(), 2, 60, 10); + cLib_addCalcAngleS(&mSlidePositionOffset, getDispPosOutSide_OffsetX(), 2, 60, 10); } Vec map_pos = dMapInfo_n::getMapPlayerPos(); @@ -579,8 +579,8 @@ void dMeterMap_c::_move(u32 param_0) { mSizeH = (s16)sizeH; #endif - field_0x18 = field_0x28 + getMapDispEdgeLeftX_Layout(); - field_0x1c = getMapDispEdgeBottomY_Layout() - mSizeH; + mDrawPosX = mSlidePositionOffset + getMapDispEdgeLeftX_Layout(); + mDrawPosY = getMapDispEdgeBottomY_Layout() - mSizeH; mMap->_move(map_pos.x, map_pos.z, stayNo, map_pos.y); field_0x30 = dComIfGp_event_runCheck(); @@ -609,8 +609,8 @@ void dMeterMap_c::draw() { graf->setup2D(); f32 sizeX = mSizeW; f32 sizeY = mSizeH; - f32 tmp2 = field_0x18; - f32 tmp3 = field_0x1c; + f32 drawPosX = mDrawPosX; + f32 drawPosY = mDrawPosY; u8 alpha = mMapAlpha; #if DEBUG @@ -620,7 +620,7 @@ void dMeterMap_c::draw() { #endif mMapJ2DPicture->setAlpha(alpha); - mMapJ2DPicture->draw(tmp2, tmp3, sizeX, sizeY, false, false, false); + mMapJ2DPicture->draw(drawPosX, drawPosY, sizeX, sizeY, false, false, false); mMapJ2DPicture->calcMtx(); } } @@ -640,7 +640,7 @@ void dMeterMap_c::ctrlShowMap() { dMeter2Info_getPauseStatus() == 2 || dMeter2Info_getPauseStatus() == 6) { #if !DEBUG - if (dMeter2Info_getMapStatus() == 0 && field_0x2d == 0) { + if (dMeter2Info_getMapStatus() == 0 && mMapIsInside == 0) { setDispPosInsideFlg_SE_On(); Z2GetAudioMgr()->seStart(Z2SE_SY_MAP_OPEN_S, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); @@ -653,7 +653,7 @@ void dMeterMap_c::ctrlShowMap() { #if DEBUG dMeter2Info_getMapStatus() == 0 && #else - dMeter2Info_getMapStatus() == 1 && field_0x2d != 0 && + dMeter2Info_getMapStatus() == 1 && mMapIsInside != 0 && #endif isFmapScreen() ) { @@ -690,7 +690,7 @@ void dMeterMap_c::ctrlShowMap() { dMeter2Info_resetPauseStatus(); if (isDmapScreen()) { #if !DEBUG - if (dMeter2Info_getMapStatus() == 0 && field_0x2d == 0) { + if (dMeter2Info_getMapStatus() == 0 && mMapIsInside == 0) { setDispPosInsideFlg_SE_On(); Z2GetAudioMgr()->seStart(Z2SE_SY_MAP_OPEN_S, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); @@ -703,7 +703,7 @@ void dMeterMap_c::ctrlShowMap() { #if DEBUG dMeter2Info_getMapStatus() == 0 #else - dMeter2Info_getMapStatus() == 1 && field_0x2d != 0 + dMeter2Info_getMapStatus() == 1 && mMapIsInside != 0 #endif ) { dMeter2Info_setMapStatus(6); From 422ed7afc3fa490a739331d8ac0bdfddd650fb30 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sat, 11 Apr 2026 08:42:00 +0200 Subject: [PATCH 03/22] Couple sizeof(CMemBlock)s (#3143) --- libs/JSystem/include/JSystem/JKernel/JKRExpHeap.h | 2 +- libs/JSystem/src/JKernel/JKRExpHeap.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/JSystem/include/JSystem/JKernel/JKRExpHeap.h b/libs/JSystem/include/JSystem/JKernel/JKRExpHeap.h index 1535ba757b..cf6bb819eb 100644 --- a/libs/JSystem/include/JSystem/JKernel/JKRExpHeap.h +++ b/libs/JSystem/include/JSystem/JKernel/JKRExpHeap.h @@ -35,7 +35,7 @@ public: CMemBlock* getNextBlock() const { return mNext; } u32 getSize() const { return size; } u8 getGroupId() const { return mGroupId; } - static CMemBlock* getBlock(void* data) { return (CMemBlock*)((uintptr_t)data + -0x10); } + static CMemBlock* getBlock(void* data) { return (CMemBlock*)((uintptr_t)data + -sizeof(CMemBlock)); } private: /* 0x0 */ u16 mMagic; diff --git a/libs/JSystem/src/JKernel/JKRExpHeap.cpp b/libs/JSystem/src/JKernel/JKRExpHeap.cpp index 1c6d16c1a9..1f570dd421 100644 --- a/libs/JSystem/src/JKernel/JKRExpHeap.cpp +++ b/libs/JSystem/src/JKernel/JKRExpHeap.cpp @@ -464,7 +464,7 @@ void JKRExpHeap::do_freeAll() { JKRHeap::callAllDisposer(); mHeadFreeList = (CMemBlock*)mStart; mTailFreeList = mHeadFreeList; - mHeadFreeList->initiate(NULL, NULL, mSize - 0x10, 0, 0); + mHeadFreeList->initiate(NULL, NULL, mSize - sizeof(CMemBlock), 0, 0); mHeadUsedList = NULL; mTailUsedList = NULL; #if DEBUG From 3f8bbe7c57edd0c5b766cb9f7139ea4db3030873 Mon Sep 17 00:00:00 2001 From: Max Roncace Date: Sat, 11 Apr 2026 02:43:37 -0400 Subject: [PATCH 04/22] Replace magic constants derived from framebuffer size (#3144) --- include/m_Do/m_Do_graphic.h | 6 ++++-- src/d/d_com_inf_game.cpp | 2 +- src/d/d_file_select.cpp | 2 +- src/d/d_jcam_editor.cpp | 3 ++- src/d/d_kankyo.cpp | 4 ++-- src/d/d_menu_collect.cpp | 2 +- src/d/d_menu_fmap.cpp | 24 +++++++++++------------ src/d/d_menu_insect.cpp | 3 +++ src/d/d_menu_item_explain.cpp | 3 +++ src/d/d_menu_ring.cpp | 36 +++++++++++++++++------------------ src/d/d_meter2_info.cpp | 8 ++++---- src/d/d_meter_HIO.cpp | 6 +++--- src/d/d_meter_button.cpp | 2 +- src/d/d_meter_haihai.cpp | 12 ++++++------ src/d/d_msg_scrn_explain.cpp | 13 ++++++++----- src/d/d_msg_scrn_item.cpp | 3 +++ src/d/d_msg_scrn_talk.cpp | 7 +++++-- src/d/d_s_logo.cpp | 11 ++++++----- src/d/d_scope.cpp | 22 ++++++++++----------- src/m_Do/m_Do_graphic.cpp | 34 ++++++++++++++++----------------- 20 files changed, 111 insertions(+), 92 deletions(-) diff --git a/include/m_Do/m_Do_graphic.h b/include/m_Do/m_Do_graphic.h index a00d62dbe8..123326c207 100644 --- a/include/m_Do/m_Do_graphic.h +++ b/include/m_Do/m_Do_graphic.h @@ -5,12 +5,14 @@ #include "m_Do/m_Do_mtx.h" #include "global.h" +#define FB_WIDTH_BASE (608) +#define FB_HEIGHT_BASE (448) #if WIDESCREEN_SUPPORT #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(); diff --git a/src/d/d_com_inf_game.cpp b/src/d/d_com_inf_game.cpp index b461738e11..8dd0118685 100644 --- a/src/d/d_com_inf_game.cpp +++ b/src/d/d_com_inf_game.cpp @@ -1018,7 +1018,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_file_select.cpp b/src/d/d_file_select.cpp index 1bbc3eb78c..fc262d4f2b 100644 --- a/src/d/d_file_select.cpp +++ b/src/d/d_file_select.cpp @@ -5437,7 +5437,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 4700fdbe10..a5afe0c117 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 = new J2DOrthoGraph(0.0f, 0.0f, 608.0f, 448.0f, -1.0f, 1.0f); + mOrthoGraph = new J2DOrthoGraph(0.0f, 0.0f, FB_WIDTH_BASE, FB_HEIGHT_BASE, -1.0f, 1.0f); mFont = 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 2490209efd..09d013115f 100644 --- a/src/d/d_kankyo.cpp +++ b/src/d/d_kankyo.cpp @@ -10971,9 +10971,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 809a473c9a..c72379a7f2 100644 --- a/src/d/d_menu_collect.cpp +++ b/src/d/d_menu_collect.cpp @@ -2568,7 +2568,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 2cb5987613..db722089d7 100644 --- a/src/d/d_menu_fmap.cpp +++ b/src/d/d_menu_fmap.cpp @@ -227,17 +227,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; @@ -1703,17 +1703,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; @@ -1753,17 +1753,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 d2560b548a..24c4076f01 100644 --- a/src/d/d_menu_insect.cpp +++ b/src/d/d_menu_insect.cpp @@ -169,6 +169,9 @@ void dMenu_Insect_c::_draw() { mpBlackTex->draw(0.0f, 0.0f, FB_WIDTH, FB_HEIGHT, 0, 0, 0); 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 cfb76fa24a..5159940d2e 100644 --- a/src/d/d_menu_item_explain.cpp +++ b/src/d/d_menu_item_explain.cpp @@ -325,6 +325,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 4374dd1826..6de4f86fdb 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_info.cpp b/src/d/d_meter2_info.cpp index 3e8d2601c1..ed0d81d346 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 e368881152..72f24f21d9 100644 --- a/src/d/d_meter_HIO.cpp +++ b/src/d/d_meter_HIO.cpp @@ -3995,9 +3995,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 9fd0da14e0..9fe5443d63 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 = 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 5e6c9fd3e7..55da5db550 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_scrn_explain.cpp b/src/d/d_msg_scrn_explain.cpp index 7387b36a6c..d14e193a40 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 = 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 @@ -306,7 +306,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) { @@ -327,6 +327,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; @@ -382,7 +385,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); } @@ -400,7 +403,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()); } @@ -580,7 +583,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 904b418ab9..3de8119a8f 100644 --- a/src/d/d_msg_scrn_item.cpp +++ b/src/d/d_msg_scrn_item.cpp @@ -598,6 +598,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 941e984fbd..f7b498357e 100644 --- a/src/d/d_msg_scrn_talk.cpp +++ b/src/d/d_msg_scrn_talk.cpp @@ -446,8 +446,8 @@ void dMsgScrnTalk_c::fukiPosCalc(u8 param_1) { f3y = cStack_7c.y; } else { mDoLib_project(&msgActor->pos, &local_70); - 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 { @@ -482,6 +482,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 bdf5f325ee..1b8e71d3e8 100644 --- a/src/d/d_s_logo.cpp +++ b/src/d/d_s_logo.cpp @@ -1150,19 +1150,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 = new dDlst_2D_c(timg, 304 - (width / 2), 224 - (height / 2), width, height, 255); + mStrapImg = 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 = new dDlst_2D_c(timg, 304 - (width / 2), 224 - (height / 2), width, height, 255); + mNvLogo = 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 = new dDlst_2D_c(timg, 304 - (width / 2), 224 - (height / 2), width, height, 255); + mMocImg = 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 c81267f174..265b5654c1 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/m_Do/m_Do_graphic.cpp b/src/m_Do/m_Do_graphic.cpp index 99c6fbeb7b..7f624531f7 100644 --- a/src/m_Do/m_Do_graphic.cpp +++ b/src/m_Do/m_Do_graphic.cpp @@ -507,29 +507,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}, }; void mDoGph_gInf_c::setTvSize() { @@ -537,8 +537,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; @@ -1952,7 +1952,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 { @@ -1963,8 +1963,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); } @@ -2050,9 +2050,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()) { dComIfGp_particle_draw2Dback(&draw_info3); From ba5799200ed371b0d41ed41e9e5600509b957818 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sat, 11 Apr 2026 08:44:22 +0200 Subject: [PATCH 05/22] Fix field array size on field_0x50 (#3145) UB caught by modern compilers, this fixes it. --- include/d/actor/d_a_npc_lf.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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; From 6f793b0c42330817544b27e24baa86cd70d74e6d Mon Sep 17 00:00:00 2001 From: TakaRikka <38417346+TakaRikka@users.noreply.github.com> Date: Sat, 11 Apr 2026 00:07:18 -0700 Subject: [PATCH 06/22] henna ub fix (#3147) --- include/d/actor/d_a_npc_henna.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/d/actor/d_a_npc_henna.h b/include/d/actor/d_a_npc_henna.h index 73d11c5269..e9a13d13fc 100644 --- a/include/d/actor/d_a_npc_henna.h +++ b/include/d/actor/d_a_npc_henna.h @@ -32,8 +32,7 @@ public: /* 0x620 */ s16 field_0x620; /* 0x624 */ mDoExt_McaMorf* mpMorf; /* 0x628 */ mDoExt_btkAnm* mpBtkAnms[3]; - /* 0x634 */ mDoExt_btpAnm* mpBtpAnms[3]; - /* 0x640 */ u8 field_0x640[0x654 - 0x640]; + /* 0x634 */ mDoExt_btpAnm* mpBtpAnms[8]; /* 0x654 */ s32 field_0x654; /* 0x658 */ s32 field_0x658; /* 0x65C */ s32 mAnmResIndex; From 855c79458683411f73dd411c0b129cae5dc43ab9 Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Sat, 11 Apr 2026 16:11:19 +0200 Subject: [PATCH 07/22] Improve dDlst_list_c::draw debug group code to also go to tracy, be less of a performance hog when active. --- include/dusk/gx_helper.h | 3 +++ src/d/d_drawlist.cpp | 30 ++++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) 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/src/d/d_drawlist.cpp b/src/d/d_drawlist.cpp index 8a564914c0..98a22ecf13 100644 --- a/src/d/d_drawlist.cpp +++ b/src/d/d_drawlist.cpp @@ -10,6 +10,10 @@ #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 "d/d_s_play.h" #include "dusk/frame_interpolation.h" #include "dusk/gx_helper.h" @@ -1923,14 +1927,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); + GX_AND_TRACY_SCOPED(name); #endif dlst->draw(); } From bcf7b4ca857a1be1a20d9ff85a7408b58153949c Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Sat, 11 Apr 2026 16:11:41 +0200 Subject: [PATCH 08/22] Bunch of debug/tracy groups for J2D --- libs/JSystem/src/J2DGraph/J2DPicture.cpp | 2 ++ libs/JSystem/src/J2DGraph/J2DPictureEx.cpp | 1 + libs/JSystem/src/J2DGraph/J2DScreen.cpp | 2 ++ libs/JSystem/src/J2DGraph/J2DTextBox.cpp | 2 ++ libs/JSystem/src/J2DGraph/J2DTextBoxEx.cpp | 1 + libs/JSystem/src/J2DGraph/J2DWindow.cpp | 2 ++ libs/JSystem/src/J2DGraph/J2DWindowEx.cpp | 1 + src/d/d_meter2_draw.cpp | 1 + 8 files changed, 12 insertions(+) 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..62925c4a98 100644 --- a/libs/JSystem/src/J2DGraph/J2DPictureEx.cpp +++ b/libs/JSystem/src/J2DGraph/J2DPictureEx.cpp @@ -79,6 +79,7 @@ bool J2DPictureEx::prepareTexture(u8 param_0) { } void J2DPictureEx::drawSelf(f32 param_0, f32 param_1, f32 (*param_2)[3][4]) { + GX_AND_TRACY_SCOPED("J2DPictureEx::drawSelf") if (mMaterial != NULL) { mMaterial->setGX(); GXClearVtxDesc(); 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/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]); From cffb4b24005f457113b0a1326e2d1cc161fe8aca Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Sat, 11 Apr 2026 16:13:45 +0200 Subject: [PATCH 09/22] Make J2DPictureEx not draw if zero alpha Reduces the amount of draw calls from inactive UI elements by a lot. --- libs/JSystem/src/J2DGraph/J2DPictureEx.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libs/JSystem/src/J2DGraph/J2DPictureEx.cpp b/libs/JSystem/src/J2DGraph/J2DPictureEx.cpp index 62925c4a98..ba69048a4b 100644 --- a/libs/JSystem/src/J2DGraph/J2DPictureEx.cpp +++ b/libs/JSystem/src/J2DGraph/J2DPictureEx.cpp @@ -78,9 +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); From a72dbe779da1c695d3ab7ef13d246202b3158027 Mon Sep 17 00:00:00 2001 From: MelonSpeedruns Date: Sat, 11 Apr 2026 10:22:58 -0400 Subject: [PATCH 10/22] Don't allow quick transform while in the STAR tent --- src/d/actor/d_a_alink_dusk.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/d/actor/d_a_alink_dusk.cpp b/src/d/actor/d_a_alink_dusk.cpp index 95218268ac..342efe9610 100644 --- a/src/d/actor/d_a_alink_dusk.cpp +++ b/src/d/actor/d_a_alink_dusk.cpp @@ -32,6 +32,12 @@ void daAlink_c::handleQuickTransform() { 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); From c29f6737e5a7d10372f04f9778979d2e9afe7437 Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Sat, 11 Apr 2026 17:10:04 +0200 Subject: [PATCH 11/22] Guess this isn't going to Tracy. --- src/d/d_drawlist.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/d/d_drawlist.cpp b/src/d/d_drawlist.cpp index 98a22ecf13..1474b6f24d 100644 --- a/src/d/d_drawlist.cpp +++ b/src/d/d_drawlist.cpp @@ -14,6 +14,7 @@ #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" @@ -1952,7 +1953,7 @@ void dDlst_list_c::draw(dDlst_base_c** p_start, dDlst_base_c** p_end) { #if TARGET_PC && (TRACY_ENABLE || PARTIAL_DEBUG) const auto name = getTypeDrawName(dlst); - GX_AND_TRACY_SCOPED(name); + GXScopedDebugGroup scope(name); #endif dlst->draw(); } From f735a07dcaddae15d73f6bb76636a531b8ed7344 Mon Sep 17 00:00:00 2001 From: Howard Luck Date: Sat, 11 Apr 2026 09:33:27 -0600 Subject: [PATCH 12/22] Fix daNpcCoach_Attr_c::field_0x28 array size (#320) --- include/d/actor/d_a_npc_coach.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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 From 8522d33935a1af76b984c35fe3a5183da234067d Mon Sep 17 00:00:00 2001 From: MelonSpeedruns Date: Sat, 11 Apr 2026 11:38:36 -0400 Subject: [PATCH 13/22] Moved check for event running & Added sfx if trying to quick transform while in a cutscene --- src/d/actor/d_a_alink_dusk.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/d/actor/d_a_alink_dusk.cpp b/src/d/actor/d_a_alink_dusk.cpp index 342efe9610..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,6 +25,12 @@ 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. From 82e3845d6418ab7b1c568dbc28f029ebeef5c865 Mon Sep 17 00:00:00 2001 From: MelonSpeedruns Date: Sat, 11 Apr 2026 13:12:32 -0400 Subject: [PATCH 14/22] Added periods at the end of every option description (#323) This allows multiple sentences to be defined for a description. Co-authored-by: MelonSpeedruns --- src/dusk/imgui/ImGuiMenuEnhancements.cpp | 34 +++++++++++++----------- src/dusk/imgui/ImGuiMenuGame.cpp | 2 +- 2 files changed, 20 insertions(+), 16 deletions(-) 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(); From a0e12c36e77e7388f9885df2d116b8eb7845b82e Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sat, 11 Apr 2026 19:28:01 +0200 Subject: [PATCH 15/22] UB fixes (#3150) * Fix incorrect size for J2DTevBlock8::insertTexture local_38 * Fix dMeter_drawOptionHIO_c mOptionTypeBGPosX/Y size * dMeter_drawLightDropHIO_c mVesselAlpha fix * d_a_mg_rod array size fixes * Fix e_tk2_class mActionTimer array size * daObjTOMBO_c field_0x714 array size fix --- include/d/actor/d_a_e_tk2.h | 3 +-- include/d/actor/d_a_mg_rod.h | 13 ++++++------- include/d/actor/d_a_obj_tombo.h | 3 +-- include/d/d_meter_HIO.h | 11 +++-------- libs/JSystem/src/J2DGraph/J2DMatBlock.cpp | 2 +- src/d/actor/d_a_e_tk2.cpp | 4 ++-- src/d/actor/d_a_obj_tombo.cpp | 4 ++-- src/d/d_meter_HIO.cpp | 12 ++++++------ 8 files changed, 22 insertions(+), 30 deletions(-) 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_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_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/libs/JSystem/src/J2DGraph/J2DMatBlock.cpp b/libs/JSystem/src/J2DGraph/J2DMatBlock.cpp index 1bf28751ac..ce26719e72 100644 --- a/libs/JSystem/src/J2DGraph/J2DMatBlock.cpp +++ b/libs/JSystem/src/J2DGraph/J2DMatBlock.cpp @@ -1416,7 +1416,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/src/d/actor/d_a_e_tk2.cpp b/src/d/actor/d_a_e_tk2.cpp index 336f011f3a..6b69dc8863 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_obj_tombo.cpp b/src/d/actor/d_a_obj_tombo.cpp index 27d22b2bfc..3da749dced 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_meter_HIO.cpp b/src/d/d_meter_HIO.cpp index 72f24f21d9..63da02cfc5 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); From c77ade5f24d2e31f9c3bd5a63d6508499d254611 Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Sat, 11 Apr 2026 19:46:22 +0200 Subject: [PATCH 16/22] Stub out most of DynamicLink.cpp and more of c_dylink.cpp This code wasn't used (no dynamic linking) and was causing various compiler warnings that don't make sense to clean up. Get rid of it. --- src/DynamicLink.cpp | 5 +++++ src/c/c_dylink.cpp | 8 ++++++++ 2 files changed, 13 insertions(+) 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) { From ba9d5ba6c536f16cf9dd02971ee54600a278c805 Mon Sep 17 00:00:00 2001 From: Howard Luck Date: Sat, 11 Apr 2026 11:48:47 -0600 Subject: [PATCH 17/22] Fix obj_maki_class::field_0x6f8 array size (#322) --- include/d/actor/d_a_obj_maki.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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); From a8f4f44708ca7e0fcc33b6ec889e7bdbbeac5845 Mon Sep 17 00:00:00 2001 From: Howard Luck Date: Sat, 11 Apr 2026 11:49:17 -0600 Subject: [PATCH 18/22] Fix daE_FB_c::mKeys array size on PC (#324) --- include/d/actor/d_a_e_fb.h | 6 ++++++ 1 file changed, 6 insertions(+) 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); From c51b8d06662a51e5f559edb3cb6ebe4362c57174 Mon Sep 17 00:00:00 2001 From: Howard Luck Date: Sat, 11 Apr 2026 11:49:52 -0600 Subject: [PATCH 19/22] Fix daE_VA_c::mRopeCutStatus and va_tag_* array sizes (#325) --- include/d/actor/d_a_e_vt.h | 3 +-- src/d/actor/d_a_e_vt.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) 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/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 From 97e566f1175d915601f8d55a1699e25f684b387c Mon Sep 17 00:00:00 2001 From: Howard Luck Date: Sat, 11 Apr 2026 11:53:03 -0600 Subject: [PATCH 20/22] Fix dMsgFlow_c::event027 aParam8 buffer size (#326) --- src/d/d_msg_flow.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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)); From e31efcfbd6de06e93e26193850a4f01d6a34c6a4 Mon Sep 17 00:00:00 2001 From: Lurs <2795933+Lurs@users.noreply.github.com> Date: Sat, 11 Apr 2026 21:33:46 +0200 Subject: [PATCH 21/22] Fixes dominion rod camera #176 --- src/d/d_camera.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; From 14e77aed9c297471a59321523cce9bf06b968490 Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Sat, 11 Apr 2026 21:46:14 +0200 Subject: [PATCH 22/22] Fix JUTResFont duplicating texture data I misunderstood the way this code works the first time. --- libs/JSystem/src/JUtility/JUTResFont.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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,