From 955a70db1eda9425ed40fd7e7bd3f1e2cfc2d588 Mon Sep 17 00:00:00 2001 From: CraftyBoss Date: Sat, 21 Mar 2026 00:56:01 -0400 Subject: [PATCH] more BE stuff, fix scissors for dmap/fmap --- include/d/d_menu_fmap.h | 4 ++-- libs/JSystem/src/JStudio/JStudio/ctb-data.cpp | 2 +- libs/JSystem/src/JStudio/JStudio/ctb.cpp | 2 +- src/d/actor/d_a_obj_brg.cpp | 10 +++++---- src/d/d_menu_dmap.cpp | 21 ++++++++++++++++++- src/d/d_menu_fmap2D.cpp | 19 ++++++++++++++--- 6 files changed, 46 insertions(+), 12 deletions(-) diff --git a/include/d/d_menu_fmap.h b/include/d/d_menu_fmap.h index a0648698bc..026e98e056 100644 --- a/include/d/d_menu_fmap.h +++ b/include/d/d_menu_fmap.h @@ -96,10 +96,10 @@ public: /* 0x02 */ const char mStageName[8]; /* 0x0A */ u8 mRoomNo; /* 0x0B */ u8 mWarpPlayerNo; - /* 0x0C */ u16 mMessageID; + /* 0x0C */ BE(u16) mMessageID; /* 0x0E */ u8 mStageNo; /* 0x0F */ u8 mSwitchNo; - /* 0x10 */ cXyz mPosition; + /* 0x10 */ BE(Vec) mPosition; }; /* 0x0 */ u8 field_0x0[8]; diff --git a/libs/JSystem/src/JStudio/JStudio/ctb-data.cpp b/libs/JSystem/src/JStudio/JStudio/ctb-data.cpp index 55a83f0d3f..629d542457 100644 --- a/libs/JSystem/src/JStudio/JStudio/ctb-data.cpp +++ b/libs/JSystem/src/JStudio/JStudio/ctb-data.cpp @@ -2,4 +2,4 @@ #include "JSystem/JStudio/JStudio/ctb.h" -const u32 JStudio::ctb::data::ga4cSignature = 'CTB\0'; +const u32 JStudio::ctb::data::ga4cSignature = BSWAP32('CTB\0'); diff --git a/libs/JSystem/src/JStudio/JStudio/ctb.cpp b/libs/JSystem/src/JStudio/JStudio/ctb.cpp index 61046ad35c..9a371ea936 100644 --- a/libs/JSystem/src/JStudio/JStudio/ctb.cpp +++ b/libs/JSystem/src/JStudio/JStudio/ctb.cpp @@ -68,7 +68,7 @@ JStudio::ctb::TObject* JStudio::ctb::TControl::getObject_index(u32 param_0) { JStudio::ctb::TFactory::~TFactory() {} JStudio::ctb::TObject* JStudio::ctb::TFactory::create(JStudio::ctb::data::TParse_TBlock const& param_0) { - switch(param_0.get_scheme()) { + switch(BSWAP16(param_0.get_scheme())) { case 1: return JKR_NEW TObject_TxyzRy(param_0); default: diff --git a/src/d/actor/d_a_obj_brg.cpp b/src/d/actor/d_a_obj_brg.cpp index d0dea6cf98..b2acca8f98 100644 --- a/src/d/actor/d_a_obj_brg.cpp +++ b/src/d/actor/d_a_obj_brg.cpp @@ -588,9 +588,11 @@ static void cut_control2(obj_brg_class* i_this, br_s* i_part) { } static void himo_cut_control1(obj_brg_class* i_this, cXyz* param_1, f32 param_2) { - cXyz sp74; - cXyz sp80; - cXyz sp8C; + STUB_RET(); + + cXyz sp74 = {}; + cXyz sp80 = {}; + cXyz sp8C = {}; sp74.x = 0.0f; sp74.y = 0.0f; @@ -602,7 +604,7 @@ static void himo_cut_control1(obj_brg_class* i_this, cXyz* param_1, f32 param_2) sp74.y = 0.0f; sp74.z = param_2; - int i, temp_r27 = (intptr_t) ++param_1; + intptr_t i, temp_r27 = (intptr_t) ++param_1; f32 var_f31, var_f30, var_f29, var_f28, var_f27; for (i = 1; i < 5; i++, param_1++) { var_f28 = i_this->field_0xaf30 * cM_ssin( (i_this->field_0xaf20 * 6000) + (NREG_S(3) - 10000) * (temp_r27 + i) ) diff --git a/src/d/d_menu_dmap.cpp b/src/d/d_menu_dmap.cpp index 537d264b3b..046f072c62 100644 --- a/src/d/d_menu_dmap.cpp +++ b/src/d/d_menu_dmap.cpp @@ -864,14 +864,23 @@ void dMenu_DmapBg_c::draw() { grafContext->setup2D(); GXGetScissor(&scissor_left, &scissor_top, &scissor_width, &scissor_height); - grafContext->scissor(field_0xd94, 0.0f, FB_WIDTH, FB_HEIGHT); +#if TARGET_PC + grafContext->scissor(field_0xd94, 0.0f, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight()); +#else + grafContext->scissor(field_0xd94, 0.0f, FB_WIDTH, FB_HEIGHT); +#endif grafContext->setScissor(); mBaseScreen->draw(field_0xd94, field_0xd98, grafContext); dMenu_Dmap_c::myclass->drawFloorScreenBack(mFloorScreen, field_0xd94, field_0xd98, grafContext); +#if TARGET_PC + f32 dVar21 = mDoGph_gInf_c::getWidth() / FB_WIDTH; + f32 dVar16 = mDoGph_gInf_c::getHeight() / FB_HEIGHT; +#else f32 dVar21 = mDoGph_gInf_c::getWidthF() / FB_WIDTH; f32 dVar16 = mDoGph_gInf_c::getHeightF() / FB_HEIGHT; +#endif mMapScreen[0]->draw(field_0xd94, field_0xd98, grafContext); if (mpBackTexture != NULL) { @@ -896,9 +905,15 @@ void dMenu_DmapBg_c::draw() { mpBackTexture->draw(local_28c, field_0xd94 + mpBackTexture->getBounds().i.y, mpBackTexture->getWidth(), mpBackTexture->getHeight(), false, false, false); +#if TARGET_PC + grafContext->scissor(field_0xd94, + 0, mDoGph_gInf_c::getWidth(), + scissor_height); +#else grafContext->scissor(field_0xd94 + mDoGph_gInf_c::getMinXF(), scissor_top, mDoGph_gInf_c::getWidthF(), scissor_height); +#endif grafContext->setScissor(); } @@ -918,7 +933,11 @@ void dMenu_DmapBg_c::draw() { Vec local_26c = pane.getGlobalVtx(mMapPane, &local_110, 0, false, 0); drawIcon(local_26c.x + field_0xd94, local_26c.y, field_0xda8, 1.0f); +#if TARGET_PC + grafContext->scissor(field_0xd94, scissor_top, mDoGph_gInf_c::getWidth(), scissor_height); +#else grafContext->scissor(field_0xd94 + mDoGph_gInf_c::getMinXF(), scissor_top, mDoGph_gInf_c::getWidthF(), scissor_height); +#endif grafContext->setScissor(); grafContext->scissor(scissor_left, scissor_top, scissor_width, scissor_height); grafContext->setScissor(); diff --git a/src/d/d_menu_fmap2D.cpp b/src/d/d_menu_fmap2D.cpp index 4048ddd4d2..29ec5db854 100644 --- a/src/d/d_menu_fmap2D.cpp +++ b/src/d/d_menu_fmap2D.cpp @@ -275,14 +275,18 @@ void dMenu_Fmap2DBack_c::draw() { u32 scissorLeft, scissorTop, scissorWidth, scissorHeight; GXGetScissor(&scissorLeft, &scissorTop, &scissorWidth, &scissorHeight); +#if TARGET_PC + grafPort->scissor(mTransX, 0.0f, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight()); +#else grafPort->scissor(mTransX, 0.0f, FB_WIDTH, FB_HEIGHT); +#endif grafPort->setScissor(); mpBackTex->setBlackWhite(field_0x1208, field_0x120c); mpBackTex->setAlpha(mAlphaRate * 255.0f * g_fmapHIO.mBackgroundAlpha); mpBackTex->draw(mTransX + mDoGph_gInf_c::getMinXF(), - mTransZ + mDoGph_gInf_c::getMinYF(), mDoGph_gInf_c::getWidthF(), - mDoGph_gInf_c::getHeightF(), false, false, false); + mTransZ + mDoGph_gInf_c::getMinYF(), mDoGph_gInf_c::getWidth(), + mDoGph_gInf_c::getHeight(), false, false, false); mpBackScreen->draw(mTransX, mTransZ, grafPort); mpBaseScreen->draw(mTransX, mTransZ, grafPort); @@ -292,8 +296,13 @@ void dMenu_Fmap2DBack_c::draw() { Vec vec2 = mpMapArea->getGlobalVtx(&mtx, 3, false, 0); - f32 width = mDoGph_gInf_c::getWidthF() / FB_WIDTH; +#if TARGET_PC + f32 width = mDoGph_gInf_c::getWidthF() / mDoGph_gInf_c::getWidth(); + f32 height = mDoGph_gInf_c::getHeightF() / mDoGph_gInf_c::getHeight(); +#else + f32 width = mDoGph_gInf_c::getWidthF() / FB_WIDTH; f32 height = mDoGph_gInf_c::getHeightF() / FB_HEIGHT; +#endif grafPort->scissor(mTransX + ((vec1.x - mDoGph_gInf_c::getMinXF()) / width), mTransZ + (vec1.y / height), (vec2.x - vec1.x) / width, @@ -2554,7 +2563,11 @@ void dMenu_Fmap2DTop_c::draw() { J2DOrthoGraph* ctx = static_cast(dComIfGp_getCurrentGrafPort()); ctx->setup2D(); GXGetScissor(&scissor_left, &scissor_top, &scissor_width, &scissor_height); +#if TARGET_PC + ctx->scissor(mTransX, 0.0f, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight()); +#else ctx->scissor(mTransX, 0.0f, FB_WIDTH, FB_HEIGHT); +#endif ctx->setScissor(); mpTitleScreen->draw(mTransX, mTransY, ctx); ctx->scissor(scissor_left, scissor_top, scissor_width, scissor_height);